linbox
NTL_ZZ Class Reference

the integer ring. More...

#include <ntl-zz.h>

Public Types

typedef NTL_ZZRandIter RandIter
 
typedef NTL_ZZ Father_t
 
typedef NTL::ZZ Element
 
typedef NTL::ZZ Residu_t
 

Public Member Functions

 NTL_ZZ (int p=0, int exp=1)
 
integercardinality (integer &c) const
 
integercharacteristic (integer &c) const
 
template<class IntType>
IntType & characteristic (IntType &c) const
 
std::ostream & write (std::ostream &out) const
 
std::istream & read (std::istream &in) const
 
template<class Element2>
Elementinit (Element &x, const Element2 &y) const
 Init x from y.
 
Elementinit (Element &x, const Element &y) const
 Init from a NTL::ZZ.
 
Elementinit (Element &x, const int64_t &y) const
 Init from an int64_t.
 
Elementinit (Element &x, const uint64_t &y) const
 Init from a uint64_t.
 
Elementinit (Element &x, const integer &y) const
 I don't know how to init from integer efficiently.
 
integerconvert (integer &x, const Element &y) const
 Convert y to an Element.
 
double & convert (double &x, const Element &y) const
 
Elementassign (Element &x, const Element &y) const
 x = y.
 
bool areEqual (const Element &x, const Element &y) const
 Test if x == y.
 
bool isZero (const Element &x) const
 Test if x == 0.
 
bool isOne (const Element &x) const
 Test if x == 1.
 
bool isMOne (const Element &x) const
 Test if x == -1.
 
Elementadd (Element &x, const Element &y, const Element &z) const
 return x = y + z
 
Elementsub (Element &x, const Element &y, const Element &z) const
 return x = y - z
 
template<class Int>
Elementmul (Element &x, const Element &y, const Int &z) const
 return x = y * z
 
Elementdiv (Element &x, const Element &y, const Element &z) const
 If z divides y, return x = y / z, otherwise, throw an exception.
 
Elementinv (Element &x, const Element &y) const
 If y is a unit, return x = 1 / y, otherwsie, throw an exception.
 
Elementneg (Element &x, const Element &y) const
 return x = -y;
 
template<class Int>
Elementaxpy (Element &r, const Element &a, const Int &x, const Element &y) const
 return r = a x + y
 
Elementaddin (Element &x, const Element &y) const
 return x += y;
 
Elementsubin (Element &x, const Element &y) const
 return x -= y;
 
template<class Int>
Elementmulin (Element &x, const Int &y) const
 return x *= y;
 
Elementdivin (Element &x, const Element &y) const
 If y divides x, return x /= y, otherwise throw an exception.
 
Elementinvin (Element &x)
 If x is a unit, x = 1 / x, otherwise, throw an exception.
 
Elementnegin (Element &x) const
 return x = -x;
 
template<class Int>
Elementaxpyin (Element &r, const Element &a, const Int &x) const
 return r += a x
 
std::ostream & write (std::ostream &out, const Element &y) const
 out << y;
 
std::istream & read (std::istream &in, Element &x) const
 read x from istream in
 
bool isUnit (const Element &x) const
 some PIR function
 
Elementgcd (Element &g, const Element &a, const Element &b) const
 return g = gcd (a, b)
 
Elementgcdin (Element &g, const Element &b) const
 return g = gcd (g, b)
 
Elementxgcd (Element &g, Element &s, Element &t, const Element &a, const Element &b) const
 g = gcd(a, b) = a*s + b*t.
 
Elementlcm (Element &c, const Element &a, const Element &b) const
 c = lcm (a, b)
 
Elementlcmin (Element &l, const Element &b) const
 l = lcm (l, b)
 
Elementsqrt (Element &x, const Element &y) const
 x = floor ( sqrt(y)).
 
long RationalReconstruction (Element &a, Element &b, const Element &x, const Element &m, const Element &a_bound, const Element &b_bound) const
 Requires 0 <= x < m, m > 2 * a_bound * b_bound, a_bound >= 0, b_bound > 0 This routine either returns 0, leaving a and b unchanged, or returns 1 and sets a and b so that (1) a = b x (mod m), (2) |a| <= a_bound, 0 < b <= b_bound, and (3) gcd(m, b) = gcd(a, b).
 
Elementquo (Element &q, const Element &a, const Element &b) const
 q = floor (x/y);
 
Elementrem (Element &r, const Element &a, const Element &b) const
 r = remindar of a / b
 
Elementquoin (Element &a, const Element &b) const
 a = quotient (a, b)
 
Elementremin (Element &x, const Element &y) const
 a = quotient (a, b)
 
void quoRem (Element &q, Element &r, const Element &a, const Element &b) const
 q = [a/b], r = a - b*q |r| < |b|, and if r != 0, sign(r) = sign(b)
 
bool isDivisor (const Element &a, const Element &b) const
 Test if b | a.
 
long compare (const Element &a, const Element &b) const
 compare two elements, a and b return 1, if a > b return 0, if a = b; return -1.
 
Elementabs (Element &x, const Element &a) const
 return the absolute value x = abs (a);
 

Static Public Member Functions

static int maxCardinality ()
 

Data Fields

Element zero
 
Element one
 
Element mOne
 

Detailed Description

the integer ring.

Member Typedef Documentation

◆ RandIter

◆ Father_t

typedef NTL_ZZ Father_t

◆ Element

typedef NTL::ZZ Element

◆ Residu_t

typedef NTL::ZZ Residu_t

Constructor & Destructor Documentation

◆ NTL_ZZ()

NTL_ZZ ( int p = 0,
int exp = 1 )
inline

Member Function Documentation

◆ cardinality()

integer & cardinality ( integer & c) const
inline

◆ characteristic() [1/2]

integer & characteristic ( integer & c) const
inline

◆ characteristic() [2/2]

template<class IntType>
IntType & characteristic ( IntType & c) const
inline

◆ write() [1/2]

std::ostream & write ( std::ostream & out) const
inline

◆ read() [1/2]

std::istream & read ( std::istream & in) const
inline

◆ init() [1/5]

template<class Element2>
Element & init ( Element & x,
const Element2 & y ) const
inline

Init x from y.

◆ init() [2/5]

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

Init from a NTL::ZZ.

◆ init() [3/5]

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

Init from an int64_t.

◆ init() [4/5]

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

Init from a uint64_t.

◆ init() [5/5]

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

I don't know how to init from integer efficiently.

◆ convert() [1/2]

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

Convert y to an Element.

◆ convert() [2/2]

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

◆ assign()

Element & assign ( Element & x,
const Element & y ) const
inline

x = y.

◆ areEqual()

bool areEqual ( const Element & x,
const Element & y ) const
inline

Test if x == y.

◆ isZero()

bool isZero ( const Element & x) const
inline

Test if x == 0.

◆ isOne()

bool isOne ( const Element & x) const
inline

Test if x == 1.

◆ isMOne()

bool isMOne ( const Element & x) const
inline

Test if x == -1.

◆ add()

Element & add ( Element & x,
const Element & y,
const Element & z ) const
inline

return x = y + z

◆ sub()

Element & sub ( Element & x,
const Element & y,
const Element & z ) const
inline

return x = y - z

◆ mul()

template<class Int>
Element & mul ( Element & x,
const Element & y,
const Int & z ) const
inline

return x = y * z

◆ div()

Element & div ( Element & x,
const Element & y,
const Element & z ) const
inline

If z divides y, return x = y / z, otherwise, throw an exception.

◆ inv()

Element & inv ( Element & x,
const Element & y ) const
inline

If y is a unit, return x = 1 / y, otherwsie, throw an exception.

◆ neg()

Element & neg ( Element & x,
const Element & y ) const
inline

return x = -y;

◆ axpy()

template<class Int>
Element & axpy ( Element & r,
const Element & a,
const Int & x,
const Element & y ) const
inline

return r = a x + y

◆ addin()

Element & addin ( Element & x,
const Element & y ) const
inline

return x += y;

◆ subin()

Element & subin ( Element & x,
const Element & y ) const
inline

return x -= y;

◆ mulin()

template<class Int>
Element & mulin ( Element & x,
const Int & y ) const
inline

return x *= y;

◆ divin()

Element & divin ( Element & x,
const Element & y ) const
inline

If y divides x, return x /= y, otherwise throw an exception.

◆ invin()

Element & invin ( Element & x)
inline

If x is a unit, x = 1 / x, otherwise, throw an exception.

◆ negin()

Element & negin ( Element & x) const
inline

return x = -x;

◆ axpyin()

template<class Int>
Element & axpyin ( Element & r,
const Element & a,
const Int & x ) const
inline

return r += a x

◆ write() [2/2]

std::ostream & write ( std::ostream & out,
const Element & y ) const
inline

out << y;

◆ read() [2/2]

std::istream & read ( std::istream & in,
Element & x ) const
inline

read x from istream in

◆ isUnit()

bool isUnit ( const Element & x) const
inline

some PIR function

Test if x is a unit.

◆ gcd()

Element & gcd ( Element & g,
const Element & a,
const Element & b ) const
inline

return g = gcd (a, b)

◆ gcdin()

Element & gcdin ( Element & g,
const Element & b ) const
inline

return g = gcd (g, b)

◆ xgcd()

Element & xgcd ( Element & g,
Element & s,
Element & t,
const Element & a,
const Element & b ) const
inline

g = gcd(a, b) = a*s + b*t.

The coefficients s and t are defined according to the standard Euclidean algorithm applied to |a| and |b|, with the signs then adjusted according to the signs of a and b.

◆ lcm()

Element & lcm ( Element & c,
const Element & a,
const Element & b ) const
inline

c = lcm (a, b)

◆ lcmin()

Element & lcmin ( Element & l,
const Element & b ) const
inline

l = lcm (l, b)

◆ sqrt()

Element & sqrt ( Element & x,
const Element & y ) const
inline

x = floor ( sqrt(y)).

◆ RationalReconstruction()

long RationalReconstruction ( Element & a,
Element & b,
const Element & x,
const Element & m,
const Element & a_bound,
const Element & b_bound ) const
inline

Requires 0 <= x < m, m > 2 * a_bound * b_bound, a_bound >= 0, b_bound > 0 This routine either returns 0, leaving a and b unchanged, or returns 1 and sets a and b so that (1) a = b x (mod m), (2) |a| <= a_bound, 0 < b <= b_bound, and (3) gcd(m, b) = gcd(a, b).

◆ quo()

Element & quo ( Element & q,
const Element & a,
const Element & b ) const
inline

q = floor (x/y);

◆ rem()

Element & rem ( Element & r,
const Element & a,
const Element & b ) const
inline

r = remindar of a / b

◆ quoin()

Element & quoin ( Element & a,
const Element & b ) const
inline

a = quotient (a, b)

◆ remin()

Element & remin ( Element & x,
const Element & y ) const
inline

a = quotient (a, b)

◆ quoRem()

void quoRem ( Element & q,
Element & r,
const Element & a,
const Element & b ) const
inline

q = [a/b], r = a - b*q |r| < |b|, and if r != 0, sign(r) = sign(b)

◆ isDivisor()

bool isDivisor ( const Element & a,
const Element & b ) const
inline

Test if b | a.

◆ compare()

long compare ( const Element & a,
const Element & b ) const
inline

compare two elements, a and b return 1, if a > b return 0, if a = b; return -1.

if a < b

◆ abs()

Element & abs ( Element & x,
const Element & a ) const
inline

return the absolute value x = abs (a);

◆ maxCardinality()

static int maxCardinality ( )
inlinestatic

Field Documentation

◆ zero

Element zero

◆ one

Element one

◆ mOne

Element mOne

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