SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
Numeric.h
Go to the documentation of this file.
1 /**
2  * @file Numeric.h
3  * @author Florian Corzilius <corzilius@cs.rwth-aachen.de>
4  *
5  * @version 2013-04-15
6  * Created on April 15th, 2013
7  */
8 
9 #ifndef NUMERIC_H
10 #define NUMERIC_H
11 
12 #include <iostream>
13 #include <cassert>
15 
16 
17 namespace smtrat
18 {
19  namespace lra
20  {
21  class Numeric
22  {
23  private:
24  // Members:
26 
27  public:
28  // Constructors/Destructor:
29  Numeric();
30  Numeric( const Rational& );
31  Numeric( int );
32  Numeric( unsigned int );
33  Numeric( long );
34  Numeric( unsigned long );
35  Numeric( const char* );
36  Numeric( const Numeric& );
37  ~Numeric();
38 
39  // Methods:
40  const Rational& content() const
41  {
42  return *mContent;
43  }
44 
46  {
47  return *mContent;
48  }
49 
50  Numeric& operator=( int );
51  Numeric& operator=( unsigned int );
52  Numeric& operator=( long );
53  Numeric& operator=( unsigned long );
54  Numeric& operator=( const char* );
55  Numeric& operator=( const Numeric& );
56 
57  bool operator==( const Numeric& ) const;
58  bool operator!=( const Numeric& ) const;
59  bool operator<( const Numeric& ) const;
60  bool operator<=( const Numeric& ) const;
61  bool operator>( const Numeric& ) const;
62  bool operator>=( const Numeric& ) const;
63 
64  Numeric numer() const;
65  Numeric denom() const;
66  Numeric floor() const;
67 
68  bool is_positive() const;
69  bool is_negative() const;
70  bool is_zero() const;
71  bool is_integer() const;
72  };
73 
74  Numeric abs( const Numeric& );
75  Numeric mod( const Numeric&, const Numeric& );
76  Numeric lcm( const Numeric&, const Numeric& );
77  Numeric gcd( const Numeric&, const Numeric& );
78  Numeric operator+( const Numeric&, const Numeric& );
79  Numeric operator-( const Numeric&, const Numeric& );
80  Numeric operator*( const Numeric&, const Numeric& );
81  Numeric operator/( const Numeric&, const Numeric& );
82  Numeric& operator+=( Numeric&, const Numeric& );
83  Numeric& operator-=( Numeric&, const Numeric& );
84  Numeric& operator*=( Numeric&, const Numeric& );
85  Numeric& operator/=( Numeric&, const Numeric& );
86  Numeric operator-( const Numeric& );
87  Numeric& operator++( Numeric& );
88  Numeric& operator--( Numeric& );
89  std::ostream& operator <<( std::ostream&, const Numeric& );
90  } // namespace lra
91 } // namespace smtrat
92 
93 #endif /* NUMERIC_H */
94 
const Rational & content() const
Definition: Numeric.h:40
Numeric floor() const
Definition: Numeric.cpp:229
bool is_integer() const
Definition: Numeric.cpp:266
bool is_zero() const
Definition: Numeric.cpp:257
bool operator>=(const Numeric &) const
Compares whether this Numeric is greater or equal than the given one.
Definition: Numeric.cpp:205
Numeric numer() const
Definition: Numeric.cpp:213
bool operator<=(const Numeric &) const
Compares whether this Numeric is less or equal than the given one.
Definition: Numeric.cpp:183
Numeric & operator=(int)
Cast from an integer.
Definition: Numeric.cpp:88
Rational & rContent()
Definition: Numeric.h:45
bool is_negative() const
Definition: Numeric.cpp:248
bool operator>(const Numeric &) const
Compares whether this Numeric is greater than the given one.
Definition: Numeric.cpp:194
bool operator<(const Numeric &) const
Compares whether this Numeric is less than the given one.
Definition: Numeric.cpp:172
bool is_positive() const
Checks whether this Numeric corresponds to a positive rational number.
Definition: Numeric.cpp:239
Numeric()
Default constructor.
Definition: Numeric.cpp:18
bool operator==(const Numeric &) const
Compares whether this Numeric and the given one are equal.
Definition: Numeric.cpp:150
Rational * mContent
Definition: Numeric.h:25
bool operator!=(const Numeric &) const
Compares whether this Numeric and the given one are not equal.
Definition: Numeric.cpp:161
Numeric denom() const
Definition: Numeric.cpp:221
Numeric & operator+=(Numeric &_valueA, const Numeric &_valueB)
Adds the value of the second given Numeric to the second given Numeric.
Definition: Numeric.cpp:375
Numeric lcm(const Numeric &_valueA, const Numeric &_valueB)
Calculates the least common multiple of the two arguments.
Definition: Numeric.cpp:302
std::ostream & operator<<(std::ostream &_out, const Numeric &_value)
Prints the given Numerics representation on the given output stream.
Definition: Numeric.cpp:455
Numeric & operator++(Numeric &_value)
Increments the given Numeric by one.
Definition: Numeric.cpp:432
Numeric operator-(const Numeric &_valueA, const Numeric &_valueB)
Calculates the difference between the two given Numerics.
Definition: Numeric.cpp:342
Numeric abs(const Numeric &_value)
Calculates the absolute value of the given Numeric.
Definition: Numeric.cpp:276
Numeric & operator*=(Numeric &_valueA, const Numeric &_valueB)
Multiplies the second given Numeric to the first given Numeric.
Definition: Numeric.cpp:399
Numeric mod(const Numeric &_valueA, const Numeric &_valueB)
Calculates the result of the first argument modulo the second argument.
Definition: Numeric.cpp:288
Numeric operator*(const Numeric &_valueA, const Numeric &_valueB)
Calculates the product of the two given Numerics.
Definition: Numeric.cpp:353
Numeric operator/(const Numeric &_valueA, const Numeric &_valueB)
Calculates the division of the two given Numerics.
Definition: Numeric.cpp:364
Numeric & operator--(Numeric &_value)
Decrements the given Numeric by one.
Definition: Numeric.cpp:443
Numeric operator+(const Numeric &_valueA, const Numeric &_valueB)
Calculates the sum of the two given Numerics.
Definition: Numeric.cpp:331
Numeric & operator-=(Numeric &_valueA, const Numeric &_valueB)
Subtracts the second given Numeric to the first given Numeric.
Definition: Numeric.cpp:387
Numeric gcd(const Numeric &_valueA, const Numeric &_valueB)
Calculates the greatest common divisor of the two arguments.
Definition: Numeric.cpp:317
Numeric & operator/=(Numeric &_valueA, const Numeric &_valueB)
Divides the first given Numeric by the second given Numeric.
Definition: Numeric.cpp:411
Class to create the formulas for axioms.
mpq_class Rational
Definition: types.h:19