|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--HFE.Poly2MultiSquare
This class provides polynomials of degree two in n independent variables.
The polynomials are over the finite field GF(2) which is
provided in the class Field2
.
Field Summary | |
private int[] |
coeff
Coefficients for the variables. |
private int |
varNum
The number of variables in this polynomial. |
Constructor Summary | |
Poly2MultiSquare()
sets all the coefficients to zero assumes that the polynomial has no variables |
|
Poly2MultiSquare(int varNum)
Sets all the coefficients to zero by allocating new memory. |
|
Poly2MultiSquare(int[] inArray)
array2poly(int[]) |
|
Poly2MultiSquare(int varNum,
int[] inArray)
Creates a new object by using inArray for the coefficients. |
|
Poly2MultiSquare(int varNum,
java.util.Random rnd)
Sets all the coefficients to a random value and also allocates new memory for these coefficients. |
|
Poly2MultiSquare(Poly2MultiLinear father)
Creates a copy from the given linear polynomial. |
|
Poly2MultiSquare(Poly2MultiLinear a,
Poly2MultiLinear b)
Multiplies two lineare polynomials and stores the result in a new object. |
|
Poly2MultiSquare(Poly2MultiSquare father)
Creates a copy from the given polynomial. |
Method Summary | |
void |
add(int whom,
int i)
calculate this[i] += whom in terms of coefficient addition |
void |
add(Poly2MultiLinear whom)
calculate this += whom as polynomial addition |
void |
add(Poly2MultiSquare whom)
calculate this += whom as polynomial addition |
void |
add(Poly2MultiSquare a,
Poly2MultiSquare b)
calculates this = a + b as polynomial addition |
int |
apply(int[] values)
Evaluate the polynomial using the given value vector. |
static int |
apply(int[] coeffs,
int[] values)
Evaluate the polynomial using the given value vector and the given coefficient vector. |
void |
array2poly(int[] inArray)
Sets the coefficients using the given coefficient. |
int[] |
coeffs()
returns the coefficient array without copying it. |
static void |
getValues(int[] rawValues,
int[] res)
Calculates the square values using the linear values. |
void |
initMem()
Allocates new memory for the coefficients. |
boolean |
isEqual(Poly2MultiSquare whom)
Compares this and whom coefficientwise. |
boolean |
isZero()
Checks if the polynomial is the zero polynomial. |
static void |
main(java.lang.String[] args)
Mainly invoces the testIt() method. |
void |
mul(Poly2MultiLinear a,
Poly2MultiLinear b)
Calculates this = a*b in terms of polynomial multiplication. |
void |
mulAdd(int factor,
Poly2MultiSquare whom)
this += factor*whom. |
void |
mulAdd(Poly2MultiLinear a,
Poly2MultiLinear b)
Calculates this += a*b in terms of polynomial multiplication. |
void |
rnd(java.util.Random rnd)
Sets all the coefficients to a random value without allocating new memory for these coefficients. |
void |
setCoeffs(int[] inArray)
Sets all the coefficients by the given array. |
void |
setZero()
Sets all the coefficients to zero without allocating new memory. |
void |
sub(Poly2MultiSquare whom)
calculate this -= whom as polynomial subtraction |
void |
sub(Poly2MultiSquare a,
Poly2MultiSquare b)
calculates this = a - b as polynomial subtraction |
static int |
tau_inverse(int t)
Calulates the number of variables for a given number of terms t. |
static int |
tau(int n)
Calulates the number of terms for a given number of variables n by using the formula ((n+1)*(n+2))/2. |
static void |
testIt()
Tests the functionality for the whole class. |
void |
writeString()
Writes the polynomial as a string to stdout |
Methods inherited from class java.lang.Object |
|
Field Detail |
private int varNum
private int[] coeff
varNum
. Position 0
is for the constant term. Position
n+1 is for x_1*x_2, n+2 is for
x_1*x_3, ..., n+(n-2) is for x_1*x_n,
n+(n-1) is for x_2*x_3, n*n is for
x_2*x_4, ...Constructor Detail |
public Poly2MultiSquare()
public Poly2MultiSquare(int varNum)
varNum
- number of variables for that polynomialpublic Poly2MultiSquare(int varNum, java.util.Random rnd)
varNum
- number of variables for that polynomialpublic Poly2MultiSquare(Poly2MultiSquare father)
public Poly2MultiSquare(Poly2MultiLinear father)
public Poly2MultiSquare(int[] inArray)
array2poly(int[])
public Poly2MultiSquare(int varNum, int[] inArray)
varNum
- number of variables for this objectinArray
- coefficients for the multivaribale polynomialpublic Poly2MultiSquare(Poly2MultiLinear a, Poly2MultiLinear b)
mul(HFE.Poly2MultiLinear, HFE.Poly2MultiLinear)
Method Detail |
public static int tau(int n)
public static int tau_inverse(int t)
public int[] coeffs()
public boolean isEqual(Poly2MultiSquare whom)
public boolean isZero()
public void setZero()
public void initMem()
public void setCoeffs(int[] inArray)
public void array2poly(int[] inArray)
IllegalArgumentException:
- array has the wrong length, needs to be (varNum+1)public void rnd(java.util.Random rnd)
rnd
- random generatorpublic void add(Poly2MultiSquare a, Poly2MultiSquare b)
public void add(Poly2MultiSquare whom)
public void add(int whom, int i)
public void add(Poly2MultiLinear whom)
public void sub(Poly2MultiSquare a, Poly2MultiSquare b)
public void sub(Poly2MultiSquare whom)
public static void getValues(int[] rawValues, int[] res)
public int apply(int[] values)
getValues(int[], int[])
.values
- array with tau(varNum) entries. tau(int)
public static int apply(int[] coeffs, int[] values)
coeffs
- coefficients of a multivariable, linear polynomialvalues
- values for the variables (and there squares) of the polynomial, value[1] is the value for the first variable, ...public void mul(Poly2MultiLinear a, Poly2MultiLinear b)
public void mulAdd(int factor, Poly2MultiSquare whom)
public void mulAdd(Poly2MultiLinear a, Poly2MultiLinear b)
public void writeString()
public static void testIt()
public static void main(java.lang.String[] args)
testIt()
method.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |