multiplyVector method

BigInt multiplyVector(
  1. BigInt vector
)

Multiplies this matrix by packed vector over GF(2).

Bit i of the result corresponds to matrix row i.

Implementation

BigInt multiplyVector(BigInt vector) {
  if (vector.isNegative || vector >= (BigInt.one << columnCount)) {
    throw RohdHclException(
        'Binary vector $vector does not fit in $columnCount columns.');
  }

  var result = BigInt.zero;
  for (var rowIndex = 0; rowIndex < rowCount; rowIndex++) {
    if (_hasOddParity(_rows[rowIndex] & vector)) {
      result |= BigInt.one << rowIndex;
    }
  }
  return result;
}