/** * Create a new vector over <tt>GF(2<sup>m</sup>)</tt> of the given * length and element array. * * @param field the finite field <tt>GF(2<sup>m</sup>)</tt> * @param vector the element array */ public GF2mVector(GF2mField field, int[] vector) { this.field = field; length = vector.length; for (int i = vector.length - 1; i >= 0; i--) { if (!field.isElementOfThisField(vector[i])) { throw new ArithmeticException( "Element array is not specified over the given finite field."); } } this.vector = IntUtils.clone(vector); }
/** * Create a new vector over <tt>GF(2<sup>m</sup>)</tt> of the given * length and element array. * * @param field the finite field <tt>GF(2<sup>m</sup>)</tt> * @param vector the element array */ public GF2mVector(GF2mField field, int[] vector) { this.field = field; length = vector.length; for (int i = vector.length - 1; i >= 0; i--) { if (!field.isElementOfThisField(vector[i])) { throw new ArithmeticException( "Element array is not specified over the given finite field."); } } this.vector = IntUtils.clone(vector); }
/** * Multiply this polynomial with an element from GF(2^m). * * @param element an element of the finite field GF(2^m) * @throws ArithmeticException if <tt>element</tt> is not an element of the finite * field this polynomial is defined over. */ public void multThisWithElement(int element) { if (!field.isElementOfThisField(element)) { throw new ArithmeticException( "Not an element of the finite field this polynomial is defined over."); } coefficients = multWithElement(coefficients, element); computeDegree(); }
/** * Multiply this polynomial with an element from GF(2^m). * * @param element an element of the finite field GF(2^m) * @throws ArithmeticException if <tt>element</tt> is not an element of the finite * field this polynomial is defined over. */ public void multThisWithElement(int element) { if (!field.isElementOfThisField(element)) { throw new ArithmeticException( "Not an element of the finite field this polynomial is defined over."); } coefficients = multWithElement(coefficients, element); computeDegree(); }
/** * Compute the product of this polynomial with an element from GF(2^m). * * @param element an element of the finite field GF(2^m) * @return <tt>this * element</tt> (newly created) * @throws ArithmeticException if <tt>element</tt> is not an element of the finite * field this polynomial is defined over. */ public PolynomialGF2mSmallM multWithElement(int element) { if (!field.isElementOfThisField(element)) { throw new ArithmeticException( "Not an element of the finite field this polynomial is defined over."); } int[] resultCoeff = multWithElement(coefficients, element); return new PolynomialGF2mSmallM(field, resultCoeff); }
/** * Compute the product of this polynomial with an element from GF(2^m). * * @param element an element of the finite field GF(2^m) * @return <tt>this * element</tt> (newly created) * @throws ArithmeticException if <tt>element</tt> is not an element of the finite * field this polynomial is defined over. */ public PolynomialGF2mSmallM multWithElement(int element) { if (!field.isElementOfThisField(element)) { throw new ArithmeticException( "Not an element of the finite field this polynomial is defined over."); } int[] resultCoeff = multWithElement(coefficients, element); return new PolynomialGF2mSmallM(field, resultCoeff); }
if (!this.field.isElementOfThisField(matrix[i][j]))
if (!this.field.isElementOfThisField(matrix[i][j]))
if (!this.field.isElementOfThisField(matrix[i][j]))
if (!this.field.isElementOfThisField(coefficients[i]))
if (!field.isElementOfThisField(vector[i]))
if (!this.field.isElementOfThisField(coefficients[i]))
if (!field.isElementOfThisField(vector[i]))