PPL  1.2
Parma_Polyhedra_Library::GMP_Integer Class Reference

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

#include <GMP_Integer_types.hh>

Related Functions

(Note that these are not member functions.)

Accessor Functions
const mpz_class & raw_value (const GMP_Integer &x)
 Returns a const reference to the underlying integer value. More...
 
mpz_class & raw_value (GMP_Integer &x)
 Returns a reference to the underlying integer value. More...
 
Arithmetic Operators
void neg_assign (GMP_Integer &x)
 Assigns to x its negation. More...
 
void neg_assign (GMP_Integer &x, const GMP_Integer &y)
 Assigns to x the negation of y. More...
 
void abs_assign (GMP_Integer &x)
 Assigns to x its absolute value. More...
 
void abs_assign (GMP_Integer &x, const GMP_Integer &y)
 Assigns to x the absolute value of y. More...
 
void rem_assign (GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
 Assigns to x the remainder of the division of y by z. More...
 
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. More...
 
void gcdext_assign (GMP_Integer &x, GMP_Integer &s, GMP_Integer &t, const GMP_Integer &y, const GMP_Integer &z)
 Extended GCD. More...
 
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. More...
 
void add_mul_assign (GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
 Assigns to x the value x + y * z. More...
 
void sub_mul_assign (GMP_Integer &x, const GMP_Integer &y, const GMP_Integer &z)
 Assigns to x the value x - y * z. More...
 
void mul_2exp_assign (GMP_Integer &x, const GMP_Integer &y, unsigned int exp)
 Assigns to x the value $ y \cdot 2^\mathtt{exp} $. More...
 
void div_2exp_assign (GMP_Integer &x, const GMP_Integer &y, unsigned int exp)
 Assigns to x the value $ y / 2^\mathtt{exp} $. More...
 
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. More...
 
void sqrt_assign (GMP_Integer &x, const GMP_Integer &y)
 Assigns to x the integer square root of y. More...
 
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. More...
 

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://gmplib.org/

Friends And Related Function Documentation

void abs_assign ( GMP_Integer x)
related

Assigns to x its absolute value.

Definition at line 42 of file GMP_Integer_inlines.hh.

42  {
43  mpz_abs(x.get_mpz_t(), x.get_mpz_t());
44 }
void abs_assign ( GMP_Integer x,
const GMP_Integer y 
)
related

Assigns to x the absolute value of y.

Definition at line 47 of file GMP_Integer_inlines.hh.

47  {
48  mpz_abs(x.get_mpz_t(), y.get_mpz_t());
49 }
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 75 of file GMP_Integer_inlines.hh.

75  {
76  mpz_addmul(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
77 }
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 106 of file GMP_Integer_inlines.hh.

106  {
107  return mpz_cmp(x.get_mpz_t(), y.get_mpz_t());
108 }
void div_2exp_assign ( GMP_Integer x,
const GMP_Integer y,
unsigned int  exp 
)
related

Assigns to x the value $ y / 2^\mathtt{exp} $.

Definition at line 90 of file GMP_Integer_inlines.hh.

90  {
91  mpz_tdiv_q_2exp(x.get_mpz_t(), y.get_mpz_t(), exp);
92 }
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 95 of file GMP_Integer_inlines.hh.

95  {
96  PPL_ASSERT(y % z == 0);
97  mpz_divexact(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
98 }
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 52 of file GMP_Integer_inlines.hh.

52  {
53  mpz_gcd(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
54 }
void gcdext_assign ( GMP_Integer x,
GMP_Integer s,
GMP_Integer t,
const GMP_Integer y,
const GMP_Integer z 
)
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 62 of file GMP_Integer_inlines.hh.

63  {
64  mpz_gcdext(x.get_mpz_t(),
65  s.get_mpz_t(), t.get_mpz_t(),
66  y.get_mpz_t(), z.get_mpz_t());
67 }
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 70 of file GMP_Integer_inlines.hh.

70  {
71  mpz_lcm(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
72 }
void mul_2exp_assign ( GMP_Integer x,
const GMP_Integer y,
unsigned int  exp 
)
related

Assigns to x the value $ y \cdot 2^\mathtt{exp} $.

Definition at line 85 of file GMP_Integer_inlines.hh.

85  {
86  mpz_mul_2exp(x.get_mpz_t(), y.get_mpz_t(), exp);
87 }
void neg_assign ( GMP_Integer x)
related

Assigns to x its negation.

Definition at line 32 of file GMP_Integer_inlines.hh.

32  {
33  mpz_neg(x.get_mpz_t(), x.get_mpz_t());
34 }
void neg_assign ( GMP_Integer x,
const GMP_Integer y 
)
related

Assigns to x the negation of y.

Definition at line 37 of file GMP_Integer_inlines.hh.

37  {
38  mpz_neg(x.get_mpz_t(), y.get_mpz_t());
39 }
const mpz_class & raw_value ( const GMP_Integer x)
related

Returns a const reference to the underlying integer value.

Definition at line 111 of file GMP_Integer_inlines.hh.

111  {
112  return x;
113 }
mpz_class & raw_value ( GMP_Integer x)
related

Returns a reference to the underlying integer value.

Definition at line 116 of file GMP_Integer_inlines.hh.

116  {
117  return x;
118 }
void rem_assign ( GMP_Integer x,
const GMP_Integer y,
const GMP_Integer z 
)
related

Assigns to x the remainder of the division of y by z.

Definition at line 57 of file GMP_Integer_inlines.hh.

57  {
58  mpz_tdiv_r(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
59 }
void sqrt_assign ( GMP_Integer x,
const GMP_Integer y 
)
related

Assigns to x the integer square root of y.

Definition at line 101 of file GMP_Integer_inlines.hh.

101  {
102  mpz_sqrt(x.get_mpz_t(), y.get_mpz_t());
103 }
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 80 of file GMP_Integer_inlines.hh.

80  {
81  mpz_submul(x.get_mpz_t(), y.get_mpz_t(), z.get_mpz_t());
82 }

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