HFE
Class Multi2Mul

java.lang.Object
  |
  +--HFE.Multi2Mul

class Multi2Mul
extends java.lang.Object

This class deals with multi-variable polynomials and a general modulus provied to the constructor. Basicly, this class calculates multiples of two polynomials and one polynomial and one element of (GF(2))^n. All calculations are done in GF(2) (Field2) Every entry is a polynomial of the form f_i(x1,x2,...) = g^i*(b_0 + b_1*x_1 + b_2*x_2 + ... + b_n*x_n) The reduction is done in the variable g.

Version:
0.15

Field Summary
private static Poly2MultiLinear[] mul_resL
          Holds a static variable for the sake of speed which is used in mul.
private static Poly2MultiLinear mul_tmpL
          Holds a static variable for the sake of speed which is used in mul.
private static Poly2MultiSquare mul_tmpS
          Holds a static variable for the sake of speed which is used in mul.
private  Poly2Max[] reduce
          Stores all the reduction steps.
 
Constructor Summary
(package private) Multi2Mul(Poly2Max modulus)
          Initializes the internal field reduce
 
Method Summary
static void initAll()
          Init method for this class
static void main(java.lang.String[] args)
          Calls the testIt() method
 Poly2MultiLinear[] mul(int[] con, Poly2MultiLinear[] poly)
          Computes res = con * poly in terms of vector multiplication of polynomials.
 Poly2MultiSquare[] mul(int[] con, Poly2MultiLinear[] a, Poly2MultiLinear[] b)
          Computes res = con * a * b in terms of vector multiplication of polynomials.
(package private)  void mul(Poly2MultiLinear[] res, int[] con, Poly2MultiLinear[] poly)
          Computes res = con * poly in terms of vector multiplication of polynomials.
 Poly2MultiSquare[] mul(Poly2MultiLinear[] a, Poly2MultiLinear[] b)
          Computes res = a * b in terms of vector multiplication of polynomials.
(package private)  void mul(Poly2MultiSquare[] res, int[] con, Poly2MultiLinear[] a, Poly2MultiLinear[] b)
          Computes res = con * a * b in terms of vector multiplication of polynomials.
 Poly2MultiSquare[] mul2(int[] con, Poly2MultiLinear[] a, Poly2MultiLinear[] b)
          Computes res = con * a * b in terms of vector multiplication of polynomials.
 Poly2MultiSquare[] mul2(Poly2MultiLinear[] a, Poly2MultiLinear[] b)
          Computes res = a * b in terms of vector multiplication of polynomials.
static void speedIt()
          Tests how fast the package runs on the current hardware.
static void testIt()
          Tests the functionality of the class.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

reduce

private Poly2Max[] reduce
Stores all the reduction steps. reduce[0] tells how to reduce the first polynomial, reduce[1] who to reduce the second polynomial, ...

mul_tmpS

private static Poly2MultiSquare mul_tmpS
Holds a static variable for the sake of speed which is used in mul.

mul_tmpL

private static Poly2MultiLinear mul_tmpL
Holds a static variable for the sake of speed which is used in mul.

mul_resL

private static Poly2MultiLinear[] mul_resL
Holds a static variable for the sake of speed which is used in mul.
Constructor Detail

Multi2Mul

Multi2Mul(Poly2Max modulus)
Initializes the internal field reduce
Parameters:
modulus - polynomial over GF(2) for reduction the number of variables must be 3 for our purpose
Method Detail

mul

public Poly2MultiSquare[] mul(Poly2MultiLinear[] a,
                              Poly2MultiLinear[] b)
Computes res = a * b in terms of vector multiplication of polynomials. Uses reduce to take the modulus into account.

mul

public Poly2MultiSquare[] mul(int[] con,
                              Poly2MultiLinear[] a,
                              Poly2MultiLinear[] b)
Computes res = con * a * b in terms of vector multiplication of polynomials. Uses reduce to take the modulus into account.
Parameters:
con - constants as a vector, i.e. a vector of polynomials of degree 0 or -1
a - linear polynomial in dimension variables
b - linear polynimial in dimension variables

initAll

public static void initAll()
Init method for this class

mul

void mul(Poly2MultiSquare[] res,
         int[] con,
         Poly2MultiLinear[] a,
         Poly2MultiLinear[] b)
Computes res = con * a * b in terms of vector multiplication of polynomials. Uses reduce to take the modulus into account.
Parameters:
res - vector for our result polynomials
con - constants as a vector, i.e. a vector of polynomials of degree 0 or -1
a - linear polynomial in dimension variables
b - linear polynimial in dimension variables

mul

public Poly2MultiLinear[] mul(int[] con,
                              Poly2MultiLinear[] poly)
Computes res = con * poly in terms of vector multiplication of polynomials. Uses reduce to take the modulus into account.
Parameters:
con - constants as a vector, i.e. a vector of polynomials of degree 0 or -1
poly - linear polynomial in dimension variables

mul

void mul(Poly2MultiLinear[] res,
         int[] con,
         Poly2MultiLinear[] poly)
Computes res = con * poly in terms of vector multiplication of polynomials. Uses reduce to take the modulus into account.
Parameters:
res - linear polynomials in dimension variables
con - constants as a vector, i.e. a vector of polynomials of degree 0 or -1
poly - linear polynomials in dimension variables

mul2

public Poly2MultiSquare[] mul2(Poly2MultiLinear[] a,
                               Poly2MultiLinear[] b)
Computes res = a * b in terms of vector multiplication of polynomials. Uses reduce to take the modulus into account. This is an independent implementation to mul(Poly2MultiLinear[], Poly2MultiLinear[]) and regarded to be slower.

mul2

public Poly2MultiSquare[] mul2(int[] con,
                               Poly2MultiLinear[] a,
                               Poly2MultiLinear[] b)
Computes res = con * a * b in terms of vector multiplication of polynomials. Uses reduce to take the modulus into account. This is an independent implementation to mul(int[], Poly2MultiLinear[], Poly2MultiLinear[]) and regarded to be slower.

testIt

public static void testIt()
Tests the functionality of the class. Is called by the main method.

speedIt

public static final void speedIt()
Tests how fast the package runs on the current hardware.

main

public static void main(java.lang.String[] args)
Calls the testIt() method