Class GaloisPolynomial

Class GaloisPolynomial

java.lang.Object
   |
   +----GaloisPolynomial

public class GaloisPolynomial
extends Object
A class for working with Polynomials.
The coefficients are elements taken from a galois field
See Also:
GaloisField, ExtendedGaloisField

Variable Index

 o ZEROCOEFS
An array of zero coefficients to construct a zero polynomial.

Constructor Index

 o GaloisPolynomial(int[], char, GaloisField)
Construct a polynomial.
 o GaloisPolynomial(String, char, GaloisField)
Construct a polynomial.

Method Index

 o allPolynomials(int, char, GaloisField)
Returns a vector containing all possible polynomials degree 0 till [deg].
 o calcHorner(int)
Evaluates the polynomial for a given galois element using the Horner scheme.
 o copy()
Returns a copy of this polynomial.
 o createConstant(int, char, GaloisField)
Returns a constant 'polynomial'.
 o degree()
Returns the degree.
 o divide(GaloisPolynomial)
Returns the quotient of 'this' and a given polynomial.
 o equals(GaloisPolynomial)
Check if two polynomials are equal.
 o getAlfa()
Returns the variable.
 o getCoefficient(int)
Returns the coefficient for position [pos].
 o getField()
Returns the coefficient's galois field.
 o irrMonomials(int, char, GaloisField)
Returns a vector containing all the possible irreducible monomials.
 o minus(GaloisPolynomial)
Returns the difference between 'this' and a given polynomial.
 o product(GaloisPolynomial)
Returns the product of 'this' and a given polynomial.
 o product_one_term(int, int)
Returns the product of 'this' and a 'one term polynomial'.
 o sum(GaloisPolynomial)
Returns the sum of 'this' and a given polynomial.
 o toBase()
Converts the polynomial's coefficients into base-field elements.
 o toCoefficientString(int)
Returns a string representation for this polynomial.
 o toExtended(GaloisField)
Converts the polynomial's coefficients into elements of [fld2].
 o toString()
Returns a string representation for this polynomial.

Variables

 o ZEROCOEFS
  public final static int ZEROCOEFS[]
An array of zero coefficients to construct a zero polynomial.

Constructors

 o GaloisPolynomial
  public GaloisPolynomial(int newcoef[],
                          char newalfa,
                          GaloisField newfield)
Construct a polynomial.
Parameters:
newcoef - An array containing the coefficients.
newalpha - The variable. For ex: 'x'.
newfield - The coefficient galois field.
 o GaloisPolynomial
  public GaloisPolynomial(String poly,
                          char newalfa,
                          GaloisField newfield) throws GaloisException
Construct a polynomial. Invoke the string parser.
Parameters:
poly - A string representation for the polynomial.
newalpha - The variable. For ex: 'x'.
newfield - The coefficient galois field.

Methods

 o createConstant
  public static GaloisPolynomial createConstant(int elem,
                                                char newalfa,
                                                GaloisField newfield)
Returns a constant 'polynomial'.
Parameters:
elem - The constants value.
newalpha - The variable. For ex: 'x'.
newfield - The coefficient galois field.
 o calcHorner
  public int calcHorner(int vl)
Evaluates the polynomial for a given galois element using the Horner scheme.
 o toBase
  public GaloisPolynomial toBase() throws GaloisException
Converts the polynomial's coefficients into base-field elements.
 o toExtended
  public GaloisPolynomial toExtended(GaloisField fld2) throws GaloisException
Converts the polynomial's coefficients into elements of [fld2].
Throws: GaloisException
If [fld2] is no superfield of getField().
 o toString
  public String toString()
Returns a string representation for this polynomial.
For ex: 1 + 3x + 4x^2.
Overrides:
toString in class Object
 o toCoefficientString
  public String toCoefficientString(int pwr)
Returns a string representation for this polynomial.
For ex: 11010001011 GF(2) (only the coefficients are given).
For ex: 11 01 00 01 11 GF(4)
 o degree
  public int degree()
Returns the degree.
 o equals
  public boolean equals(GaloisPolynomial b)
Check if two polynomials are equal. That is, if the coefficients are equal.
 o getCoefficient
  public int getCoefficient(int pos)
Returns the coefficient for position [pos].
getCoefficient(0) returns the constant coefficient.
 o copy
  public GaloisPolynomial copy()
Returns a copy of this polynomial.
You should never use this method because a polynomial can't change.
It uses value-semantics.
 o sum
  public GaloisPolynomial sum(GaloisPolynomial b)
Returns the sum of 'this' and a given polynomial.
 o minus
  public GaloisPolynomial minus(GaloisPolynomial b)
Returns the difference between 'this' and a given polynomial.
 o product
  public GaloisPolynomial product(GaloisPolynomial b)
Returns the product of 'this' and a given polynomial.
 o product_one_term
  public GaloisPolynomial product_one_term(int coef,
                                           int pwr)
Returns the product of 'this' and a 'one term polynomial'.
For ex: [coef]x^[pwr]
Parameters:
coef - The coefficient for the one-term.
pwr - The power for the one-term.
 o divide
  public GaloisPolynomial[] divide(GaloisPolynomial b) throws GaloisException
Returns the quotient of 'this' and a given polynomial.
Throws: GaloisException
On division by zero.
 o irrMonomials
  public static Vector irrMonomials(int deg,
                                    char alfa,
                                    GaloisField field)
Returns a vector containing all the possible irreducible monomials.
in the galois field [field].
Parameters:
deg - The degree of the monomials.
alfa - The variable. For ex: 'x'.
field - The galois field.
 o allPolynomials
  public static GaloisPolynomial[] allPolynomials(int deg,
                                                  char alfa,
                                                  GaloisField field)
Returns a vector containing all possible polynomials degree 0 till [deg].
in the galois field [field].
Parameters:
deg - The maximum degree of the polynomials.
alfa - The variable. For ex: 'x'.
field - The galois field.
 o getAlfa
  public char getAlfa()
Returns the variable. For ex: 'x'.
 o getField
  public GaloisField getField()
Returns the coefficient's galois field.