public final GF2nPolynomial shiftLeft(int amount) { if (amount <= 0) { return new GF2nPolynomial(this); } GF2nPolynomial result = new GF2nPolynomial(size + amount, coeff[0]); result.assignZeroToElements(); for (int i = 0; i < size; i++) { result.coeff[i + amount] = coeff[i]; } return result; }
public final GF2nPolynomial shiftLeft(int amount) { if (amount <= 0) { return new GF2nPolynomial(this); } GF2nPolynomial result = new GF2nPolynomial(size + amount, coeff[0]); result.assignZeroToElements(); for (int i = 0; i < size; i++) { result.coeff[i + amount] = coeff[i]; } return result; }
/** * Multiplies the scalar <i>s</i> to each coefficient of this * PolynomialGF2n and returns the result in a new PolynomialGF2n. * * @param s the scalar to multiply * @return <i>this</i> x <i>s</i> */ public final GF2nPolynomial scalarMultiply(GF2nElement s) { GF2nPolynomial result = new GF2nPolynomial(size()); int i; for (i = 0; i < size(); i++) { result.coeff[i] = (GF2nElement)coeff[i].multiply(s); // result[i] // = // a[i]*s } return result; }
/** * Multiplies the scalar <i>s</i> to each coefficient of this * PolynomialGF2n and returns the result in a new PolynomialGF2n. * * @param s the scalar to multiply * @return <i>this</i> x <i>s</i> * @throws DifferentFieldsException if <tt>this</tt> and <tt>s</tt> are not defined over * the same field. */ public final GF2nPolynomial scalarMultiply(GF2nElement s) throws RuntimeException { GF2nPolynomial result = new GF2nPolynomial(size()); int i; for (i = 0; i < size(); i++) { result.coeff[i] = (GF2nElement)coeff[i].multiply(s); // result[i] // = // a[i]*s } return result; }
int hDegree; GF2nPolynomial g = new GF2nPolynomial(polynomial, this); int gDegree = g.getDegree(); int i; ut = new GF2nPolynomial(2, GF2nONBElement.ZERO(this)); c = new GF2nPolynomial(ut); g = new GF2nPolynomial(h);
/** * Computes the greatest common divisor of <i>this</i> and <i>g</i> and * returns the result in a new PolynomialGF2n. * * @param g - * a GF2nPolynomial * @return gcd(<i>this</i>, <i>g</i>) */ public final GF2nPolynomial gcd(GF2nPolynomial g) { GF2nPolynomial a = new GF2nPolynomial(this); GF2nPolynomial b = new GF2nPolynomial(g); a.shrink(); b.shrink(); GF2nPolynomial c; GF2nPolynomial result; GF2nElement alpha; while (!b.isZero()) { c = a.remainder(b); a = b; b = c; } alpha = a.coeff[a.getDegree()]; result = a.scalarMultiply((GF2nElement)alpha.invert()); return result; }
int hDegree; GF2nPolynomial g = new GF2nPolynomial(polynomial, this); int gDegree = g.getDegree(); int i; ut = new GF2nPolynomial(2, GF2nPolynomialElement.ZERO(this)); c = new GF2nPolynomial(ut); g = new GF2nPolynomial(h);
throws RuntimeException, ArithmeticException GF2nPolynomial a = new GF2nPolynomial(this); GF2nPolynomial b = new GF2nPolynomial(g); a.shrink(); b.shrink();
int hDegree; GF2nPolynomial g = new GF2nPolynomial(polynomial, this); int gDegree = g.getDegree(); int i; ut = new GF2nPolynomial(2, GF2nONBElement.ZERO(this)); c = new GF2nPolynomial(ut); g = new GF2nPolynomial(h);
int hDegree; GF2nPolynomial g = new GF2nPolynomial(polynomial, this); int gDegree = g.getDegree(); int i; ut = new GF2nPolynomial(2, GF2nPolynomialElement.ZERO(this)); c = new GF2nPolynomial(ut); g = new GF2nPolynomial(h);
GF2nPolynomial a = new GF2nPolynomial(this); a.shrink(); GF2nPolynomial shift; if (a.getDegree() < bDegree) result[0] = new GF2nPolynomial(this); result[0].assignZeroToElements(); result[0].shrink(); result[1] = new GF2nPolynomial(this); result[1].shrink(); return result; result[0] = new GF2nPolynomial(this); result[0].assignZeroToElements(); int i = a.getDegree() - bDegree;
GF2nPolynomial a = new GF2nPolynomial(this); a.shrink(); GF2nPolynomial shift; if (a.getDegree() < bDegree) result[0] = new GF2nPolynomial(this); result[0].assignZeroToElements(); result[0].shrink(); result[1] = new GF2nPolynomial(this); result[1].shrink(); return result; result[0] = new GF2nPolynomial(this); result[0].assignZeroToElements(); int i = a.getDegree() - bDegree;
+ "have the same size!"); GF2nPolynomial result = new GF2nPolynomial((aDegree << 1) - 1); for (i = 0; i < size(); i++)
if (size() >= b.size()) result = new GF2nPolynomial(size()); int i; for (i = 0; i < b.size(); i++) result = new GF2nPolynomial(b.size()); int i; for (i = 0; i < size(); i++)
+ "have the same size!"); GF2nPolynomial result = new GF2nPolynomial((aDegree << 1) - 1); for (i = 0; i < size(); i++)
if (size() >= b.size()) result = new GF2nPolynomial(size()); int i; for (i = 0; i < b.size(); i++) result = new GF2nPolynomial(b.size()); int i; for (i = 0; i < size(); i++)