linbox
NTL_zz_p Struct Reference

long ints modulo a positive integer. More...

#include <ntl-lzz_p.h>

+ Inheritance diagram for NTL_zz_p:

Public Types

typedef NTL::zz_p Element
 
typedef Givaro::UnparametricOperations< ElementFather_t
 
typedef UnparametricRandIter< NTL::zz_p > RandIter
 

Public Member Functions

 NTL_zz_p (integer p, size_t e=1)
 
 NTL_zz_p ()
 
Elementinit (Element &x) const
 
Elementinit (Element &x, const double &y) const
 
Elementinit (Element &x, const integer &y) const
 
Elementinit (Element &x, const NTL::zz_p &y) const
 
template<class ANY>
ANY & convert (ANY &x, const Element &y) const
 
Elementpow (Element &res, const Element &x, long exp) const
 
Elementpowin (Element &x, long exp) const
 
template<typename Residu_t>
Residu_t & cardinality (Residu_t &c) const
 Cardinality.
 
integer cardinality () const
 
template<typename Residu_t>
Residu_t & characteristic (Residu_t &c) const
 Characteristic.
 
integer characteristic () const
 
Elementinv (Element &x, const Element &y) const
 Multiplicative Inverse.
 
bool isZero (const Element &x) const
 Zero equality.
 
bool isOne (const Element &x) const
 One equality.
 
bool isUnit (const Element &x) const
 Unit test.
 
bool isMOne (const Element &x) const
 MOne equality.
 
Elementinvin (Element &x) const
 Inplace Multiplicative Inverse.
 
std::ostream & write (std::ostream &os) const
 Print field.
 
std::ostream & write (std::ostream &os, const std::string &) const
 
std::ostream & write (std::ostream &os, const Element &x) const
 

Static Public Member Functions

static integer maxCardinality ()
 

Data Fields

const Element zero
 
const Element one
 
const Element mOne
 

Detailed Description

long ints modulo a positive integer.

While NTL allows any int to serve as the modulus, only prime moduli yield fields. The primality of the modulus will not be checked, so it is the programmer's responsibility to supply a prime modulus if a field is wanted. These specializations allow the Givaro::ZRing template class to be used to wrap NTL's zz_p class as a LinBox field. Uses nice trick for mod p via floating point.

Member Typedef Documentation

◆ Element

typedef NTL::zz_p Element

◆ Father_t

typedef Givaro::UnparametricOperations<Element> Father_t

◆ RandIter

typedef UnparametricRandIter<NTL::zz_p> RandIter

Constructor & Destructor Documentation

◆ NTL_zz_p() [1/2]

NTL_zz_p ( integer p,
size_t e = 1 )
inline

◆ NTL_zz_p() [2/2]

NTL_zz_p ( )
inline

Member Function Documentation

◆ init() [1/4]

Element & init ( Element & x) const
inline

◆ init() [2/4]

Element & init ( Element & x,
const double & y ) const
inline

◆ init() [3/4]

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

◆ init() [4/4]

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

◆ convert()

template<class ANY>
ANY & convert ( ANY & x,
const Element & y ) const
inline

◆ maxCardinality()

static integer maxCardinality ( )
inlinestatic

◆ pow()

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

◆ powin()

Element & powin ( Element & x,
long exp ) const
inline

◆ cardinality() [1/2]

template<typename Residu_t>
Residu_t & cardinality ( Residu_t & 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

◆ characteristic() [1/2]

template<typename Residu_t>
Residu_t & characteristic ( Residu_t & 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/2]

integer characteristic ( ) const
inline

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

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

Returns
boolean true if invertible, 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.

◆ 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/3]

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

std::ostream & write ( std::ostream & os,
const std::string &  ) const
inline

◆ write() [3/3]

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

Field Documentation

◆ zero

const Element zero

◆ one

const Element one

◆ mOne

const Element mOne

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