linbox
|
the integer ring. More...
#include <ntl-zz.h>
Public Member Functions | |
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_t &y) const |
Init from an int64_t. | |
Element & | init (Element &x, const uint64_t &y) const |
Init from a uint64_t. | |
Element & | init (Element &x, const integer &y) const |
I don't know how to init from integer efficiently. | |
integer & | convert (integer &x, const Element &y) const |
Convert y to an Element. | |
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. | |
bool | isMOne (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 |
some PIR function More... | |
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. More... | |
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 |
compare two elements, a and b return 1, if a > b return 0, if a = b; return -1. More... | |
Element & | abs (Element &x, const Element &a) const |
return the absolute value x = abs (a); | |
the integer ring.
|
inline |
some PIR function
Test if x is a unit.
|
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.
|
inline |
compare two elements, a and b return 1, if a > b return 0, if a = b; return -1.
if a < b