multiply method
Implementation
GenericGFPoly multiply(GenericGFPoly other) {
if (_field != other._field) {
throw ArgumentError('GenericGFPolys do not have same GenericGF field');
}
if (isZero || other.isZero) {
return _field.zero;
}
final aCoefficients = _coefficients;
final aLength = aCoefficients.length;
final bCoefficients = other._coefficients;
final bLength = bCoefficients.length;
final product = Int32List(aLength + bLength - 1);
for (int i = 0; i < aLength; i++) {
final aCoeff = aCoefficients[i];
for (int j = 0; j < bLength; j++) {
product[i + j] = GenericGF.addOrSubtract(
product[i + j],
_field.multiply(aCoeff, bCoefficients[j]),
);
}
}
return GenericGFPoly(_field, product);
}