concatenate method

BinaryAffineTransform concatenate(
  1. BinaryAffineTransform other
)

Concatenates this transform's outputs below other's outputs.

Both transforms consume the same input. This transform occupies the low outputWidth result bits and other occupies the remaining high bits.

Implementation

BinaryAffineTransform concatenate(BinaryAffineTransform other) {
  if (inputWidth != other.inputWidth) {
    throw RohdHclException(
        'Cannot concatenate binary affine transforms with input widths '
        '$inputWidth and ${other.inputWidth}.');
  }

  return BinaryAffineTransform(
    BinaryMatrix(
      [...matrix.rows, ...other.matrix.rows],
      columnCount: inputWidth,
    ),
    offset: offset | (other.offset << outputWidth),
  );
}