Parma_Polyhedra_Library::GMP_Integer Class Reference
[C++ Language Interface]

Unbounded integers as provided by the GMP library. More...

#include <GMP_Integer.types.hh>

List of all members.

Related Functions

(Note that these are not member functions.)

void swap (Parma_Polyhedra_Library::GMP_Integer &x, Parma_Polyhedra_Library::GMP_Integer &y)
 Specializes std::swap.
Accessor Functions
const mpz_class & raw_value (const GMP_Integer &x)
 Returns a const reference to the underlying integer value.
mpz_class & raw_value (GMP_Integer &x)
 Returns a reference to the underlying integer value.
Memory Size Inspection Functions
memory_size_type total_memory_in_bytes (const GMP_Integer &x)
 Returns the total size in bytes of the memory occupied by x.
memory_size_type external_memory_in_bytes (const GMP_Integer &x)
 Returns the size in bytes of the memory managed by x.
Arithmetic Operators
void neg_assign (GMP_Integer &x)
 Assigns to x its negation.
void neg_assign (GMP_Integer &x, const GMP_Integer &y)
 Assigns to x the negation of y.
void gcd_assign (GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
 Assigns to x the greatest common divisor of y and z.
void gcdext_assign (GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z, GMP_Integer &s, GMP_Integer &t)
 Extended GCD.
void lcm_assign (GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
 Assigns to x the least common multiple of y and z.
void add_mul_assign (GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
 Assigns to x the value x + y * z.
void sub_mul_assign (GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
 Assigns to x the value x - y * z.
void exact_div_assign (GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
 If z divides y, assigns to x the quotient of the integer division of y and z.
void sqrt_assign (GMP_Integer &x, const GMP_Integer &y)
 Assigns to x the integer square root of y.
int cmp (const GMP_Integer &x, const GMP_Integer &y)
 Returns a negative, zero or positive value depending on whether x is lower than, equal to or greater than y, respectively.


Detailed Description

Unbounded integers as provided by the GMP library.

GMP_Integer is an alias for the mpz_class type defined in the C++ interface of the GMP library. For more information, see http://www.swox.com/gmp/


Friends And Related Function Documentation

const mpz_class & raw_value ( const GMP_Integer x  )  [related]

Returns a const reference to the underlying integer value.

Definition at line 84 of file GMP_Integer.inlines.hh.

00084                                 {
00085   return x;
00086 }

mpz_class & raw_value ( GMP_Integer x  )  [related]

Returns a reference to the underlying integer value.

Definition at line 89 of file GMP_Integer.inlines.hh.

00089                           {
00090   return x;
00091 }

memory_size_type total_memory_in_bytes ( const GMP_Integer x  )  [related]

Returns the total size in bytes of the memory occupied by x.

Definition at line 99 of file GMP_Integer.inlines.hh.

00099                                             {
00100   return sizeof(x) + external_memory_in_bytes(x);
00101 }

memory_size_type external_memory_in_bytes ( const GMP_Integer x  )  [related]

Returns the size in bytes of the memory managed by x.

Definition at line 94 of file GMP_Integer.inlines.hh.

00094                                                {
00095   return x.get_mpz_t()[0]._mp_alloc * SIZEOF_MP_LIMB_T;
00096 }

void neg_assign ( GMP_Integer x  )  [related]

Assigns to x its negation.

Definition at line 29 of file GMP_Integer.inlines.hh.

00029                            {
00030   mpz_neg(x.get_mpz_t(), x.get_mpz_t());
00031 }

void neg_assign ( GMP_Integer x,
const GMP_Integer y 
) [related]

Assigns to x the negation of y.

Definition at line 34 of file GMP_Integer.inlines.hh.

00034                                                  {
00035   mpz_neg(x.get_mpz_t(), y.get_mpz_t());
00036 }

void gcd_assign ( GMP_Integer x,
const GMP_Integer y,
const GMP_Integer z 
) [related]

Assigns to x the greatest common divisor of y and z.

Definition at line 39 of file GMP_Integer.inlines.hh.

00039                                                                        {
00040   mpz_gcd(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
00041 }

void gcdext_assign ( GMP_Integer x,
const GMP_Integer y,
const GMP_Integer z,
GMP_Integer s,
GMP_Integer t 
) [related]

Extended GCD.

Assigns to x the greatest common divisor of y and z, and to s and t the values such that y * s + z * t = x.

Definition at line 44 of file GMP_Integer.inlines.hh.

00046                                               {
00047   mpz_gcdext(x.get_mpz_t(),
00048              s.get_mpz_t(), t.get_mpz_t(),
00049              y.get_mpz_t(), z.get_mpz_t());
00050 }

void lcm_assign ( GMP_Integer x,
const GMP_Integer y,
const GMP_Integer z 
) [related]

Assigns to x the least common multiple of y and z.

Definition at line 53 of file GMP_Integer.inlines.hh.

00053                                                                        {
00054   mpz_lcm(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
00055 }

void add_mul_assign ( GMP_Integer x,
const GMP_Integer y,
const GMP_Integer z 
) [related]

Assigns to x the value x + y * z.

Definition at line 58 of file GMP_Integer.inlines.hh.

00058                                                                            {
00059   mpz_addmul(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
00060 }

void sub_mul_assign ( GMP_Integer x,
const GMP_Integer y,
const GMP_Integer z 
) [related]

Assigns to x the value x - y * z.

Definition at line 63 of file GMP_Integer.inlines.hh.

00063                                                                            {
00064   mpz_submul(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
00065 }

void exact_div_assign ( GMP_Integer x,
const GMP_Integer y,
const GMP_Integer z 
) [related]

If z divides y, assigns to x the quotient of the integer division of y and z.

The behavior is undefined if z does not divide y.

Definition at line 68 of file GMP_Integer.inlines.hh.

00068                                                                              {
00069   assert(y % z == 0);
00070   mpz_divexact(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
00071 }

void sqrt_assign ( GMP_Integer x,
const GMP_Integer y 
) [related]

Assigns to x the integer square root of y.

Definition at line 74 of file GMP_Integer.inlines.hh.

00074                                                   {
00075   mpz_sqrt(x.get_mpz_t(), y.get_mpz_t());
00076 }

int cmp ( const GMP_Integer x,
const GMP_Integer y 
) [related]

Returns a negative, zero or positive value depending on whether x is lower than, equal to or greater than y, respectively.

Definition at line 79 of file GMP_Integer.inlines.hh.

00079                                                 {
00080   return mpz_cmp(x.get_mpz_t(), y.get_mpz_t());
00081 }

Specializes std::swap.

Definition at line 107 of file GMP_Integer.inlines.hh.

00108                                                  {
00109   mpz_swap(x.get_mpz_t(), y.get_mpz_t());
00110 }


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

Generated on Wed Jul 16 22:55:53 2008 for PPL by  doxygen 1.5.6