2 #ifndef _BPAS_RATIONAL_NUMBER_H_     3 #define _BPAS_RATIONAL_NUMBER_H_     5 #include "BPASField.hpp"    44         RationalNumber (
const mpz_class& a, 
const mpz_class& b = mpz_class(1));
    83         inline mpq_class get_mpq()
 const {
    87         inline mpq_class& get_mpq_ref() {
    91         inline const mpq_class& get_mpq_ref()
 const {
    95         inline mpq_ptr get_mpq_t() {
    96             return _m.get_mpq_t();
    99         inline mpq_srcptr get_mpq_t()
 const {
   100             return _m.get_mpq_t();
   103         inline Integer get_num()
 const {
   107         double get_d()
 const {
   111         inline Integer get_den()
 const {
   231             mpq_neg(ret._m.get_mpq_t(), (*this)._m.get_mpq_t());
   326             std::vector<RationalNumber> ret;
   327             ret.push_back(*
this);
   369             mpz_pow_ui(r._m.get_num_mpz_t(), _m.get_num_mpz_t(), (
unsigned long int) e);
   370             mpz_pow_ui(r._m.get_den_mpz_t(), _m.get_den_mpz_t(), (
unsigned long int) e);
   390             mpz_set(ret._m.get_den_mpz_t(), _m.get_num_mpz_t());
   391             mpz_set(ret._m.get_num_mpz_t(), _m.get_den_mpz_t());
   392             ret._m.canonicalize();
 RationalNumber & operator+=(const RationalNumber &i)
Addition assignment. 
Definition: RationalNumber.hpp:204
RationalNumber operator^(long long int e) const
Overload operator ^ replace xor operation by exponentiation. 
Definition: RationalNumber.hpp:367
A sparsely represented univariate polynomial over an arbitrary ring. 
Definition: BigPrimeField.hpp:21
void negativeOne()
Assign to negative one. 
Definition: RationalNumber.hpp:165
void zero()
Assign to zero. 
Definition: RationalNumber.hpp:129
A multivariate polynomial with RationalNumber coefficients represented sparely. 
Definition: mrpolynomial.h:71
An arbitrary-precision complex rational number. 
Definition: ComplexRationalNumber.hpp:23
bool isZero() const
Is a zero. 
Definition: RationalNumber.hpp:120
Factors< RationalNumber > squareFree() const
Compute squarefree factorization of *this. 
Definition: RationalNumber.hpp:325
void one()
Assign to one. 
Definition: RationalNumber.hpp:147
An ExpressionTree encompasses various forms of data that can be expressed generically as a binary tre...
Definition: ExpressionTree.hpp:17
A finite field whose prime should be a generalized fermat number. 
Definition: GeneralizedFermatPrimeField.hpp:36
RationalNumber & operator-=(const RationalNumber &i)
Subtraction assignment. 
Definition: RationalNumber.hpp:221
bool isOne() const
Is a 1. 
Definition: RationalNumber.hpp:138
RationalNumber & operator^=(long long int e)
Exponentiation assignment. 
Definition: RationalNumber.hpp:374
RationalNumber gcd(const RationalNumber &b) const
GCD(a, b) 
Definition: RationalNumber.hpp:313
A prime field whose prime is 32 bits or less. 
Definition: SmallPrimeField.hpp:450
A univariate polynomial with Integer coefficients using a dense representation. 
Definition: uzpolynomial.h:14
RationalNumber remainder(const RationalNumber &b) const
Get the remainder of *this and b. 
RationalNumber operator*(const RationalNumber &i) const
Multiplication. 
Definition: RationalNumber.hpp:238
RationalNumber & operator/=(const RationalNumber &i)
Exact division assignment. 
Definition: RationalNumber.hpp:287
RationalNumber & operator*=(const RationalNumber &i)
Multiplication assignment. 
Definition: RationalNumber.hpp:247
A univariate polynomial with RationalNumber coefficients represented densely. 
Definition: urpolynomial.h:16
Integer euclideanSize() const
Get the euclidean size of *this. 
Definition: RationalNumber.hpp:334
A prime field whose prime can be arbitrarily large. 
Definition: BigPrimeField.hpp:27
A simple data structure for encapsulating a collection of Factor elements. 
Definition: Factors.hpp:95
int isConstant() const
Is a constant. 
Definition: RationalNumber.hpp:174
RationalNumber extendedEuclidean(const RationalNumber &b, RationalNumber *s=NULL, RationalNumber *t=NULL) const
Perform the extended euclidean division on *this and b. 
An arbitrary-precision Integer. 
Definition: Integer.hpp:22
bool operator==(const RationalNumber &i) const
Equality test,. 
Definition: RationalNumber.hpp:257
RationalNumber unitCanonical(RationalNumber *u=NULL, RationalNumber *v=NULL) const
Obtain the unit normal (a.k.a canonical associate) of an element. 
RationalNumber & operator=(const RationalNumber &a)
Copy assignment. 
RationalNumber euclideanDivision(const RationalNumber &b, RationalNumber *q=NULL) const
Perform the eucldiean division of *this and b. 
RationalNumber operator-() const
Negation. 
Definition: RationalNumber.hpp:229
RationalNumber quotient(const RationalNumber &b) const
Get the quotient of *this and b. 
An arbitrary-precision rational number. 
Definition: RationalNumber.hpp:24
An abstract class defining the interface of a field. 
Definition: BPASField.hpp:11
RationalNumber inverse() const
Get the inverse of *this. 
Definition: RationalNumber.hpp:388
RationalNumber operator/(const RationalNumber &i) const
Exact division. 
Definition: RationalNumber.hpp:277
RationalNumber & operator%=(const RationalNumber &r)
Assign *this to be the remainder of *this and b. 
Definition: RationalNumber.hpp:383
ExprTreeNode is a single node in the bianry tree of an ExpressionTree. 
Definition: ExprTreeNode.hpp:76
bool operator!=(const RationalNumber &i) const
Inequality test,. 
Definition: RationalNumber.hpp:266
RationalNumber operator%(const RationalNumber &r) const
Get the remainder of *this and b;. 
Definition: RationalNumber.hpp:379
ExpressionTree convertToExpressionTree() const
Convert this to an expression tree. 
Definition: RationalNumber.hpp:270
RationalNumber operator+(const RationalNumber &i) const
Addition. 
Definition: RationalNumber.hpp:195
bool isNegativeOne() const
Is a -1. 
Definition: RationalNumber.hpp:156