/** * Reduce this polynomial modulo another polynomial. * * @param f the reduction polynomial * @return <tt>this mod f</tt> */ public PolynomialGF2mSmallM mod(PolynomialGF2mSmallM f) { int[] resultCoeff = mod(coefficients, f.coefficients); return new PolynomialGF2mSmallM(field, resultCoeff); }
/** * Return the greatest common divisor of this and a polynomial <i>f</i> * * @param f polynomial * @return GCD(this, f) */ public PolynomialGF2mSmallM gcd(PolynomialGF2mSmallM f) { int[] resultCoeff = gcd(coefficients, f.coefficients); return new PolynomialGF2mSmallM(field, resultCoeff); }
/** * Compute the sum of this polynomial and the given polynomial. * * @param addend the addend * @return <tt>this + a</tt> (newly created) */ public PolynomialGF2mSmallM add(PolynomialGF2mSmallM addend) { int[] resultCoeff = add(coefficients, addend.coefficients); return new PolynomialGF2mSmallM(field, resultCoeff); }
/** * Reduce this polynomial modulo another polynomial. * * @param f the reduction polynomial * @return <tt>this mod f</tt> */ public PolynomialGF2mSmallM mod(PolynomialGF2mSmallM f) { int[] resultCoeff = mod(coefficients, f.coefficients); return new PolynomialGF2mSmallM(field, resultCoeff); }
/** * Return the greatest common divisor of this and a polynomial <i>f</i> * * @param f polynomial * @return GCD(this, f) */ public PolynomialGF2mSmallM gcd(PolynomialGF2mSmallM f) { int[] resultCoeff = gcd(coefficients, f.coefficients); return new PolynomialGF2mSmallM(field, resultCoeff); }
/** * Compute the product of this polynomial and the given factor using a * Karatzuba like scheme. * * @param factor the polynomial * @return <tt>this * factor</tt> */ public PolynomialGF2mSmallM multiply(PolynomialGF2mSmallM factor) { int[] resultCoeff = multiply(coefficients, factor.coefficients); return new PolynomialGF2mSmallM(field, resultCoeff); }
/** * Compute the product of this polynomial and the given factor using a * Karatzuba like scheme. * * @param factor the polynomial * @return <tt>this * factor</tt> */ public PolynomialGF2mSmallM multiply(PolynomialGF2mSmallM factor) { int[] resultCoeff = multiply(coefficients, factor.coefficients); return new PolynomialGF2mSmallM(field, resultCoeff); }
/** * Compute the product of this polynomial with a monomial X^k. * * @param k the degree of the monomial * @return <tt>this * X^k</tt> */ public PolynomialGF2mSmallM multWithMonomial(int k) { int[] resultCoeff = multWithMonomial(coefficients, k); return new PolynomialGF2mSmallM(field, resultCoeff); }
/** * Compute the inverse of this polynomial modulo the given polynomial. * * @param a the reduction polynomial * @return <tt>this^(-1) mod a</tt> */ public PolynomialGF2mSmallM modInverse(PolynomialGF2mSmallM a) { int[] unit = {1}; int[] resultCoeff = modDiv(unit, coefficients, a.coefficients); return new PolynomialGF2mSmallM(field, resultCoeff); }
public PolynomialGF2mSmallM[] getQInv() { PolynomialGF2mSmallM[] qInv = new PolynomialGF2mSmallM[encqInv.length]; GF2mField field = this.getField(); for (int i = 0; i < encqInv.length; i++) { qInv[i] = new PolynomialGF2mSmallM(field, encqInv[i]); } return qInv; }
public PolynomialGF2mSmallM[] getQInv() { PolynomialGF2mSmallM[] qInv = new PolynomialGF2mSmallM[encqInv.length]; GF2mField field = this.getField(); for (int i = 0; i < encqInv.length; i++) { qInv[i] = new PolynomialGF2mSmallM(field, encqInv[i]); } return qInv; }
/** * Compute the sum of this polynomial and the given polynomial. * * @param addend the addend * @return <tt>this + a</tt> (newly created) */ public PolynomialGF2mSmallM add(PolynomialGF2mSmallM addend) { int[] resultCoeff = add(coefficients, addend.coefficients); return new PolynomialGF2mSmallM(field, resultCoeff); }
/** * Compute the product of this polynomial with a monomial X^k. * * @param k the degree of the monomial * @return <tt>this * X^k</tt> */ public PolynomialGF2mSmallM multWithMonomial(int k) { int[] resultCoeff = multWithMonomial(coefficients, k); return new PolynomialGF2mSmallM(field, resultCoeff); }
/** * Compute the inverse of this polynomial modulo the given polynomial. * * @param a the reduction polynomial * @return <tt>this^(-1) mod a</tt> */ public PolynomialGF2mSmallM modInverse(PolynomialGF2mSmallM a) { int[] unit = {1}; int[] resultCoeff = modDiv(unit, coefficients, a.coefficients); return new PolynomialGF2mSmallM(field, resultCoeff); }
public PolynomialGF2mSmallM getGoppaPoly() { return new PolynomialGF2mSmallM(this.getField(), encGp); }
public PolynomialGF2mSmallM getGoppaPoly() { return new PolynomialGF2mSmallM(this.getField(), encGp); }
/** * Compute the sum of this polynomial and the monomial of the given degree. * * @param degree the degree of the monomial * @return <tt>this + X^k</tt> */ public PolynomialGF2mSmallM addMonomial(int degree) { int[] monomial = new int[degree + 1]; monomial[degree] = 1; int[] resultCoeff = add(coefficients, monomial); return new PolynomialGF2mSmallM(field, resultCoeff); }
public PolynomialGF2mSmallM getGoppaPoly() { return new PolynomialGF2mSmallM(this.getField(), encGp); }
public PolynomialGF2mSmallM getGoppaPoly() { return new PolynomialGF2mSmallM(this.getField(), encGp); }
/** * Compute the sum of this polynomial and the monomial of the given degree. * * @param degree the degree of the monomial * @return <tt>this + X^k</tt> */ public PolynomialGF2mSmallM addMonomial(int degree) { int[] monomial = new int[degree + 1]; monomial[degree] = 1; int[] resultCoeff = add(coefficients, monomial); return new PolynomialGF2mSmallM(field, resultCoeff); }