public QRPolynomial Multiply(QRPolynomial other) { var num = new int[Length + other.Length - 1]; for (int i = 0; i < Length; i++) { for (int j = 0; j < other.Length; j++) { num[i + j] ^= QRMath.GExp(QRMath.GLog(this[i]) + QRMath.GLog(other[j])); } } return(new QRPolynomial(num, 0)); }
public QRPolynomial Mod(QRPolynomial other) { if (Length - other.Length < 0) { return(this); } var ratio = QRMath.GLog(this[0]) - QRMath.GLog(other[0]); var num = new int[Length]; Array.Copy(_num, num, Length); for (int i = 0; i < other.Length; i++) { num[i] ^= QRMath.GExp(QRMath.GLog(other[i]) + ratio); } return(new QRPolynomial(num, 0).Mod(other)); }