linbox
NTL_ZZ_p Struct Reference

Wrapper of zz_p from NTL. More...

#include <ntl-zz_p.h>

+ Inheritance diagram for NTL_ZZ_p:

NTL_ZZ_p

Arbitrary precision integers modulus a positive integer.

While NTL allows any integer to serve as the modulus, only prime moduli yield fields. Therefore, while arthmetic operations may be valid for any modulus, only prime moduli are supported in this implementation. The primality of the modulus will not be checked, so it is the programmer's responsibility to supply a prime modulus. These specializations allow the Givaro::ZRing template class to be used to wrap NTL's ZZ_p class as a LinBox field.

 NTL_ZZ_p (integer q, size_t e=1)
 
 NTL_ZZ_p (NTL::ZZ d, size_t e=1)
 
 NTL_ZZ_p ()
 NULL constructor.
 
Element & init (Element &x, const integer &y) const
 
Element & init (Element &x, const double &y) const
 
Element & init (Element &x, const NTL::ZZ &y) const
 Specialization for NTL::ZZ. More...
 
Element & init (Element &x) const
 
Element & init (Element &x, const Element &y) const
 
template<class ANY >
Element & init (Element &x, const ANY &y) const
 
NTL::ZZ & convert (NTL::ZZ &x, const Element &y) const
 Specialization for NTL::ZZ. More...
 
integerconvert (integer &x, const Element &y) const
 Conversion of field element to an integer. More...
 
double & convert (double &x, const Element &y) const
 
template<class ANY >
ANY & convert (ANY &x, const Element &y) const
 
Element & pow (Element &res, const Element &x, long exp) const
 
Element & powin (Element &x, long exp) const
 
integercardinality (integer &c) const
 Cardinality. More...
 
integer cardinality () const
 
integercharacteristic (integer &c) const
 Characteristic. More...
 
size_t & characteristic (size_t &c) const
 
integer characteristic () const
 
Element & inv (Element &x, const Element &y) const
 Multiplicative Inverse. More...
 
bool isZero (const Element &x) const
 Zero equality. More...
 
bool isOne (const Element &x) const
 One equality. More...
 
bool isMOne (const Element &x) const
 MOne equality. More...
 
bool isUnit (const Element &x) const
 Unit test. More...
 
Element & invin (Element &x) const
 Inplace Multiplicative Inverse. More...
 
std::ostream & write (std::ostream &os) const
 Print field. More...
 
std::ostream & write (std::ostream &os, const Element &x) const
 Print field. More...
 
static integer maxCardinality ()
 

Detailed Description

Wrapper of zz_p from NTL.

Uses nice mod p via floating pt trick.

Constructor & Destructor Documentation

◆ NTL_ZZ_p() [1/2]

NTL_ZZ_p ( integer  q,
size_t  e = 1 
)
inline
Parameters
q,e

◆ NTL_ZZ_p() [2/2]

NTL_ZZ_p ( NTL::ZZ  d,
size_t  e = 1 
)
inline
Parameters
d,e

Member Function Documentation

◆ init() [1/6]

Element& init ( Element &  x,
const integer y 
) const
inline
Parameters
q,e

◆ init() [2/6]

Element& init ( Element &  x,
const double &  y 
) const
inline
Parameters
q,e

◆ init() [3/6]

Element& init ( Element &  x,
const NTL::ZZ &  y 
) const
inline

Specialization for NTL::ZZ.

Returns
reference to field element.
Parameters
xfield element to contain output (reference returned)
yNTL::ZZ.

◆ init() [4/6]

Element& init ( Element &  x) const
inline
Parameters
q,e

◆ init() [5/6]

Element& init ( Element &  x,
const Element &  y 
) const
inline
Parameters
q,e

◆ init() [6/6]

Element& init ( Element &  x,
const ANY &  y 
) const
inline
Parameters
q,e

◆ convert() [1/4]

NTL::ZZ& convert ( NTL::ZZ &  x,
const Element &  y 
) const
inline

Specialization for NTL::ZZ.

Returns
reference to NTL::ZZ
Parameters
xNTL::ZZ to contain output (reference returned).
yconstant reference to field element.

◆ convert() [2/4]

integer& convert ( integer x,
const Element &  y 
) const
inline

Conversion of field element to an integer.

This function assumes the output field element x has already been constructed, but that it is not already initialized. This done by converting to a std::string : inefficient but correct.

Returns
reference to integer.
Parameters
xreference to integer to contain output (reference returned).
yconstant reference to field element.

◆ convert() [3/4]

double& convert ( double &  x,
const Element &  y 
) const
inline
Parameters
q,e

◆ convert() [4/4]

ANY& convert ( ANY &  x,
const Element &  y 
) const
inline
Parameters
q,e

◆ maxCardinality()

static integer maxCardinality ( )
inlinestatic
Parameters
q,e

◆ pow()

Element& pow ( Element &  res,
const Element &  x,
long  exp 
) const
inline
Parameters
q,e

◆ powin()

Element& powin ( Element &  x,
long  exp 
) const
inline
Parameters
q,e

◆ cardinality() [1/2]

integer& cardinality ( integer c) const
inline

Cardinality.

Return integer representing cardinality of the field. Returns the modulus of the field, which should be prime.

Returns
integer representing cardinality of the field

◆ cardinality() [2/2]

integer cardinality ( ) const
inline
Parameters
q,e

◆ characteristic() [1/3]

integer& characteristic ( integer c) const
inline

Characteristic.

Return integer representing characteristic of the field. Returns the modulus of the field, which should be prime.

Returns
integer representing characteristic of the field.

◆ characteristic() [2/3]

size_t& characteristic ( size_t &  c) const
inline
Parameters
q,e

◆ characteristic() [3/3]

integer characteristic ( ) const
inline
Parameters
q,e

◆ inv()

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.

◆ isZero()

bool isZero ( const Element &  x) const
inline

Zero equality.

Test if field element is equal to zero. This function assumes the field element has already been constructed and initialized. In this specialization, NTL's IsZero function is called.

Returns
boolean true if equals zero, false if not.
Parameters
xfield element.

◆ isOne()

bool isOne ( const Element &  x) const
inline

One equality.

Test if field element is equal to one. This function assumes the field element has already been constructed and initialized. In this specialization, NTL's IsOne function is called.

Returns
boolean true if equals one, false if not.
Parameters
xfield element.

◆ isMOne()

bool isMOne ( const Element &  x) const
inline

MOne equality.

Test if field element is equal to one. This function assumes the field element has already been constructed and initialized. In this specialization, NTL's IsMOne function is called.

Returns
boolean true if equals one, false if not.
Parameters
xfield element.

◆ isUnit()

bool isUnit ( const Element &  x) const
inline

Unit test.

Test if field element is invertible. This function assumes the field element has already been constructed and initialized. In this specialization, NTL's InvModStatus function is called. inline long InvModStatus(ZZ& x, const ZZ& a, const ZZ& n) // if gcd(a,n) = 1, then ReturnValue = 0, x = a^{-1} mod n // otherwise, ReturnValue = 1, x = gcd(a, n)

Returns
boolean true if invertible, false if not.
Parameters
xfield element.

◆ invin()

Element& invin ( Element &  x) const
inline

Inplace Multiplicative Inverse.

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

Returns
reference to x.
Parameters
xfield element (reference returned).

◆ write() [1/2]

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.

◆ write() [2/2]

std::ostream& write ( std::ostream &  os,
const Element &  x 
) const
inline

Print field.

Returns
output stream to which field is written.
Parameters
osoutput stream to which field is written.
x

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