Givaro
Public Types | Static Public Attributes | Friends
Integer Class Reference

This is the Integer class. More...

#include <gmp++_int.h>

Inherited by SpyInteger::InHeritsInteger.

Public Types

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

Public Member Functions

Constructor/Destructors.

Constructors and destructor for an Integer.

giv_all_inlined Integer (int n=0)
 Constructor form a known type. More...
 
giv_all_inlined Integer (long int n)
 
giv_all_inlined Integer (unsigned char n)
 
giv_all_inlined Integer (unsigned int n)
 
giv_all_inlined Integer (long unsigned int n)
 
giv_all_inlined Integer (double n)
 
giv_all_inlined Integer (const char *n)
 
giv_all_inlined Integer (const Integer &n)
 Copy constructor. More...
 
giv_all_inlined Integer (long unsigned *d, long sz)
 Creates a new Integer from pointers. More...
 
giv_all_inlined Integer (const vect_t &v)
 Creates a new Integers for a vector of limbs. More...
 
giv_all_inlined ~Integer ()
 destructor
 
Assignment and copy operators
giv_all_inlined Integeroperator= (const Integer &n)
 copy from an integer. More...
 
giv_all_inlined Integerlogcpy (const Integer &n)
 copy from an integer. More...
 
giv_all_inlined Integercopy (const Integer &n)
 copy from an integer. More...
 
Bit logic operators.
giv_all_inlined Integer operator^ (const Integer &a) const
 XOR (^) More...
 
giv_all_inlined Integer operator^ (const long unsigned int &a) const
 
giv_all_inlined Integer operator^ (const unsigned int &a) const
 
giv_all_inlined Integeroperator^= (const Integer &a)
 XOR inplace (^=) More...
 
giv_all_inlined Integeroperator^= (const long unsigned int &a)
 
giv_all_inlined Integeroperator^= (const unsigned int &a)
 
giv_all_inlined Integer operator| (const Integer &a) const
 OR (|) More...
 
giv_all_inlined Integer operator| (const long unsigned int &a) const
 
giv_all_inlined Integer operator| (const unsigned int &a) const
 
giv_all_inlined Integeroperator|= (const Integer &a)
 OR inplace (|=) More...
 
giv_all_inlined Integeroperator|= (const long unsigned int &a)
 
giv_all_inlined Integeroperator|= (const unsigned int &a)
 
giv_all_inlined Integer operator& (const Integer &a) const
 AND (&) More...
 
giv_all_inlined unsigned int operator& (const unsigned int &a) const
 
giv_all_inlined long unsigned operator& (const long unsigned int &a) const
 
giv_all_inlined Integeroperator&= (const Integer &a)
 AND inplace (&=) More...
 
giv_all_inlined Integeroperator&= (const long unsigned int &a)
 
giv_all_inlined Integeroperator&= (const unsigned int &a)
 
giv_all_inlined Integer operator~ () const
 complement to 1 (~)
 
giv_all_inlined Integer operator<< (int l) const
 left shift (<<) More...
 
giv_all_inlined Integer operator<< (long int l) const
 
giv_all_inlined Integer operator<< (unsigned int l) const
 
giv_all_inlined Integer operator<< (long unsigned int l) const
 
giv_all_inlined Integeroperator<<= (int l)
 left shift inplace (<<=) More...
 
giv_all_inlined Integeroperator<<= (long int l)
 
giv_all_inlined Integeroperator<<= (unsigned int l)
 
giv_all_inlined Integeroperator<<= (long unsigned int l)
 
giv_all_inlined Integer operator>> (int l) const
 right shift (>>) More...
 
giv_all_inlined Integer operator>> (long int l) const
 
giv_all_inlined Integer operator>> (unsigned int l) const
 
giv_all_inlined Integer operator>> (long unsigned int l) const
 
giv_all_inlined Integeroperator>>= (int l)
 right shift inplace (>>=) More...
 
giv_all_inlined Integeroperator>>= (long int l)
 
giv_all_inlined Integeroperator>>= (unsigned int l)
 
giv_all_inlined Integeroperator>>= (long unsigned int l)
 
Increment/Decrement operators
Integeroperator++ ()
 
Integer operator++ (int)
 
Integeroperator-- ()
 
Integer operator-- (int)
 
Cast operators.

Convert an Integer to a basic C++ type.

Warning
Cast towards unsigned consider only the absolute value
 operator bool () const
 
 operator short () const
 
 operator unsigned short () const
 
 operator unsigned char () const
 
giv_all_inlined operator unsigned int () const
 
giv_all_inlined operator int () const
 
 operator signed char () const
 
giv_all_inlined operator long unsigned () const
 
giv_all_inlined operator long () const
 
giv_all_inlined operator long long unsigned () const
 
giv_all_inlined operator long long () const
 
giv_all_inlined operator std::string () const
 
giv_all_inlined operator float () const
 
giv_all_inlined operator double () const
 
giv_all_inlined operator vect_t () const
 

Static Public Member Functions

Addition, substraction, multiplication
static giv_all_inlined Integeraddin (Integer &res, const Integer &n)
 Addition (inplace) res+=n. More...
 
static giv_all_inlined Integeraddin (Integer &res, const long int n)
 
static giv_all_inlined Integeraddin (Integer &res, const long unsigned int n)
 
static giv_all_inlined Integeradd (Integer &res, const Integer &n1, const Integer &n2)
 Addition res=n1+n2. More...
 
static giv_all_inlined Integeradd (Integer &res, const Integer &n1, const long int n2)
 
static giv_all_inlined Integeradd (Integer &res, const Integer &n1, const long unsigned int n2)
 
static giv_all_inlined Integersubin (Integer &res, const Integer &n)
 Substraction (inplace) res-=n. More...
 
static giv_all_inlined Integersubin (Integer &res, const long int n)
 
static giv_all_inlined Integersubin (Integer &res, const long unsigned int n)
 
static giv_all_inlined Integersub (Integer &res, const Integer &n1, const Integer &n2)
 Substraction res=n1-n2. More...
 
static giv_all_inlined Integersub (Integer &res, const Integer &n1, const long int n2)
 
static giv_all_inlined Integersub (Integer &res, const Integer &n1, const long unsigned int n2)
 
static giv_all_inlined Integernegin (Integer &res)
 Negation (inplace) res=-res. More...
 
static giv_all_inlined Integerneg (Integer &res, const Integer &n)
 Negation res=-n. More...
 
static giv_all_inlined Integermulin (Integer &res, const Integer &n)
 Multiplication (inplace) res*=n. More...
 
static giv_all_inlined Integermulin (Integer &res, const long int n)
 
static giv_all_inlined Integermulin (Integer &res, const long unsigned int n)
 
static giv_all_inlined Integermul (Integer &res, const Integer &n1, const Integer &n2)
 Multiplication res=n1*n2. More...
 
static giv_all_inlined Integermul (Integer &res, const Integer &n1, const long int n2)
 
static giv_all_inlined Integermul (Integer &res, const Integer &n1, const long unsigned int n2)
 
fused add-multiply

Groups a multiplication and an addition/division in a single function.

This is usually faster than doing the two operations separately (and preferable to using operators).

static giv_all_inlined Integeraxpy (Integer &res, const Integer &a, const Integer &x, const Integer &y)
 axpy res = ax+y. More...
 
static giv_all_inlined Integeraxpy (Integer &res, const Integer &a, const long unsigned int x, const Integer &y)
 
static giv_all_inlined Integeraxpyin (Integer &res, const Integer &a, const Integer &x)
 axpyin (inplace) res += ax. More...
 
static giv_all_inlined Integeraxpyin (Integer &res, const Integer &a, const long unsigned int x)
 
static giv_all_inlined Integermaxpy (Integer &res, const Integer &a, const Integer &x, const Integer &y)
 maxpy res = y - ax. More...
 
static giv_all_inlined Integermaxpy (Integer &res, const Integer &a, const long unsigned int x, const Integer &y)
 
static giv_all_inlined Integermaxpyin (Integer &res, const Integer &a, const Integer &x)
 maxpyin res -= ax. More...
 
static giv_all_inlined Integermaxpyin (Integer &res, const Integer &a, const long unsigned int x)
 
static giv_all_inlined Integeraxmy (Integer &res, const Integer &a, const Integer &x, const Integer &y)
 axmy res = ax - y. More...
 
static giv_all_inlined Integeraxmy (Integer &res, const Integer &a, const long unsigned int x, const Integer &y)
 
static giv_all_inlined Integeraxmyin (Integer &res, const Integer &a, const Integer &x)
 axmyin (in place) res = ax - res. More...
 
static giv_all_inlined Integeraxmyin (Integer &res, const Integer &a, const long unsigned int x)
 
Random numbers functions
static void seeding (long unsigned int s)
 Random numbers (no doc)
 
static void seeding (Integer s)
 Random numbers (no doc)
 
static void seeding ()
 Random numbers (no doc)
 
static bool RandBool ()
 Random numbers (no doc)
 
template<bool ALWAYSPOSITIVE>
static Integerrandom_lessthan (Integer &r, const Integer &m)
 returns a random integer r in the intervall [[x, m-1]] where x = 0 or -(m-1) according to ALWAYSPOSITIVE More...
 
static Integerrandom_lessthan (Integer &r, const Integer &m)
 Random numbers (no doc)
 
template<bool ALWAYSPOSITIVE>
static Integerrandom_lessthan_2exp (Integer &r, const long unsigned int &m)
 returns a random integer r in the intervall [[x, 2^m-1]] where x = 0 or -(2^m-1) according to ALWAYSPOSITIVE returns a random integer r of at most m bits
 
static Integerrandom_lessthan_2exp (Integer &r, const long unsigned int &m)
 Random numbers (no doc)
 
template<bool ALWAYSPOSITIVE>
static Integer random_lessthan_2exp (const long unsigned int &m)
 Random numbers (no doc)
 
static Integer random_lessthan_2exp (const long unsigned int &m)
 Random numbers (no doc)
 
template<bool ALWAYSPOSITIVE>
static Integerrandom_lessthan (Integer &r, const long unsigned int &m)
 Random numbers (no doc)
 
static Integerrandom_lessthan (Integer &r, const long unsigned int &m)
 Random numbers (no doc)
 
template<bool ALWAYSPOSITIVE, class T >
static Integer random_lessthan (const T &m)
 Random numbers (no doc)
 
template<class T >
static Integer random_lessthan (const T &m)
 Random numbers (no doc)
 
template<bool ALWAYSPOSITIVE>
static Integerrandom_exact_2exp (Integer &r, const long unsigned int &m)
 returns a reference to a random number r of the size m bits, exactly.
 
static Integerrandom_exact_2exp (Integer &r, const long unsigned int &m)
 Random numbers (no doc)
 
template<bool ALWAYSPOSITIVE>
static Integerrandom_exact (Integer &r, const Integer &s)
 returns a reference to a random number r of the size of s, exactly.
 
static Integerrandom_exact (Integer &r, const Integer &s)
 Random numbers (no doc)
 
template<bool ALWAYSPOSITIVE>
static Integerrandom_exact (Integer &r, const long unsigned int &m)
 Random numbers (no doc)
 
static Integerrandom_exact (Integer &r, const long unsigned int &m)
 Random numbers (no doc)
 
template<bool ALWAYSPOSITIVE, class T >
static Integerrandom_exact (Integer &r, const T &m)
 Random numbers (no doc)
 
template<class T >
static Integerrandom_exact (Integer &r, const T &m)
 Random numbers (no doc)
 
template<bool ALWAYSPOSITIVE, class T >
static Integer random_exact (const T &s)
 Random numbers (no doc)
 
template<class T >
static Integer random_exact (const T &s)
 Random numbers (no doc)
 
static Integerrandom_between (Integer &r, const Integer &m, const Integer &M)
 Random numbers (no doc)
 
static Integer random_between (const Integer &m, const Integer &M)
 Random numbers (no doc)
 
static Integerrandom_between_2exp (Integer &r, const long unsigned int &m, const long unsigned int &M)
 Random numbers (no doc)
 
static Integerrandom_between (Integer &r, const long unsigned int &m, const long unsigned int &M)
 Random numbers (no doc)
 
static Integer random_between_2exp (const long unsigned int &m, const long unsigned int &M)
 Random numbers (no doc)
 
static Integer random_between (const long unsigned int &m, const long unsigned int &M)
 Random numbers (no doc)
 
template<class R >
static Integer random_between (const R &m, const R &M)
 Random numbers (no doc)
 
template<class R >
static Integerrandom_between (Integer &r, const R &m, const R &M)
 Random numbers (no doc)
 
template<bool ALWAYSPOSITIVE, class T >
static Integerrandom (Integer &r, const T &m)
 returns a random integer less than...
 
template<class T >
static Integerrandom (Integer &r, const T &m)
 Random numbers (no doc)
 
template<bool ALWAYSPOSITIVE, class T >
static Integer random (const T &sz)
 returns a random integer less than...
 
template<class T >
static Integer random (const T &sz)
 Random numbers (no doc)
 
template<bool ALWAYSPOSITIVE>
static Integer random ()
 Random numbers (no doc)
 
static Integer random ()
 Random numbers (no doc)
 
template<bool ALWAYSPOSITIVE, class T >
static Integer nonzerorandom (const T &sz)
 Random numbers (no doc)
 
template<bool ALWAYSPOSITIVE, class T >
static Integernonzerorandom (Integer &r, const T &size)
 Random numbers (no doc)
 
template<class T >
static Integer nonzerorandom (const T &sz)
 Random numbers (no doc)
 
template<class T >
static Integernonzerorandom (Integer &r, const T &size)
 Random numbers (no doc)
 
static Integer nonzerorandom ()
 Random numbers (no doc)
 

Static Public Attributes

static const Integer zero
 zero (0)
 
static const Integer one
 one (1)
 
static const Integer mOne
 minus one (-1)
 

Friends

giv_all_inlined Integerpowmod (Integer &Res, const Integer &n, const long unsigned int e, const Integer &m)
 modular pow. return $n^e \mod m$.
 
giv_all_inlined Integerpowmod (Integer &Res, const Integer &n, const long int e, const Integer &m)
 
giv_all_inlined Integerpowmod (Integer &Res, const Integer &n, const unsigned int e, const Integer &m)
 
giv_all_inlined Integerpowmod (Integer &Res, const Integer &n, const int e, const Integer &m)
 
giv_all_inlined Integerpowmod (Integer &Res, const Integer &n, const Integer &e, const Integer &m)
 
giv_all_inlined Integer powmod (const Integer &n, const long unsigned int e, const Integer &m)
 modular pow. More...
 
giv_all_inlined Integer powmod (const Integer &n, const long int e, const Integer &m)
 
giv_all_inlined Integer powmod (const Integer &n, const unsigned int e, const Integer &m)
 
giv_all_inlined Integer powmod (const Integer &n, const int e, const Integer &m)
 
giv_all_inlined Integer powmod (const Integer &n, const Integer &e, const Integer &m)
 
giv_all_inlined Integer fact (long unsigned int l)
 fact More...
 
giv_all_inlined Integer sqrt (const Integer &p)
 (square) roots More...
 
giv_all_inlined Integersqrt (Integer &r, const Integer &p)
 (square) roots More...
 
giv_all_inlined Integer sqrtrem (const Integer &p, Integer &rem)
 (square) roots More...
 
giv_all_inlined Integersqrtrem (Integer &r, const Integer &p, Integer &rem)
 (square) roots More...
 
giv_all_inlined bool root (Integer &q, const Integer &a, unsigned int n)
 (square) roots More...
 
giv_all_inlined long logp (const Integer &a, const Integer &p)
 logs More...
 
giv_all_inlined double logtwo (const Integer &a)
 logs More...
 
giv_all_inlined double naturallog (const Integer &a)
 logs More...
 
Arithmetic functions
giv_all_inlined Integer gcd (const Integer &a, const Integer &b)
 gcd. More...
 
giv_all_inlined Integer gcd (Integer &u, Integer &v, const Integer &a, const Integer &b)
 
giv_all_inlined Integergcd (Integer &g, const Integer &a, const Integer &b)
 
giv_all_inlined Integergcd (Integer &g, Integer &u, Integer &v, const Integer &a, const Integer &b)
 
giv_all_inlined Integerinv (Integer &u, const Integer &a, const Integer &b)
 Inverse. More...
 
giv_all_inlined Integerinvin (Integer &u, const Integer &b)
 Compute the inverse inplace u = u/b. More...
 
giv_all_inlined Integer pp (const Integer &P, const Integer &Q)
 pp More...
 
giv_all_inlined Integerlcm (Integer &g, const Integer &a, const Integer &b)
 lcm More...
 
giv_all_inlined Integer lcm (const Integer &a, const Integer &b)
 lcm More...
 
giv_all_inlined Integerpow (Integer &Res, const Integer &n, const long int l)
 pow. More...
 
giv_all_inlined Integerpow (Integer &Res, const long unsigned int n, const long unsigned int l)
 
giv_all_inlined Integerpow (Integer &Res, const Integer &n, const long unsigned int l)
 
giv_all_inlined Integerpow (Integer &Res, const Integer &n, const int l)
 
giv_all_inlined Integerpow (Integer &Res, const Integer &n, const unsigned int l)
 
giv_all_inlined Integer pow (const Integer &n, const long int l)
 pow. More...
 
giv_all_inlined Integer pow (const Integer &n, const long unsigned int l)
 
giv_all_inlined Integer pow (const Integer &n, const int l)
 
giv_all_inlined Integer pow (const Integer &n, const unsigned int l)
 
primes
giv_all_inlined Integerprevprime (Integer &, const Integer &p)
 
giv_all_inlined Integernextprime (Integer &, const Integer &p)
 
giv_all_inlined int probab_prime (const Integer &p)
 
giv_all_inlined int probab_prime (const Integer &p, int r)
 
giv_all_inlined int jacobi (const Integer &u, const Integer &v)
 
giv_all_inlined int legendre (const Integer &u, const Integer &v)
 

Comparisons functions.

giv_all_inlined friend int compare (const Integer &a, const Integer &b)
 Compares two integers. More...
 
giv_all_inlined friend int absCompare (const Integer &a, const Integer &b)
 Compare the norm of two integers. More...
 
giv_all_inlined friend int absCompare (const Integer &a, const double b)
 
giv_all_inlined friend int absCompare (const Integer &a, const float b)
 
giv_all_inlined friend int absCompare (const Integer &a, const long unsigned b)
 
giv_all_inlined friend int absCompare (const Integer &a, const unsigned b)
 
giv_all_inlined friend int absCompare (const Integer &a, const long int b)
 
giv_all_inlined friend int absCompare (const Integer &a, const int b)
 
template<class T >
giv_all_inlined friend int absCompare (const T a, const Integer &b)
 
giv_all_inlined int isOne (const Integer &a)
 name compare to 1 and 0 More...
 
giv_all_inlined int isMOne (const Integer &a)
 Compares two integers. More...
 
giv_all_inlined int nonZero (const Integer &a)
 name compare to 1 and 0 More...
 
giv_all_inlined int isZero (const Integer &a)
 name compare to 1 and 0 More...
 
giv_all_inlined int isZero (const short int a)
 
giv_all_inlined int isZero (const int a)
 
giv_all_inlined int isZero (const long int a)
 
giv_all_inlined int isZero (const unsigned short int a)
 
giv_all_inlined int isZero (const unsigned int a)
 
giv_all_inlined int isZero (const long unsigned int a)
 
template<class A , class B >
static giv_all_inlined bool isleq (const A &a, const B &b)
 isleq More...
 

Comparison operators.

Compare with operators.

giv_all_inlined int operator>= (const Integer &l) const
 greater or equal. More...
 
giv_all_inlined int operator>= (const int l) const
 
giv_all_inlined int operator>= (const long int l) const
 
giv_all_inlined int operator>= (const long unsigned int l) const
 
giv_all_inlined int operator>= (const unsigned int l) const
 
giv_all_inlined int operator>= (const double l) const
 
giv_all_inlined int operator>= (const float l) const
 
giv_all_inlined int operator<= (const Integer &l) const
 less or equal More...
 
giv_all_inlined int operator<= (const int l) const
 
giv_all_inlined int operator<= (const long int l) const
 
giv_all_inlined int operator<= (const long unsigned int l) const
 
giv_all_inlined int operator<= (const unsigned int l) const
 
giv_all_inlined int operator<= (const double l) const
 
giv_all_inlined int operator<= (const float l) const
 
giv_all_inlined int operator!= (const Integer &l) const
 operator != (not equal) More...
 
giv_all_inlined int operator!= (const int l) const
 
giv_all_inlined int operator!= (const long int l) const
 
giv_all_inlined int operator!= (const long unsigned int l) const
 
giv_all_inlined int operator!= (const unsigned int l) const
 
giv_all_inlined int operator!= (const double l) const
 
giv_all_inlined int operator!= (const float l) const
 
giv_all_inlined int operator== (const Integer &l) const
 Equality. More...
 
giv_all_inlined int operator== (const int l) const
 
giv_all_inlined int operator== (const long int l) const
 
giv_all_inlined int operator== (const long unsigned int l) const
 
giv_all_inlined int operator== (const unsigned int l) const
 
giv_all_inlined int operator== (const double l) const
 
giv_all_inlined int operator== (const float l) const
 
giv_all_inlined int operator> (const Integer &l) const
 greater (strict) More...
 
giv_all_inlined int operator> (const int l) const
 
giv_all_inlined int operator> (const long int l) const
 
giv_all_inlined int operator> (const long unsigned int l) const
 
giv_all_inlined int operator> (const unsigned int l) const
 
giv_all_inlined int operator> (const double l) const
 
giv_all_inlined int operator> (const float l) const
 
giv_all_inlined int operator< (const Integer &l) const
 less (strict) More...
 
giv_all_inlined int operator< (const int l) const
 
giv_all_inlined int operator< (const long int l) const
 
giv_all_inlined int operator< (const long unsigned int l) const
 
giv_all_inlined int operator< (const unsigned int l) const
 
giv_all_inlined int operator< (const double l) const
 
giv_all_inlined int operator< (const float l) const
 
giv_all_inlined friend int operator>= (unsigned int l, const Integer &n)
 greater or equal. More...
 
giv_all_inlined friend int operator>= (float l, const Integer &n)
 
giv_all_inlined friend int operator>= (double l, const Integer &n)
 
giv_all_inlined friend int operator>= (int l, const Integer &n)
 
giv_all_inlined friend int operator>= (long int l, const Integer &n)
 
giv_all_inlined friend int operator>= (long unsigned int l, const Integer &n)
 
giv_all_inlined friend int operator<= (unsigned int l, const Integer &n)
 less or equal More...
 
giv_all_inlined friend int operator<= (float l, const Integer &n)
 
giv_all_inlined friend int operator<= (double l, const Integer &n)
 
giv_all_inlined friend int operator<= (int l, const Integer &n)
 
giv_all_inlined friend int operator<= (long int l, const Integer &n)
 
giv_all_inlined friend int operator<= (long unsigned int l, const Integer &n)
 
giv_all_inlined friend int operator!= (unsigned int l, const Integer &n)
 operator != (not equal) More...
 
giv_all_inlined friend int operator!= (float l, const Integer &n)
 
giv_all_inlined friend int operator!= (double l, const Integer &n)
 
giv_all_inlined friend int operator!= (int l, const Integer &n)
 
giv_all_inlined friend int operator!= (long int l, const Integer &n)
 
giv_all_inlined friend int operator!= (long unsigned int l, const Integer &n)
 
giv_all_inlined friend int operator== (unsigned int l, const Integer &n)
 Equality. More...
 
giv_all_inlined friend int operator== (float l, const Integer &n)
 
giv_all_inlined friend int operator== (double l, const Integer &n)
 
giv_all_inlined friend int operator== (int l, const Integer &n)
 
giv_all_inlined friend int operator== (long int l, const Integer &n)
 
giv_all_inlined friend int operator== (long unsigned int l, const Integer &n)
 
giv_all_inlined friend int operator> (unsigned int l, const Integer &n)
 greater (strict) More...
 
giv_all_inlined friend int operator> (float l, const Integer &n)
 
giv_all_inlined friend int operator> (double l, const Integer &n)
 
giv_all_inlined friend int operator> (int l, const Integer &n)
 
giv_all_inlined friend int operator> (long int l, const Integer &n)
 
giv_all_inlined friend int operator> (long unsigned int l, const Integer &n)
 
giv_all_inlined friend int operator< (unsigned int l, const Integer &n)
 less (strict) More...
 
giv_all_inlined friend int operator< (float l, const Integer &n)
 
giv_all_inlined friend int operator< (double l, const Integer &n)
 
giv_all_inlined friend int operator< (int l, const Integer &n)
 
giv_all_inlined friend int operator< (long int l, const Integer &n)
 
giv_all_inlined friend int operator< (long unsigned int l, const Integer &n)
 

Addition, substraction, multiplication operators

giv_all_inlined Integer operator+ (const Integer &n) const
 operator +. More...
 
giv_all_inlined Integer operator+ (const long unsigned int n) const
 
giv_all_inlined Integer operator+ (const long int n) const
 
giv_all_inlined Integeroperator+= (const Integer &n)
 operator += . More...
 
giv_all_inlined Integeroperator+= (const long unsigned int n)
 
giv_all_inlined Integeroperator+= (const long int n)
 
template<class XXX >
Integeroperator+= (const XXX &n)
 
giv_all_inlined Integer operator- (const Integer &n) const
 operator -. More...
 
giv_all_inlined Integer operator- (const long unsigned int n) const
 
giv_all_inlined Integer operator- (const long int n) const
 
giv_all_inlined Integeroperator-= (const Integer &n)
 operator -= . More...
 
giv_all_inlined Integeroperator-= (const long unsigned int n)
 
giv_all_inlined Integeroperator-= (const long int n)
 
template<class XXX >
Integeroperator-= (const XXX &n)
 
giv_all_inlined Integer operator- () const
 Opposite. More...
 
giv_all_inlined Integer operator* (const Integer &n) const
 operator *. More...
 
giv_all_inlined Integer operator* (const long unsigned int n) const
 
giv_all_inlined Integer operator* (const long int n) const
 
giv_all_inlined Integeroperator*= (const Integer &n)
 operator *= . More...
 
giv_all_inlined Integeroperator*= (const long unsigned int n)
 
giv_all_inlined Integeroperator*= (const long int n)
 
template<class XXX >
Integeroperator*= (const XXX &n)
 
giv_all_inlined Integer operator+ (const int l, const Integer &n)
 operator +. More...
 
giv_all_inlined Integer operator+ (const unsigned int l, const Integer &n)
 
giv_all_inlined Integer operator+ (const long int l, const Integer &n)
 
giv_all_inlined Integer operator+ (const long unsigned int l, const Integer &n)
 
giv_all_inlined Integer operator+ (const Integer &n, const int l)
 
giv_all_inlined Integer operator+ (const Integer &n, const unsigned int l)
 
giv_all_inlined Integeroperator+= (Integer &n, const int l)
 operator +=. More...
 
giv_all_inlined Integeroperator+= (Integer &n, const unsigned int l)
 
giv_all_inlined Integer operator- (const int l, const Integer &n)
 operator - More...
 
giv_all_inlined Integer operator- (const unsigned int l, const Integer &n)
 
giv_all_inlined Integer operator- (const long int l, const Integer &n)
 
giv_all_inlined Integer operator- (const long unsigned int l, const Integer &n)
 
giv_all_inlined Integer operator- (const Integer &n, const int l)
 
giv_all_inlined Integer operator- (const Integer &n, const unsigned int l)
 
giv_all_inlined Integeroperator-= (Integer &n, const int l)
 operator -= More...
 
giv_all_inlined Integeroperator-= (Integer &n, const unsigned int l)
 
giv_all_inlined Integer operator* (const int l, const Integer &n)
 operator * More...
 
giv_all_inlined Integer operator* (const unsigned int l, const Integer &n)
 
giv_all_inlined Integer operator* (const long int l, const Integer &n)
 
giv_all_inlined Integer operator* (const long unsigned int l, const Integer &n)
 
giv_all_inlined Integer operator* (const Integer &n, const int l)
 
giv_all_inlined Integer operator* (const Integer &n, const unsigned int l)
 
giv_all_inlined Integeroperator*= (Integer &n, const int l)
 operator *= More...
 
giv_all_inlined Integeroperator*= (Integer &n, const unsigned int l)
 

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).
giv_all_inlined Integer operator/ (const Integer &d) const
 Division operator. More...
 
giv_all_inlined Integer operator/ (const long unsigned int d) const
 
giv_all_inlined Integer operator/ (const long int d) const
 
giv_all_inlined Integeroperator/= (const Integer &d)
 Division operator (inplace). More...
 
giv_all_inlined Integeroperator/= (const long unsigned int d)
 
giv_all_inlined Integeroperator/= (const long int d)
 
template<class XXX >
Integeroperator/= (const XXX &d)
 
giv_all_inlined Integer operator% (const Integer &n) const
 Modulo operator. More...
 
giv_all_inlined long operator% (const long unsigned int n) const
 
giv_all_inlined long operator% (const long int n) const
 
giv_all_inlined double operator% (const double n) const
 
short operator% (const unsigned short n) const
 
template<class XXX >
XXX operator% (const XXX &n) const
 
giv_all_inlined Integeroperator%= (const Integer &n)
 Modulo operator (inplace). More...
 
giv_all_inlined Integeroperator%= (const long unsigned int n)
 
giv_all_inlined Integeroperator%= (const long int n)
 
template<class XXX >
Integeroperator%= (const XXX &n)
 
giv_all_inlined Integer operator/ (const int l, const Integer &n)
 operator /
 
giv_all_inlined Integer operator/ (const long int l, const Integer &n)
 
giv_all_inlined Integer operator/ (const Integer &n, const int l)
 
giv_all_inlined Integer operator/ (const Integer &n, const unsigned int l)
 
giv_all_inlined Integeroperator/= (Integer &n, const int l)
 operator /=
 
giv_all_inlined Integeroperator/= (Integer &n, const long int l)
 
giv_all_inlined Integeroperator/= (Integer &n, const unsigned int l)
 
giv_all_inlined Integer operator% (const int l, const Integer &n)
 operator % More...
 
giv_all_inlined Integer operator% (const long int l, const Integer &n)
 
giv_all_inlined Integer operator% (const Integer &n, const int l)
 
giv_all_inlined Integer operator% (const Integer &n, const unsigned int l)
 
giv_all_inlined Integeroperator%= (Integer &n, const int l)
 
giv_all_inlined Integeroperator%= (Integer &n, const unsigned int l)
 
static giv_all_inlined Integerdivin (Integer &q, const Integer &d)
 Division q/=d. More...
 
static giv_all_inlined Integerdivin (Integer &q, const long int d)
 
static giv_all_inlined Integerdivin (Integer &q, const long unsigned int d)
 
static giv_all_inlined Integerdiv (Integer &q, const Integer &n, const Integer &d)
 Division q=n/d. More...
 
static giv_all_inlined Integerdiv (Integer &q, const Integer &n, const long int d)
 
static giv_all_inlined Integerdiv (Integer &q, const Integer &n, const int d)
 
static giv_all_inlined Integerdiv (Integer &q, const Integer &n, const long unsigned int d)
 
static giv_all_inlined Integerdivexact (Integer &q, const Integer &n, const Integer &d)
 Division when d divides n. More...
 
static giv_all_inlined Integerdivexact (Integer &q, const Integer &n, const unsigned long &d)
 Division operator. More...
 
static giv_all_inlined Integerdivexact (Integer &q, const Integer &n, const long &d)
 Division operator. More...
 
static giv_all_inlined Integer divexact (const Integer &n, const Integer &d)
 Division when d divides n. More...
 
static giv_all_inlined Integer divexact (const Integer &n, const unsigned long &d)
 Division operator. More...
 
static giv_all_inlined Integer divexact (const Integer &n, const long &d)
 Division operator. More...
 
static giv_all_inlined Integertrem (Integer &r, const Integer &n, const Integer &d)
 Stuff.
 
static giv_all_inlined Integercrem (Integer &r, const Integer &n, const Integer &d)
 Division operator. More...
 
static giv_all_inlined Integerfrem (Integer &r, const Integer &n, const Integer &d)
 Division operator. More...
 
static giv_all_inlined Integertrem (Integer &r, const Integer &n, const unsigned long &d)
 Stuff.
 
static giv_all_inlined Integercrem (Integer &r, const Integer &n, const unsigned long &d)
 Division operator. More...
 
static giv_all_inlined Integerfrem (Integer &r, const Integer &n, const unsigned long &d)
 Division operator. More...
 
static giv_all_inlined unsigned long trem (const Integer &n, const unsigned long &d)
 Stuff.
 
static giv_all_inlined unsigned long crem (const Integer &n, const unsigned long &d)
 Division operator. More...
 
static giv_all_inlined unsigned long frem (const Integer &n, const unsigned long &d)
 Division operator. More...
 
static giv_all_inlined Integermodin (Integer &r, const Integer &n)
 Function mod (inplace). More...
 
static giv_all_inlined Integermodin (Integer &r, const long int n)
 
static giv_all_inlined Integermodin (Integer &r, const long unsigned int n)
 
static giv_all_inlined Integermod (Integer &r, const Integer &n, const Integer &d)
 Function mod. More...
 
static giv_all_inlined Integermod (Integer &r, const Integer &n, const long int d)
 
static giv_all_inlined Integermod (Integer &r, const Integer &n, const long unsigned int d)
 
static giv_all_inlined Integerdivmod (Integer &q, Integer &r, const Integer &n, const Integer &d)
 Euclidean division. More...
 
static giv_all_inlined Integerdivmod (Integer &q, long int &r, const Integer &n, const long int d)
 
static giv_all_inlined Integerdivmod (Integer &q, long unsigned int &r, const Integer &n, const long unsigned int d)
 
static giv_all_inlined Integerceil (Integer &res, const Integer &n, const Integer &d)
 rounding functions. More...
 
static giv_all_inlined Integerfloor (Integer &res, const Integer &n, const Integer &d)
 
static giv_all_inlined Integertrunc (Integer &res, const Integer &n, const Integer &d)
 
static giv_all_inlined Integer ceil (const Integer &n, const Integer &d)
 rounding functions. More...
 
static giv_all_inlined Integer floor (const Integer &n, const Integer &d)
 
static giv_all_inlined Integer trunc (const Integer &n, const Integer &d)
 

Miscellaneous.

int sign () const
 sign
 
int priv_sign () const
 private sign
 
giv_all_inlined void swap (Integer &a, Integer &b)
 
int sign (const Integer &a)
 sign More...
 

representation

get representation

mpz_ptr get_mpz ()
 get representation (constant)
 
mpz_srcptr get_mpz_const () const
 get representation (constant)
 
giv_all_inlined size_t size () const
 returns the number of machine words used to store *this
 
giv_all_inlined size_t size_in_base (int B) const
 returns ceil(log_BASE(*this)). More...
 
giv_all_inlined size_t bitsize () const
 returns ceil(log_2(*this)) . More...
 
giv_all_inlined long unsigned operator[] (size_t i) const
 return the i-th word of the integer. More...
 
giv_all_inlined long unsigned int length (const Integer &a)
 returns the number of bytes used to store *this More...
 
giv_all_inlined int isperfectpower (const Integer &n)
 perfect power
 
giv_all_inlined Integer abs (const Integer &n)
 absolute value
 
giv_all_inlined bool isOdd (const Integer &)
 parity of an integer More...
 

I/O

giv_all_inlined std::ostream & print (std::ostream &o) const
 print integer. More...
 
giv_all_inlined std::istream & operator>> (std::istream &i, Integer &n)
 Input/Output of Integers. More...
 
giv_all_inlined std::ostream & operator<< (std::ostream &o, const Integer &n)
 out operator. More...
 
giv_all_inlined std::ostream & absOutput (std::ostream &o, const Integer &n)
 nodoc More...
 
giv_all_inlined void importWords (Integer &x, size_t count, int order, int size, int endian, size_t nails, const void *op)
 nodoc More...
 

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.

Constructor & Destructor Documentation

Integer ( int  n = 0)

Constructor form a known type.

Parameters
ninput to be constructed from
Integer ( long int  n)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer ( unsigned char  n)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer ( unsigned int  n)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer ( long unsigned int  n)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer ( double  n)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer ( const char *  n)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer ( const Integer n)

Copy constructor.

Parameters
ninput to be constructed from
giv_all_inlined Integer ( long unsigned *  d,
long  sz 
)

Creates a new Integer from pointers.

Parameters
darray
szsize
Integer ( const vect_t v)

Creates a new Integers for a vector of limbs.

Parameters
vvector of limbs

Member Function Documentation

Integer & operator= ( const Integer n)

copy from an integer.

Parameters
ninteger to copy.
Integer & logcpy ( const Integer n)

copy from an integer.

Parameters
ninteger to copy.
Integer & copy ( const Integer n)

copy from an integer.

Parameters
ninteger to copy.
Examples:
examples/Integer/ProbLucas.C.
static giv_all_inlined bool isleq ( const A &  a,
const B &  b 
)
inlinestatic

isleq

Parameters
a,b
int operator>= ( const Integer l) const

greater or equal.

Parameters
linteger to be compared to
int operator>= ( const int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator>= ( const long int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator>= ( const long unsigned int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator>= ( const unsigned int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator>= ( const double  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator>= ( const float  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator<= ( const Integer l) const

less or equal

Parameters
linteger to be compared to
int operator<= ( const int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator<= ( const long int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator<= ( const long unsigned int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator<= ( const unsigned int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator<= ( const double  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator<= ( const float  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator!= ( const Integer l) const

operator != (not equal)

Parameters
linteger
Returns
1 iff l == this
int operator!= ( const int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator!= ( const long int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator!= ( const long unsigned int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator!= ( const unsigned int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator!= ( const double  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator!= ( const float  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator== ( const Integer l) const

Equality.

Parameters
linteger to be compared to
int operator== ( const int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator== ( const long int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator== ( const long unsigned int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator== ( const unsigned int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator== ( const double  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator== ( const float  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator> ( const Integer l) const

greater (strict)

Parameters
linteger to be compared to
int operator> ( const int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator> ( const long int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator> ( const long unsigned int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator> ( const unsigned int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator> ( const double  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator> ( const float  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator< ( const Integer l) const

less (strict)

Parameters
linteger to be compared to
int operator< ( const int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator< ( const long int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator< ( const long unsigned int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator< ( const unsigned int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator< ( const double  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int operator< ( const float  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer operator^ ( const Integer a) const

XOR (^)

Parameters
ainteger
Integer operator^ ( const long unsigned int &  a) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer operator^ ( const unsigned int &  a) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & operator^= ( const Integer a)

XOR inplace (^=)

Parameters
ainteger
Integer & operator^= ( const long unsigned int &  a)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & operator^= ( const unsigned int &  a)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer operator| ( const Integer a) const

OR (|)

Parameters
ainteger
Integer operator| ( const long unsigned int &  a) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer operator| ( const unsigned int &  a) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & operator|= ( const Integer a)

OR inplace (|=)

Parameters
ainteger
Integer & operator|= ( const long unsigned int &  a)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & operator|= ( const unsigned int &  a)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer operator& ( const Integer a) const

AND (&)

Parameters
ainteger
unsigned int operator& ( const unsigned int &  a) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

long unsigned operator& ( const long unsigned int &  a) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & operator&= ( const Integer a)

AND inplace (&=)

Parameters
ainteger
Integer & operator&= ( const long unsigned int &  a)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & operator&= ( const unsigned int &  a)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer operator<< ( int  l) const

left shift (<<)

Parameters
lshift
Integer operator<< ( long int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer operator<< ( unsigned int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer operator<< ( long unsigned int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & operator<<= ( int  l)

left shift inplace (<<=)

Parameters
lshift
Integer & operator<<= ( long int  l)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & operator<<= ( unsigned int  l)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & operator<<= ( long unsigned int  l)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer operator>> ( int  l) const

right shift (>>)

Parameters
lshift
Integer operator>> ( long int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer operator>> ( unsigned int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer operator>> ( long unsigned int  l) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & operator>>= ( int  l)

right shift inplace (>>=)

Parameters
lshift
Integer & operator>>= ( long int  l)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & operator>>= ( unsigned int  l)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & operator>>= ( long unsigned int  l)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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 int  n 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & addin ( Integer res,
const long unsigned int  n 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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 int  n2 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & add ( Integer res,
const Integer n1,
const long unsigned int  n2 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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 int  n 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & subin ( Integer res,
const long unsigned int  n 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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 int  n2 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & sub ( Integer res,
const Integer n1,
const long unsigned int  n2 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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 int  n 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & mulin ( Integer res,
const long unsigned int  n 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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 int  n2 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & mul ( Integer res,
const Integer n1,
const long unsigned int  n2 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer operator+ ( const Integer n) const

operator +.

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer operator+ ( const long int  n) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & operator+= ( const Integer n)

operator += .

Parameters
nasfriend In the formula.
Returns
(*this) += n.
Integer & operator+= ( const long unsigned int  n)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & operator+= ( const long int  n)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer& operator+= ( const XXX &  n)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer operator- ( const Integer n) const

operator -.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer operator- ( const long int  n) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & operator-= ( const Integer n)

operator -= .

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & operator-= ( const long int  n)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer& operator-= ( const XXX &  n)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer operator- ( ) const

Opposite.

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

operator *.

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer operator* ( const long int  n) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & operator*= ( const Integer n)

operator *= .

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & operator*= ( const long int  n)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer& operator*= ( const XXX &  n)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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
Integer & axpy ( Integer res,
const Integer a,
const long unsigned int  x,
const Integer y 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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.
Integer & axpyin ( Integer res,
const Integer a,
const long unsigned int  x 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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.
Integer & maxpy ( Integer res,
const Integer a,
const long unsigned int  x,
const Integer y 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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.
Integer & maxpyin ( Integer res,
const Integer a,
const long unsigned int  x 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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.
Integer & axmy ( Integer res,
const Integer a,
const long unsigned int  x,
const Integer y 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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 long unsigned int  x 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & divin ( Integer q,
const Integer d 
)
static

Division q/=d.

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & divin ( Integer q,
const long unsigned int  d 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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 int  d 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & div ( Integer q,
const Integer n,
const int  d 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & div ( Integer q,
const Integer n,
const long unsigned int  d 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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 ( Integer q,
const Integer n,
const unsigned long &  d 
)
static

Division operator.

Parameters
ddivisor
Integer & divexact ( Integer q,
const Integer n,
const long &  d 
)
static

Division operator.

Parameters
ddivisor
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 divexact ( const Integer n,
const unsigned long &  d 
)
static

Division operator.

Parameters
ddivisor
Integer divexact ( const Integer n,
const long &  d 
)
static

Division operator.

Parameters
ddivisor
Integer & crem ( Integer r,
const Integer n,
const Integer d 
)
static

Division operator.

Parameters
ddivisor
Integer & frem ( Integer r,
const Integer n,
const Integer d 
)
static

Division operator.

Parameters
ddivisor
Integer & crem ( Integer r,
const Integer n,
const unsigned long &  d 
)
static

Division operator.

Parameters
ddivisor
Integer & frem ( Integer r,
const Integer n,
const unsigned long &  d 
)
static

Division operator.

Parameters
ddivisor
unsigned long crem ( const Integer n,
const unsigned long &  d 
)
static

Division operator.

Parameters
ddivisor
unsigned long frem ( const Integer n,
const unsigned long &  d 
)
static

Division operator.

Parameters
ddivisor
Integer operator/ ( const Integer d) const

Division operator.

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer operator/ ( const long int  d) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & operator/= ( const Integer d)

Division operator (inplace).

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & operator/= ( const long int  d)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer& operator/= ( const XXX &  d)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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 int  n 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & modin ( Integer r,
const long unsigned int  n 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

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 int  d 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & mod ( Integer r,
const Integer n,
const long unsigned int  d 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & divmod ( Integer q,
Integer r,
const Integer n,
const Integer d 
)
static

Euclidean division.

n = d q + r . Computes both the quotient and the residue (as in quorem).

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 int &  r,
const Integer n,
const long int  d 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & divmod ( Integer q,
long unsigned int &  r,
const Integer n,
const long unsigned int  d 
)
static

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & ceil ( Integer res,
const Integer n,
const Integer d 
)
static

rounding functions.

these are the same as the STL ones, except for the signature.

Parameters
resthe result
nthe numerator
dthe demominator

same as std::ceil (n/d)

Integer & floor ( Integer res,
const Integer n,
const Integer d 
)
static

same as std::floor(n/d)

Integer & trunc ( Integer res,
const Integer n,
const Integer d 
)
static

same as std::trunc(n/d)

Integer ceil ( const Integer n,
const Integer d 
)
static

rounding functions.

these are the same as the STL ones, except for the signature.

Parameters
nthe numerator
dthe demominator
Returns
n/d rounded.

same as std::ceil (n/d)

Integer floor ( const Integer n,
const Integer d 
)
static

same as std::floor(n/d)

Integer trunc ( const Integer n,
const Integer d 
)
static

same as std::trunc(n/d)

Integer operator% ( const Integer n) const

Modulo operator.

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

long operator% ( const long int  n) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

double operator% ( const double  n) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

short operator% ( const unsigned short  n) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

XXX operator% ( const XXX &  n) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & operator%= ( const Integer n)

Modulo operator (inplace).

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer & operator%= ( const long int  n)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Integer& operator%= ( const XXX &  n)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

size_t size_in_base ( int  B) const

returns ceil(log_BASE(*this)).

size_t bitsize ( ) const

returns ceil(log_2(*this)) .

long unsigned operator[] ( size_t  i) const

return the i-th word of the integer.

Word 0 is lowest word.

Integer & random_lessthan ( Integer r,
const Integer m 
)
inlinestatic

returns a random integer r in the intervall [[x, m-1]] where x = 0 or -(m-1) according to ALWAYSPOSITIVE

Bug:
m has to be an integer here.
std::ostream & print ( std::ostream &  o) const

print integer.

Parameters
ooutput stream.

Friends And Related Function Documentation

giv_all_inlined friend int compare ( const Integer a,
const Integer b 
)
friend

Compares two integers.

Parameters
ainteger
binteger
Returns
1 if $a > b$, 0 if $a = b$ and -1 otherwise.
giv_all_inlined friend int absCompare ( const Integer a,
const Integer b 
)
friend

Compare the norm of two integers.

Parameters
ainteger
binteger
Returns
1 if $|a| > |b|$, 0 if $|a| = |b|$ and -1 otherwise.
giv_all_inlined friend int absCompare ( const Integer a,
const double  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int absCompare ( const Integer a,
const float  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int absCompare ( const Integer a,
const long unsigned  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int absCompare ( const Integer a,
const unsigned  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int absCompare ( const Integer a,
const long int  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int absCompare ( const Integer a,
const int  b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int absCompare ( const T  a,
const Integer b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined int isOne ( const Integer a)
friend

name compare to 1 and 0

Parameters
a
giv_all_inlined int isMOne ( const Integer a)
friend

Compares two integers.

Parameters
ainteger
binteger
Returns
1 if $a > b$, 0 if $a = b$ and -1 otherwise.
giv_all_inlined int nonZero ( const Integer a)
friend

name compare to 1 and 0

Parameters
a
giv_all_inlined int isZero ( const Integer a)
friend

name compare to 1 and 0

Parameters
a
giv_all_inlined int isZero ( const short int  a)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined int isZero ( const int  a)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined int isZero ( const long int  a)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined int isZero ( const unsigned short int  a)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined int isZero ( const unsigned int  a)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined int isZero ( const long unsigned int  a)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator>= ( unsigned int  l,
const Integer n 
)
friend

greater or equal.

Parameters
l,nintegers to compare
giv_all_inlined friend int operator>= ( float  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator>= ( double  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator>= ( int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator>= ( long int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator>= ( long unsigned int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator<= ( unsigned int  l,
const Integer n 
)
friend

less or equal

Parameters
l,nintegers to compare
giv_all_inlined friend int operator<= ( float  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator<= ( double  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator<= ( int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator<= ( long int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator<= ( long unsigned int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator!= ( unsigned int  l,
const Integer n 
)
friend

operator != (not equal)

Parameters
l,ninteger
Returns
1 iff l == n
giv_all_inlined friend int operator!= ( float  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator!= ( double  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator!= ( int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator!= ( long int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator!= ( long unsigned int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator== ( unsigned int  l,
const Integer n 
)
friend

Equality.

Parameters
l,nintegers to compare
giv_all_inlined friend int operator== ( float  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator== ( double  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator== ( int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator== ( long int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator== ( long unsigned int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator> ( unsigned int  l,
const Integer n 
)
friend

greater (strict)

Parameters
l,nintegers to compare
giv_all_inlined friend int operator> ( float  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator> ( double  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator> ( int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator> ( long int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator> ( long unsigned int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator< ( unsigned int  l,
const Integer n 
)
friend

less (strict)

Parameters
l,nintegers to compare
giv_all_inlined friend int operator< ( float  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator< ( double  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator< ( int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator< ( long int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined friend int operator< ( long unsigned int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer operator+ ( const int  l,
const Integer n 
)
friend

operator +.

Parameters
l,nto be added
giv_all_inlined Integer operator+ ( const unsigned int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer operator+ ( const long int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer operator+ ( const long unsigned int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer operator+ ( const Integer n,
const int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer operator+ ( const Integer n,
const unsigned int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer& operator+= ( Integer n,
const int  l 
)
friend

operator +=.

Parameters
nInteger
lto be added up
giv_all_inlined Integer& operator+= ( Integer n,
const unsigned int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer operator- ( const int  l,
const Integer n 
)
friend

operator -

Parameters
l,nto be substracted
giv_all_inlined Integer operator- ( const unsigned int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer operator- ( const long int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer operator- ( const long unsigned int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer operator- ( const Integer n,
const int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer operator- ( const Integer n,
const unsigned int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer& operator-= ( Integer n,
const int  l 
)
friend

operator -=

Parameters
l,nto be substracted
giv_all_inlined Integer& operator-= ( Integer n,
const unsigned int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer operator* ( const int  l,
const Integer n 
)
friend

operator *

Parameters
l,nto be multpct
giv_all_inlined Integer operator* ( const unsigned int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer operator* ( const long int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer operator* ( const long unsigned int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer operator* ( const Integer n,
const int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer operator* ( const Integer n,
const unsigned int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer& operator*= ( Integer n,
const int  l 
)
friend

operator *=

Parameters
l,nto be multpct
giv_all_inlined Integer& operator*= ( Integer n,
const unsigned int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer operator/ ( const long int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer operator/ ( const Integer n,
const int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer operator/ ( const Integer n,
const unsigned int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer& operator/= ( Integer n,
const long int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer& operator/= ( Integer n,
const unsigned int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer operator% ( const int  l,
const Integer n 
)
friend

operator %

Parameters
l
n
Returns
nl
giv_all_inlined Integer operator% ( const long int  l,
const Integer n 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer operator% ( const Integer n,
const int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer operator% ( const Integer n,
const unsigned int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer& operator%= ( Integer n,
const int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer& operator%= ( Integer n,
const unsigned int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer gcd ( const Integer a,
const Integer b 
)
friend

gcd.

Parameters
a,bintegers
Returns
gcd(a,b)
giv_all_inlined Integer gcd ( Integer u,
Integer v,
const Integer a,
const Integer b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer& gcd ( Integer g,
const Integer a,
const Integer b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer& gcd ( Integer g,
Integer u,
Integer v,
const Integer a,
const Integer b 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer& inv ( Integer u,
const Integer a,
const Integer b 
)
friend

Inverse.

Compute the inverse u = a/b.

Parameters
u
a
b
a
b
[out]uis set to $a^{-1}$ modulo b
giv_all_inlined Integer& invin ( Integer u,
const Integer b 
)
friend

Compute the inverse inplace u = u/b.

Parameters
u
b
giv_all_inlined Integer pp ( const Integer P,
const Integer Q 
)
friend

pp

Parameters
P,Qparams
giv_all_inlined Integer& lcm ( Integer g,
const Integer a,
const Integer b 
)
friend

lcm

Parameters
g,a,b
Returns
g=lcm(a,b)
giv_all_inlined Integer lcm ( const Integer a,
const Integer b 
)
friend

lcm

Parameters
a,b
giv_all_inlined Integer& pow ( Integer Res,
const Integer n,
const long int  l 
)
friend

pow.

return $n^l$

Parameters
Res,n,l
giv_all_inlined Integer& pow ( Integer Res,
const long unsigned int  n,
const long unsigned int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer& pow ( Integer Res,
const Integer n,
const long unsigned int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer& pow ( Integer Res,
const Integer n,
const int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer& pow ( Integer Res,
const Integer n,
const unsigned int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer pow ( const Integer n,
const long int  l 
)
friend

pow.

return $n^l$

Parameters
n,l
giv_all_inlined Integer pow ( const Integer n,
const long unsigned int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer pow ( const Integer n,
const int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer pow ( const Integer n,
const unsigned int  l 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer& powmod ( Integer Res,
const Integer n,
const long int  e,
const Integer m 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer& powmod ( Integer Res,
const Integer n,
const unsigned int  e,
const Integer m 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer& powmod ( Integer Res,
const Integer n,
const int  e,
const Integer m 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer& powmod ( Integer Res,
const Integer n,
const Integer e,
const Integer m 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer powmod ( const Integer n,
const long unsigned int  e,
const Integer m 
)
friend

modular pow.

return $n^e \mod m$.

Parameters
n,e,m
giv_all_inlined Integer powmod ( const Integer n,
const long int  e,
const Integer m 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer powmod ( const Integer n,
const unsigned int  e,
const Integer m 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer powmod ( const Integer n,
const int  e,
const Integer m 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer powmod ( const Integer n,
const Integer e,
const Integer m 
)
friend

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

giv_all_inlined Integer fact ( long unsigned int  l)
friend

fact

Parameters
l
giv_all_inlined Integer sqrt ( const Integer p)
friend

(square) roots

Parameters
p
giv_all_inlined Integer& sqrt ( Integer r,
const Integer p 
)
friend

(square) roots

Parameters
r,p
giv_all_inlined Integer sqrtrem ( const Integer p,
Integer rem 
)
friend

(square) roots

Parameters
p,rem
giv_all_inlined Integer& sqrtrem ( Integer r,
const Integer p,
Integer rem 
)
friend

(square) roots

Parameters
r,p,rem
giv_all_inlined bool root ( Integer q,
const Integer a,
unsigned int  n 
)
friend

(square) roots

Parameters
q,a,n
giv_all_inlined long logp ( const Integer a,
const Integer p 
)
friend

logs

Parameters
a,p
giv_all_inlined double logtwo ( const Integer a)
friend

logs

Parameters
a
giv_all_inlined double naturallog ( const Integer a)
friend

logs

Parameters
a
giv_all_inlined void swap ( Integer a,
Integer b 
)
friend

swap

Parameters
a,b
int sign ( const Integer a)
friend

sign

Parameters
a
giv_all_inlined long unsigned int length ( const Integer a)
friend

returns the number of bytes used to store *this

Parameters
a
Bug:
JGD 23.04.2012: shouldn't it be "mp_limb_t" instead of "long unsigned"?
giv_all_inlined bool isOdd ( const Integer a)
friend

parity of an integer

Parameters
ainteger
Returns
1 if odd, 0 if even
giv_all_inlined std::istream& operator>> ( std::istream &  i,
Integer n 
)
friend

Input/Output of Integers.

in operator.

Parameters
iinput stream
ninteger to be built
giv_all_inlined std::ostream& operator<< ( std::ostream &  o,
const Integer n 
)
friend

out operator.

Parameters
ooutput stream
ninteger to be printed
giv_all_inlined std::ostream& absOutput ( std::ostream &  o,
const Integer n 
)
friend

nodoc

Parameters
ooutput
ninteger
giv_all_inlined void importWords ( Integer x,
size_t  count,
int  order,
int  size,
int  endian,
size_t  nails,
const void *  op 
)
friend

nodoc

Parameters
xx
countx
orderx
sizex
endianx
nailsx
opx

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