OPENF4
Library for Gröebner basis computations over finite fields.
 All Classes Namespaces Files Functions Variables Friends Pages
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
F4::ElementPrime< baseType > Class Template Reference

Represent an element of a prime field, this class is a POD (Plain Old Data) because of the alignement required in class Matrix. More...

#include <element-prime.h>

Public Member Functions

baseType modulo ()
 Set this in [-MODULO/2, MODULO/2]. More...
 
baseType getElement ()
 Return this. More...
 
ElementPrime< baseType > & addMult (ElementPrime< baseType > const &element, ElementPrime< baseType > const &mult)
 Set this+=(mult*element). More...
 
ElementPrime< baseType > & inverse ()
 Inverse this according to the base field. More...
 
void printElementPrime (std::ostream &stream) const
 Print the element.
 
bool isZero () const
 Test if this is nul. More...
 
bool isOne () const
 Test if this is one (neutral multiplicative element). More...
 
void setZero ()
 Set the element to zero.
 
void setOne ()
 Set the element to one.
 
ElementPrimeoperator= (baseType element)
 Overload the operator =. More...
 
ElementPrimeoperator*= (ElementPrime const &mult)
 Overload the operator *=. More...
 

Static Public Member Functions

static void setModulo (baseType modulo)
 Set the static variable MODULO. More...
 
static baseType getModulo ()
 Get the static variable MODULO. More...
 
static baseType getMax ()
 Get the static variable MAX. More...
 

Public Attributes

baseType _element
 

Static Public Attributes

static baseType MODULO
 
static baseType MAX
 

Detailed Description

template<typename baseType>
class F4::ElementPrime< baseType >

Represent an element of a prime field, this class is a POD (Plain Old Data) because of the alignement required in class Matrix.

Examples:
tutorial-method3.cpp.

Definition at line 47 of file element-prime.h.

Member Function Documentation

template<typename baseType>
ElementPrime<baseType>& F4::ElementPrime< baseType >::addMult ( ElementPrime< baseType > const &  element,
ElementPrime< baseType > const &  mult 
)

Set this+=(mult*element).

Parameters
elementElement of the prime field.
multElement of the prime field.
Precondition
mult is set in [-MODULO/2, MODULO/2].
element is set in [-MODULO/2, MODULO/2].
Postcondition
this is set in [-MAX, MAX].
Returns
this.
template<typename baseType>
baseType F4::ElementPrime< baseType >::getElement ( )

Return this.

Returns
Integer form of this.
template<typename baseType>
static baseType F4::ElementPrime< baseType >::getMax ( )
static

Get the static variable MAX.

Returns
Maximum range for the baseType elements.
template<typename baseType>
static baseType F4::ElementPrime< baseType >::getModulo ( )
static

Get the static variable MODULO.

Returns
Characteristic of the base field.
template<typename baseType>
ElementPrime<baseType>& F4::ElementPrime< baseType >::inverse ( )

Inverse this according to the base field.

Precondition
The static variable MODULO must be set beforehand. Beware, baseType must be signed.
Postcondition
this is set in [-MODULO/2, MODULO/2].
Returns
this.
template<typename baseType>
bool F4::ElementPrime< baseType >::isOne ( ) const

Test if this is one (neutral multiplicative element).

Returns
true if this==one.
false otherwise.
template<typename baseType>
bool F4::ElementPrime< baseType >::isZero ( ) const

Test if this is nul.

Returns
true if this==zero.
false otherwise.
template<typename baseType>
baseType F4::ElementPrime< baseType >::modulo ( )

Set this in [-MODULO/2, MODULO/2].

Postcondition
this is set in [-MODULO/2, MODULO/2].
Returns
Integer form of this.
template<typename baseType>
ElementPrime& F4::ElementPrime< baseType >::operator*= ( ElementPrime< baseType > const &  mult)

Overload the operator *=.

Precondition
The static variable MODULO must be set beforehand.
Parameters
elementElement of a prime field.
Precondition
mult is set in [-MODULO/2, MODULO/2].
Postcondition
this is set in [-MODULO/2, MODULO/2].
Returns
Reference on this.
template<typename baseType>
ElementPrime& F4::ElementPrime< baseType >::operator= ( baseType  element)

Overload the operator =.

Precondition
The static variable MODULO must be set beforehand.
Parameters
elementElement of a prime field.
Returns
Reference on this.
template<typename baseType>
static void F4::ElementPrime< baseType >::setModulo ( baseType  modulo)
static

Set the static variable MODULO.

Parameters
moduloCharacteristic of the base field.

Member Data Documentation

template<typename baseType>
baseType F4::ElementPrime< baseType >::_element

Represent an element of the field of characteristic MODULO

Definition at line 164 of file element-prime.h.

template<typename baseType>
baseType F4::ElementPrime< baseType >::MAX
static

Maximum range for the baseType elements.

Definition at line 167 of file element-prime.h.

template<typename baseType>
baseType F4::ElementPrime< baseType >::MODULO
static

Characteristic of the base field.

Definition at line 166 of file element-prime.h.


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