divide method
Implementation
List<GFPoly> divide(GFPoly other) {
var quotient = gf.zero();
var remainder = this;
final fld = gf;
final denomLeadTerm = other.getCoefficient(other.getDegree());
final inversDenomLeadTerm = fld.invers(denomLeadTerm);
while (remainder.getDegree() >= other.getDegree() && !remainder.zero()) {
final degreeDiff = remainder.getDegree() - other.getDegree();
final scale = fld.multiply(
remainder.getCoefficient(remainder.getDegree()), inversDenomLeadTerm);
final term = other.multByMonominal(degreeDiff, scale);
final itQuot = GFPoly.monominalPoly(fld, degreeDiff, scale);
quotient = quotient.addOrSubstract(itQuot);
remainder = remainder.addOrSubstract(term);
}
return <GFPoly>[quotient, remainder];
}