FAAST
0.2.1
|
A finite field. More...
Public Member Functions | |
Artin-Schreier Extensions | |
Build Artin-Schreier extensions as described in [DFS '09]. | |
const Field< T > & | ArtinSchreierExtension () const throw (CharacteristicTooLargeException, NotSupportedException) |
Build a primitive extension of degree p as in [DFS '09, Section 3]. | |
const Field< T > & | ArtinSchreierExtension (const FieldElement< T > &alpha) const throw (CharacteristicTooLargeException, NotIrreducibleException, NotSupportedException, IllegalCoercionException) |
Build the splitting field of the polynomial ![]() | |
FieldElement< T > | Couveignes2000 (const FieldElement< T > &alpha) const throw (IllegalCoercionException, IsIrreducibleException) |
Finds a root of the polynomial ![]() | |
Properties | |
BigInt | characteristic () const throw () |
The characteristic of the field. | |
long | degree () const throw () |
The degree over the prime field Fp. | |
ZZ | cardinality () const throw () |
The cardinality of the field. | |
long | ArtinSchreierHeight () const throw () |
The constructed Artin-Schreier height. | |
FieldPolynomial< T > | generatingPolynomial () const throw () |
The polynomial with coefficients in subField() that has been used to generate this extension. | |
FieldPolynomial< T > | primitivePolynomial () const throw () |
The polynomial with coefficients in Fp used to represent elements of this field. | |
Field Elements | |
Routines to create elements of the field. | |
FieldElement< T > | scalar (const BigInt &i) const throw () |
The element i mod p. | |
FieldElement< T > | zero () const throw () |
The zero element of this field. | |
FieldElement< T > | one () const throw () |
The identity element of this field. | |
FieldElement< T > | generator () const throw () |
The generator over subField(). | |
FieldElement< T > | primitiveElement () const throw () |
The generator over Fp | |
FieldElement< T > | random () const throw () |
A random element of the field. | |
Access to the Infrastructure | |
These methods let you use the internal
| |
void | switchContext () const throw () |
Set the current context to this field's context. | |
FieldElement< T > | fromInfrastructure (const GFp &e) const throw () |
Build an element of this field from an NTL type. | |
FieldElement< T > | fromInfrastructure (const GFpE &e) const throw (IllegalCoercionException) |
Build an element of this field from an NTL type. | |
FieldPolynomial< T > | fromInfrastructure (const GFpX &P) const throw () |
Build an polynomial with coefficients in this field from an NTL type. | |
FieldPolynomial< T > | fromInfrastructure (const GFpEX &P) const throw (IllegalCoercionException) |
Build an polynomial with coefficients in this field from an NTL type. | |
Field lattice navigation | |
These routines permit to move around in the lattice of fields created by calls to ArtinSchreierExtension() as described in section Lattices of fields. | |
const Field< T > & | primeField () const throw () |
The prime field Fp of this field. | |
const Field< T > & | baseField () const throw () |
The base field of the Artin-Schreier tower. | |
const Field< T > & | subField () const throw (NoSubFieldException) |
The immediate subfield in the primitive tower. | |
const Field< T > & | overField () const throw (NoOverFieldException) |
The immediate overfield in the primitive tower. | |
const Field< T > & | stemField () const throw () |
The field on the primitive tower isomorphic to this field. | |
Applying the isomorphism | |
These routines implement the algorithms of [DFS '09, Section 6.2] that convert elements written on the univariate basis of the primitive Artin-Schreier tower to and from the multivariate basis of any isomorphic tower. | |
void | toBivariate (const FieldElement< T > &e, vector< FieldElement< T > > &v) const throw (IllegalCoercionException) |
Convert the univariate representation of e to the multivariate representation over this field. | |
void | toUnivariate (const vector< FieldElement< T > > &v, FieldElement< T > &e) const throw (NotInSameFieldException, IllegalCoercionException) |
Convert the multivariate representation of v to the univariate representation of this field. | |
Predicates | |
bool | operator== (const Field< T > &F) const throw () |
Equality. | |
bool | operator!= (const Field< T > &F) const throw () |
Inequality. | |
bool | isIsomorphic (const Field< T > &F) const throw () |
This field is isomorphic to F. | |
bool | isSubFieldOf (const Field< T > &F) const throw () |
This field is contained in F. | |
bool | isOverFieldOf (const Field< T > &F) const throw () |
This field contains F. | |
bool | isPrimeField () const throw () |
This is a prime field. | |
bool | isBaseField () const throw () |
Printing | |
ostream & | print (ostream &o) const |
Print details about the field to o. |
Static Public Member Functions | |
Instantiators | |
All instantiators are static. There's no constructor for Field objects. | |
static const Field< T > & | createField (const bool test=true) throw (NotPrimeException, NotIrreducibleException) |
Default instantiator, builds a field from NTL 's context. | |
static const Field< T > & | createField (const GFpX &P, const bool test=true) throw (NotPrimeException, NotIrreducibleException) |
Build a field from an irreducible polynomial P. | |
static const Field< T > & | createField (const BigInt &p, const long d=1, const bool test=true) throw (NotPrimeException, BadParametersException) |
Build the field Fpd using a default polynomial. |
Data Fields | |
Public data members | |
const BigInt | p |
The characteristic of the field. | |
const long | d |
The degree over the prime field Fp. | |
const long | height |
The constructed Artin-Schreier height. |
Related Functions | |
(Note that these are not member functions.) | |
template<class T > | |
ostream & | operator<< (ostream &o, const Field< T > &F) |
Print details about F to o. |
Local types | |
Local types defined in this class. They are aliases to simplify the access to the Infrastructure T and its subtypes.
| |
typedef T | Infrastructure |
A link to the Infrastructures Infrastructure. | |
typedef T::GFp | GFp |
typedef T::MatGFp | MatGFp |
typedef T::VecGFp | VecGFp |
typedef T::GFpX | GFpX |
typedef T::GFpE | GFpE |
typedef T::GFpEX | GFpEX |
typedef T::BigInt | BigInt |
typedef T::Context | Context |
typedef T::GFpXModulus | GFpXModulus |
A finite field.
Objects of this class can only be built through the static instantiators createField() and can never be destroyed.
The way the arithmetics of the field are actually implemented is given by the template parameter T that must be one of the Infrastructures. Note that changing the Infrastructure may sensibly change the speed of your code.
T | An Infrastructure. It specfies which NTL types will carry out the arithmetic operations. |
const Field< T > & FAAST::Field< T >::ArtinSchreierExtension | ( | ) | const throw (CharacteristicTooLargeException, NotSupportedException) |
Build a primitive extension of degree p as in [DFS '09, Section 3].
CharacteristicTooLargeException | If p is a multiprecision integer larger than the largest single precision integer. |
NotSupportedException | If d is divisible by p and the generator of this field has trace 0. See creteField() and [DFS '09] for necessary and sufficient conditions for this not to hold. |
const Field< T > & FAAST::Field< T >::ArtinSchreierExtension | ( | const FieldElement< T > & | alpha | ) | const throw (CharacteristicTooLargeException, NotIrreducibleException, NotSupportedException, IllegalCoercionException) |
Build the splitting field of the polynomial as in [DFS '09, Section 6].
The polynomial must be reducible (equivalently alpha must have trace 0). A primitive Artin-Schreier extension is constructed using ArtinSchreierExtension(), then Couveignes2000() is used in such an extension to find one of the roots and the isomorphic field is constructed. The computed root is used in pushDown() and liftUp() to navigate the tower as in [DFS '09, Section 6.2].
CharacteristicTooLargeException | If p is a multiprecision integer larger than the largest single precision integer. |
NotIrreducibleException | If alpha has trace 0. |
NotSupportedException | If the primitive field cannot be created. See ArtinSchreierExtension() for details |
IllegalCoercionException | If alpha cannot be coerced to an element of this field. |
|
inline |
The constructed Artin-Schreier height.
const Field< T > & FAAST::Field< T >::baseField | ( | ) | const throw () |
The base field of the Artin-Schreier tower.
The Artin-Schreier height 0 subfield of this field.
|
inline |
The characteristic of the field.
FieldElement< T > FAAST::Field< T >::Couveignes2000 | ( | const FieldElement< T > & | alpha | ) | const throw (IllegalCoercionException, IsIrreducibleException) |
Finds a root of the polynomial .
It uses the algorithm described in [Couveignes '00] and [DFS '09, Section 6.1].
IllegalCoercionException | if alpha cannot be coerced to this field. |
IsIrreducibleException | If the polynomial is irreducible (equivalently, if alpha has trace 0). |
|
static |
Default instantiator, builds a field from NTL
's context.
[in] | test | If false, do not perform primality and irreducibility tests. |
NotPrimeException | If the current NTL modulus, as obtained by T::GFp::modulus();
|
NotIrreducibleException | If the current NTL modulus, as obtained by T::GFpE::modulus();
|
|
static |
Build a field from an irreducible polynomial P.
Build the field F[X]/P(X).
T::GFp::modulus
must be set accordingly, unless T is GF2_Algebra.
[in] | P | An irreducible polynomial. |
[in] | test | If false, do not perform primality and irreducibility tests. |
NotPrimeException | If the current NTL modulus, as obtained by T::GFp::modulus();
|
NotIrreducibleException | If P is not an irreducible polynomial. |
|
static |
Build the field Fpd using a default polynomial.
Notice that this operation implicitely creates the field Fp too.
[in] | p | A prime number. |
[in] | d | A positive integer. |
[in] | test | If false, do not perform a primality test on p. |
NotPrimeException | If p is not prime |
BadParametersException | If d is less than one. |
BadParametersException | If T is GF2_Algebra and p is different from 2. |
|
inline |
The degree over the prime field Fp.
FieldElement< T > FAAST::Field< T >::fromInfrastructure | ( | const GFp & | e | ) | const throw () |
Build an element of this field from an NTL
type.
Returns a new element of this field having e as representation.
[in] | e | An NTL scalar element. |
FieldElement< T > FAAST::Field< T >::fromInfrastructure | ( | const GFpE & | e | ) | const throw (IllegalCoercionException) |
Build an element of this field from an NTL
type.
Returns a new element of this field having e as representation.
[in] | e | an NTL element. |
IllegalCoercionException | If this field is a prime field only scalar elements can belong to it. Use fromInfrastructure(const GFp&) const instead. |
FieldPolynomial< T > FAAST::Field< T >::fromInfrastructure | ( | const GFpX & | P | ) | const throw () |
Build an polynomial with coefficients in this field from an NTL
type.
Returns a new polynomial over this field having P as representation.
[in] | P | an NTL scalar polynomial. |
FieldPolynomial< T > FAAST::Field< T >::fromInfrastructure | ( | const GFpEX & | P | ) | const throw (IllegalCoercionException) |
Build an polynomial with coefficients in this field from an NTL
type.
Returns a new polynomial over this field having P as representation.
[in] | P | an NTL polynomial. |
IllegalCoercionException | If this field is a prime field only scalar polynomials can belong to it. Use fromInfrastructure(const GFpX&) const instead. |
FieldPolynomial< T > FAAST::Field< T >::generatingPolynomial | ( | ) | const throw () |
The polynomial with coefficients in subField() that has been used to generate this extension.
Or X - 1 if this is a prime field.
|
inline |
The generator over subField().
|
inline |
This is the base field of an ArtinSchreier tower
|
inline |
This field is isomorphic to F.
true
only if the isomorphism has been computed.
|
inline |
bool FAAST::Field< T >::isSubFieldOf | ( | const Field< T > & | F | ) | const throw () |
This field is contained in F.
true
only if the inclusion has been computed.
|
inline |
Inequality.
|
inline |
Equality.
|
inline |
The immediate overfield in the primitive tower.
If this field belongs to the primitive tower (the stem), then its immediate overfield is returned. Otherwise stemField().overField() is returned.
NoOverFieldException | If no overfield as been constructed through a call to ArtinSchreierExtension() |
|
inline |
The generator over Fp
FieldPolynomial< T > FAAST::Field< T >::primitivePolynomial | ( | ) | const throw () |
The polynomial with coefficients in Fp used to represent elements of this field.
Or X - 1 if this is a prime field.
FieldElement< T > FAAST::Field< T >::scalar | ( | const BigInt & | i | ) | const throw () |
The element i mod p.
[in] | i | An integer. |
|
inline |
The field on the primitive tower isomorphic to this field.
If this field belongs to the primitive tower, then it returns itself. Otherwise it returns the field in the primitive tower (the stem) that is isomorphic to this field. The isomorphism has been computed through Couveignes2000(const FieldElement<T>&) const as described in ArtinSchreierExtension(const FieldElement<T>&) const.
|
inline |
The immediate subfield in the primitive tower.
If this field belongs to the primitive tower (the stem), then its immediate subfield is returned. Otherwise stemField().subField() is returned.
NoSubFieldException | If this is a prime field. |
void FAAST::Field< T >::switchContext | ( | ) | const throw () |
Set the current context to this field's context.
NTL
's context holds information about the modulus and the characteristic of a finite field. By calling this method you set the current NTL
context to this field's context, so that any subsequent operation on NTL
types such as T::GFpX or T::GFpE will use that context.
You usually shouldn't be concerned about this method as the library takes care of switching the context for you when needed. The only time when you have to explicitly call it is when you want to use NTL types outside of the library and then transform the result to a FieldElement or FieldPolynomial through a call to a fromInfrastructure() method.
void FAAST::Field< T >::toBivariate | ( | const FieldElement< T > & | e, |
vector< FieldElement< T > > & | v | ||
) | const throw (IllegalCoercionException) |
Convert the univariate representation of e to the multivariate representation over this field.
If this is a prime field, then v is filled with the coefficients in Fp of its univariate representation. Otherwise let
This method fills the vector v with p elements of this field such that
Let K be this field, this corresponds to convert e from its internal (univariate) representation to the bivariate representation as an element of K[x]. A repeated application of this method implements ApplyInverse
of [DFS '09, Section 6.2].
[in] | e | An element of any field isomorphic to overField(). |
[out] | v | A vector of elements of this field that satisfies condition (1). |
IllegalCoercionException | If the field e belongs to is not isomorphic to overField(). |
pushDown(e, v)
and then coerce all the contents of v to this field. void FAAST::Field< T >::toUnivariate | ( | const vector< FieldElement< T > > & | v, |
FieldElement< T > & | e | ||
) | const throw (NotInSameFieldException, IllegalCoercionException) |
Convert the multivariate representation of v to the univariate representation of this field.
If the elements of v belong to the prime field, then e is the element whose univariate representation has v as cofficients. Otherwise let
This method stores in e an element of this field such that
If v is too short, it is filled with zeros. If v is too long, the unnecessary elements are ignored.
Let K be the field containing the elements of v, this corresponds to convert v from the multivariate representation as an element of K[x] to the internal (univariate) representation of this field. A repeated application of this method implements ApplyIsomorphism
of [DFS '09, Section 6.2].
[in] | v | A vector of elements all belonging to a field isomorphic to subField(). |
[out] | e | An element of this field satisfying condition (2). |
NotInSameFieldException | If the elements of v do not belong all to the same field. |
IllegalCoercionException | If the field the elements of v belong to is not isomorphic to subField(). |
liftUp(v, e)
. const long FAAST::Field< T >::height |
The constructed Artin-Schreier height.
This is the number of intermediate Artin-Schreier extensions over baseField() that have been constructed using the the techniques of [DFS '09, Sections 3 and 6].