Class GaloisField

Class GaloisField

java.lang.Object
   |
   +----GaloisField

public class GaloisField
extends Object

Variable Index

 o ALFAPOWER
A constant for the display mode ALFAPOWER
For ex: valueString(a) -> a^k
 o ONE
A constant for the galois element one '1'
 o POLYCOEFS
A constant for the display mode POLYCOEFS
For ex: valueString(a) -> 1 1
 o POLYNOMIAL
A constant for the display mode POLYNOMIAL
For ex: valueString(a) -> 1+a
 o ZERO
A constant for the galois element zero '0'

Constructor Index

 o GaloisField(int)
Creates a new base galois field.
 o GaloisField(int, int)
This constructor is for internal use only.

Method Index

 o atoi(String)
Converts a string to an integer.
 o cleanString(String)
Cleans a string.
 o divide(int, int)
Returns a / b.
 o fillString(char, int)
Returns a string length [len] containing nothing but characters [ch].
 o getAlfa()
Returns the character used for alpha in a polynomial representation.
 o getAlfaPower(int)
Returns a power of the primitive element.
 o getAllCyclotomics(int)
Returns all the cyclotomics modulo [modulo].
 o getBase()
Returns the base field.
 o getCardinality()
Returns the cardinality.
 o getCyclotomic(int, int)
Returns the cyclotomic of [elem] modulo [modulo].
 o getDisplayMode()
Returns the display mode.
 o getKPrimitiveNRoot(int)
Method for construction of primitive roots for 'one'.
 o getMinimalPolynomial(int, char)
Returns a minimal polynomial.
 o getRoot()
Returns the root field.
 o isBase()
Is this field a base field?.
 o minus(int, int)
Returns a - b.
 o modulo(int, int)
Returns (a mod b).
 o normalise(int)
Normalises a galois element.
 o parse(String, int)
Converts a string to a galois element.
 o power(int, int)
Calculates the power of a given integer.
 o product(int, int)
Returns the product of two galois elements.
 o setDisplayMode(int)
Set a new display mode.
 o sum(int, int)
Returns the sum of two galois elements.
 o toBase(int)
Converts a galois element from 'this' field to the base field.
 o toExtended(int, GaloisField)
Converts a galois element from 'this' field to a given ExtendedGaloisField.
 o toString()
Returns a String representation of this field.
 o toSuper(int)
Converts a galois element from the base field to 'this' field.
 o valueString(int)
Returns a String representation for the given element.

Variables

 o ZERO
  public final static int ZERO
A constant for the galois element zero '0'
 o ONE
  public final static int ONE
A constant for the galois element one '1'
 o ALFAPOWER
  public final static int ALFAPOWER
A constant for the display mode ALFAPOWER
For ex: valueString(a) -> a^k
 o POLYNOMIAL
  public final static int POLYNOMIAL
A constant for the display mode POLYNOMIAL
For ex: valueString(a) -> 1+a
 o POLYCOEFS
  public final static int POLYCOEFS
A constant for the display mode POLYCOEFS
For ex: valueString(a) -> 1 1

Constructors

 o GaloisField
  public GaloisField(int p) throws GaloisException
Creates a new base galois field.
Parameters:
p - The cardinality for the new field.
Throws: GaloisException
If p is not a prime number.
 o GaloisField
  public GaloisField(int newcard,
                     int newalfa)
This constructor is for internal use only. Do not call it directly!
Parameters:
newcard - The cardinality for the new field.
newalpha - The index of the primitive element.

Methods

 o setDisplayMode
  public void setDisplayMode(int newmode)
Set a new display mode.
See: 'ALFAPOWER'
See: 'POLYNOMIAL'
See: 'POLYCOEFS'
Parameters:
newmode - One of the supported display modes.
 o getDisplayMode
  public int getDisplayMode()
Returns the display mode.
See: setDisplayMode
 o getCardinality
  public int getCardinality()
Returns the cardinality.
 o normalise
  public int normalise(int element)
Normalises a galois element.
Returns the modulo value of the element in [0,getCardinality()-1].
 o toString
  public String toString()
Returns a String representation of this field.
Something like "Base Galois Field GF(5)".
Overrides:
toString in class Object
 o sum
  public int sum(int a,
                 int b)
Returns the sum of two galois elements.
 o minus
  public int minus(int a,
                   int b)
Returns a - b.
 o product
  public int product(int a,
                     int b)
Returns the product of two galois elements.
 o divide
  public int divide(int a,
                    int b) throws GaloisException
Returns a / b.
Throws: GaloisException
If b = 0 (Division by zero).
 o getCyclotomic
  public int[] getCyclotomic(int modulo,
                             int elem)
Returns the cyclotomic of [elem] modulo [modulo].
This is an array of primitive element powers.
Parameters:
modulo - The modulo parameter for the cyclotomic.
elem - The starting power.
 o getAllCyclotomics
  public Vector getAllCyclotomics(int modulo)
Returns all the cyclotomics modulo [modulo].
This is a Vector of cyclotomics.
See: getCyclotomic
Parameters:
modulo - The modulo parameter for the cyclotomic.
 o getKPrimitiveNRoot
  public int[] getKPrimitiveNRoot(int n)
Method for construction of primitive roots for 'one'.
Returns an array of two integers.
The first is the k-parameter for the extended field containing the root.
The second is the power p of the primitive element in that field.
beta^n = 1, beta = alpha^p in GF(base^k).
Parameters:
n - Take the n-th root of 'one'.
 o getMinimalPolynomial
  public GaloisPolynomial getMinimalPolynomial(int alphapwr,
                                               char talfa) throws GaloisException
Returns a minimal polynomial.
Parameters:
alphapwr - To identify the polynomial: p(alpha^alphapwr) = 0.
talpha - The polynomial variable. For ex: 'x'.
Throws: GaloisException
If an error occurs.
 o getAlfaPower
  public int getAlfaPower(int pwr)
Returns a power of the primitive element.
 o valueString
  public String valueString(int a)
Returns a String representation for the given element.
 o isBase
  public boolean isBase()
Is this field a base field?.
 o getBase
  public GaloisField getBase()
Returns the base field.
 o getRoot
  public GaloisField getRoot()
Returns the root field.
If 'this' = GF((p^k)...^q)) this method returns GF(p).
 o toBase
  public int toBase(int a) throws GaloisException
Converts a galois element from 'this' field to the base field.
Throws: GaloisException
If the element can't be found in the base field.
 o toSuper
  public int toSuper(int a) throws GaloisException
Converts a galois element from the base field to 'this' field.
Throws: GaloisException
If the element can't be converted.
 o toExtended
  public int toExtended(int a,
                        GaloisField till) throws GaloisException
Converts a galois element from 'this' field to a given ExtendedGaloisField.
Throws: GaloisException
If 'this' is no sub-field of the given field.
 o getAlfa
  public char getAlfa()
Returns the character used for alpha in a polynomial representation.
 o cleanString
  public static String cleanString(String strg)
Cleans a string. Removes all surrounding spaces and parantheses.
For ex: " ( (lk()dj )) " -> "lk()dj"
 o parse
  public int parse(String strg,
                   int onempty) throws GaloisException
Converts a string to a galois element.
Throws: GaloisException
If the string is no valid representation.
 o atoi
  public static int atoi(String intvl) throws GaloisException
Converts a string to an integer.
Throws: GaloisException
If there are illegal characters in the string.
 o power
  public static int power(int what,
                          int vl)
Calculates the power of a given integer.
Warning: this is not the power function for galois elements.
 o fillString
  public static String fillString(char ch,
                                  int len)
Returns a string length [len] containing nothing but characters [ch].
 o modulo
  public static int modulo(int a,
                           int b)
Returns (a mod b).