HFE
Class AffinePolyVec

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

final class AffinePolyVec
extends java.lang.Object

This class provides a vector of polynomials of degree one in n independent variables. The polynomials are over the finite field GF(2) each. As all these polynomials are processed in parallel, the coefficients are represented in terms of Field2_n each.

Version:
0.15

Field Summary
private  Field2_n[] coeff
          Coefficients for the variables.
static int elemNum
          The number of rows in this vector.
static int varNum
          The number of variables in this polynomial.
 
Constructor Summary
AffinePolyVec()
          Initializes all coefficients to zero.
AffinePolyVec(AffinePolyVec father)
          Creates a copy from the given polynomial.
AffinePolyVec(Transform2 inTransform)
          transform2poly(HFE.Transform2)
 
Method Summary
 void add(AffinePolyVec whom)
          calculate this += whom as polynomial addition
 void add(AffinePolyVec a, AffinePolyVec b)
          calculates this = a + b as polynomial addition
 void apply(Field2_n res, Field2_n value)
          Evaluate the polynomial using the given value vector
 void apply(Field2_n res, int[] values)
          Evaluate the polynomial using the given value vector The entry value[0] is _not_ uses, value[1] is the first valid entry.
 void applyLinear(Field2_n res, Field2_n value)
          Evaluate the polynomial using the given value vector.
 Field2_n coeff(int which)
          Returns the coefficients for a given variable.
 Field2_n[] coeffs()
          returns the coefficient array without copying it.
 void initMem()
          Allocates new memory for the coefficients.
 boolean isEqual(AffinePolyVec whom)
          Compares this and whom coefficientwise.
static void main(java.lang.String[] args)
          Mainly invoces the testIt() method.
 void mul(AffinePolyVec res, Field2_n fac)
          res = fac*this in terms of affine polynomial vector multiplication
 void rnd(java.util.Random rnd)
          Initializes all coefficients with random bits
 void setCoeffs(Field2_n[] inArray)
          Sets all the coefficients by the given array.
 void setZero()
          Sets all the coefficients to zero
 AffinePolyVec sqr()
          Computes an affine polynomial vector which is exactly a squaring of the original one.
 void sub(AffinePolyVec whom)
          calculate this -= whom as polynomial subtraction
 void sub(AffinePolyVec a, AffinePolyVec b)
          calculates this = a - b as polynomial subtraction
static void testIt()
          Tests the functionality for the whole class.
 void transform2poly(Transform2 inTransform)
          Transforms an affine transformation into an affine polynomial vector.
 void writeString()
          Writes the polynomials as a string to stdout
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

varNum

public static int varNum
The number of variables in this polynomial.

elemNum

public static int elemNum
The number of rows in this vector.

coeff

private Field2_n[] coeff
Coefficients for the variables. The variables are x_1..x_n where n is varNum. Position 0 is for the constant terms.
Constructor Detail

AffinePolyVec

public AffinePolyVec()
Initializes all coefficients to zero. The resulting polynomial vector is _not_ affine!

AffinePolyVec

public AffinePolyVec(AffinePolyVec father)
Creates a copy from the given polynomial. Uses memory copy for the coefficients.

AffinePolyVec

public AffinePolyVec(Transform2 inTransform)
transform2poly(HFE.Transform2)
Method Detail

coeff

public Field2_n coeff(int which)
Returns the coefficients for a given variable. Valid values: 0: constant term, 1..valNum: variable

coeffs

public Field2_n[] coeffs()
returns the coefficient array without copying it.

isEqual

public boolean isEqual(AffinePolyVec whom)
Compares this and whom coefficientwise. If the two polynomials have different number of variables they can not be equal.
Returns:
true iff all the coefficients are the same both objects

setZero

public void setZero()
Sets all the coefficients to zero

initMem

public void initMem()
Allocates new memory for the coefficients. The coefficients are initalized with zero.

rnd

public void rnd(java.util.Random rnd)
Initializes all coefficients with random bits

setCoeffs

public void setCoeffs(Field2_n[] inArray)
Sets all the coefficients by the given array. Does neither memory copy nor argument checking.

transform2poly

public void transform2poly(Transform2 inTransform)
Transforms an affine transformation into an affine polynomial vector.
Parameters:
inTransform - affine tranformation

add

public void add(AffinePolyVec a,
                AffinePolyVec b)
calculates this = a + b as polynomial addition

add

public void add(AffinePolyVec whom)
calculate this += whom as polynomial addition

sub

public void sub(AffinePolyVec a,
                AffinePolyVec b)
calculates this = a - b as polynomial subtraction

sub

public void sub(AffinePolyVec whom)
calculate this -= whom as polynomial subtraction

apply

public void apply(Field2_n res,
                  int[] values)
Evaluate the polynomial using the given value vector The entry value[0] is _not_ uses, value[1] is the first valid entry.
Parameters:
res - value of the current polynimial vector.
values - array with varNum+1 entries

apply

public void apply(Field2_n res,
                  Field2_n value)
Evaluate the polynomial using the given value vector
Parameters:
res - value of the current polynimial vector.
value - array with varNum entries as Field2_n element

applyLinear

public void applyLinear(Field2_n res,
                        Field2_n value)
Evaluate the polynomial using the given value vector. Does _not_ apply the constant terms
Parameters:
res - value of the current polynimial vector.
value - array with varNum entries as Field2_n element

sqr

public AffinePolyVec sqr()
Computes an affine polynomial vector which is exactly a squaring of the original one.

mul

public void mul(AffinePolyVec res,
                Field2_n fac)
res = fac*this in terms of affine polynomial vector multiplication

writeString

public void writeString()
Writes the polynomials as a string to stdout

testIt

public static void testIt()
Tests the functionality for the whole class. Reports errors to stdout.

main

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