10 #include <boost/logic/tribool.hpp> 
   14 #include "../../core/Relation.h" 
   16 #include "../common/Operations.h" 
   17 #include "../common/NumberOperations.h" 
   22 class LPRealAlgebraicNumber {
 
   25     using NumberType = mpq_class;
 
   31             lp_value_destruct(&c);
 
   34     mutable std::shared_ptr<Content> m_content;
 
   36     static const Variable auxVariable;
 
   39     ~LPRealAlgebraicNumber();
 
   44     LPRealAlgebraicNumber();
 
   50     LPRealAlgebraicNumber(
const lp_value_t& num);
 
   57     LPRealAlgebraicNumber(lp_value_t&& num);
 
   71     LPRealAlgebraicNumber(
const NumberType& num);
 
   73     LPRealAlgebraicNumber(
const LPRealAlgebraicNumber& ran);
 
   74     LPRealAlgebraicNumber(LPRealAlgebraicNumber&& ran);
 
   75     LPRealAlgebraicNumber& operator=(
const LPRealAlgebraicNumber& n);
 
   76     LPRealAlgebraicNumber& operator=(LPRealAlgebraicNumber&& n);
 
   86     inline lp_value_t* get_internal() {
 
   87         return &(m_content->c);
 
   93     inline const lp_value_t* get_internal()
 const {
 
   94         return &(m_content->c);
 
  100     bool is_numeric() 
const;
 
  103     const UnivariatePolynomial<NumberType> polynomial() 
const;
 
  105     const Interval<NumberType> interval() 
const;
 
  107     const NumberType get_upper_bound() 
const;
 
  109     const NumberType get_lower_bound() 
const;
 
  115     const NumberType value() 
const;
 
  117     friend bool compare(
const LPRealAlgebraicNumber&, 
const LPRealAlgebraicNumber&, 
const Relation);
 
  118     friend bool compare(
const LPRealAlgebraicNumber&, 
const NumberType&, 
const Relation);
 
  121     friend NumberType 
sample_above(
const LPRealAlgebraicNumber& n);
 
  122     friend NumberType 
sample_below(
const LPRealAlgebraicNumber& n);
 
  123     friend NumberType 
sample_between(
const LPRealAlgebraicNumber& lower, 
const LPRealAlgebraicNumber& upper);
 
  124     friend NumberType 
sample_between(
const LPRealAlgebraicNumber& lower, 
const NumberType& upper);
 
  125     friend NumberType 
sample_between(
const NumberType& lower, 
const LPRealAlgebraicNumber& upper);
 
  126     friend NumberType 
floor(
const LPRealAlgebraicNumber& n);
 
  127     friend NumberType 
ceil(
const LPRealAlgebraicNumber& n);
 
  132 bool compare(
const LPRealAlgebraicNumber&, 
const LPRealAlgebraicNumber&, 
const Relation);
 
  133 bool compare(
const LPRealAlgebraicNumber&, 
const LPRealAlgebraicNumber::NumberType&, 
const Relation);
 
  135 LPRealAlgebraicNumber::NumberType 
branching_point(
const LPRealAlgebraicNumber& n);
 
  136 LPRealAlgebraicNumber::NumberType 
sample_above(
const LPRealAlgebraicNumber& n);
 
  137 LPRealAlgebraicNumber::NumberType 
sample_below(
const LPRealAlgebraicNumber& n);
 
  138 LPRealAlgebraicNumber::NumberType 
sample_between(
const LPRealAlgebraicNumber& lower, 
const LPRealAlgebraicNumber& upper);
 
  139 LPRealAlgebraicNumber::NumberType 
sample_between(
const LPRealAlgebraicNumber& lower, 
const LPRealAlgebraicNumber::NumberType& upper);
 
  140 LPRealAlgebraicNumber::NumberType 
sample_between(
const LPRealAlgebraicNumber::NumberType& lower, 
const LPRealAlgebraicNumber& upper);
 
  141 LPRealAlgebraicNumber::NumberType 
floor(
const LPRealAlgebraicNumber& n);
 
  142 LPRealAlgebraicNumber::NumberType 
ceil(
const LPRealAlgebraicNumber& n);
 
  144 void refine(
const LPRealAlgebraicNumber& n);
 
  146 inline bool is_zero(
const LPRealAlgebraicNumber& n) {
 
  148     return lp_value_sgn(n.get_internal()) == 0;
 
  151 bool is_integer(
const LPRealAlgebraicNumber& n);
 
  152 LPRealAlgebraicNumber::NumberType 
integer_below(
const LPRealAlgebraicNumber& n);
 
  153 LPRealAlgebraicNumber 
abs(
const LPRealAlgebraicNumber& n);
 
  155 std::size_t 
bitsize(
const LPRealAlgebraicNumber& n);
 
  156 Sign sgn(
const LPRealAlgebraicNumber& n);
 
  157 Sign sgn(
const LPRealAlgebraicNumber& n, 
const UnivariatePolynomial<LPRealAlgebraicNumber::NumberType>& p);
 
  158 bool contained_in(
const LPRealAlgebraicNumber& n, 
const Interval<LPRealAlgebraicNumber::NumberType>& i);
 
  160 std::ostream& 
operator<<(std::ostream& os, 
const LPRealAlgebraicNumber& ran);
 
  163 struct is_ran_type<LPRealAlgebraicNumber> : std::true_type {};
 
  168 struct hash<
carl::LPRealAlgebraicNumber> {
 
  169     std::size_t operator()(
const carl::LPRealAlgebraicNumber& n)
 const {
 
  171         return lp_value_hash_approx(n.get_internal(), 0);
 
carl is the main namespace for the library.
Interval< Number > ceil(const Interval< Number > &_in)
Method which returns the next larger integer of the passed number or the number itself,...
Interval< Number > abs(const Interval< Number > &_in)
Method which returns the absolute value of the passed number.
Interval< Number > floor(const Interval< Number > &_in)
Method which returns the next smaller integer of this number or the number itself,...
const Number & branching_point(const Number &n)
Number sample_above(const Number &n)
std::ostream & operator<<(std::ostream &os, const BasicConstraint< Poly > &c)
Prints the given constraint on the given stream.
signed compare(const BasicConstraint< Pol > &_constraintA, const BasicConstraint< Pol > &_constraintB)
Compares _constraintA with _constraintB.
Sign
This class represents the sign of a number .
bool is_zero(const Interval< Number > &i)
Check if this interval is a point-interval containing 0.
Number integer_below(const IntRepRealAlgebraicNumber< Number > &n)
Sign sgn(const Number &n)
Obtain the sign of the given number.
bool contained_in(const IntRepRealAlgebraicNumber< Number > &n, const Interval< Number > &i)
bool is_integer(const Interval< Number > &n)
Number sample_below(const Number &n)
std::size_t bitsize(const cln::cl_I &n)
Get the bit size of the representation of a integer.
Number sample_between(const Number &lower, const Number &upper)
This class represents a univariate polynomial with coefficients of an arbitrary type.