BinaryMatrix constructor

BinaryMatrix(
  1. Iterable<BigInt> rows, {
  2. required int columnCount,
})

Creates a matrix from packed rows.

Implementation

BinaryMatrix(Iterable<BigInt> rows, {required this.columnCount})
    : _rows = List<BigInt>.unmodifiable(rows) {
  if (columnCount <= 0) {
    throw RohdHclException('Binary matrix column count must be positive.');
  }
  if (_rows.isEmpty) {
    throw RohdHclException('Binary matrix must have at least one row.');
  }
  final limit = BigInt.one << columnCount;
  for (final row in _rows) {
    if (row.isNegative || row >= limit) {
      throw RohdHclException(
          'Binary matrix row $row does not fit in $columnCount columns.');
    }
  }
}