/** * @return int[] form of this vector */ public int[] getIntArrayForm() { return IntUtils.clone(vector); }
/** * Creates a new GF2Polynomial by cloneing the given GF2Polynomial <i>b</i>. * * @param b the GF2Polynomial to clone */ public GF2Polynomial(GF2Polynomial b) { len = b.len; blocks = b.blocks; value = IntUtils.clone(b.value); }
/** * Copy constructor. * * @param other another {@link GF2Vector} */ public GF2Vector(GF2Vector other) { this.length = other.length; this.v = IntUtils.clone(other.v); }
/** * @return the permutation vector <tt>(perm(0),perm(1),...,perm(n-1))</tt> */ public int[] getVector() { return IntUtils.clone(perm); }
/** * Copy constructor. * * @param other another {@link PolynomialGF2mSmallM} */ public PolynomialGF2mSmallM(PolynomialGF2mSmallM other) { // field needs not to be cloned since it is immutable field = other.field; degree = other.degree; coefficients = IntUtils.clone(other.coefficients); }
/** * @return int[] form of this vector */ public int[] getIntArrayForm() { return IntUtils.clone(vector); }
/** * @return the permutation vector <tt>(perm(0),perm(1),...,perm(n-1))</tt> */ public int[] getVector() { return IntUtils.clone(perm); }
/** * Creates a new GF2Polynomial by cloneing the given GF2Polynomial <i>b</i>. * * @param b the GF2Polynomial to clone */ public GF2Polynomial(GF2Polynomial b) { len = b.len; blocks = b.blocks; value = IntUtils.clone(b.value); }
/** * Copy constructor. * * @param other another {@link GF2Vector} */ public GF2Vector(GF2Vector other) { this.length = other.length; this.v = IntUtils.clone(other.v); }
/** * Copy constructor. * * @param other another {@link PolynomialGF2mSmallM} */ public PolynomialGF2mSmallM(PolynomialGF2mSmallM other) { // field needs not to be cloned since it is immutable field = other.field; degree = other.degree; coefficients = IntUtils.clone(other.coefficients); }
/** * Copy constructor. * * @param other another {@link GF2mMatrix} */ public GF2mMatrix(GF2mMatrix other) { numRows = other.numRows; numColumns = other.numColumns; field = other.field; matrix = new int[numRows][]; for (int i = 0; i < numRows; i++) { matrix[i] = IntUtils.clone(other.matrix[i]); } }
/** * Copy constructor. * * @param other another {@link GF2mMatrix} */ public GF2mMatrix(GF2mMatrix other) { numRows = other.numRows; numColumns = other.numColumns; field = other.field; matrix = new int[numRows][]; for (int i = 0; i < numRows; i++) { matrix[i] = IntUtils.clone(other.matrix[i]); } }
/** * Copy constructor. * * @param other another {@link GF2mVector} */ public GF2mVector(GF2mVector other) { field = new GF2mField(other.field); length = other.length; vector = IntUtils.clone(other.vector); }
/** * Copy constructor. * * @param other another {@link GF2mVector} */ public GF2mVector(GF2mVector other) { field = new GF2mField(other.field); length = other.length; vector = IntUtils.clone(other.vector); }
/** * Create a permutation using the given permutation vector. * * @param perm the permutation vector */ public Permutation(int[] perm) { if (!isPermutation(perm)) { throw new IllegalArgumentException( "array is not a permutation vector"); } this.perm = IntUtils.clone(perm); }
/** * Create a permutation using the given permutation vector. * * @param perm the permutation vector */ public Permutation(int[] perm) { if (!isPermutation(perm)) { throw new IllegalArgumentException( "array is not a permutation vector"); } this.perm = IntUtils.clone(perm); }
/** * Copy constructor. * * @param a another {@link GF2Matrix} */ public GF2Matrix(GF2Matrix a) { numColumns = a.getNumColumns(); numRows = a.getNumRows(); length = a.length; matrix = new int[a.matrix.length][]; for (int i = 0; i < matrix.length; i++) { matrix[i] = IntUtils.clone(a.matrix[i]); } }
/** * Copy constructor. * * @param a another {@link GF2Matrix} */ public GF2Matrix(GF2Matrix a) { numColumns = a.getNumColumns(); numRows = a.getNumRows(); length = a.length; matrix = new int[a.matrix.length][]; for (int i = 0; i < matrix.length; i++) { matrix[i] = IntUtils.clone(a.matrix[i]); } }
/** * Copy constructor. * * @param a another {@link GF2MatrixEx} */ public GF2MatrixEx(GF2MatrixEx a) { numColumns = a.getNumColumns(); numRows = a.getNumRows(); length = a.getLength(); matrix = new int[a.getIntArray().length][]; for (int i = 0; i < matrix.length; i++) { matrix[i] = IntUtils.clone(a.getIntArray()[i]); } }
/** * Compute the square root of this polynomial modulo the given polynomial. * * @param a the reduction polynomial * @return <tt>this^(1/2) mod a</tt> */ public PolynomialGF2mSmallM modSquareRoot(PolynomialGF2mSmallM a) { int[] resultCoeff = IntUtils.clone(coefficients); int[] help = modMultiply(resultCoeff, resultCoeff, a.coefficients); while (!isEqual(help, coefficients)) { resultCoeff = normalForm(help); help = modMultiply(resultCoeff, resultCoeff, a.coefficients); } return new PolynomialGF2mSmallM(field, resultCoeff); }