Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

NTL_ZZ Class Reference

#include <ntl-ZZ.h>

List of all members.

Public Types

typedef NTL_ZZRandIter RandIter
typedef NTL::ZZ Element

Public Methods

 NTL_ZZ (int p=0, int exp=1)
integer & cardinality (integer &c) const
integer & characteristic (integer &c) const
std::ostream & write (std::ostream &out) const
std::istream & read (std::istream &in) const
template<class Element2> Element & init (Element &x, const Element2 &y) const
 Init x from y.

Element & init (Element &x, const Element &y) const
 Init from a NTL::ZZ.

Element & init (Element &x, const int64 &y) const
 Init from an int64.

Element & init (Element &x, const uint64 &y) const
 Init from a uint64.

Element & init (Element &x, const integer &y) const
 I don't know how to init from integer efficiently.

Element & assign (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.

Element & add (Element &x, const Element &y, const Element &z) const
 return x = y + z

Element & sub (Element &x, const Element &y, const Element &z) const
 return x = y - z

template<class Int> Element & mul (Element &x, const Element &y, const Int &z) const
 return x = y * z

Element & div (Element &x, const Element &y, const Element &z) const
 If z divides y, return x = y / z, otherwise, throw an exception.

Element & inv (Element &x, const Element &y) const
 If y is a unit, return x = 1 / y, otherwsie, throw an exception.

Element & neg (Element &x, const Element &y) const
 return x = -y;

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

Element & addin (Element &x, const Element &y) const
 return x += y;

Element & subin (Element &x, const Element &y) const
 return x -= y;

template<class Int> Element & mulin (Element &x, const Int &y) const
 return x *= y;

Element & divin (Element &x, const Element &y) const
 If y divides x, return x /= y, otherwise throw an exception.

Element & invin (Element &x)
 If x is a unit, x = 1 / x, otherwise, throw an exception.

Element & negin (Element &x) const
 return x = -x;

template<class Int> Element & axpyin (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
 Test if x is a unit.

Element & gcd (Element &g, const Element &a, const Element &b) const
 return g = gcd (a, b)

Element & gcdin (Element &g, const Element &b) const
 return g = gcd (g, b)

Element & xgcd (Element &g, Element &s, Element &t, const Element &a, const Element &b) const
 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.

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

Element & lcmin (Element &l, const Element &b) const
 l = lcm (l, b)

Element & sqrt (Element &x, const Element &y) const
 x = floor ( sqrt(y)).

long reconstructRational (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).

Element & quo (Element &q, const Element &a, const Element &b) const
 q = floor (x/y);

Element & rem (Element &r, const Element &a, const Element &b) const
 r = remindar of a / b

Element & quoin (Element &a, const Element &b) const
 a = quotient (a, b)

Element & remin (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
Element & abs (Element &x, const Element &a) const

Static Public Methods

integer & convert (integer &x, const Element &y)
 Convert y to an Element.

double & convert (double &x, const Element &y)
int getMaxModulus ()


Member Typedef Documentation

typedef NTL::ZZ Element
 

typedef NTL_ZZRandIter RandIter
 


Constructor & Destructor Documentation

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


Member Function Documentation

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

return the absolute value x = abs (a);

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

return x = y + z

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

return x += y;

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

Test if x == y.

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

x = y.

Element& axpy (  Element &    r,
const Element &    a,
const Int &    x,
const Element &    y
)  const [inline]
 

return r = a x + y

Element& axpyin (  Element &    r,
const Element &    a,
const Int &    x
)  const [inline]
 

return r += a x

integer& cardinality (  integer &    c )  const [inline]
 

integer& characteristic (  integer &    c )  const [inline]
 

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

double& convert (  double &    x,
const Element &    y
)  [inline, static]
 

integer& convert (  integer &    x,
const Element &    y
)  [inline, static]
 

Convert y to an Element.

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

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

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

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

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

return g = gcd (a, b)

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

return g = gcd (g, b)

int getMaxModulus (    )  [inline, static]
 

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

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

Element& init (  Element &    x,
const uint64 &    y
)  const [inline]
 

Init from a uint64.

Element& init (  Element &    x,
const int64 &    y
)  const [inline]
 

Init from an int64.

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

Init from a NTL::ZZ.

Element& init (  Element &    x,
const Element2 &    y
)  const [inline]
 

Init x from y.

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

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

Element& invin (  Element &    x )  [inline]
 

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

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

Test if b | a.

bool isOne (  const Element &    x )  const [inline]
 

Test if x == 1.

bool isUnit (  const Element &    x )  const [inline]
 

Test if x is a unit.

bool isZero (  const Element &    x )  const [inline]
 

Test if x == 0.

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

c = lcm (a, b)

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

l = lcm (l, b)

Element& mul (  Element &    x,
const Element &    y,
const Int &    z
)  const [inline]
 

return x = y * z

Element& mulin (  Element &    x,
const Int &    y
)  const [inline]
 

return x *= y;

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

return x = -y;

Element& negin (  Element &    x )  const [inline]
 

return x = -x;

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

q = floor (x/y);

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

a = quotient (a, b)

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)

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

read x from istream in

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

long reconstructRational (  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).

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

r = remindar of a / b

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

a = quotient (a, b)

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

x = floor ( sqrt(y)).

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

return x = y - z

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

return x -= y;

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

out << y;

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

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.


Generated on Mon Jun 20 09:16:55 2005 for linbox by doxygen1.2.18