Wrapper for GMP types. More...
#include <cmath>#include <stdlib.h>#include <stdio.h>#include <string.h>#include <iomanip>#include <sstream>#include <cstring>#include <limits.h>#include "rational.h"#include "spxalloc.h"#include "spxdefines.h"Go to the source code of this file.
Classes | |
| class | Rational::Private |
| Defines the "Pimpl"-class Private. More... | |
Namespaces | |
| soplex | |
| Everything should be within this namespace. | |
Macros | |
| #define | SOPLEX_PERFALT_1 |
| use mpq_sgn instead of mpq_equal to compare rationals with zero More... | |
| #define | SOPLEX_PERFALT_2a |
| turn on checking rationals for zero in arithmetic plus and minus operators More... | |
| #define | SOPLEX_PERFALT_2b |
| turn on checking rationals for zero, posone, negone in arithmetic multiplication and division operators More... | |
| #define | SOPLEX_PERFALT_3 |
| turn on checking rationals for zero, posone, negone before conversion to double and long double More... | |
| #define | SOPLEX_PERFALT_4 |
| turn on checking for equality before assigning in operator=() More... | |
| #define | SOPLEX_PERFALT_5a |
| turn on checking whether assignment in assignment operators is redundant for 0 More... | |
| #define | SOPLEX_PERFALT_5b |
| turn on checking whether assignment in assignment operators is redundant for +1 and -1 More... | |
Functions | |
| 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... | |
| 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... | |
| 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 &r) |
| print Rational More... | |
| 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) |
| equality operator More... | |
| bool | operator!= (const Rational &r, const Rational &s) |
| inequality 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) |
| equality operator for Rational and double More... | |
| bool | operator!= (const Rational &r, const double &s) |
| inequality 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) |
| equality operator for double and Rational More... | |
| bool | operator!= (const double &r, const Rational &s) |
| inequality operator 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) |
| equality operator for Rational and long double 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) |
| 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) |
| equality operator for long double and Rational More... | |
| bool | operator!= (const long double &r, const Rational &s) |
| inequality operator long double and Rational More... | |
| bool | operator< (const long double &r, const Rational &s) |
| less than operator long double and Rational More... | |
| bool | operator<= (const long double &r, const Rational &s) |
| less than or equal to operator long double and Rational More... | |
| bool | operator> (const long double &r, const Rational &s) |
| greater than operator long double and Rational More... | |
| bool | operator>= (const long double &r, const Rational &s) |
| greater than or equal to operator long double and Rational More... | |
| bool | operator== (const Rational &r, const int &s) |
| equality operator for Rational and int More... | |
| bool | operator!= (const Rational &r, const int &s) |
| inequality 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) |
| equality operator for int and Rational More... | |
| bool | operator!= (const int &r, const Rational &s) |
| inequality operator for int and Rational More... | |
| bool | operator< (const int &r, const Rational &s) |
| less than operator for int and Rational More... | |
| bool | operator<= (const int &r, const Rational &s) |
| less than or equal to operator for int and Rational More... | |
| bool | operator> (const int &r, const Rational &s) |
| greater than operator for int and Rational More... | |
| bool | operator>= (const int &r, const Rational &s) |
| greater than or equal to operator for int and Rational More... | |
| Rational | operator+ (const double &d, const Rational &r) |
| addition operator for double and Rational More... | |
| Rational | operator+ (const int &d, const Rational &r) |
| addition 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 &r) |
| Negation. More... | |
| int | totalSizeRational (const Rational *vector, const int length, const int base) |
| Total size of rational vector. More... | |
| int | dlcmSizeRational (const Rational *vector, const int length, const int base) |
| Size of least common multiple of denominators in rational vector. More... | |
| int | dmaxSizeRational (const Rational *vector, const int length, const int base) |
| Size of largest denominator in rational vector. More... | |
Wrapper for GMP types.
Definition in file rational.cpp.
| #define SOPLEX_PERFALT_1 |
use mpq_sgn instead of mpq_equal to compare rationals with zero
Definition at line 40 of file rational.cpp.
| #define SOPLEX_PERFALT_2a |
turn on checking rationals for zero in arithmetic plus and minus operators
Definition at line 43 of file rational.cpp.
| #define SOPLEX_PERFALT_2b |
turn on checking rationals for zero, posone, negone in arithmetic multiplication and division operators
Definition at line 46 of file rational.cpp.
| #define SOPLEX_PERFALT_3 |
turn on checking rationals for zero, posone, negone before conversion to double and long double
Definition at line 49 of file rational.cpp.
| #define SOPLEX_PERFALT_4 |
turn on checking for equality before assigning in operator=()
Definition at line 52 of file rational.cpp.
| #define SOPLEX_PERFALT_5a |
turn on checking whether assignment in assignment operators is redundant for 0
Definition at line 55 of file rational.cpp.
| #define SOPLEX_PERFALT_5b |
turn on checking whether assignment in assignment operators is redundant for +1 and -1
Definition at line 58 of file rational.cpp.