/** * @return a copy of this GF2Polynomial */ public Object clone() { return new GF2Polynomial(this); }
/** * @return a copy of this GF2Polynomial */ public Object clone() { return new GF2Polynomial(this); }
/** * Creates a new GF2nPolynomialElement by cloning the given * GF2nPolynomialElement <i>b</i>. * * @param other the GF2nPolynomialElement to clone */ public GF2nPolynomialElement(GF2nPolynomialElement other) { mField = other.mField; mDegree = other.mDegree; polynomial = new GF2Polynomial(other.polynomial); }
/** * Return row vector i of the squaring matrix. * * @param i the index of the row vector to return * @return a copy of squaringMatrix[i] * @see GF2nPolynomialElement#squareMatrix */ public GF2Polynomial getSquaringVector(int i) { return new GF2Polynomial(squaringMatrix[i]); }
/** * Returns the value of this GF2nPolynomialElement in a new Bitstring. * * @return the value of this GF2nPolynomialElement in a new Bitstring */ private GF2Polynomial getGF2Polynomial() { return new GF2Polynomial(polynomial); }
/** * Return row vector i of the squaring matrix. * * @param i the index of the row vector to return * @return a copy of squaringMatrix[i] * @see GF2nPolynomialElement#squareMatrix */ public GF2Polynomial getSquaringVector(int i) { return new GF2Polynomial(squaringMatrix[i]); }
/** * Creates a new GF2nPolynomialElement by cloning the given * GF2nPolynomialElement <i>b</i>. * * @param other the GF2nPolynomialElement to clone */ public GF2nPolynomialElement(GF2nPolynomialElement other) { mField = other.mField; mDegree = other.mDegree; polynomial = new GF2Polynomial(other.polynomial); }
/** * Returns the value of this GF2nPolynomialElement in a new Bitstring. * * @return the value of this GF2nPolynomialElement in a new Bitstring */ private GF2Polynomial getGF2Polynomial() { return new GF2Polynomial(polynomial); }
/** * Returns the fieldpolynomial as a new Bitstring. * * @return a copy of the fieldpolynomial as a new Bitstring */ public final GF2Polynomial getFieldPolynomial() { if (fieldPolynomial == null) { computeFieldPolynomial(); } return new GF2Polynomial(fieldPolynomial); }
/** * Toggles the LSB of this GF2Polynomial, increasing the value by 'one' and * returns the result in a new GF2Polynomial. * * @return <tt>this + 1</tt> */ public GF2Polynomial increase() { GF2Polynomial result = new GF2Polynomial(this); result.increaseThis(); return result; }
/** * Toggles the LSB of this GF2Polynomial, increasing the value by 'one' and * returns the result in a new GF2Polynomial. * * @return <tt>this + 1</tt> */ public GF2Polynomial increase() { GF2Polynomial result = new GF2Polynomial(this); result.increaseThis(); return result; }
/** * Returns the fieldpolynomial as a new Bitstring. * * @return a copy of the fieldpolynomial as a new Bitstring */ public final GF2Polynomial getFieldPolynomial() { if (fieldPolynomial == null) { computeFieldPolynomial(); } return new GF2Polynomial(fieldPolynomial); }
/** * Create the one element. * * @param f the finite field * @return the one element in the given finite field */ public static GF2nPolynomialElement ONE(GF2nPolynomialField f) { GF2Polynomial polynomial = new GF2Polynomial(f.getDegree(), new int[]{1}); return new GF2nPolynomialElement(f, polynomial); }
/** * Create the zero element. * * @param f the finite field * @return the zero element in the given finite field */ public static GF2nPolynomialElement ZERO(GF2nPolynomialField f) { GF2Polynomial polynomial = new GF2Polynomial(f.getDegree()); return new GF2nPolynomialElement(f, polynomial); }
/** * Create the zero element. * * @param f the finite field * @return the zero element in the given finite field */ public static GF2nPolynomialElement ZERO(GF2nPolynomialField f) { GF2Polynomial polynomial = new GF2Polynomial(f.getDegree()); return new GF2nPolynomialElement(f, polynomial); }
/** * Create the one element. * * @param f the finite field * @return the one element in the given finite field */ public static GF2nPolynomialElement ONE(GF2nPolynomialField f) { GF2Polynomial polynomial = new GF2Polynomial(f.getDegree(), new int[]{1}); return new GF2nPolynomialElement(f, polynomial); }
/** * Create a new random GF2nPolynomialElement using the given field and * source of randomness. * * @param f the GF2nField to use * @param rand the source of randomness */ public GF2nPolynomialElement(GF2nPolynomialField f, Random rand) { mField = f; mDegree = mField.getDegree(); polynomial = new GF2Polynomial(mDegree); randomize(rand); }
/** * Creates a new GF2nPolynomialElement using the given field and Bitstring. * * @param f the GF2nPolynomialField to use * @param bs the desired value as Bitstring */ public GF2nPolynomialElement(GF2nPolynomialField f, GF2Polynomial bs) { mField = f; mDegree = mField.getDegree(); polynomial = new GF2Polynomial(bs); polynomial.expandN(mDegree); }
/** * Creates a new GF2nPolynomialElement using the given field and Bitstring. * * @param f the GF2nPolynomialField to use * @param bs the desired value as Bitstring */ public GF2nPolynomialElement(GF2nPolynomialField f, GF2Polynomial bs) { mField = f; mDegree = mField.getDegree(); polynomial = new GF2Polynomial(bs); polynomial.expandN(mDegree); }
/** * Creates a new GF2nPolynomialElement using the given field <i>f</i> and * int[] <i>is</i> as value. * * @param f the GF2nField to use * @param is the integer string to assign to this GF2nPolynomialElement */ public GF2nPolynomialElement(GF2nPolynomialField f, int[] is) { mField = f; mDegree = mField.getDegree(); polynomial = new GF2Polynomial(mDegree, is); polynomial.expandN(f.mDegree); }