Public Member Functions |
|
| FieldPolynomial () throw () |
| Construct the special 0 polynomial.
|
|
const Field< T > & | parent () const throw (UndefinedFieldException) |
| The parent field.
|
long | degree () const throw () |
| Degree of the polynomial.
|
|
You can copy polynomials using assignment.
|
| FieldPolynomial (const FieldPolynomial< T > &) throw () |
FieldPolynomial< T > & | operator= (const FieldPolynomial< T > &) throw () |
| FieldPolynomial (const FieldElement< T > &e) throw () |
FieldPolynomial< T > & | operator= (const FieldElement< T > &e) throw () |
FieldPolynomial< T > & | operator= (const BigInt &i) throw (UndefinedFieldException) |
| The degree 0 polynomial with constant coefficient i.
|
|
void | getCoeff (const long i, FieldElement< T > &e) const throw (BadParametersException) |
| Store in e the i-th coefficient.
|
void | setCoeff (const long i, const FieldElement< T > &e) throw (NotInSameFieldException, BadParametersException) |
| Set the i-th coefficient to e.
|
void | setCoeff (const long i, const BigInt &c) throw (UndefinedFieldException, BadParametersException) |
| Set the i-th coefficient to c.
|
void | setCoeff (const long i) throw (UndefinedFieldException, BadParametersException) |
| Set the i-th coefficient to 1.
|
|
All binary operators throw a NotInSameFieldException if neither of this two conditions is satisfied:
|
FieldPolynomial< T > | operator+ (const FieldPolynomial< T > &e) const throw (NotInSameFieldException) |
FieldPolynomial< T > | operator- (const FieldPolynomial< T > &e) const throw (NotInSameFieldException) |
FieldPolynomial< T > | operator* (const FieldPolynomial< T > &e) const throw (NotInSameFieldException) |
FieldPolynomial< T > | operator/ (const FieldPolynomial< T > &e) const throw (NotInSameFieldException, DivisionByZeroException) |
FieldPolynomial< T > | operator% (const FieldPolynomial< T > &e) const throw (NotInSameFieldException, DivisionByZeroException) |
FieldPolynomial< T > | operator<< (const long n) const |
| Left shift.
|
FieldPolynomial< T > | operator>> (const long n) const |
| Right shift.
|
void | operator+= (const FieldPolynomial< T > &) throw (NotInSameFieldException) |
void | operator-= (const FieldPolynomial< T > &) throw (NotInSameFieldException) |
void | operator*= (const FieldPolynomial< T > &) throw (NotInSameFieldException) |
void | operator/= (const FieldPolynomial< T > &) throw (NotInSameFieldException, DivisionByZeroException) |
void | operator%= (const FieldPolynomial< T > &) throw (NotInSameFieldException, DivisionByZeroException) |
void | operator<<= (const long n) |
| Left shift.
|
void | operator>>= (const long n) |
| Right shift.
|
void | sum (const FieldPolynomial< T > &a, const FieldPolynomial< T > &b) throw (NotInSameFieldException) |
| Stores a + b in this polynomial.
|
void | difference (const FieldPolynomial< T > &a, const FieldPolynomial< T > &b) throw (NotInSameFieldException) |
| Stores a - b in this polynomial.
|
void | product (const FieldPolynomial< T > &a, const FieldPolynomial< T > &b) throw (NotInSameFieldException) |
| Stores a * b in this polynomial.
|
void | division (const FieldPolynomial< T > &a, const FieldPolynomial< T > &b) throw (NotInSameFieldException, DivisionByZeroException) |
| Stores a / b in this polynomial.
|
void | mod (const FieldPolynomial< T > &a, const FieldPolynomial< T > &b) throw (NotInSameFieldException, DivisionByZeroException) |
| Stores a % b in this polynomial.
|
void | LeftShift (const FieldPolynomial< T > &a, const long n) |
| Left shift. Stores a * Xn in this polynomial.
|
void | RightShift (const FieldPolynomial< T > &a, const long n) |
| Right shift. Stores a / Xn in this polynomial.
|
|
bool | divides (const FieldPolynomial< T > &P) const throw () |
| Test divisibility of this polynomial by P.
|
FieldPolynomial< T > | operator- () const throw () |
FieldPolynomial< T > | operator^ (const long i) const throw () |
| Power.
|
FieldPolynomial< T > | derivative () const throw () |
FieldPolynomial< T > | monic () const throw () |
| The monic polynomial obtained by dividing this polynomial by its leading coeffcient.
|
FieldPolynomial< T > | frobenius () const throw () |
| p-th power (frobenius morphism) of the coefficients.
|
FieldPolynomial< T > | frobenius (const long n) const throw () |
| pn-th power (iterated frobenius morphism) of the coefficients.
|
|
These operators store the result of the operation into the polynomial itself.
|
void | negate () throw () |
| Flip the sign of this polynomial.
|
void | operator^= (const long) throw () |
| Power.
|
void | self_derivative () throw () |
| Derivative.
|
void | normalize () throw () |
| Make this polynomial monic.
|
void | self_frobenius () throw () |
| p-th power (frobenius morphism) of the coefficients.
|
void | self_frobenius (long) throw () |
| pn-th power (iterated frobenius morphism) of the coefficients.
|
|
Every polynomial has an unique parent field, but its coefficients may belong to some subfield of its parent field or you may want to change its parent field to an overfield of its actual one. Coercion does exactly this. When the coericion is impossible because either there is no known embedding between the two fields or because the coefficients do not belong to the new field, an IllegalCoercionException is thrown.
|
FieldPolynomial< T > | toScalarPolynomial () const throw (IllegalCoercionException) |
| Coerce to a scalar polynomial.
|
FieldPolynomial< T > | operator>> (const Field< T > &) const throw (IllegalCoercionException) |
| Coerce to the field F.
|
void | operator>>= (const Field< T > &F) throw (IllegalCoercionException) |
| Coerce to the field F and store the result in this polynomial.
|
bool | isCoercible (const Field< T > &) const throw () |
| Test if this polynomial is coercible to F.
|
|
FieldElement< T > | evaluate (const FieldElement< T > &e, vector< FieldPolynomial< T > > &minpols) const throw (IllegalCoercionException, BadParametersException) |
| The evaulation of this polynomial at e.
|
FieldElement< T > | evaluate (const FieldElement< T > &e) const throw (IllegalCoercionException, BadParametersException) |
|
|
|
bool | operator== (const FieldPolynomial< T > &) const throw (NotInSameFieldException) |
| Equality.
|
bool | operator== (const FieldElement< T > &) const throw (NotInSameFieldException) |
| Equality.
|
bool | operator== (const BigInt &) const throw () |
| Equality.
|
bool | operator!= (const FieldPolynomial< T > &e) const throw (NotInSameFieldException) |
| Inequality.
|
bool | operator!= (const FieldElement< T > &e) const throw (NotInSameFieldException) |
| Inequality.
|
bool | operator!= (const BigInt &i) const throw () |
| Inequality.
|
bool | isZero () const throw () |
| Test to zero.
|
bool | isOne () const throw () |
| Test to one.
|
bool | isScalarPolynomial () const throw () |
| Test if this polynomial has coefficients in Fp.
|
|
These methods let you access the internal NTL representation of polynomials.
- Warning
- These methods are for advanced use only. Use them if you want to use an algorithm by you or in NTL that is not available for FieldPolynomial.
|
void | toInfrastructure (GFpX &P) const throw (IllegalCoercionException) |
| Get the representation of polynomials whose parent field is Fp.
|
void | toInfrastructure (GFpEX &P) const throw (IllegalCoercionException) |
| Get the representation of polynomials whose parent field is an extension field.
|
|
ostream & | print (ostream &) const |
| Print this polynomial to o.
|
ostream & | print (ostream &, const string &varPoly, const string &varField) const |
| Print this element to o as a polynomial over its parent field.
|
ostream & | print (ostream &, const string &varPoly, const vector< string > &varsField) const |
| Print this element to o as a polynomial over its parent field.
|
template<class T>
class FAAST::FieldPolynomial< T >
An polynomial with coefficients over a finite field.
Objects of this class represent polynomials over a finite field, as represented by the class Field. With the exception of the zero polynomial created by the default constructor, any element has an unique parent field and binary operations can combine two elements only in one of the following two cases:
- the two polynomials have the same parent field,
- the parent element of one polynomial is the prime field of the other's.
Polynomials created through the default constructor, as for example
have a special status as they don't belong to any specific field: their default value is 0 and they can be combined with any other polynomial. The result of a binary operation involving such a special polynomial is one of the following:
- A DivisionByZeroException if the operation is division and the divisor is the special 0 polynomial.
- A polynomial over the field K, if K is the parent field of the other polynomial.
- The special 0 polynomial if the other polynomial is the special 0 polynomial.
- An UndefinedFieldException if the other polynomial is not the special 0 polynomial and yet does not belong to any field, as in this example
FieldPolynomial<T> P;
return P + 1;
See UndefinedFieldException for more details.
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.
- Template Parameters
-
T | An Infrastructure. It specfies which NTL types will carry out the arithmetic operations. |
- See Also
- Field, FieldElement, UndefinedFieldException
- Examples:
- test.c++.