cvc4-1.4
|
#include <integer_cln_imp.h>
Public Member Functions | |
Integer () | |
Constructs a rational with the value 0. | |
Integer (const char *sp, unsigned base=10) throw (std::invalid_argument) | |
Constructs a Integer from a C string. | |
Integer (const std::string &s, unsigned base=10) throw (std::invalid_argument) | |
Integer (const Integer &q) | |
Integer (signed int z) | |
Integer (unsigned int z) | |
Integer (signed long int z) | |
Integer (unsigned long int z) | |
~Integer () | |
Integer & | operator= (const Integer &x) |
bool | operator== (const Integer &y) const |
Integer | operator- () const |
bool | operator!= (const Integer &y) const |
bool | operator< (const Integer &y) const |
bool | operator<= (const Integer &y) const |
bool | operator> (const Integer &y) const |
bool | operator>= (const Integer &y) const |
Integer | operator+ (const Integer &y) const |
Integer & | operator+= (const Integer &y) |
Integer | operator- (const Integer &y) const |
Integer & | operator-= (const Integer &y) |
Integer | operator* (const Integer &y) const |
Integer & | operator*= (const Integer &y) |
Integer | bitwiseOr (const Integer &y) const |
Integer | bitwiseAnd (const Integer &y) const |
Integer | bitwiseXor (const Integer &y) const |
Integer | bitwiseNot () const |
Integer | multiplyByPow2 (uint32_t pow) const |
Return this*(2^pow). | |
bool | isBitSet (uint32_t i) const |
Integer | setBit (uint32_t i) const |
Integer | oneExtend (uint32_t size, uint32_t amount) const |
uint32_t | toUnsignedInt () const |
Integer | extractBitRange (uint32_t bitCount, uint32_t low) const |
See CLN Documentation. | |
Integer | floorDivideQuotient (const Integer &y) const |
Returns the floor(this / y) | |
Integer | floorDivideRemainder (const Integer &y) const |
Returns r == this - floor(this/y)*y. | |
Integer | ceilingDivideQuotient (const Integer &y) const |
Returns the ceil(this / y) | |
Integer | ceilingDivideRemainder (const Integer &y) const |
Returns the ceil(this / y) | |
Integer | euclidianDivideQuotient (const Integer &y) const |
Returns the quoitent according to Boute's Euclidean definition. | |
Integer | euclidianDivideRemainder (const Integer &y) const |
Returns the remainfing according to Boute's Euclidean definition. | |
Integer | exactQuotient (const Integer &y) const |
If y divides *this, then exactQuotient returns (this/y) | |
Integer | modByPow2 (uint32_t exp) const |
Integer | divByPow2 (uint32_t exp) const |
Integer | pow (unsigned long int exp) const |
Raise this Integer to the power exp . | |
Integer | gcd (const Integer &y) const |
Return the greatest common divisor of this integer with another. | |
Integer | lcm (const Integer &y) const |
Return the least common multiple of this integer with another. | |
bool | divides (const Integer &y) const |
Return true if *this exactly divides y. | |
Integer | abs () const |
Return the absolute value of this integer. | |
std::string | toString (int base=10) const |
int | sgn () const |
bool | strictlyPositive () const |
bool | strictlyNegative () const |
bool | isZero () const |
bool | isOne () const |
bool | isNegativeOne () const |
bool | fitsSignedInt () const |
fits the C "signed int" primitive | |
bool | fitsUnsignedInt () const |
fits the C "unsigned int" primitive | |
int | getSignedInt () const |
unsigned int | getUnsignedInt () const |
long | getLong () const |
unsigned long | getUnsignedLong () const |
size_t | hash () const |
Computes the hash of the node from the first word of the numerator, the denominator. | |
bool | testBit (unsigned n) const |
Returns true iff bit n is set. | |
unsigned | isPow2 () const |
Returns k if the integer is equal to 2^(k-1) | |
size_t | length () const |
If x != 0, returns the unique n s.t. | |
Integer () | |
Constructs a rational with the value 0. | |
Integer (const char *s, unsigned base=10) | |
Constructs a Integer from a C string. | |
Integer (const std::string &s, unsigned base=10) | |
Integer (const Integer &q) | |
Integer (signed int z) | |
Integer (unsigned int z) | |
Integer (signed long int z) | |
Integer (unsigned long int z) | |
~Integer () | |
Integer & | operator= (const Integer &x) |
bool | operator== (const Integer &y) const |
Integer | operator- () const |
bool | operator!= (const Integer &y) const |
bool | operator< (const Integer &y) const |
bool | operator<= (const Integer &y) const |
bool | operator> (const Integer &y) const |
bool | operator>= (const Integer &y) const |
Integer | operator+ (const Integer &y) const |
Integer & | operator+= (const Integer &y) |
Integer | operator- (const Integer &y) const |
Integer & | operator-= (const Integer &y) |
Integer | operator* (const Integer &y) const |
Integer & | operator*= (const Integer &y) |
Integer | bitwiseOr (const Integer &y) const |
Integer | bitwiseAnd (const Integer &y) const |
Integer | bitwiseXor (const Integer &y) const |
Integer | bitwiseNot () const |
Integer | multiplyByPow2 (uint32_t pow) const |
Return this*(2^pow). | |
Integer | setBit (uint32_t i) const |
Returns the Integer obtained by setting the ith bit of the current Integer to 1. | |
bool | isBitSet (uint32_t i) const |
Integer | oneExtend (uint32_t size, uint32_t amount) const |
Returns the integer with the binary representation of size bits extended with amount 1's. | |
uint32_t | toUnsignedInt () const |
Integer | extractBitRange (uint32_t bitCount, uint32_t low) const |
See GMP Documentation. | |
Integer | floorDivideQuotient (const Integer &y) const |
Returns the floor(this / y) | |
Integer | floorDivideRemainder (const Integer &y) const |
Returns r == this - floor(this/y)*y. | |
Integer | ceilingDivideQuotient (const Integer &y) const |
Returns the ceil(this / y) | |
Integer | ceilingDivideRemainder (const Integer &y) const |
Returns the ceil(this / y) | |
Integer | euclidianDivideQuotient (const Integer &y) const |
Returns the quoitent according to Boute's Euclidean definition. | |
Integer | euclidianDivideRemainder (const Integer &y) const |
Returns the remainfing according to Boute's Euclidean definition. | |
Integer | exactQuotient (const Integer &y) const |
If y divides *this, then exactQuotient returns (this/y) | |
Integer | modByPow2 (uint32_t exp) const |
Returns y mod 2^exp. | |
Integer | divByPow2 (uint32_t exp) const |
Returns y / 2^exp. | |
int | sgn () const |
bool | strictlyPositive () const |
bool | strictlyNegative () const |
bool | isZero () const |
bool | isOne () const |
bool | isNegativeOne () const |
Integer | pow (unsigned long int exp) const |
Raise this Integer to the power exp . | |
Integer | gcd (const Integer &y) const |
Return the greatest common divisor of this integer with another. | |
Integer | lcm (const Integer &y) const |
Return the least common multiple of this integer with another. | |
bool | divides (const Integer &y) const |
All non-zero integers z, z.divide(0) ! zero.divides(zero) | |
Integer | abs () const |
Return the absolute value of this integer. | |
std::string | toString (int base=10) const |
bool | fitsSignedInt () const |
bool | fitsUnsignedInt () const |
signed int | getSignedInt () const |
unsigned int | getUnsignedInt () const |
long | getLong () const |
unsigned long | getUnsignedLong () const |
size_t | hash () const |
Computes the hash of the node from the first word of the numerator, the denominator. | |
bool | testBit (unsigned n) const |
Returns true iff bit n is set. | |
unsigned | isPow2 () const |
Returns k if the integer is equal to 2^(k-1) | |
size_t | length () const |
If x != 0, returns the smallest n s.t. | |
Static Public Member Functions | |
static void | floorQR (Integer &q, Integer &r, const Integer &x, const Integer &y) |
Computes a floor quoient and remainder for x divided by y. | |
static void | euclidianQR (Integer &q, Integer &r, const Integer &x, const Integer &y) |
Computes a quoitent and remainder according to Boute's Euclidean definition. | |
static void | extendedGcd (Integer &g, Integer &s, Integer &t, const Integer &a, const Integer &b) |
static const Integer & | min (const Integer &a, const Integer &b) |
Returns a reference to the minimum of two integers. | |
static const Integer & | max (const Integer &a, const Integer &b) |
Returns a reference to the maximum of two integers. | |
static void | floorQR (Integer &q, Integer &r, const Integer &x, const Integer &y) |
Computes a floor quotient and remainder for x divided by y. | |
static void | euclidianQR (Integer &q, Integer &r, const Integer &x, const Integer &y) |
Computes a quoitent and remainder according to Boute's Euclidean definition. | |
static void | extendedGcd (Integer &g, Integer &s, Integer &t, const Integer &a, const Integer &b) |
static const Integer & | min (const Integer &a, const Integer &b) |
Returns a reference to the minimum of two integers. | |
static const Integer & | max (const Integer &a, const Integer &b) |
Returns a reference to the maximum of two integers. | |
Friends | |
class | CVC4::Rational |
Definition at line 34 of file integer_gmp_imp.h.
|
inline |
Constructs a rational with the value 0.
Definition at line 63 of file integer_cln_imp.h.
|
inlineexplicit |
Constructs a Integer from a C string.
Throws std::invalid_argument if the string is not a valid rational. For more information about what is a valid rational string, see GMP's documentation for mpq_set_str().
Definition at line 71 of file integer_cln_imp.h.
|
inlineexplicit |
Definition at line 75 of file integer_cln_imp.h.
|
inline |
Definition at line 79 of file integer_cln_imp.h.
|
inline |
Definition at line 81 of file integer_cln_imp.h.
|
inline |
Definition at line 82 of file integer_cln_imp.h.
|
inline |
Definition at line 83 of file integer_cln_imp.h.
|
inline |
Definition at line 84 of file integer_cln_imp.h.
|
inline |
Definition at line 91 of file integer_cln_imp.h.
|
inline |
Constructs a rational with the value 0.
Definition at line 56 of file integer_gmp_imp.h.
|
explicit |
Constructs a Integer from a C string.
Throws std::invalid_argument if the string is not a valid rational. For more information about what is a valid rational string, see GMP's documentation for mpq_set_str().
|
explicit |
|
inline |
Definition at line 67 of file integer_gmp_imp.h.
|
inline |
Definition at line 69 of file integer_gmp_imp.h.
|
inline |
Definition at line 70 of file integer_gmp_imp.h.
|
inline |
Definition at line 71 of file integer_gmp_imp.h.
|
inline |
Definition at line 72 of file integer_gmp_imp.h.
|
inline |
Definition at line 79 of file integer_gmp_imp.h.
|
inline |
Return the absolute value of this integer.
Definition at line 360 of file integer_cln_imp.h.
|
inline |
Return the absolute value of this integer.
Definition at line 413 of file integer_gmp_imp.h.
Definition at line 158 of file integer_cln_imp.h.
Referenced by CVC4::BitVector::operator&().
Definition at line 148 of file integer_gmp_imp.h.
|
inline |
Definition at line 166 of file integer_cln_imp.h.
Referenced by CVC4::BitVector::operator~().
|
inline |
Definition at line 160 of file integer_gmp_imp.h.
Definition at line 154 of file integer_cln_imp.h.
Referenced by CVC4::BitVector::operator|().
Definition at line 142 of file integer_gmp_imp.h.
Definition at line 162 of file integer_cln_imp.h.
Referenced by CVC4::BitVector::operator^().
Definition at line 154 of file integer_gmp_imp.h.
Returns the ceil(this / y)
Definition at line 234 of file integer_cln_imp.h.
Returns the ceil(this / y)
Definition at line 249 of file integer_gmp_imp.h.
Returns the ceil(this / y)
Definition at line 241 of file integer_cln_imp.h.
Returns the ceil(this / y)
Definition at line 258 of file integer_gmp_imp.h.
|
inline |
Definition at line 313 of file integer_cln_imp.h.
Referenced by CVC4::BitVector::arithRightShift(), and CVC4::BitVector::logicalRightShift().
|
inline |
Returns y / 2^exp.
Definition at line 341 of file integer_gmp_imp.h.
|
inline |
Return true if *this exactly divides y.
Definition at line 352 of file integer_cln_imp.h.
Referenced by exactQuotient().
|
inline |
All non-zero integers z, z.divide(0) ! zero.divides(zero)
Definition at line 405 of file integer_gmp_imp.h.
Returns the quoitent according to Boute's Euclidean definition.
See the documentation for euclidianQR.
Definition at line 284 of file integer_cln_imp.h.
Returns the quoitent according to Boute's Euclidean definition.
See the documentation for euclidianQR.
Definition at line 302 of file integer_gmp_imp.h.
Returns the remainfing according to Boute's Euclidean definition.
See the documentation for euclidianQR.
Definition at line 294 of file integer_cln_imp.h.
Returns the remainfing according to Boute's Euclidean definition.
See the documentation for euclidianQR.
Definition at line 312 of file integer_gmp_imp.h.
|
inlinestatic |
Computes a quoitent and remainder according to Boute's Euclidean definition.
euclidianDivideQuotient, euclidianDivideRemainder.
Boute, Raymond T. (April 1992). The Euclidean definition of the functions div and mod. ACM Transactions on Programming Languages and Systems (TOPLAS) ACM Press. 14 (2): 127 - 144. doi:10.1145/128861.128862.
Definition at line 254 of file integer_cln_imp.h.
References sgn(), and strictlyNegative().
|
inlinestatic |
Computes a quoitent and remainder according to Boute's Euclidean definition.
euclidianDivideQuotient, euclidianDivideRemainder.
Boute, Raymond T. (April 1992). The Euclidean definition of the functions div and mod. ACM Transactions on Programming Languages and Systems (TOPLAS) ACM Press. 14 (2): 127 - 144. doi:10.1145/128861.128862.
Definition at line 273 of file integer_gmp_imp.h.
References sgn(), and strictlyNegative().
If y divides *this, then exactQuotient returns (this/y)
Definition at line 303 of file integer_cln_imp.h.
References CVC4::DebugCheckArgument(), and divides().
If y divides *this, then exactQuotient returns (this/y)
Definition at line 322 of file integer_gmp_imp.h.
References CVC4::DebugCheckArgument(), and divides().
|
inlinestatic |
Definition at line 498 of file integer_cln_imp.h.
|
inlinestatic |
Definition at line 489 of file integer_gmp_imp.h.
|
inline |
See CLN Documentation.
Definition at line 204 of file integer_cln_imp.h.
Referenced by CVC4::BitVector::arithRightShift(), CVC4::BitVector::extract(), and CVC4::BitVector::signExtend().
|
inline |
See GMP Documentation.
Definition at line 210 of file integer_gmp_imp.h.
bool CVC4::Integer::fitsSignedInt | ( | ) | const |
fits the C "signed int" primitive
bool CVC4::Integer::fitsSignedInt | ( | ) | const |
bool CVC4::Integer::fitsUnsignedInt | ( | ) | const |
fits the C "unsigned int" primitive
bool CVC4::Integer::fitsUnsignedInt | ( | ) | const |
Returns the floor(this / y)
Definition at line 212 of file integer_cln_imp.h.
Referenced by CVC4::BitVector::unsignedDivTotal().
Returns the floor(this / y)
Definition at line 224 of file integer_gmp_imp.h.
Returns r == this - floor(this/y)*y.
Definition at line 219 of file integer_cln_imp.h.
Referenced by CVC4::BitVector::unsignedRemTotal().
Returns r == this - floor(this/y)*y.
Definition at line 233 of file integer_gmp_imp.h.
|
inlinestatic |
Computes a floor quoient and remainder for x divided by y.
Definition at line 225 of file integer_cln_imp.h.
|
inlinestatic |
Computes a floor quotient and remainder for x divided by y.
Definition at line 242 of file integer_gmp_imp.h.
Return the greatest common divisor of this integer with another.
Definition at line 336 of file integer_cln_imp.h.
Return the greatest common divisor of this integer with another.
Definition at line 386 of file integer_gmp_imp.h.
|
inline |
Definition at line 428 of file integer_cln_imp.h.
References CVC4::CheckArgument().
|
inline |
Definition at line 429 of file integer_gmp_imp.h.
References CVC4::CheckArgument().
int CVC4::Integer::getSignedInt | ( | ) | const |
signed int CVC4::Integer::getSignedInt | ( | ) | const |
unsigned int CVC4::Integer::getUnsignedInt | ( | ) | const |
unsigned int CVC4::Integer::getUnsignedInt | ( | ) | const |
|
inline |
Definition at line 437 of file integer_cln_imp.h.
References CVC4::CheckArgument().
|
inline |
Definition at line 436 of file integer_gmp_imp.h.
References CVC4::CheckArgument().
|
inline |
Computes the hash of the node from the first word of the numerator, the denominator.
Definition at line 450 of file integer_cln_imp.h.
Referenced by CVC4::BitVector::hash(), CVC4::DivisibleHashFunction::operator()(), CVC4::IntegerHashFunction::operator()(), and CVC4::SubrangeBoundsHashFunction::operator()().
|
inline |
Computes the hash of the node from the first word of the numerator, the denominator.
Definition at line 448 of file integer_gmp_imp.h.
References CVC4::gmpz_hash().
|
inline |
Definition at line 179 of file integer_cln_imp.h.
Referenced by CVC4::BitVector::isBitSet().
|
inline |
Definition at line 185 of file integer_gmp_imp.h.
|
inline |
Definition at line 414 of file integer_cln_imp.h.
|
inline |
Definition at line 368 of file integer_gmp_imp.h.
|
inline |
Definition at line 410 of file integer_cln_imp.h.
|
inline |
Definition at line 364 of file integer_gmp_imp.h.
|
inline |
Returns k if the integer is equal to 2^(k-1)
Definition at line 468 of file integer_cln_imp.h.
Referenced by CVC4::BitVector::isPow2().
|
inline |
Returns k if the integer is equal to 2^(k-1)
Definition at line 466 of file integer_gmp_imp.h.
|
inline |
Definition at line 406 of file integer_cln_imp.h.
|
inline |
Definition at line 360 of file integer_gmp_imp.h.
Return the least common multiple of this integer with another.
Definition at line 344 of file integer_cln_imp.h.
Return the least common multiple of this integer with another.
Definition at line 395 of file integer_gmp_imp.h.
|
inline |
If x != 0, returns the unique n s.t.
2^{n-1} <= abs(x) < 2^{n}. If x == 0, returns 1.
Definition at line 478 of file integer_cln_imp.h.
|
inline |
If x != 0, returns the smallest n s.t.
2^{n-1} <= abs(x) < 2^{n}. If x == 0, returns 1.
Definition at line 481 of file integer_gmp_imp.h.
Returns a reference to the maximum of two integers.
Definition at line 508 of file integer_cln_imp.h.
Returns a reference to the maximum of two integers.
Definition at line 501 of file integer_gmp_imp.h.
Returns a reference to the minimum of two integers.
Definition at line 503 of file integer_cln_imp.h.
Returns a reference to the minimum of two integers.
Definition at line 496 of file integer_gmp_imp.h.
|
inline |
Definition at line 308 of file integer_cln_imp.h.
Referenced by CVC4::BitVector::BitVector(), and CVC4::BitVector::BitVector().
|
inline |
Returns y mod 2^exp.
Definition at line 332 of file integer_gmp_imp.h.
|
inline |
Return this*(2^pow).
Definition at line 174 of file integer_cln_imp.h.
Referenced by CVC4::BitVector::concat(), and CVC4::BitVector::leftShift().
|
inline |
Return this*(2^pow).
Definition at line 169 of file integer_gmp_imp.h.
|
inline |
Definition at line 189 of file integer_cln_imp.h.
References CVC4::DebugCheckArgument().
Referenced by CVC4::BitVector::arithRightShift(), and CVC4::BitVector::signExtend().
|
inline |
Returns the integer with the binary representation of size bits extended with amount 1's.
Definition at line 193 of file integer_gmp_imp.h.
References CVC4::DebugCheckArgument().
|
inline |
Definition at line 108 of file integer_cln_imp.h.
|
inline |
Definition at line 96 of file integer_gmp_imp.h.
Definition at line 145 of file integer_cln_imp.h.
Definition at line 133 of file integer_gmp_imp.h.
Definition at line 148 of file integer_cln_imp.h.
Definition at line 136 of file integer_gmp_imp.h.
Definition at line 129 of file integer_cln_imp.h.
Definition at line 117 of file integer_gmp_imp.h.
Definition at line 132 of file integer_cln_imp.h.
Definition at line 120 of file integer_gmp_imp.h.
|
inline |
Definition at line 103 of file integer_cln_imp.h.
|
inline |
Definition at line 91 of file integer_gmp_imp.h.
Definition at line 137 of file integer_cln_imp.h.
Definition at line 125 of file integer_gmp_imp.h.
Definition at line 140 of file integer_cln_imp.h.
Definition at line 128 of file integer_gmp_imp.h.
|
inline |
Definition at line 112 of file integer_cln_imp.h.
|
inline |
Definition at line 100 of file integer_gmp_imp.h.
|
inline |
Definition at line 116 of file integer_cln_imp.h.
|
inline |
Definition at line 104 of file integer_gmp_imp.h.
Definition at line 93 of file integer_cln_imp.h.
Definition at line 81 of file integer_gmp_imp.h.
|
inline |
Definition at line 99 of file integer_cln_imp.h.
|
inline |
Definition at line 87 of file integer_gmp_imp.h.
|
inline |
Definition at line 120 of file integer_cln_imp.h.
|
inline |
Definition at line 108 of file integer_gmp_imp.h.
|
inline |
Definition at line 124 of file integer_cln_imp.h.
|
inline |
Definition at line 112 of file integer_gmp_imp.h.
|
inline |
Raise this Integer to the power exp
.
exp | the exponent |
Definition at line 322 of file integer_cln_imp.h.
|
inline |
Raise this Integer to the power exp
.
exp | the exponent |
Definition at line 377 of file integer_gmp_imp.h.
|
inline |
Definition at line 183 of file integer_cln_imp.h.
Referenced by CVC4::BitVector::setBit().
|
inline |
Returns the Integer obtained by setting the ith bit of the current Integer to 1.
Definition at line 179 of file integer_gmp_imp.h.
|
inline |
Definition at line 392 of file integer_cln_imp.h.
Referenced by euclidianQR().
|
inline |
Definition at line 348 of file integer_gmp_imp.h.
|
inline |
Definition at line 402 of file integer_cln_imp.h.
Referenced by euclidianQR().
|
inline |
Definition at line 356 of file integer_gmp_imp.h.
|
inline |
Definition at line 398 of file integer_cln_imp.h.
|
inline |
Definition at line 352 of file integer_gmp_imp.h.
|
inline |
Returns true iff bit n is set.
n | the bit to test (0 == least significant bit) |
Definition at line 460 of file integer_cln_imp.h.
|
inline |
Returns true iff bit n is set.
n | the bit to test (0 == least significant bit) |
Definition at line 458 of file integer_gmp_imp.h.
|
inline |
Definition at line 364 of file integer_cln_imp.h.
Referenced by CVC4::Cardinality::Cardinality(), CVC4::CardinalityBeth::CardinalityBeth(), CVC4::SExpr::getValue(), CVC4::operator<<(), and CVC4::BitVector::toString().
|
inline |
Definition at line 417 of file integer_gmp_imp.h.
|
inline |
Definition at line 198 of file integer_cln_imp.h.
Referenced by CVC4::BitVector::arithRightShift(), CVC4::BitVector::leftShift(), and CVC4::BitVector::logicalRightShift().
|
inline |
Definition at line 205 of file integer_gmp_imp.h.
|
friend |
Definition at line 512 of file integer_cln_imp.h.