de.flexiprovider.common.math.finitefields
Class GF2nPolynomialField

java.lang.Object
  |
  +--de.flexiprovider.common.math.finitefields.GF2nField
        |
        +--de.flexiprovider.common.math.finitefields.GF2nPolynomialField

public class GF2nPolynomialField
extends GF2nField

This class implements the abstract class GF2nField for polynomial representation. It computes the field polynomial and the squaring matrix. GF2nField is used by GF2nPolynomialElement which implements the elements of this field.

Author:
Oliver Seiler
See Also:
GF2nField, GF2nPolynomialElement

Field Summary
(package private)  GF2Polynomial[] squaringMatrix
          Matrix used for fast squaring
 
Fields inherited from class de.flexiprovider.common.math.finitefields.GF2nField
fieldPolynomial, fields, matrices, mDegree
 
Constructor Summary
GF2nPolynomialField(int deg)
          constructs an instance of the finite field with 2deg elements and characteristic 2.
GF2nPolynomialField(int deg, boolean file)
          constructs an instance of the finite field with 2deg elements and characteristic 2.
GF2nPolynomialField(int deg, GF2Polynomial polynomial)
          Creates a new GF2nField of degree i and uses the given polynomial as field polynomial.
 
Method Summary
protected  void computeCOBMatrix(GF2nField B1)
          Computes the change-of-basis matrix for basis conversion according to 1363.
protected  void computeFieldPolynomial()
          Computes the field polynomial.
protected  void computeFieldPolynomial2()
          Computes the field polynomial.
 int[] getPc()
          Returns the degree of the middle coefficients of the used field pentanomial (x^n + x^(getPc()[2]) + x^(getPc()[1]) + x^(getPc()[0]) + 1).
protected  GF2nElement getRandomRoot(GF2Polynomial polynomial)
          Compute a random root of the given GF2Polynomial.
 GF2Polynomial getSquaringVector(int i)
          Return row vector i of the squaring matrix.
 int getTc()
          Returns the degree of the middle coefficient of the used field trinomial (x^n + x^(getTc()) + 1).
 boolean isPentanomial()
          Returns true if the field polynomial is a pentanomial.
 boolean isTrinomial()
          Returns true if the field polynomial is a trinomial.
 
Methods inherited from class de.flexiprovider.common.math.finitefields.GF2nField
convert, equals, getDegree, getFieldPolynomial, hashCode, invertMatrix
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

squaringMatrix

GF2Polynomial[] squaringMatrix
Matrix used for fast squaring
Constructor Detail

GF2nPolynomialField

public GF2nPolynomialField(int deg)
constructs an instance of the finite field with 2deg elements and characteristic 2.
Parameters:
deg - the extention degree of this field

GF2nPolynomialField

public GF2nPolynomialField(int deg,
                           boolean file)
constructs an instance of the finite field with 2deg elements and characteristic 2.
Parameters:
deg - the degree of this field
file - true if you want to read the field polynomial from the file false if you want to use a random fielpolynomial (this can take very long for huge degrees)

GF2nPolynomialField

public GF2nPolynomialField(int deg,
                           GF2Polynomial polynomial)
                    throws PolynomialIsNotIrreducibleException
Creates a new GF2nField of degree i and uses the given polynomial as field polynomial. The polynomial is checked whether it is irreducible. This can take some time if i is huge!
Parameters:
deg - degree of the GF2nField
polynomial - the field polynomial to use
Throws:
PolynomialIsNotIrreducibleException - if the given polynomial is not irreducible in GF(2^i)
Method Detail

isTrinomial

public boolean isTrinomial()
Returns true if the field polynomial is a trinomial. The coefficient can be retrieved using getTc().
Returns:
true if the field polynomial is a trinomial

isPentanomial

public boolean isPentanomial()
Returns true if the field polynomial is a pentanomial. The coefficients can be retrieved using getPc().
Returns:
true if the field polynomial is a pentanomial

getTc

public int getTc()
          throws GFException
Returns the degree of the middle coefficient of the used field trinomial (x^n + x^(getTc()) + 1).
Returns:
the middle coefficient of the used field trinomial
Throws:
GFException - if the field polynomial is not a trinomial

getPc

public int[] getPc()
            throws GFException
Returns the degree of the middle coefficients of the used field pentanomial (x^n + x^(getPc()[2]) + x^(getPc()[1]) + x^(getPc()[0]) + 1).
Returns:
the middle coefficients of the used field pentanomial
Throws:
GFException - if the field polynomial is not a pentanomial

getSquaringVector

public GF2Polynomial getSquaringVector(int i)
Return row vector i of the squaring matrix.
Parameters:
i - the index of the row vector to return
Returns:
a copy of squaringMatrix[i]
See Also:
GF2nPolynomialElement.squareMatrix()

getRandomRoot

protected GF2nElement getRandomRoot(GF2Polynomial polynomial)
Compute a random root of the given GF2Polynomial.
Overrides:
getRandomRoot in class GF2nField
Parameters:
polynomial - the polynomial
Returns:
a random root of polynomial

computeCOBMatrix

protected void computeCOBMatrix(GF2nField B1)
Computes the change-of-basis matrix for basis conversion according to 1363. The result is stored in the lists fields and matrices.
Overrides:
computeCOBMatrix in class GF2nField
Parameters:
B1 - the GF2nField to convert to
See Also:
"P1363 A.7.3, p111ff"

computeFieldPolynomial

protected void computeFieldPolynomial()
Computes the field polynomial. This can take a long time for big degrees.
Overrides:
computeFieldPolynomial in class GF2nField

computeFieldPolynomial2

protected void computeFieldPolynomial2()
Computes the field polynomial. This can take a long time for big degrees.