Scippy

SoPlex

Sequential object-oriented simPlex

Rational Class Reference

Wrapper for GMP type mpq_class.We wrap mpq_class so that we can replace it by a double type if GMP is not available. More...

#include <rational.h>

Classes

class  Private
 Defines the "Pimpl"-class Private. More...
 

Public Member Functions

GMP Only methods

Methods of the Rational class that are only available if SoPlex is compiled with "-DGMP=on"

Rationaloperator= (const mpq_t &q)
 assignment operator from mpq_t More...
 
const mpq_t * getMpqPtr () const
 provides read-only access to underlying mpq_t More...
 
const mpq_t & getMpqRef () const
 provides read-only access to underlying mpq_t More...
 
mpq_t * getMpqPtr_w () const
 provides write access to underlying mpq_t; use with care More...
 
mpq_t & getMpqRef_w () const
 provides write access to underlying mpq_t; use with care More...
 
Typecasts
 operator double () const
 typecasts Rational to double (allows only explicit typecast) More...
 
 operator long double () const
 typecasts Rational to long double (allows only explicit typecast) More...
 
Arithmetic operators
Rational operator+ (const Rational &r) const
 addition operator More...
 
Rationaloperator+= (const Rational &r)
 addition assignment operator More...
 
Rational operator+ (const double &r) const
 addition operator for doubles More...
 
Rationaloperator+= (const double &r)
 addition assignment operator for doubles More...
 
Rational operator+ (const int &r) const
 addition operator for ints More...
 
Rationaloperator+= (const int &r)
 addition assignment operator for ints More...
 
Rational operator- (const Rational &r) const
 subtraction operator More...
 
Rationaloperator-= (const Rational &r)
 subtraction assignment operator More...
 
Rational operator- (const double &r) const
 subtraction operator for doubles More...
 
Rationaloperator-= (const double &r)
 subtraction assignment operator for doubles More...
 
Rational operator- (const int &r) const
 subtraction operator for ints More...
 
Rationaloperator-= (const int &r)
 subtraction assignment operator for ints More...
 
Rational operator* (const Rational &r) const
 multiplication operator More...
 
Rationaloperator*= (const Rational &r)
 multiplication assignment operator operator More...
 
Rational operator* (const double &r) const
 multiplication operator for doubles More...
 
Rationaloperator*= (const double &r)
 multiplication assignment operator for doubles More...
 
Rational operator* (const int &r) const
 multiplication operator for ints More...
 
Rationaloperator*= (const int &r)
 multiplication assignment operator for ints More...
 
Rational operator/ (const Rational &r) const
 division operator More...
 
Rationaloperator/= (const Rational &r)
 division assignment operator More...
 
Rational operator/ (const double &r) const
 division operator for doubles More...
 
Rationaloperator/= (const double &r)
 division assignment operator for doubles More...
 
Rational operator/ (const int &r) const
 division operator for ints More...
 
Rationaloperator/= (const int &r)
 division assignment operator for ints More...
 
RationaladdProduct (const Rational &r, const Rational &s)
 add product of two rationals More...
 
RationalsubProduct (const Rational &r, const Rational &s)
 subtract product of two rationals More...
 
RationaladdQuotient (const Rational &r, const Rational &s)
 add quotient of two rationals, r divided by s More...
 
RationalsubQuotient (const Rational &r, const Rational &s)
 subtract quotient of two rationals, r divided by s More...
 
Rationalinvert ()
 inversion More...
 
RationalpowRound ()
 round up to next power of two More...
 
Methods for checking exactness of doubles
bool isNextTo (const double &d)
 checks if d is the closest number that can be represented by double More...
 
bool isAdjacentTo (const double &d) const
 checks if d is exactly equal to the Rational and if not, if it is one of the two adjacent doubles More...
 
Methods for querying size
int sizeInBase (const int base=2) const
 Size in specified base (bit size for base 2) More...
 

Static Public Member Functions

Static methods
static int precision ()
 returns precision of Rational implementation, i.e., number of bits used to store Rational numbers (INT_MAX if exact) More...
 

Private Member Functions

 Rational (const int &i, const bool &dummy)
 special constructor only for initializing static rational variables; this is necessary since we need a constructor for Rational::{ZERO, POSONE, NEGONE} that does not use these numbers More...
 

Private Attributes

Privatedpointer
 

Static Private Attributes

static THREADLOCAL IdList< PrivateunusedPrivateList
 list of unused Private objects More...
 
static THREADLOCAL bool useListMem = true
 list of unused Private objects; note that this cannot be used if SOPLEX_WITH_GMP is not defined, since then the Private class has no member next() and prev() should list memory be used? More...
 
Static variables for special rational values
static const Rational ZERO
 rational zero (GMP only) More...
 
static const Rational POSONE
 rational plus one (GMP only) More...
 
static const Rational NEGONE
 rational minus one (GMP only) More...
 

Friends

Friends
int compareRational (const Rational &r, const Rational &s)
 comparison operator returning a positive value if r > s, zero if r = s, and a negative value if r < s More...
 
bool operator!= (const Rational &r, const Rational &s)
 inequality operator More...
 
bool operator== (const Rational &r, const Rational &s)
 equality operator More...
 
bool operator< (const Rational &r, const Rational &s)
 less than operator More...
 
bool operator<= (const Rational &r, const Rational &s)
 less than or equal to operator More...
 
bool operator> (const Rational &r, const Rational &s)
 greater than operator More...
 
bool operator>= (const Rational &r, const Rational &s)
 greater than or equal to operator More...
 
bool operator!= (const Rational &r, const double &s)
 inequality operator for Rational and double More...
 
bool operator== (const Rational &r, const double &s)
 equality operator for Rational and double More...
 
bool operator< (const Rational &r, const double &s)
 less than operator for Rational and double More...
 
bool operator<= (const Rational &r, const double &s)
 less than or equal to operator for Rational and double More...
 
bool operator> (const Rational &r, const double &s)
 greater than operator for Rational and double More...
 
bool operator>= (const Rational &r, const double &s)
 greater than or equal to operator for Rational and double More...
 
bool operator!= (const double &r, const Rational &s)
 inequality operator double and Rational More...
 
bool operator== (const double &r, const Rational &s)
 equality operator for double and Rational More...
 
bool operator< (const double &r, const Rational &s)
 less than operator double and Rational More...
 
bool operator<= (const double &r, const Rational &s)
 less than or equal to operator double and Rational More...
 
bool operator> (const double &r, const Rational &s)
 greater than operator double and Rational More...
 
bool operator>= (const double &r, const Rational &s)
 greater than or equal to operator double and Rational More...
 
bool operator!= (const Rational &r, const long double &s)
 inequality operator for Rational and long double More...
 
bool operator== (const Rational &r, const long double &s)
 equality operator for Rational and long double More...
 
bool operator< (const Rational &r, const long double &s)
 less than operator for Rational and long double More...
 
bool operator<= (const Rational &r, const long double &s)
 less than or equal to operator for Rational and long double More...
 
bool operator> (const Rational &r, const long double &s)
 greater than operator for Rational and long double More...
 
bool operator>= (const Rational &r, const long double &s)
 greater than or equal to operator for Rational and long double More...
 
bool operator!= (const long double &r, const Rational &s)
 inequality operator for long double and Rational More...
 
bool operator== (const long double &r, const Rational &s)
 equality operator for long double and Rational More...
 
bool operator< (const long double &r, const Rational &s)
 less than operator for long double and Rational More...
 
bool operator<= (const long double &r, const Rational &s)
 less than or equal to operator for long double and Rational More...
 
bool operator> (const long double &r, const Rational &s)
 greater than operator for long double and Rational More...
 
bool operator>= (const long double &r, const Rational &s)
 greater than or equal to operator for long double and Rational More...
 
Rational operator+ (const double &d, const Rational &r)
 addition operator for double and Rational More...
 
Rational operator- (const double &d, const Rational &r)
 subtraction operator for double and Rational More...
 
Rational operator* (const double &d, const Rational &r)
 multiplication operator for double and Rational More...
 
Rational operator/ (const double &d, const Rational &r)
 division operator for double and Rational More...
 
bool operator!= (const Rational &r, const int &s)
 inequality operator for Rational and int More...
 
bool operator== (const Rational &r, const int &s)
 equality operator for Rational and int More...
 
bool operator< (const Rational &r, const int &s)
 less than operator for Rational and int More...
 
bool operator<= (const Rational &r, const int &s)
 less than or equal to operator for Rational and int More...
 
bool operator> (const Rational &r, const int &s)
 greater than operator for Rational and int More...
 
bool operator>= (const Rational &r, const int &s)
 greater than or equal to operator for Rational and int More...
 
bool operator!= (const int &r, const Rational &s)
 inequality operator int and Rational More...
 
bool operator== (const int &r, const Rational &s)
 equality operator for int and Rational More...
 
bool operator< (const int &r, const Rational &s)
 less than operator int and Rational More...
 
bool operator<= (const int &r, const Rational &s)
 less than or equal to operator int and Rational More...
 
bool operator> (const int &r, const Rational &s)
 greater than operator int and Rational More...
 
bool operator>= (const int &r, const Rational &s)
 greater than or equal to operator int and Rational More...
 
Rational operator+ (const int &d, const Rational &r)
 addition operator for int and Rational More...
 
Rational operator- (const int &d, const Rational &r)
 subtraction operator for int and Rational More...
 
Rational operator* (const int &d, const Rational &r)
 multiplication operator for int and Rational More...
 
Rational operator/ (const int &d, const Rational &r)
 division operator for int and Rational More...
 
Rational spxAbs (const Rational &r)
 Absolute. More...
 
int sign (const Rational &r)
 Sign function; returns 1 if r > 0, 0 if r = 0, and -1 if r < 0. More...
 
Rational operator- (const Rational &q)
 Negation. More...
 

Construction and destruction

 Rational ()
 default constructor More...
 
 Rational (const Rational &r)
 copy constructor More...
 
 Rational (const long double &r)
 constructor from long double More...
 
 Rational (const double &r)
 constructor from double More...
 
 Rational (const int &i)
 constructor from int More...
 
 Rational (const mpq_t &q)
 constructor from mpq_t (GMP only) More...
 
 ~Rational ()
 destructor More...
 
Rationaloperator= (const Rational &)
 assignment operator More...
 
Rationaloperator= (const long double &r)
 assignment operator from long double More...
 
Rationaloperator= (const double &r)
 assignment operator from double More...
 
Rationaloperator= (const int &i)
 assignment operator from int More...
 
static void enableListMem ()
 enables list memory More...
 
static void freeListMem ()
 frees the unused rational elements in the memory list More...
 
static void disableListMem ()
 disables list memory More...
 

Conversion from and to String

bool readString (const char *s)
 read Rational from string More...
 
std::string rationalToString (const Rational &r, const int precision)
 convert rational number to string More...
 
bool readStringRational (const char *s, Rational &value)
 read Rational from string More...
 
std::ostream & operator<< (std::ostream &os, const Rational &q)
 print Rational More...
 

Detailed Description

Wrapper for GMP type mpq_class.

We wrap mpq_class so that we can replace it by a double type if GMP is not available.

If compiled with GMP support, Rational is defined as mpq_class.

Definition at line 44 of file rational.h.

Constructor & Destructor Documentation

◆ Rational() [1/7]

Rational ( const int &  i,
const bool &  dummy 
)
private

special constructor only for initializing static rational variables; this is necessary since we need a constructor for Rational::{ZERO, POSONE, NEGONE} that does not use these numbers

Definition at line 364 of file rational.cpp.

References Rational::dpointer, Rational::Private::Private(), Rational::Private::privatevalue, and soplex::spx_alloc().

◆ Rational() [2/7]

◆ Rational() [3/7]

Rational ( const Rational r)

◆ Rational() [4/7]

Rational ( const long double &  r)

constructor from long double

Definition at line 442 of file rational.cpp.

References Rational::dpointer, Rational::Private::Private(), soplex::spx_alloc(), and Rational::unusedPrivateList.

◆ Rational() [5/7]

Rational ( const double &  r)

constructor from double

Definition at line 475 of file rational.cpp.

References Rational::dpointer, Rational::Private::Private(), soplex::spx_alloc(), and Rational::unusedPrivateList.

◆ Rational() [6/7]

Rational ( const int &  i)

constructor from int

Definition at line 508 of file rational.cpp.

References Rational::dpointer, Rational::Private::Private(), soplex::spx_alloc(), and Rational::unusedPrivateList.

◆ Rational() [7/7]

Rational ( const mpq_t &  q)

constructor from mpq_t (GMP only)

constructor from mpq_t

Definition at line 541 of file rational.cpp.

References Rational::dpointer, Rational::Private::Private(), soplex::spx_alloc(), and Rational::unusedPrivateList.

◆ ~Rational()

Member Function Documentation

◆ addProduct()

Rational & addProduct ( const Rational r,
const Rational s 
)

add product of two rationals

Definition at line 1637 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

Referenced by SoPlex::_computeInfeasBox(), soplex::dmaxSizeRational(), and VectorBase< Real >::operator*().

◆ addQuotient()

Rational & addQuotient ( const Rational r,
const Rational s 
)

add quotient of two rationals, r divided by s

Definition at line 1741 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

Referenced by soplex::dmaxSizeRational().

◆ disableListMem()

void disableListMem ( )
static

disables list memory

Definition at line 620 of file rational.cpp.

References Rational::freeListMem().

Referenced by soplex::dmaxSizeRational(), and main().

◆ enableListMem()

void enableListMem ( )
static

enables list memory

Definition at line 597 of file rational.cpp.

References Rational::unusedPrivateList.

Referenced by soplex::dmaxSizeRational().

◆ freeListMem()

void freeListMem ( )
static

frees the unused rational elements in the memory list

frees the unused rational elements in the memory list frees the unused rational elements in the memory list

this can be useful when you want to save memory or needed when working with a GMP memory manager like the one in EGlib that frees GMP memory before the destructor of the static memory list is called; in most cases this method is optional; note that this does not free the Rational elements that are currently in use

Definition at line 611 of file rational.cpp.

References Rational::unusedPrivateList.

Referenced by Rational::disableListMem(), and soplex::dmaxSizeRational().

◆ getMpqPtr()

const mpq_t * getMpqPtr ( ) const

provides read-only access to underlying mpq_t

Definition at line 720 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ getMpqPtr_w()

mpq_t * getMpqPtr_w ( ) const

provides write access to underlying mpq_t; use with care

Definition at line 736 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ getMpqRef()

const mpq_t & getMpqRef ( ) const

provides read-only access to underlying mpq_t

Definition at line 728 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

Referenced by soplex::dlcmSizeRational(), soplex::dmaxSizeRational(), and soplex::Reconstruct().

◆ getMpqRef_w()

mpq_t & getMpqRef_w ( ) const

provides write access to underlying mpq_t; use with care

Definition at line 744 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ invert()

◆ isAdjacentTo()

bool isAdjacentTo ( const double &  d) const

checks if d is exactly equal to the Rational and if not, if it is one of the two adjacent doubles

checks if d is exactly equal to the Rational and if not, if it is one of the two adjacent doubles

Definition at line 1886 of file rational.cpp.

References Rational::dpointer, soplex::infinity, Rational::Private::privatevalue, and soplex::spxNextafter().

Referenced by soplex::dmaxSizeRational().

◆ isNextTo()

bool isNextTo ( const double &  d)

checks if d is the closest number that can be represented by double

checks if d is the closest possible double

Definition at line 1857 of file rational.cpp.

References Rational::dpointer, soplex::infinity, Rational::Private::privatevalue, Rational::Rational(), Rational::spxAbs, and soplex::spxNextafter().

Referenced by soplex::dmaxSizeRational().

◆ operator double()

operator double ( ) const

typecasts Rational to double (allows only explicit typecast)

Definition at line 674 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator long double()

operator long double ( ) const

typecasts Rational to long double (allows only explicit typecast)

Definition at line 697 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator*() [1/3]

Rational operator* ( const Rational r) const

multiplication operator

Definition at line 1116 of file rational.cpp.

References Rational::dpointer, Rational::Private::privatevalue, and Rational::ZERO.

Referenced by soplex::dmaxSizeRational().

◆ operator*() [2/3]

Rational operator* ( const double &  r) const

multiplication operator for doubles

Definition at line 1195 of file rational.cpp.

References Rational::dpointer, Rational::Private::privatevalue, and Rational::ZERO.

◆ operator*() [3/3]

Rational operator* ( const int &  r) const

multiplication operator for ints

Definition at line 1282 of file rational.cpp.

References Rational::dpointer, Rational::Private::privatevalue, and Rational::ZERO.

◆ operator*=() [1/3]

Rational & operator*= ( const Rational r)

multiplication assignment operator operator

multiplication assignment operator

Definition at line 1153 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

Referenced by soplex::dmaxSizeRational().

◆ operator*=() [2/3]

Rational & operator*= ( const double &  r)

multiplication assignment operator for doubles

Definition at line 1237 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator*=() [3/3]

Rational & operator*= ( const int &  r)

multiplication assignment operator for ints

Definition at line 1324 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator+() [1/3]

Rational operator+ ( const Rational r) const

addition operator

Definition at line 752 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

Referenced by soplex::dmaxSizeRational().

◆ operator+() [2/3]

Rational operator+ ( const double &  r) const

addition operator for doubles

Definition at line 807 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator+() [3/3]

Rational operator+ ( const int &  r) const

addition operator for ints

Definition at line 868 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator+=() [1/3]

Rational & operator+= ( const Rational r)

addition assignment operator

Definition at line 780 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

Referenced by soplex::dmaxSizeRational().

◆ operator+=() [2/3]

Rational & operator+= ( const double &  r)

addition assignment operator for doubles

Definition at line 836 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator+=() [3/3]

Rational & operator+= ( const int &  r)

addition assignment operator for ints

Definition at line 897 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator-() [1/3]

Rational operator- ( const Rational r) const

subtraction operator

Definition at line 929 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

Referenced by soplex::dmaxSizeRational().

◆ operator-() [2/3]

Rational operator- ( const double &  r) const

subtraction operator for doubles

Definition at line 992 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator-() [3/3]

Rational operator- ( const int &  r) const

subtraction operator for ints

Definition at line 1054 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator-=() [1/3]

Rational & operator-= ( const Rational r)

subtraction assignment operator

Definition at line 957 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

Referenced by soplex::dmaxSizeRational().

◆ operator-=() [2/3]

Rational & operator-= ( const double &  r)

subtraction assignment operator for doubles

Definition at line 1021 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator-=() [3/3]

Rational & operator-= ( const int &  r)

subtraction assignment operator for ints

Definition at line 1083 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

◆ operator/() [1/3]

Rational operator/ ( const Rational r) const

division operator

Definition at line 1369 of file rational.cpp.

References Rational::dpointer, Rational::invert(), Rational::Private::privatevalue, and Rational::ZERO.

Referenced by soplex::dmaxSizeRational().

◆ operator/() [2/3]

Rational operator/ ( const double &  r) const

division operator for doubles

Definition at line 1453 of file rational.cpp.

References Rational::dpointer, Rational::invert(), Rational::Private::privatevalue, and Rational::ZERO.

◆ operator/() [3/3]

Rational operator/ ( const int &  r) const

division operator for ints

Definition at line 1545 of file rational.cpp.

References Rational::dpointer, Rational::invert(), Rational::Private::privatevalue, and Rational::ZERO.

◆ operator/=() [1/3]

Rational & operator/= ( const Rational r)

division assignment operator

Definition at line 1411 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

Referenced by soplex::dmaxSizeRational().

◆ operator/=() [2/3]

Rational & operator/= ( const double &  r)

division assignment operator for doubles

Definition at line 1498 of file rational.cpp.

References Rational::dpointer, Rational::invert(), and Rational::Private::privatevalue.

◆ operator/=() [3/3]

Rational & operator/= ( const int &  r)

division assignment operator for ints

Definition at line 1590 of file rational.cpp.

References Rational::dpointer, Rational::invert(), and Rational::Private::privatevalue.

◆ operator=() [1/5]

Rational & operator= ( const Rational r)

assignment operator

Definition at line 629 of file rational.cpp.

References Rational::dpointer.

Referenced by soplex::dmaxSizeRational().

◆ operator=() [2/5]

Rational & operator= ( const long double &  r)

assignment operator from long double

Definition at line 638 of file rational.cpp.

References Rational::dpointer.

◆ operator=() [3/5]

Rational & operator= ( const double &  r)

assignment operator from double

Definition at line 647 of file rational.cpp.

References Rational::dpointer.

◆ operator=() [4/5]

Rational & operator= ( const int &  i)

assignment operator from int

Definition at line 656 of file rational.cpp.

References Rational::dpointer.

◆ operator=() [5/5]

Rational & operator= ( const mpq_t &  q)

assignment operator from mpq_t

Definition at line 665 of file rational.cpp.

References Rational::dpointer.

◆ powRound()

Rational & powRound ( )

round up to next power of two

Definition at line 1824 of file rational.cpp.

References Rational::dpointer, MSG_DEBUG, Rational::Private::privatevalue, and Rational::rationalToString.

Referenced by SoPlex::_performOptIRStable(), and soplex::dmaxSizeRational().

◆ precision()

int precision ( )
static

returns precision of Rational implementation, i.e., number of bits used to store Rational numbers (INT_MAX if exact)

Definition at line 1930 of file rational.cpp.

Referenced by soplex::dmaxSizeRational().

◆ readString()

◆ sizeInBase()

int sizeInBase ( const int  base = 2) const

Size in specified base (bit size for base 2)

Definition at line 1921 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

Referenced by soplex::dmaxSizeRational(), and soplex::totalSizeRational().

◆ subProduct()

Rational & subProduct ( const Rational r,
const Rational s 
)

subtract product of two rationals

Definition at line 1688 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

Referenced by SoPlex::_computeInfeasBox(), and soplex::dmaxSizeRational().

◆ subQuotient()

Rational & subQuotient ( const Rational r,
const Rational s 
)

subtract quotient of two rationals, r divided by s

Definition at line 1778 of file rational.cpp.

References Rational::dpointer, and Rational::Private::privatevalue.

Referenced by soplex::dmaxSizeRational().

Friends And Related Function Documentation

◆ compareRational

int compareRational ( const Rational r,
const Rational s 
)
friend

comparison operator returning a positive value if r > s, zero if r = s, and a negative value if r < s

Definition at line 2326 of file rational.cpp.

Referenced by soplex::dmaxSizeRational().

◆ operator!= [1/7]

bool operator!= ( const Rational r,
const Rational s 
)
friend

inequality operator

Definition at line 2342 of file rational.cpp.

Referenced by soplex::dmaxSizeRational().

◆ operator!= [2/7]

bool operator!= ( const Rational r,
const double &  s 
)
friend

inequality operator for Rational and double

Definition at line 2402 of file rational.cpp.

◆ operator!= [3/7]

bool operator!= ( const double &  r,
const Rational s 
)
friend

inequality operator double and Rational

inequality operator for double and Rational

Definition at line 2510 of file rational.cpp.

◆ operator!= [4/7]

bool operator!= ( const Rational r,
const long double &  s 
)
friend

inequality operator for Rational and long double

Definition at line 2570 of file rational.cpp.

◆ operator!= [5/7]

bool operator!= ( const long double &  r,
const Rational s 
)
friend

inequality operator for long double and Rational

Definition at line 2678 of file rational.cpp.

◆ operator!= [6/7]

bool operator!= ( const Rational r,
const int &  s 
)
friend

inequality operator for Rational and int

Definition at line 2804 of file rational.cpp.

◆ operator!= [7/7]

bool operator!= ( const int &  r,
const Rational s 
)
friend

inequality operator int and Rational

inequality operator for int and Rational

Definition at line 2912 of file rational.cpp.

◆ operator* [1/2]

Rational operator* ( const double &  d,
const Rational r 
)
friend

multiplication operator for double and Rational

Definition at line 2737 of file rational.cpp.

◆ operator* [2/2]

Rational operator* ( const int &  d,
const Rational r 
)
friend

multiplication operator for int and Rational

Definition at line 2971 of file rational.cpp.

◆ operator+ [1/2]

Rational operator+ ( const double &  d,
const Rational r 
)
friend

addition operator for double and Rational

Definition at line 2718 of file rational.cpp.

◆ operator+ [2/2]

Rational operator+ ( const int &  d,
const Rational r 
)
friend

addition operator for int and Rational

Definition at line 2952 of file rational.cpp.

◆ operator- [1/3]

Rational operator- ( const double &  d,
const Rational r 
)
friend

subtraction operator for double and Rational

Definition at line 2726 of file rational.cpp.

◆ operator- [2/3]

Rational operator- ( const int &  d,
const Rational r 
)
friend

subtraction operator for int and Rational

Definition at line 2960 of file rational.cpp.

◆ operator- [3/3]

Rational operator- ( const Rational q)
friend

Negation.

Definition at line 3036 of file rational.cpp.

◆ operator/ [1/2]

Rational operator/ ( const double &  d,
const Rational r 
)
friend

division operator for double and Rational

Definition at line 2756 of file rational.cpp.

◆ operator/ [2/2]

Rational operator/ ( const int &  d,
const Rational r 
)
friend

division operator for int and Rational

Definition at line 2990 of file rational.cpp.

◆ operator< [1/7]

bool operator< ( const Rational r,
const Rational s 
)
friend

less than operator

Definition at line 2350 of file rational.cpp.

Referenced by soplex::dmaxSizeRational().

◆ operator< [2/7]

bool operator< ( const Rational r,
const double &  s 
)
friend

less than operator for Rational and double

Definition at line 2422 of file rational.cpp.

◆ operator< [3/7]

bool operator< ( const double &  r,
const Rational s 
)
friend

less than operator double and Rational

less than operator for double and Rational

Definition at line 2518 of file rational.cpp.

◆ operator< [4/7]

bool operator< ( const Rational r,
const long double &  s 
)
friend

less than operator for Rational and long double

Definition at line 2590 of file rational.cpp.

◆ operator< [5/7]

bool operator< ( const long double &  r,
const Rational s 
)
friend

less than operator for long double and Rational

Definition at line 2686 of file rational.cpp.

◆ operator< [6/7]

bool operator< ( const Rational r,
const int &  s 
)
friend

less than operator for Rational and int

Definition at line 2824 of file rational.cpp.

◆ operator< [7/7]

bool operator< ( const int &  r,
const Rational s 
)
friend

less than operator int and Rational

less than operator for int and Rational

Definition at line 2920 of file rational.cpp.

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Rational q 
)
friend

print Rational

Definition at line 2313 of file rational.cpp.

Referenced by soplex::dmaxSizeRational().

◆ operator<= [1/7]

bool operator<= ( const Rational r,
const Rational s 
)
friend

less than or equal to operator

Definition at line 2358 of file rational.cpp.

Referenced by soplex::dmaxSizeRational().

◆ operator<= [2/7]

bool operator<= ( const Rational r,
const double &  s 
)
friend

less than or equal to operator for Rational and double

Definition at line 2442 of file rational.cpp.

◆ operator<= [3/7]

bool operator<= ( const double &  r,
const Rational s 
)
friend

less than or equal to operator double and Rational

less than or equal to operator for double and Rational

Definition at line 2526 of file rational.cpp.

◆ operator<= [4/7]

bool operator<= ( const Rational r,
const long double &  s 
)
friend

less than or equal to operator for Rational and long double

Definition at line 2610 of file rational.cpp.

◆ operator<= [5/7]

bool operator<= ( const long double &  r,
const Rational s 
)
friend

less than or equal to operator for long double and Rational

Definition at line 2694 of file rational.cpp.

◆ operator<= [6/7]

bool operator<= ( const Rational r,
const int &  s 
)
friend

less than or equal to operator for Rational and int

Definition at line 2844 of file rational.cpp.

◆ operator<= [7/7]

bool operator<= ( const int &  r,
const Rational s 
)
friend

less than or equal to operator int and Rational

less than or equal to operator for int and Rational

Definition at line 2928 of file rational.cpp.

◆ operator== [1/7]

bool operator== ( const Rational r,
const Rational s 
)
friend

equality operator

Definition at line 2334 of file rational.cpp.

Referenced by soplex::dmaxSizeRational().

◆ operator== [2/7]

bool operator== ( const Rational r,
const double &  s 
)
friend

equality operator for Rational and double

Definition at line 2382 of file rational.cpp.

◆ operator== [3/7]

bool operator== ( const double &  r,
const Rational s 
)
friend

equality operator for double and Rational

Definition at line 2502 of file rational.cpp.

◆ operator== [4/7]

bool operator== ( const Rational r,
const long double &  s 
)
friend

equality operator for Rational and long double

Definition at line 2550 of file rational.cpp.

◆ operator== [5/7]

bool operator== ( const long double &  r,
const Rational s 
)
friend

equality operator for long double and Rational

Definition at line 2670 of file rational.cpp.

◆ operator== [6/7]

bool operator== ( const Rational r,
const int &  s 
)
friend

equality operator for Rational and int

Definition at line 2784 of file rational.cpp.

◆ operator== [7/7]

bool operator== ( const int &  r,
const Rational s 
)
friend

equality operator for int and Rational

Definition at line 2904 of file rational.cpp.

◆ operator> [1/7]

bool operator> ( const Rational r,
const Rational s 
)
friend

greater than operator

Definition at line 2366 of file rational.cpp.

Referenced by soplex::dmaxSizeRational().

◆ operator> [2/7]

bool operator> ( const Rational r,
const double &  s 
)
friend

greater than operator for Rational and double

Definition at line 2462 of file rational.cpp.

◆ operator> [3/7]

bool operator> ( const double &  r,
const Rational s 
)
friend

greater than operator double and Rational

greater than operator for double and Rational

Definition at line 2534 of file rational.cpp.

◆ operator> [4/7]

bool operator> ( const Rational r,
const long double &  s 
)
friend

greater than operator for Rational and long double

Definition at line 2630 of file rational.cpp.

◆ operator> [5/7]

bool operator> ( const long double &  r,
const Rational s 
)
friend

greater than operator for long double and Rational

Definition at line 2702 of file rational.cpp.

◆ operator> [6/7]

bool operator> ( const Rational r,
const int &  s 
)
friend

greater than operator for Rational and int

Definition at line 2864 of file rational.cpp.

◆ operator> [7/7]

bool operator> ( const int &  r,
const Rational s 
)
friend

greater than operator int and Rational

greater than operator for int and Rational

Definition at line 2936 of file rational.cpp.

◆ operator>= [1/7]

bool operator>= ( const Rational r,
const Rational s 
)
friend

greater than or equal to operator

Definition at line 2374 of file rational.cpp.

Referenced by soplex::dmaxSizeRational().

◆ operator>= [2/7]

bool operator>= ( const Rational r,
const double &  s 
)
friend

greater than or equal to operator for Rational and double

Definition at line 2482 of file rational.cpp.

◆ operator>= [3/7]

bool operator>= ( const double &  r,
const Rational s 
)
friend

greater than or equal to operator double and Rational

greater than or equal to operator for double and Rational

Definition at line 2542 of file rational.cpp.

◆ operator>= [4/7]

bool operator>= ( const Rational r,
const long double &  s 
)
friend

greater than or equal to operator for Rational and long double

Definition at line 2650 of file rational.cpp.

◆ operator>= [5/7]

bool operator>= ( const long double &  r,
const Rational s 
)
friend

greater than or equal to operator for long double and Rational

Definition at line 2710 of file rational.cpp.

◆ operator>= [6/7]

bool operator>= ( const Rational r,
const int &  s 
)
friend

greater than or equal to operator for Rational and int

Definition at line 2884 of file rational.cpp.

◆ operator>= [7/7]

bool operator>= ( const int &  r,
const Rational s 
)
friend

greater than or equal to operator int and Rational

greater than or equal to operator for int and Rational

Definition at line 2944 of file rational.cpp.

◆ rationalToString

std::string rationalToString ( const Rational r,
const int  precision 
)
friend

convert rational number to string

Definition at line 2108 of file rational.cpp.

Referenced by soplex::dmaxSizeRational(), and Rational::powRound().

◆ readStringRational

bool readStringRational ( const char *  s,
Rational value 
)
friend

read Rational from string

Definition at line 2147 of file rational.cpp.

Referenced by soplex::dmaxSizeRational().

◆ sign

int sign ( const Rational r)
friend

Sign function; returns 1 if r > 0, 0 if r = 0, and -1 if r < 0.

Definition at line 3028 of file rational.cpp.

Referenced by soplex::dmaxSizeRational().

◆ spxAbs

Rational spxAbs ( const Rational r)
friend

Absolute.

absolute function

Definition at line 3018 of file rational.cpp.

Referenced by soplex::dmaxSizeRational(), and Rational::isNextTo().

Member Data Documentation

◆ dpointer

◆ NEGONE

const Rational NEGONE
staticprivate

rational minus one (GMP only)

Definition at line 64 of file rational.h.

◆ POSONE

const Rational POSONE
staticprivate

rational plus one (GMP only)

Definition at line 63 of file rational.h.

◆ unusedPrivateList

THREADLOCAL IdList< Rational::Private > unusedPrivateList
staticprivate

list of unused Private objects

Definition at line 51 of file rational.h.

Referenced by Rational::enableListMem(), Rational::freeListMem(), Rational::Rational(), and Rational::~Rational().

◆ useListMem

THREADLOCAL bool useListMem = true
staticprivate

list of unused Private objects; note that this cannot be used if SOPLEX_WITH_GMP is not defined, since then the Private class has no member next() and prev() should list memory be used?

Definition at line 52 of file rational.h.

◆ ZERO

const Rational ZERO
staticprivate

rational zero (GMP only)

Definition at line 62 of file rational.h.

Referenced by Rational::operator*(), soplex::operator*(), Rational::operator/(), and soplex::operator/().