linbox
Public Member Functions
NTL_ZZ_p Struct Reference

Wrapper of zz_p from NTL. More...

#include <ntl-zz_p.h>

+ Inheritance diagram for NTL_ZZ_p:

Public Member Functions

Element & init (Element &x, const NTL::ZZ &y) const
 Specialization for NTL::ZZ. More...
 
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...
 
integercardinality (integer &c) const
 Cardinality. More...
 
integercharacteristic (integer &c) const
 Characteristic. More...
 
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...
 
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.
 

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()

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.

◆ convert() [1/2]

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/2]

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.

◆ cardinality()

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

◆ characteristic()

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.

◆ 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: