Givaro
|
#include <gmp++_rat.h>
Public Types | |
enum | reduceFlag { Reduce = 0x1, NoReduce = 0x0 } |
Public Member Functions | |
giv_all_inlined | Rationel () |
default constructor (0/1). | |
~Rationel () | |
Destructor. | |
giv_all_inlined Rationel & | negin () |
giv_all_inlined | operator std::string () const |
giv_all_inlined Integer | getDenom () const |
Gets the denominator of a Rationel . | |
giv_all_inlined Integer | getNumer () const |
Gets the numerator of a Rationel . | |
giv_all_inlined mpq_ptr | get_mpq () |
Retrieve the GMP representation of a Rationel. | |
giv_all_inlined mpq_srcptr | get_mpq_const () const |
giv_all_inlined mpz_ptr | get_mpq_den () const |
Retrieve the GMP representation of the denominator of a Rationel. | |
giv_all_inlined mpz_ptr | get_mpq_num () const |
Retrieve the GMP representation of the numerator of a Rationel. | |
giv_all_inlined Rationel & | reduce () |
Reduces (inplace) a fraction to a canonical representation. | |
giv_all_inlined int | isZero () |
giv_all_inlined Rationel & | logcpy (const Rationel &n) |
giv_all_inlined Rationel & | operator= (const Rationel &n) |
giv_all_inlined Rationel & | operator= (const Integer &n) |
giv_all_inlined | Rationel (Integer &n) |
constructors from a single numerator. | |
giv_all_inlined | Rationel (int n) |
constructors from a single numerator. | |
giv_all_inlined | Rationel (unsigned int n) |
constructors from a single numerator. | |
giv_all_inlined | Rationel (long int n) |
constructors from a single numerator. | |
giv_all_inlined | Rationel (long unsigned int n) |
constructors from a single numerator. | |
giv_all_inlined | Rationel (Integer &n, Integer &d, enum reduceFlag=NoReduce) |
constructors from a numerator and a denominator. | |
giv_all_inlined | Rationel (int n, int d, enum reduceFlag=NoReduce) |
constructors from a numerator and a denominator. | |
giv_all_inlined | Rationel (unsigned int n, int d, enum reduceFlag=NoReduce) |
constructors from a numerator and a denominator. | |
giv_all_inlined | Rationel (long int n, int d, enum reduceFlag=NoReduce) |
constructors from a numerator and a denominator. | |
giv_all_inlined | Rationel (long unsigned int n, int d, enum reduceFlag=NoReduce) |
constructors from a numerator and a denominator. | |
giv_all_inlined | Rationel (int n, unsigned int d, enum reduceFlag=NoReduce) |
constructors from a numerator and a denominator. | |
giv_all_inlined | Rationel (int n, long int d, enum reduceFlag=NoReduce) |
constructors from a numerator and a denominator. | |
giv_all_inlined | Rationel (int n, long unsigned int d, enum reduceFlag=NoReduce) |
constructors from a numerator and a denominator. | |
giv_all_inlined | Rationel (unsigned int n, unsigned int d, enum reduceFlag=NoReduce) |
constructors from a numerator and a denominator. | |
giv_all_inlined | Rationel (unsigned int n, long int d, enum reduceFlag=NoReduce) |
constructors from a numerator and a denominator. | |
giv_all_inlined | Rationel (unsigned int n, long unsigned int d, enum reduceFlag=NoReduce) |
constructors from a numerator and a denominator. | |
giv_all_inlined | Rationel (long unsigned int n, unsigned int d, enum reduceFlag=NoReduce) |
constructors from a numerator and a denominator. | |
giv_all_inlined | Rationel (long int n, unsigned int d, enum reduceFlag=NoReduce) |
constructors from a numerator and a denominator. | |
giv_all_inlined | Rationel (long int n, long int d, enum reduceFlag=NoReduce) |
constructors from a numerator and a denominator. | |
giv_all_inlined | Rationel (long unsigned int n, long int d, enum reduceFlag=NoReduce) |
constructors from a numerator and a denominator. | |
giv_all_inlined | Rationel (long int n, long unsigned int d, enum reduceFlag=NoReduce) |
constructors from a numerator and a denominator. | |
giv_all_inlined | Rationel (long unsigned int n, long unsigned int d, enum reduceFlag=NoReduce) |
constructors from a numerator and a denominator. | |
template<class T > | |
giv_all_inlined | Rationel (Integer &n, T d, enum reduceFlag=NoReduce) |
template<class T > | |
giv_all_inlined | Rationel (T n, Integer &d, enum reduceFlag=NoReduce) |
template<class T , class U > | |
giv_all_inlined | Rationel (T n, U d, enum reduceFlag=NoReduce) |
template<class T , class U > | |
giv_all_inlined | Rationel (T &n, U &d, enum reduceFlag=NoReduce) |
giv_all_inlined | Rationel (Rationel &f, enum reduceFlag=NoReduce) |
constructors from another Rationel | |
giv_all_inlined | Rationel (float f, enum reduceFlag=NoReduce) |
constructors from another Rationel | |
giv_all_inlined | Rationel (double f, enum reduceFlag=NoReduce) |
constructors from another Rationel | |
giv_all_inlined | Rationel (long double f, enum reduceFlag=NoReduce) |
constructors from another Rationel |
Static Public Member Functions | |
static giv_all_inlined Rationel & | addin (Rationel &res, const Rationel &n) |
static giv_all_inlined Rationel & | addin (Rationel &res, const Integer &n) |
static giv_all_inlined Rationel & | negin (Rationel &res) |
static giv_all_inlined Rationel & | reduce (Rationel &r) |
Reduces a fraction to a canonical representation. | |
static int | isZero (const Rationel &n) |
static giv_all_inlined void | setInteger (Rationel &f, const Integer &n) |
Protected Types | |
typedef __mpq_struct | Rep |
typedef __mpz_struct | RawRep |
Protected Member Functions | |
int | privSign () const |
const Rep * | get_rep () const |
Protected Attributes | |
Rep | gmp_rep |
RawRep * | num |
RawRep * | den |
Static Protected Attributes | |
static reduceFlag | flags |
flag that indicates reduction is done or not after an operation. |
Friends | |
giv_all_inlined Rationel | abs (const Rationel &n) |
I/O | |
giv_all_inlined std::ostream & | print (std::ostream &o) const |
giv_all_inlined std::istream & | operator>> (std::istream &i, Rationel &n) |
giv_all_inlined std::ostream & | operator<< (std::ostream &o, const Rationel &n) |
giv_all_inlined std::ostream & | absOutput (std::ostream &o, const Rationel &n) |
|
protected |
|
protected |
enum reduceFlag |
Rationel | ( | ) |
default constructor (0/1).
constructors from a single numerator.
n | numerator, will make fraction n/1 |
Rationel | ( | int | n | ) |
constructors from a single numerator.
n | numerator, will make fraction n/1 |
Rationel | ( | unsigned int | n | ) |
constructors from a single numerator.
n | numerator, will make fraction n/1 |
Rationel | ( | long int | n | ) |
constructors from a single numerator.
n | numerator, will make fraction n/1 |
Rationel | ( | long unsigned int | n | ) |
constructors from a single numerator.
n | numerator, will make fraction n/1 |
Rationel | ( | Integer & | n, |
Integer & | d, | ||
enum reduceFlag | red = NoReduce |
||
) |
Rationel | ( | int | n, |
int | d, | ||
enum reduceFlag | red = NoReduce |
||
) |
Rationel | ( | unsigned int | n, |
int | d, | ||
enum reduceFlag | red = NoReduce |
||
) |
Rationel | ( | long int | n, |
int | d, | ||
enum reduceFlag | red = NoReduce |
||
) |
Rationel | ( | long unsigned int | n, |
int | d, | ||
enum reduceFlag | red = NoReduce |
||
) |
Rationel | ( | int | n, |
unsigned int | d, | ||
enum reduceFlag | red = NoReduce |
||
) |
Rationel | ( | int | n, |
long int | d, | ||
enum reduceFlag | red = NoReduce |
||
) |
Rationel | ( | int | n, |
long unsigned int | d, | ||
enum reduceFlag | red = NoReduce |
||
) |
Rationel | ( | unsigned int | n, |
unsigned int | d, | ||
enum reduceFlag | red = NoReduce |
||
) |
Rationel | ( | unsigned int | n, |
long int | d, | ||
enum reduceFlag | red = NoReduce |
||
) |
Rationel | ( | unsigned int | n, |
long unsigned int | d, | ||
enum reduceFlag | red = NoReduce |
||
) |
Rationel | ( | long unsigned int | n, |
unsigned int | d, | ||
enum reduceFlag | red = NoReduce |
||
) |
Rationel | ( | long int | n, |
unsigned int | d, | ||
enum reduceFlag | red = NoReduce |
||
) |
Rationel | ( | long int | n, |
long int | d, | ||
enum reduceFlag | red = NoReduce |
||
) |
Rationel | ( | long unsigned int | n, |
long int | d, | ||
enum reduceFlag | red = NoReduce |
||
) |
Rationel | ( | long int | n, |
long unsigned int | d, | ||
enum reduceFlag | red = NoReduce |
||
) |
Rationel | ( | long unsigned int | n, |
long unsigned int | d, | ||
enum reduceFlag | red = NoReduce |
||
) |
Rationel | ( | T | n, |
U | d, | ||
enum reduceFlag | red = NoReduce |
||
) |
Rationel | ( | T & | n, |
U & | d, | ||
enum reduceFlag | red = NoReduce |
||
) |
Rationel | ( | Rationel & | n, |
enum reduceFlag | red = NoReduce |
||
) |
Rationel | ( | float | f, |
enum reduceFlag | red = NoReduce |
||
) |
Rationel | ( | double | f, |
enum reduceFlag | red = NoReduce |
||
) |
Rationel | ( | long double | f, |
enum reduceFlag | red = NoReduce |
||
) |
|
inline |
Destructor.
Clearing the mpq
representation.
|
protected |
|
inlineprotected |
|
inlinestatic |
|
inline |
operator std::string | ( | ) | const |
std::ostream & print | ( | std::ostream & | o | ) | const |
mpq_ptr get_mpq | ( | ) |
Retrieve the GMP representation of a Rationel.
mpq_srcptr get_mpq_const | ( | ) | const |
mpz_ptr get_mpq_den | ( | ) | const |
Retrieve the GMP representation of the denominator of a Rationel.
mpz_ptr get_mpq_num | ( | ) | const |
Retrieve the GMP representation of the numerator of a Rationel.
Rationel & reduce | ( | ) |
Reduces (inplace) a fraction to a canonical representation.
Reduces a fraction to a canonical representation.
r | a Rationel |
r
.
|
inlinestatic |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
|
friend |
|
friend |
|
friend |
|
friend |
|
protected |
|
protected |
|
protected |
|
staticprotected |
flag that indicates reduction is done or not after an operation.
By default, this is Reduce (as in GMP).