Givaro
Public Types | Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes
Integer Class Reference

This is the Integer class. More...

#include <gmp++_int.h>

Public Types

typedef std::vector< mp_limb_t > vect_t
 vector of limbs (ie a gmp number).

Public Member Functions

int sign () const
mpz_ptr get_mpz ()
Constructor/Destructors
 Integer (const std::vector< mp_limb_t > &vect_t)
 Integer (int n=0)
 Integer (long n)
 Integer (unsigned char n)
 Integer (unsigned int n)
 Integer (unsigned long n)
 Integer (double d)
 Integer (const char *s)
 Integer (const Integer &n)
 ~Integer ()
Assignment and copy operators
Integer & operator= (const Integer &n)
Integer & logcpy (const Integer &n)
Integer & copy (const Integer &n)
Bit logic
Integer operator^ (const Integer &) const
Integer operator| (const Integer &) const
Integer operator& (const Integer &) const
unsigned long operator^ (const unsigned long &a) const
unsigned long operator| (const unsigned long &a) const
unsigned long operator& (const unsigned long &a) const
Integer operator~ () const
Integer & operator^= (const Integer &)
Integer & operator|= (const Integer &)
Integer & operator&= (const Integer &)
Integer operator<< (int l) const
Integer operator>> (int l) const
Integer operator<< (long l) const
Integer operator>> (long l) const
Integer operator<< (unsigned int l) const
Integer operator>> (unsigned int l) const
Integer operator<< (unsigned long l) const
Integer operator>> (unsigned long l) const
Integer & operator<<= (int l)
Integer & operator>>= (int l)
Integer & operator<<= (long l)
Integer & operator>>= (long l)
Integer & operator<<= (unsigned int l)
Integer & operator>>= (unsigned int l)
Integer & operator<<= (unsigned long l)
Integer & operator>>= (unsigned long l)

Static Public Member Functions

fused add-multiply

Groups a multiplication adn an addition/division is a single function.

This is usually faster than doing the two operations separately.

static Integer & axpy (Integer &res, const Integer &a, const Integer &x, const Integer &y)
 axpy res = ax+y.
static Integer & axpy (Integer &res, const Integer &a, const unsigned long x, const Integer &y)
 axpy res = ax+y.
static Integer & axpyin (Integer &res, const Integer &a, const Integer &x)
 axpyin (inplace) res += ax.
static Integer & axpyin (Integer &res, const Integer &a, const unsigned long x)
 axpy res = ax+y.
static Integer & maxpy (Integer &res, const Integer &a, const Integer &x, const Integer &y)
 maxpy res = y - ax.
static Integer & maxpy (Integer &res, const Integer &a, const unsigned long x, const Integer &y)
 axpy res = ax+y.
static Integer & maxpyin (Integer &res, const Integer &a, const Integer &x)
 maxpyin res -= ax.
static Integer & maxpyin (Integer &res, const Integer &a, const unsigned long x)
 axpy res = ax+y.
static Integer & axmy (Integer &res, const Integer &a, const Integer &x, const Integer &y)
 axmy res = ax - y.
static Integer & axmy (Integer &res, const Integer &a, const unsigned long x, const Integer &y)
 axpy res = ax+y.
static Integer & axmyin (Integer &res, const Integer &a, const Integer &x)
 axmyin (in place) res = ax - res.
static Integer & axmyin (Integer &res, const Integer &a, const unsigned long x)
 axpy res = ax+y.
Random numbers functions
static void seeding (unsigned long int s)
 returns a random integer r in the intervall [[0, m-1]]
static void seeding (Integer s)
 returns a random integer r in the intervall [[0, m-1]]
static void seeding ()
 returns a random integer r in the intervall [[0, m-1]]
static __gmp_randstate_struct intializerandstate ()
 returns a random integer r in the intervall [[0, m-1]]
static __gmp_randstate_struct * randstate ()
 returns a random integer r in the intervall [[0, m-1]]
static bool RandBool ()
 returns a random integer r in the intervall [[0, m-1]]
template<bool U>
static Integer & random_lessthan (Integer &r, const Integer &m)
 returns a random integer r in the intervall [[0, m-1]]
static Integer & random_lessthan (Integer &r, const Integer &m)
 returns a random integer r in the intervall [[0, m-1]]
template<bool U>
static Integer & random_lessthan_2exp (Integer &r, const unsigned long &m)
 returns a random integer r of at most m bits
static Integer & random_lessthan_2exp (Integer &r, const unsigned long &m)
 returns a random integer r in the intervall [[0, m-1]]
template<bool U>
static Integer random_lessthan_2exp (const unsigned long &m)
 returns a random integer r in the intervall [[0, m-1]]
static Integer random_lessthan_2exp (const unsigned long &m)
 returns a random integer r in the intervall [[0, m-1]]
template<bool U>
static Integer & random_lessthan (Integer &r, const unsigned long &m)
 returns a random integer r in the intervall [[0, m-1]]
static Integer & random_lessthan (Integer &r, const unsigned long &m)
 returns a random integer r in the intervall [[0, m-1]]
template<bool U, class T >
static Integer random_lessthan (const T &m)
 returns a random integer r in the intervall [[0, m-1]]
template<class T >
static Integer random_lessthan (const T &m)
 returns a random integer r in the intervall [[0, m-1]]
template<bool U>
static Integer & random_exact (Integer &r, const Integer &s)
 returns a reference to a random number r of the size of s, exactly.
static Integer & random_exact (Integer &r, const Integer &s)
 returns a random integer r in the intervall [[0, m-1]]
template<bool U>
static Integer & random_exact_2exp (Integer &r, const unsigned long int &m)
 returns a reference to a random number r of the size m bits, exactly.
static Integer & random_exact_2exp (Integer &r, const unsigned long int &m)
 returns a random integer r in the intervall [[0, m-1]]
template<bool U>
static Integer & random_exact (Integer &r, const unsigned long int &m)
 returns a random integer r in the intervall [[0, m-1]]
static Integer & random_exact (Integer &r, const unsigned long int &m)
 returns a random integer r in the intervall [[0, m-1]]
template<bool U, class T >
static Integer & random_exact (Integer &r, const T &m)
 returns a random integer r in the intervall [[0, m-1]]
template<class T >
static Integer & random_exact (Integer &r, const T &m)
 returns a random integer r in the intervall [[0, m-1]]
template<bool U, class T >
static Integer random_exact (const T &s)
 returns a random integer r in the intervall [[0, m-1]]
template<class T >
static Integer random_exact (const T &s)
 returns a random integer r in the intervall [[0, m-1]]
static Integer & random_between (Integer &r, const Integer &m, const Integer &M)
 returns a random integer r in the intervall [[0, m-1]]
static Integer random_between (const Integer &m, const Integer &M)
 returns a random integer r in the intervall [[0, m-1]]
static Integer & random_between_2exp (Integer &r, const unsigned long int &m, const unsigned long int &M)
 returns a random integer r in the intervall [[0, m-1]]
static Integer & random_between (Integer &r, const unsigned long int &m, const unsigned long int &M)
 returns a random integer r in the intervall [[0, m-1]]
static Integer random_between_2exp (const unsigned long int &m, const unsigned long int &M)
 returns a random integer r in the intervall [[0, m-1]]
static Integer random_between (const unsigned long int &m, const unsigned long int &M)
 returns a random integer r in the intervall [[0, m-1]]
template<class R >
static Integer random_between (const R &m, const R &M)
 returns a random integer r in the intervall [[0, m-1]]
template<class R >
static Integer & random_between (Integer &r, const R &m, const R &M)
 returns a random integer r in the intervall [[0, m-1]]
template<bool U, class T >
static Integer & random (Integer &r, const T &m)
 returns a random integer less than...
template<class T >
static Integer & random (Integer &r, const T &m)
 returns a random integer r in the intervall [[0, m-1]]
template<bool U, class T >
static Integer random (const T &sz)
 returns a random integer less than...
template<class T >
static Integer random (const T &sz)
 returns a random integer r in the intervall [[0, m-1]]
template<bool U>
static Integer random ()
 returns a random integer r in the intervall [[0, m-1]]
static Integer random ()
 returns a random integer r in the intervall [[0, m-1]]
template<bool U, class T >
static Integer nonzerorandom (const T &sz)
 returns a random integer r in the intervall [[0, m-1]]
template<bool U, class T >
static Integer & nonzerorandom (Integer &r, const T &size)
 returns a random integer r in the intervall [[0, m-1]]
template<class T >
static Integer nonzerorandom (const T &sz)
 returns a random integer r in the intervall [[0, m-1]]
template<class T >
static Integer & nonzerorandom (Integer &r, const T &size)
 returns a random integer r in the intervall [[0, m-1]]
static Integer nonzerorandom ()
 returns a random integer r in the intervall [[0, m-1]]

Static Public Attributes

static const Integer zero
 zero
static const Integer one
 one

Protected Types

typedef __mpz_struct Rep

Protected Member Functions

int priv_sign () const
const Rep * get_rep () const
 Integer (unsigned long *d, long size)

Protected Attributes

Rep gmp_rep

Friends

Arithmetic functions
Integer gcd (const Integer &a, const Integer &b)
Integer gcd (const Integer &a, const Integer &b, Integer &u, Integer &v)
Integer & gcd (Integer &g, const Integer &a, const Integer &b)
Integer & gcd (Integer &g, const Integer &a, const Integer &b, Integer &u, Integer &v)
Integer & inv (Integer &u, const Integer &a, const Integer &b)
Integer & invin (Integer &u, const Integer &b)
Integer pp (const Integer &P, const Integer &Q)
Integer & lcm (Integer &g, const Integer &a, const Integer &b)
Integer lcm (const Integer &a, const Integer &b)
Integer & pow (Integer &Res, const Integer &n, const long l)
Integer & pow (Integer &Res, const unsigned long n, const unsigned long l)
Integer & pow (Integer &Res, const Integer &n, const unsigned long l)
Integer & pow (Integer &Res, const Integer &n, const int l)
Integer & pow (Integer &Res, const Integer &n, const unsigned int l)
Integer pow (const Integer &n, const long l)
Integer pow (const Integer &n, const unsigned long l)
Integer pow (const Integer &n, const int l)
Integer pow (const Integer &n, const unsigned int l)
Integer & powmod (Integer &Res, const Integer &n, const unsigned long e, const Integer &m)
Integer & powmod (Integer &Res, const Integer &n, const long e, const Integer &m)
Integer & powmod (Integer &Res, const Integer &n, const unsigned int e, const Integer &m)
Integer & powmod (Integer &Res, const Integer &n, const int e, const Integer &m)
Integer & powmod (Integer &Res, const Integer &n, const Integer &e, const Integer &m)
Integer powmod (const Integer &n, const unsigned long e, const Integer &m)
Integer powmod (const Integer &n, const long e, const Integer &m)
Integer powmod (const Integer &n, const unsigned int e, const Integer &m)
Integer powmod (const Integer &n, const int e, const Integer &m)
Integer powmod (const Integer &n, const Integer &e, const Integer &m)
Integer fact (unsigned long l)
Integer sqrt (const Integer &p)
Integer sqrtrem (const Integer &p, Integer &rem)
Integer & sqrt (Integer &r, const Integer &p)
Integer & sqrtrem (Integer &r, const Integer &p, Integer &rem)
bool root (Integer &q, const Integer &, unsigned int n)
long logp (const Integer &a, const Integer &p)
double logtwo (const Integer &a)
double naturallog (const Integer &a)

(in)equality

int operator!= (const int l) const
int operator!= (const long l) const
int operator!= (const unsigned long l) const
int operator> (const int l) const
int operator> (const long l) const
int operator> (const unsigned long l) const
int operator< (const int l) const
int operator< (const long l) const
int operator< (const unsigned long l) const
int compare (const Integer &a, const Integer &b)
int absCompare (const Integer &a, const Integer &b)

Addition, substraction, multiplication

Integer operator+ (const Integer &n) const
 operator +.
Integer operator+ (const unsigned long n) const
 operator +.
Integer operator+ (const long n) const
 operator +.
Integer & operator+= (const Integer &n)
 operator += .
Integer & operator+= (const unsigned long n)
 operator +.
Integer & operator+= (const long n)
 operator +.
template<class XXX >
Integer & operator+= (const XXX &n)
 operator +.
Integer operator- (const Integer &n) const
 operator -.
Integer operator- (const unsigned long n) const
 operator +.
Integer operator- (const long n) const
 operator +.
Integer & operator-= (const Integer &n)
 operator -= .
Integer & operator-= (const unsigned long n)
 operator +.
Integer & operator-= (const long n)
 operator +.
template<class XXX >
Integer & operator-= (const XXX &n)
 operator +.
Integer operator- () const
 Opposite.
Integer operator* (const Integer &n) const
 operator *.
Integer operator* (const unsigned long n) const
 operator +.
Integer operator* (const long n) const
 operator +.
Integer & operator*= (const Integer &n)
 operator *= .
Integer & operator*= (const unsigned long n)
 operator +.
Integer & operator*= (const long n)
 operator +.
template<class XXX >
Integer & operator*= (const XXX &n)
 operator +.
static Integer & addin (Integer &res, const Integer &n)
 Addition (inplace) res+=n.
static Integer & addin (Integer &res, const long n)
 operator +.
static Integer & addin (Integer &res, const unsigned long n)
 operator +.
static Integer & add (Integer &res, const Integer &n1, const Integer &n2)
 Addition res=n1+n2.
static Integer & add (Integer &res, const Integer &n1, const long n2)
 operator +.
static Integer & add (Integer &res, const Integer &n1, const unsigned long n2)
 operator +.
static Integer & subin (Integer &res, const Integer &n)
 Substraction (inplace) res-=n.
static Integer & subin (Integer &res, const long n)
 operator +.
static Integer & subin (Integer &res, const unsigned long n)
 operator +.
static Integer & sub (Integer &res, const Integer &n1, const Integer &n2)
 Substraction res=n1-n2.
static Integer & sub (Integer &res, const Integer &n1, const long n2)
 operator +.
static Integer & sub (Integer &res, const Integer &n1, const unsigned long n2)
 operator +.
static Integer & negin (Integer &res)
 Negation (inplace) res=-res.
static Integer & neg (Integer &res, const Integer &n)
 Negation res=-n.
static Integer & mulin (Integer &res, const Integer &n)
 Multiplication (inplace) res*=n.
static Integer & mulin (Integer &res, const long n)
 operator +.
static Integer & mulin (Integer &res, const unsigned long n)
 operator +.
static Integer & mul (Integer &res, const Integer &n1, const Integer &n2)
 Multiplication res=n1*n2.
static Integer & mul (Integer &res, const Integer &n1, const long n2)
 operator +.
static Integer & mul (Integer &res, const Integer &n1, const unsigned long n2)
 operator +.

Division/euclidean division/modulo

The convention for rounding are the following :

  • q = a/b, or equivalent operations with the name div or divin, return q rounded towards 0, in the same manner as C's '/' (truncated division).
  • r = a % b behaves like C %. The modulo function % rounds towards 0 and the sign of the dividend is preserved. This is :

    \[ a= b q + r, \text{with } \vert r\vert < \vert b\vert \text{ and } a r \geq 0 \]

  • r = a mod b or similar functions have the same behaviour as GMP mpz_mod, that is the remainder is always positive (>=0). This is the division algorithm convention that is used (see divmod). In a formula :

    \[ a= b q + r, \text{with } 0 \leq r < \vert b\vert \]

Warning:
if q=a/b and r= a % b then a = b q + r is always true (with in addition 0 <= |r| < |b|). This is also true for divmod(q,a,b,r) (and 0<=r<|b|). However, one should not mix the two conventions and expect equalities (except if a>=0).
Integer operator/ (const Integer &d) const
 Division operator.
Integer operator/ (const unsigned long d) const
 Division operator.
Integer operator/ (const long d) const
 Division operator.
Integer & operator/= (const Integer &d)
 Division operator (inplace).
Integer & operator/= (const unsigned long d)
 Division operator.
Integer & operator/= (const long d)
 Division operator.
template<class XXX >
Integer & operator/= (const XXX &d)
 Division operator.
Integer operator% (const Integer &n) const
 Modulo operator.
long operator% (const unsigned long n) const
 Division operator.
long operator% (const long n) const
 Division operator.
double operator% (const double n) const
 Division operator.
short operator% (const unsigned short n) const
 Division operator.
template<class XXX >
XXX operator% (const XXX &n) const
 Division operator.
Integer & operator%= (const Integer &n)
 Modulo operator (inplace).
Integer & operator%= (const unsigned long n)
 Division operator.
Integer & operator%= (const long n)
 Division operator.
template<class XXX >
Integer & operator%= (const XXX &n)
 Division operator.
static Integer & divin (Integer &q, const Integer &d)
 Division q/=d.
static Integer & divin (Integer &q, const long d)
 Division operator.
static Integer & divin (Integer &q, const unsigned long d)
 Division operator.
static Integer & div (Integer &q, const Integer &n, const Integer &d)
 Division q=n/d.
static Integer & div (Integer &q, const Integer &n, const long d)
 Division operator.
static Integer & div (Integer &q, const Integer &n, const int d)
 Division operator.
static Integer & div (Integer &q, const Integer &n, const unsigned long d)
 Division operator.
static Integer & divexact (Integer &q, const Integer &n, const Integer &d)
 Division when d divides n.
static Integer divexact (const Integer &n, const Integer &d)
 Division when d divides n.
static Integer & modin (Integer &r, const Integer &n)
 Function mod (inplace).
static Integer & modin (Integer &r, const long n)
 Division operator.
static Integer & modin (Integer &r, const unsigned long n)
 Division operator.
static Integer & mod (Integer &r, const Integer &n, const Integer &d)
 Function mod.
static Integer & mod (Integer &r, const Integer &n, const long d)
 Division operator.
static Integer & mod (Integer &r, const Integer &n, const unsigned long d)
 Division operator.
static Integer & divmod (Integer &q, Integer &r, const Integer &n, const Integer &d)
 Euclidean division.
static Integer & divmod (Integer &q, long &r, const Integer &n, const long d)
 Division operator.
static Integer & divmod (Integer &q, unsigned long &r, const Integer &n, const unsigned long d)
 Division operator.

Miscellaneous.

Integer & operator++ ()
Integer operator++ (int)
Integer & operator-- ()
Integer operator-- (int)
size_t size () const
size_t size_in_base (int B) const
size_t bitsize () const
unsigned long operator[] (size_t i) const
 operator bool () const
 operator short () const
 operator unsigned short () const
 operator unsigned char () const
 operator unsigned int () const
 operator int () const
 operator signed char () const
 operator unsigned long () const
 operator long () const
 operator unsigned long long () const
 operator long long () const
 operator std::string () const
 operator float () const
 operator double () const
 operator vect_t () const
void swap (Integer &, Integer &)
int sign (const Integer &a)
int isZero (const Integer &a)
int isOne (const Integer &a)
int isperfectpower (const Integer &)
Integer abs (const Integer &n)
Integer & prevprime (Integer &, const Integer &p)
Integer & nextprime (Integer &, const Integer &p)
int probab_prime (const Integer &p)
int probab_prime (const Integer &p, int r)
int jacobi (const Integer &u, const Integer &v)
int legendre (const Integer &u, const Integer &v)
unsigned long length (const Integer &a)

I/O

std::ostream & print (std::ostream &o) const
std::istream & operator>> (std::istream &i, Integer &n)
std::ostream & operator<< (std::ostream &o, const Integer &n)
std::ostream & absOutput (std::ostream &o, const Integer &n)
void importWords (Integer &, size_t, int, int, int, size_t, const void *)

Detailed Description

This is the Integer class.

An Integer is represented as a GMP integer. This class provides arithmetic on Integers.

Examples:

examples/FiniteField/all_field.C, examples/FiniteField/domain_to_operatorstyle.C, examples/FiniteField/GF128.C, examples/FiniteField/Test_Extension.C, examples/Integer/iexponentiation.C, examples/Integer/ifactor.C, examples/Integer/ifactor_lenstra.C, examples/Integer/igcd.C, examples/Integer/igcdext.C, examples/Integer/ilcm.C, examples/Integer/ispower.C, examples/Integer/isprime.C, examples/Integer/isproot.C, examples/Integer/ModularSquareRoot.C, examples/Integer/nb_primes.C, examples/Integer/nextprime.C, examples/Integer/order.C, examples/Integer/prevprime.C, examples/Integer/primitiveroot.C, examples/Integer/ProbLucas.C, examples/Integer/RSA_breaking.C, examples/Integer/RSA_decipher.C, examples/Integer/RSA_encipher.C, examples/Polynomial/PolynomialCRT.C, examples/Rational/iratrecon.C, and examples/Rational/polydouble.C.


Member Typedef Documentation

typedef std::vector<mp_limb_t> vect_t

vector of limbs (ie a gmp number).

typedef __mpz_struct Rep [protected]

Constructor & Destructor Documentation

Integer ( const std::vector< mp_limb_t > &  vect_t)
Integer ( int  n = 0) [inline]
Integer ( long  n) [inline]
Integer ( unsigned char  n) [inline]
Integer ( unsigned int  n) [inline]
Integer ( unsigned long  n) [inline]
Integer ( double  d) [inline]
Integer ( const char *  s)
Integer ( const Integer &  n) [inline]
~Integer ( ) [inline]
Integer ( unsigned long *  d,
long  size 
) [protected]

Member Function Documentation

Integer & operator= ( const Integer &  n) [inline]
Integer & logcpy ( const Integer &  n) [inline]
Integer & copy ( const Integer &  n)
int operator!= ( const int  l) const
int operator!= ( const long  l) const
int operator!= ( const unsigned long  l) const
int operator> ( const int  l) const
int operator> ( const long  l) const
int operator> ( const unsigned long  l) const
int operator< ( const int  l) const
int operator< ( const long  l) const
int operator< ( const unsigned long  l) const
Integer operator^ ( const Integer &  a) const
Integer operator| ( const Integer &  a) const
Integer operator& ( const Integer &  a) const
unsigned long operator^ ( const unsigned long &  a) const
unsigned long operator| ( const unsigned long &  a) const
unsigned long operator& ( const unsigned long &  a) const
Integer operator~ ( ) const
Integer & operator^= ( const Integer &  a)
Integer & operator|= ( const Integer &  a)
Integer & operator&= ( const Integer &  a)
Integer operator<< ( int  l) const
Integer operator>> ( int  l) const
Integer operator<< ( long  l) const
Integer operator>> ( long  l) const
Integer operator<< ( unsigned int  l) const
Integer operator>> ( unsigned int  l) const
Integer operator<< ( unsigned long  l) const
Integer operator>> ( unsigned long  l) const
Integer & operator<<= ( int  l)
Integer & operator>>= ( int  l)
Integer & operator<<= ( long  l)
Integer & operator>>= ( long  l)
Integer & operator<<= ( unsigned int  l)
Integer & operator>>= ( unsigned int  l)
Integer & operator<<= ( unsigned long  l)
Integer & operator>>= ( unsigned long  l)
Integer & addin ( Integer &  res,
const Integer &  n 
) [static]

Addition (inplace) res+=n.

Parameters:
resas in the formula
nas in the formula
Integer & addin ( Integer &  res,
const long  n 
) [static]

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer & addin ( Integer &  res,
const unsigned long  n 
) [static]

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer & add ( Integer &  res,
const Integer &  n1,
const Integer &  n2 
) [static]

Addition res=n1+n2.

Parameters:
resas in the formula
n1as in the formula
n2as in the formula
Integer & add ( Integer &  res,
const Integer &  n1,
const long  n2 
) [static]

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer & add ( Integer &  res,
const Integer &  n1,
const unsigned long  n2 
) [static]

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer & subin ( Integer &  res,
const Integer &  n 
) [static]

Substraction (inplace) res-=n.

Parameters:
resas in the formula
nas in the formula
Integer & subin ( Integer &  res,
const long  n 
) [static]

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer & subin ( Integer &  res,
const unsigned long  n 
) [static]

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer & sub ( Integer &  res,
const Integer &  n1,
const Integer &  n2 
) [static]

Substraction res=n1-n2.

Parameters:
resas in the formula
n1as in the formula
n2as in the formula
Integer & sub ( Integer &  res,
const Integer &  n1,
const long  n2 
) [static]

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer & sub ( Integer &  res,
const Integer &  n1,
const unsigned long  n2 
) [static]

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer & negin ( Integer &  res) [static]

Negation (inplace) res=-res.

Parameters:
resas in the formula
Integer & neg ( Integer &  res,
const Integer &  n 
) [static]

Negation res=-n.

Parameters:
nas in the formula
resas in the formula
Integer & mulin ( Integer &  res,
const Integer &  n 
) [static]

Multiplication (inplace) res*=n.

Parameters:
resas in the formula
nas in the formula
Integer & mulin ( Integer &  res,
const long  n 
) [static]

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer & mulin ( Integer &  res,
const unsigned long  n 
) [static]

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer & mul ( Integer &  res,
const Integer &  n1,
const Integer &  n2 
) [static]

Multiplication res=n1*n2.

Parameters:
resas in the formula
n1as in the formula
n2as in the formula
Integer & mul ( Integer &  res,
const Integer &  n1,
const long  n2 
) [static]

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer & mul ( Integer &  res,
const Integer &  n1,
const unsigned long  n2 
) [static]

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer operator+ ( const Integer &  n) const

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer operator+ ( const unsigned long  n) const

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer operator+ ( const long  n) const

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer & operator+= ( const Integer &  n)

operator += .

Parameters:
nas in the formula.
Returns:
(*this) += n.
Integer & operator+= ( const unsigned long  n)

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer & operator+= ( const long  n)

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer& operator+= ( const XXX &  n) [inline]

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer operator- ( const Integer &  n) const

operator -.

Returns:
(*this)-n
Parameters:
nas in the formula.
Integer operator- ( const unsigned long  n) const

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer operator- ( const long  n) const

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer & operator-= ( const Integer &  n)

operator -= .

Parameters:
nas in the formula.
Returns:
(*this) -= n.
Integer & operator-= ( const unsigned long  n)

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer & operator-= ( const long  n)

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer& operator-= ( const XXX &  n) [inline]

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer operator- ( ) const [inline]

Opposite.

Returns:
-(*this).
Integer operator* ( const Integer &  n) const

operator *.

Returns:
(*this)*n
Parameters:
nas in the formula.
Integer operator* ( const unsigned long  n) const

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer operator* ( const long  n) const

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer & operator*= ( const Integer &  n)

operator *= .

Parameters:
nas in the formula.
Returns:
(*this) *= n.
Integer & operator*= ( const unsigned long  n)

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer & operator*= ( const long  n)

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer& operator*= ( const XXX &  n) [inline]

operator +.

Returns:
(*this)+n
Parameters:
nas in the formula.
Integer & axpy ( Integer &  res,
const Integer &  a,
const Integer &  x,
const Integer &  y 
) [static]

axpy res = ax+y.

Parameters:
resIntegers as in the forumla
aIntegers as in the forumla
xIntegers as in the forumla
yIntegers as in the forumla
static Integer& axpy ( Integer &  res,
const Integer &  a,
const unsigned long  x,
const Integer &  y 
) [static]

axpy res = ax+y.

Parameters:
resIntegers as in the forumla
aIntegers as in the forumla
xIntegers as in the forumla
yIntegers as in the forumla
Integer & axpyin ( Integer &  res,
const Integer &  a,
const Integer &  x 
) [static]

axpyin (inplace) res += ax.

Parameters:
resIntegers as in the formula.
aIntegers as in the formula.
xIntegers as in the formula.
static Integer& axpyin ( Integer &  res,
const Integer &  a,
const unsigned long  x 
) [static]

axpy res = ax+y.

Parameters:
resIntegers as in the forumla
aIntegers as in the forumla
xIntegers as in the forumla
yIntegers as in the forumla
Integer & maxpy ( Integer &  res,
const Integer &  a,
const Integer &  x,
const Integer &  y 
) [static]

maxpy res = y - ax.

Parameters:
resIntegers as in the formula.
aIntegers as in the formula.
xIntegers as in the formula.
yIntegers as in the formula.
static Integer& maxpy ( Integer &  res,
const Integer &  a,
const unsigned long  x,
const Integer &  y 
) [static]

axpy res = ax+y.

Parameters:
resIntegers as in the forumla
aIntegers as in the forumla
xIntegers as in the forumla
yIntegers as in the forumla
Integer & maxpyin ( Integer &  res,
const Integer &  a,
const Integer &  x 
) [static]

maxpyin res -= ax.

Parameters:
resIntegers as in the formula.
aIntegers as in the formula.
xIntegers as in the formula.
yIntegers as in the formula.
Integer & maxpyin ( Integer &  res,
const Integer &  a,
const unsigned long  x 
) [static]

axpy res = ax+y.

Parameters:
resIntegers as in the forumla
aIntegers as in the forumla
xIntegers as in the forumla
yIntegers as in the forumla
Integer & axmy ( Integer &  res,
const Integer &  a,
const Integer &  x,
const Integer &  y 
) [static]

axmy res = ax - y.

Parameters:
resIntegers as in the formula.
aIntegers as in the formula.
xIntegers as in the formula.
yIntegers as in the formula.
static Integer& axmy ( Integer &  res,
const Integer &  a,
const unsigned long  x,
const Integer &  y 
) [static]

axpy res = ax+y.

Parameters:
resIntegers as in the forumla
aIntegers as in the forumla
xIntegers as in the forumla
yIntegers as in the forumla
Integer & axmyin ( Integer &  res,
const Integer &  a,
const Integer &  x 
) [static]

axmyin (in place) res = ax - res.

Parameters:
resIntegers as in the formula.
aIntegers as in the formula.
xIntegers as in the formula.
Integer & axmyin ( Integer &  res,
const Integer &  a,
const unsigned long  x 
) [static]

axpy res = ax+y.

Parameters:
resIntegers as in the forumla
aIntegers as in the forumla
xIntegers as in the forumla
yIntegers as in the forumla
Integer & divin ( Integer &  q,
const Integer &  d 
) [static]

Division q/=d.

Parameters:
qquotient
ddivisor.
Returns:
q
Integer & divin ( Integer &  q,
const long  d 
) [static]

Division operator.

Parameters:
ddivisor
Integer & divin ( Integer &  q,
const unsigned long  d 
) [static]

Division operator.

Parameters:
ddivisor
Integer & div ( Integer &  q,
const Integer &  n,
const Integer &  d 
) [static]

Division q=n/d.

Parameters:
qquotient
ndividand.
ddivisor
Returns:
q
Integer & div ( Integer &  q,
const Integer &  n,
const long  d 
) [static]

Division operator.

Parameters:
ddivisor
Integer & div ( Integer &  q,
const Integer &  n,
const int  d 
) [static]

Division operator.

Parameters:
ddivisor
Integer & div ( Integer &  q,
const Integer &  n,
const unsigned long  d 
) [static]

Division operator.

Parameters:
ddivisor
Integer & divexact ( Integer &  q,
const Integer &  n,
const Integer &  d 
) [static]

Division when d divides n.

Parameters:
qexact quotient
ndividend
ddivisor
Warning:
if quotient is not exact, the result is not predictable.
Integer divexact ( const Integer &  n,
const Integer &  d 
) [static]

Division when d divides n.

Parameters:
ndividend
ddivisor
Returns:
exact quotient n/d
Warning:
if quotient is not exact, the result is not predictable.
Integer operator/ ( const Integer &  d) const

Division operator.

Parameters:
ddivisor
Integer operator/ ( const unsigned long  d) const

Division operator.

Parameters:
ddivisor
Integer operator/ ( const long  d) const

Division operator.

Parameters:
ddivisor
Integer & operator/= ( const Integer &  d)

Division operator (inplace).

Parameters:
ddivisor
Integer & operator/= ( const unsigned long  d)

Division operator.

Parameters:
ddivisor
Integer & operator/= ( const long  d)

Division operator.

Parameters:
ddivisor
Integer& operator/= ( const XXX &  d) [inline]

Division operator.

Parameters:
ddivisor
Integer & modin ( Integer &  r,
const Integer &  n 
) [static]

Function mod (inplace).

$ r \gets r \mod n$

Parameters:
rremainder
nmodulus
Integer & modin ( Integer &  r,
const long  n 
) [static]

Division operator.

Parameters:
ddivisor
Integer & modin ( Integer &  r,
const unsigned long  n 
) [static]

Division operator.

Parameters:
ddivisor
Integer & mod ( Integer &  r,
const Integer &  n,
const Integer &  d 
) [static]

Function mod.

$ r \gets n \mod d$

Parameters:
rremainder
ninteger
dmodulus
Integer & mod ( Integer &  r,
const Integer &  n,
const long  d 
) [static]

Division operator.

Parameters:
ddivisor
Integer & mod ( Integer &  r,
const Integer &  n,
const unsigned long  d 
) [static]

Division operator.

Parameters:
ddivisor
Integer & divmod ( Integer &  q,
Integer &  r,
const Integer &  n,
const Integer &  d 
) [static]

Euclidean division.

n = d q + r .

Parameters:
qas in the formula
ras in the formula
nas in the formula
das in the formula
Returns:
the quotient q
Integer & divmod ( Integer &  q,
long &  r,
const Integer &  n,
const long  d 
) [static]

Division operator.

Parameters:
ddivisor
Integer & divmod ( Integer &  q,
unsigned long &  r,
const Integer &  n,
const unsigned long  d 
) [static]

Division operator.

Parameters:
ddivisor
Integer operator% ( const Integer &  n) const

Modulo operator.

Parameters:
nmodulus
Returns:
remainder (*this) mod n
long operator% ( const unsigned long  n) const

Division operator.

Parameters:
ddivisor
long operator% ( const long  n) const

Division operator.

Parameters:
ddivisor
double operator% ( const double  n) const

Division operator.

Parameters:
ddivisor
short operator% ( const unsigned short  n) const [inline]

Division operator.

Parameters:
ddivisor
XXX operator% ( const XXX &  n) const [inline]

Division operator.

Parameters:
ddivisor
Integer & operator%= ( const Integer &  n)

Modulo operator (inplace).

Parameters:
nmodulus
Returns:
remainder (*this) <- (*this) mod n
Integer & operator%= ( const unsigned long  n)

Division operator.

Parameters:
ddivisor
Integer & operator%= ( const long  n)

Division operator.

Parameters:
ddivisor
Integer& operator%= ( const XXX &  n) [inline]

Division operator.

Parameters:
ddivisor
Integer& operator++ ( ) [inline]
Integer operator++ ( int  ) [inline]
Integer& operator-- ( ) [inline]
Integer operator-- ( int  ) [inline]
size_t size ( ) const [inline]
size_t size_in_base ( int  B) const [inline]
size_t bitsize ( ) const [inline]
unsigned long operator[] ( size_t  i) const [inline]
operator bool ( ) const [inline]
operator short ( ) const [inline]
operator unsigned short ( ) const [inline]
operator unsigned char ( ) const [inline]
operator unsigned int ( ) const
operator int ( ) const
operator signed char ( ) const [inline]
operator unsigned long ( ) const
operator long ( ) const
operator unsigned long long ( ) const
operator long long ( ) const
operator std::string ( ) const
operator float ( ) const
operator double ( ) const
operator vect_t ( ) const
static void seeding ( unsigned long int  s) [static]

returns a random integer r in the intervall [[0, m-1]]

void seeding ( Integer  s) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

void seeding ( ) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

Examples:
examples/Integer/ModularSquareRoot.C, examples/Integer/RSA_keys_generator.C, and examples/Polynomial/PolynomialCRT.C.
static __gmp_randstate_struct intializerandstate ( ) [static]

returns a random integer r in the intervall [[0, m-1]]

gmp_randclass & randstate ( ) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

bool RandBool ( ) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

Integer & random_lessthan ( Integer &  r,
const Integer &  m 
) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

static Integer& random_lessthan ( Integer &  r,
const Integer &  m 
) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

Integer & random_lessthan_2exp ( Integer &  r,
const unsigned long &  m 
) [inline, static]

returns a random integer r of at most m bits

static Integer& random_lessthan_2exp ( Integer &  r,
const unsigned long &  m 
) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

Integer random_lessthan_2exp ( const unsigned long &  m) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

static Integer random_lessthan_2exp ( const unsigned long &  m) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

Integer & random_lessthan ( Integer &  r,
const unsigned long &  m 
) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

static Integer& random_lessthan ( Integer &  r,
const unsigned long &  m 
) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

Integer random_lessthan ( const T &  m) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

static Integer random_lessthan ( const T &  m) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

Integer & random_exact ( Integer &  r,
const Integer &  s 
) [inline, static]

returns a reference to a random number r of the size of s, exactly.

static Integer& random_exact ( Integer &  r,
const Integer &  s 
) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

Integer & random_exact_2exp ( Integer &  r,
const unsigned long int &  m 
) [inline, static]

returns a reference to a random number r of the size m bits, exactly.

static Integer& random_exact_2exp ( Integer &  r,
const unsigned long int &  m 
) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

Integer & random_exact ( Integer &  r,
const unsigned long int &  m 
) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

static Integer& random_exact ( Integer &  r,
const unsigned long int &  m 
) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

static Integer& random_exact ( Integer &  r,
const T &  m 
) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

static Integer& random_exact ( Integer &  r,
const T &  m 
) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

Integer random_exact ( const T &  s) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

static Integer random_exact ( const T &  s) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

Integer & random_between ( Integer &  r,
const Integer &  m,
const Integer &  M 
) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

Integer random_between ( const Integer &  m,
const Integer &  M 
) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

Integer & random_between_2exp ( Integer &  r,
const unsigned long int &  m,
const unsigned long int &  M 
) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

Integer & random_between ( Integer &  r,
const unsigned long int &  m,
const unsigned long int &  M 
) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

Integer random_between_2exp ( const unsigned long int &  m,
const unsigned long int &  M 
) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

static Integer random_between ( const unsigned long int &  m,
const unsigned long int &  M 
) [static]

returns a random integer r in the intervall [[0, m-1]]

static Integer random_between ( const R &  m,
const R &  M 
) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

static Integer& random_between ( Integer &  r,
const R &  m,
const R &  M 
) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

Integer & random ( Integer &  r,
const T &  m 
) [inline, static]

returns a random integer less than...

static Integer& random ( Integer &  r,
const T &  m 
) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

Integer random ( const T &  sz) [inline, static]

returns a random integer less than...

static Integer random ( const T &  sz) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

Integer random ( ) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

static Integer random ( ) [static]

returns a random integer r in the intervall [[0, m-1]]

Integer nonzerorandom ( const T &  sz) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

Integer & nonzerorandom ( Integer &  r,
const T &  size 
) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

static Integer nonzerorandom ( const T &  sz) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

static Integer& nonzerorandom ( Integer &  r,
const T &  size 
) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

static Integer nonzerorandom ( ) [inline, static]

returns a random integer r in the intervall [[0, m-1]]

std::ostream & print ( std::ostream &  o) const
int sign ( ) const [inline]
mpz_ptr get_mpz ( ) [inline]
int priv_sign ( ) const [inline, protected]
const Rep* get_rep ( ) const [inline, protected]

Friends And Related Function Documentation

int compare ( const Integer &  a,
const Integer &  b 
) [friend]
int absCompare ( const Integer &  a,
const Integer &  b 
) [friend]
Integer gcd ( const Integer &  a,
const Integer &  b 
) [friend]
Integer gcd ( const Integer &  a,
const Integer &  b,
Integer &  u,
Integer &  v 
) [friend]
Integer& gcd ( Integer &  g,
const Integer &  a,
const Integer &  b 
) [friend]
Integer& gcd ( Integer &  g,
const Integer &  a,
const Integer &  b,
Integer &  u,
Integer &  v 
) [friend]
Integer& inv ( Integer &  u,
const Integer &  a,
const Integer &  b 
) [friend]
Integer& invin ( Integer &  u,
const Integer &  b 
) [friend]
Integer pp ( const Integer &  P,
const Integer &  Q 
) [friend]
Integer& lcm ( Integer &  g,
const Integer &  a,
const Integer &  b 
) [friend]
Integer lcm ( const Integer &  a,
const Integer &  b 
) [friend]
Integer& pow ( Integer &  Res,
const Integer &  n,
const long  l 
) [friend]
Integer& pow ( Integer &  Res,
const unsigned long  n,
const unsigned long  l 
) [friend]
Integer& pow ( Integer &  Res,
const Integer &  n,
const unsigned long  l 
) [friend]
Integer& pow ( Integer &  Res,
const Integer &  n,
const int  l 
) [friend]
Integer& pow ( Integer &  Res,
const Integer &  n,
const unsigned int  l 
) [friend]
Integer pow ( const Integer &  n,
const long  l 
) [friend]
Integer pow ( const Integer &  n,
const unsigned long  l 
) [friend]
Integer pow ( const Integer &  n,
const int  l 
) [friend]
Integer pow ( const Integer &  n,
const unsigned int  l 
) [friend]
Integer& powmod ( Integer &  Res,
const Integer &  n,
const unsigned long  e,
const Integer &  m 
) [friend]
Integer& powmod ( Integer &  Res,
const Integer &  n,
const long  e,
const Integer &  m 
) [friend]
Integer& powmod ( Integer &  Res,
const Integer &  n,
const unsigned int  e,
const Integer &  m 
) [friend]
Integer& powmod ( Integer &  Res,
const Integer &  n,
const int  e,
const Integer &  m 
) [friend]
Integer& powmod ( Integer &  Res,
const Integer &  n,
const Integer &  e,
const Integer &  m 
) [friend]
Integer powmod ( const Integer &  n,
const unsigned long  e,
const Integer &  m 
) [friend]
Integer powmod ( const Integer &  n,
const long  e,
const Integer &  m 
) [friend]
Integer powmod ( const Integer &  n,
const unsigned int  e,
const Integer &  m 
) [friend]
Integer powmod ( const Integer &  n,
const int  e,
const Integer &  m 
) [friend]
Integer powmod ( const Integer &  n,
const Integer &  e,
const Integer &  m 
) [friend]
Integer fact ( unsigned long  l) [friend]
Integer sqrt ( const Integer &  p) [friend]
Integer sqrtrem ( const Integer &  p,
Integer &  rem 
) [friend]
Integer& sqrt ( Integer &  r,
const Integer &  p 
) [friend]
Integer& sqrtrem ( Integer &  r,
const Integer &  p,
Integer &  rem 
) [friend]
bool root ( Integer &  q,
const Integer &  a,
unsigned int  n 
) [friend]
long logp ( const Integer &  a,
const Integer &  p 
) [friend]
double logtwo ( const Integer &  a) [friend]
double naturallog ( const Integer &  a) [friend]
void swap ( Integer &  a,
Integer &  b 
) [friend]
int sign ( const Integer &  a) [friend]
int isZero ( const Integer &  a) [friend]
int isOne ( const Integer &  a) [friend]
int isperfectpower ( const Integer &  n) [friend]
Integer abs ( const Integer &  n) [friend]
Integer& prevprime ( Integer &  r,
const Integer &  p 
) [friend]
Integer& nextprime ( Integer &  r,
const Integer &  p 
) [friend]
int probab_prime ( const Integer &  p) [friend]
int probab_prime ( const Integer &  p,
int  r 
) [friend]
int jacobi ( const Integer &  u,
const Integer &  v 
) [friend]
int legendre ( const Integer &  u,
const Integer &  v 
) [friend]
unsigned long length ( const Integer &  a) [friend]
std::istream& operator>> ( std::istream &  i,
Integer &  n 
) [friend]
std::ostream& operator<< ( std::ostream &  o,
const Integer &  n 
) [friend]
std::ostream& absOutput ( std::ostream &  o,
const Integer &  n 
) [friend]
void importWords ( Integer &  x,
size_t  count,
int  order,
int  size,
int  endian,
size_t  nails,
const void *  op 
) [friend]

Field Documentation

const Integer zero [static]

zero

const Integer one [static]

one

Rep gmp_rep [protected]

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