linbox
Public Types | Public Member Functions
LidiaGfq Class Reference

defines the Galois Field GF(pk). More...

#include <lidia-gfq.h>

+ Inheritance diagram for LidiaGfq:

Public Types

typedef LiDIA::gf_element Element
 Element type.
typedef LidiaGfqRandIter
< LidiaGfq
RandIter
 Random element generator which is define in the wrapper LIDIA_randiter.

Public Member Functions

 LidiaGfq ()
 Default constructor of the field.
 LidiaGfq (const integer &p, const integer &k=1)
 Constructor of GF(p^k).
 LidiaGfq (const LidiaGfq &F)
 Copy constructor.
 ~LidiaGfq ()
 Destructor.
LidiaGfqoperator= (const LidiaGfq &F)
 Assignment operator.
Object management
Elementinit (Element &x, const integer &y=0) const
 Initialization of field Element from an integer.
integerconvert (integer &x, const Element &y) const
 Conversion of field base Element to an integer.
Elementassign (Element &x, const Element &y) const
 Assignment of one field Element to another.
integercardinality (integer &c) const
 Cardinality.
integercharacteristic (integer &c) const
 Characteristic.
Arithmetic Operations

x <- y op z; x <- op y These operations require all Elements, including x, to be initialized before the operation is called.

Uninitialized field Elements will give undefined results.

bool areEqual (const Element &x, const Element &y) const
 Equality of two Elements.
Elementadd (Element &x, const Element &y, const Element &z) const
 Addition.
Elementsub (Element &x, const Element &y, const Element &z) const
 Subtraction.
Elementmul (Element &x, const Element &y, const Element &z) const
 Multiplication.
Elementdiv (Element &x, const Element &y, const Element &z) const
 Division.
Elementneg (Element &x, const Element &y) const
 Additive Inverse (Negation).
Elementinv (Element &x, const Element &y) const
 Multiplicative Inverse.
Elementaxpy (Element &r, const Element &a, const Element &x, const Element &y) const
 Natural AXPY.
bool isZero (const Element &x) const
 Zero equality.
bool isOne (const Element &x) const
 One equality.
Elementaddin (Element &x, const Element &y) const
 Inplace Addition.
Elementsubin (Element &x, const Element &y) const
 Inplace Subtraction.
Elementmulin (Element &x, const Element &y) const
 Inplace Multiplication.
Elementdivin (Element &x, const Element &y) const
 Inplace Division.
Elementnegin (Element &x) const
 Inplace Additive Inverse (Inplace Negation).
Elementinvin (Element &x) const
 Inplace Multiplicative Inverse.
Elementaxpyin (Element &r, const Element &a, const Element &x) const
 Inplace AXPY.
Input/Output Operations
std::ostreamwrite (std::ostream &os) const
 Print field.
std::istreamread (std::istream &is) const
 Read field.
std::ostreamwrite (std::ostream &os, const Element &e) const
 Print field Element like a polynom.
std::istreamread (std::istream &is, Element &e) const
 Read field Element.

Detailed Description

defines the Galois Field GF(pk).

Inherits from galois_field of LiDIA.

Precondition:
p must be prime.

Member Typedef Documentation

typedef LiDIA::gf_element Element

Element type.

This type is inherited from the LiDIA class LiDIA::gf_element


Constructor & Destructor Documentation

LidiaGfq ( const integer p,
const integer k = 1 
) [inline]

Constructor of GF(p^k).

A GF(p^k) field is constructed through the constructor of LiDIA LiDIA::galois_field We need a double cast to pass integer arguments to the LiDIA constructor


Member Function Documentation

LidiaGfq& operator= ( const LidiaGfq F) [inline]

Assignment operator.

Assigns unparam_field object F to field.

Parameters:
Funparam_field object.
Element& init ( Element x,
const integer y = 0 
) const [inline]

Initialization of field Element from an integer.

Behaves like C++ allocator construct. This function assumes the output field Element x has already been constructed, but that it is not already initialized. We also need to define the Element over the field. So what we always initialize the Element with the zero field value. If an integer different from zero is passed to the function the Element is initialized to a constant polynom of Z/pZ

Returns:
reference to field Element.
Parameters:
xfield Element to contain output (reference returned).
yinteger.
integer& convert ( integer x,
const Element y 
) const [inline]

Conversion of field base Element to an integer.

This function assumes the output field base Element x has already been constructed, but that it is not already initialized. As Elements are represented by polynom the convert function return the valuation of polynom in characteristic by the Horner Method. That keeps unicity of each Element.

Returns:
reference to an integer.
Parameters:
xinteger to contain output (reference returned).
yconstant field base Element.
Element& assign ( Element x,
const Element y 
) const [inline]

Assignment of one field Element to another.

This function assumes both field Elements have already been constructed and initialized.

Returns:
reference to x
Parameters:
xfield Element (reference returned).
yfield Element.
integer& cardinality ( integer c) const [inline]

Cardinality.

Return integer representing cardinality of the field. Returns p^k.

Returns:
constant reference to integer representing cardinality of the field.
integer& characteristic ( integer c) const [inline]

Characteristic.

Return integer representing characteristic of the field. Returns p.

Returns:
constant reference to integer representing characteristic of the field.
bool areEqual ( const Element x,
const Element y 
) const [inline]

Equality of two Elements.

This function assumes both field Elements have already been constructed and initialized.

Returns:
boolean true if equal, false if not.
Parameters:
xfield Element
yfield Element
Element& add ( Element x,
const Element y,
const Element z 
) const [inline]

Addition.

x = y + z This function assumes all the field Elements have already been constructed and initialized.

Returns:
reference to x.
Parameters:
xfield Element (reference returned).
yfield Element.
zfield Element.
Element& sub ( Element x,
const Element y,
const Element z 
) const [inline]

Subtraction.

x = y - z This function assumes all the field Elements have already been constructed and initialized.

Returns:
reference to x.
Parameters:
xfield Element (reference returned).
yfield Element.
zfield Element.
Element& mul ( Element x,
const Element y,
const Element z 
) const [inline]

Multiplication.

x = y * z This function assumes all the field Elements have already been constructed and initialized.

Returns:
reference to x.
Parameters:
xfield Element (reference returned).
yfield Element.
zfield Element.
Element& div ( Element x,
const Element y,
const Element z 
) const [inline]

Division.

x = y / z This function assumes all the field Elements have already been constructed and initialized.

Returns:
reference to x.
Parameters:
xfield Element (reference returned).
yfield Element.
zfield Element.
Element& neg ( Element x,
const Element y 
) const [inline]

Additive Inverse (Negation).

x = - y This function assumes both field Elements have already been constructed and initialized.

Returns:
reference to x.
Parameters:
xfield Element (reference returned).
yfield Element.
Element& inv ( Element x,
const Element y 
) const [inline]

Multiplicative Inverse.

x = 1 / y This function assumes both field Elements have already been constructed and initialized.

Returns:
reference to x.
Parameters:
xfield Element (reference returned).
yfield Element.
Element& axpy ( Element r,
const Element a,
const Element x,
const Element y 
) const [inline]

Natural AXPY.

r = a * x + y This function assumes all field Elements have already been constructed and initialized.

Returns:
reference to r.
Parameters:
rfield Element (reference returned).
afield Element.
xfield Element.
yfield Element.
bool isZero ( const Element x) const [inline]

Zero equality.

Test if field Element is equal to zero of field. This function assumes the field Element has already been constructed and initialized.

Returns:
boolean true if equals zero of field, false if not.
Parameters:
xfield Element.
bool isOne ( const Element x) const [inline]

One equality.

Test if field Element is equal to one of field. This function assumes the field Element has already been constructed and initialized.

Returns:
boolean true if equals one of field, false if not.
Parameters:
xfield Element.
Element& addin ( Element x,
const Element y 
) const [inline]

Inplace Addition.

x += y This function assumes both field Elements have already been constructed and initialized.

Returns:
reference to x.
Parameters:
xfield Element (reference returned).
yfield Element.
Element& subin ( Element x,
const Element y 
) const [inline]

Inplace Subtraction.

x -= y This function assumes both field Elements have already been constructed and initialized.

Returns:
reference to x.
Parameters:
xfield Element (reference returned).
yfield Element.
Element& mulin ( Element x,
const Element y 
) const [inline]

Inplace Multiplication.

x *= y This function assumes both field Elements have already been constructed and initialized.

Returns:
reference to x.
Parameters:
xfield Element (reference returned).
yfield Element.
Element& divin ( Element x,
const Element y 
) const [inline]

Inplace Division.

x /= y This function assumes both field Elements have already been constructed and initialized.

Returns:
reference to x.
Parameters:
xfield Element (reference returned).
yfield Element.
Element& negin ( Element x) const [inline]

Inplace Additive Inverse (Inplace Negation).

x = - x This function assumes the field Element has already been constructed and initialized.

Returns:
reference to x.
Parameters:
xfield Element (reference returned).
Element& invin ( Element x) const [inline]

Inplace Multiplicative Inverse.

x = 1 / x This function assumes the field Elementhas already been constructed and initialized.

Returns:
reference to x.
Parameters:
xfield Element (reference returned).
Element& axpyin ( Element r,
const Element a,
const Element x 
) const [inline]

Inplace AXPY.

r += a * x This function assumes all field Elements have already been constructed and initialized.

Returns:
reference to r.
Parameters:
rfield Element (reference returned).
afield Element.
xfield Element.
std::ostream& write ( std::ostream os) const [inline]

Print field.

Returns:
output stream to which field is written.
Parameters:
osoutput stream to which field is written.
std::istream& read ( std::istream is) const [inline]

Read field.

Returns:
input stream from which field is read.
Parameters:
isinput stream from which field is read.
std::ostream& write ( std::ostream os,
const Element e 
) const [inline]

Print field Element like a polynom.

Returns:
output stream to which field Element is written.
Parameters:
osoutput stream to which field Element is written.
efield Element.
std::istream& read ( std::istream is,
Element e 
) const [inline]

Read field Element.

Returns:
input stream from which field Element is read.
Parameters:
isinput stream from which field Element is read.
efield Element.

The documentation for this class was generated from the following file: