PPL  1.2
Parma_Polyhedra_Library::Interval< Boundary, Info > Class Template Reference

A generic, not necessarily closed, possibly restricted interval. More...

#include <Interval_defs.hh>

Inheritance diagram for Parma_Polyhedra_Library::Interval< Boundary, Info >:
Collaboration diagram for Parma_Polyhedra_Library::Interval< Boundary, Info >:

Public Types

typedef Boundary boundary_type
 
typedef Info info_type
 
typedef Interval_NS::Property Property
 

Public Member Functions

template<typename T >
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, Interval & >::type operator= (const T &x)
 
template<typename T >
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, Interval & >::type operator+= (const T &x)
 
template<typename T >
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, Interval & >::type operator-= (const T &x)
 
template<typename T >
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, Interval & >::type operator*= (const T &x)
 
template<typename T >
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, Interval & >::type operator/= (const T &x)
 
void m_swap (Interval &y)
 Swaps *this with y. More...
 
Info & info ()
 
const Info & info () const
 
Boundary & lower ()
 
const Boundary & lower () const
 
Boundary & upper ()
 
const Boundary & upper () const
 
I_Constraint< boundary_typelower_constraint () const
 
I_Constraint< boundary_typeupper_constraint () const
 
bool is_empty () const
 
bool check_empty (I_Result r) const
 
bool is_singleton () const
 
bool lower_is_open () const
 
bool upper_is_open () const
 
bool lower_is_boundary_infinity () const
 
bool upper_is_boundary_infinity () const
 
bool lower_is_domain_inf () const
 
bool upper_is_domain_sup () const
 
bool is_bounded () const
 
bool is_universe () const
 
I_Result lower_extend ()
 
template<typename C >
Enable_If< Is_Same_Or_Derived< I_Constraint_Base, C >::value, I_Result >::type lower_extend (const C &c)
 
I_Result upper_extend ()
 
template<typename C >
Enable_If< Is_Same_Or_Derived< I_Constraint_Base, C >::value, I_Result >::type upper_extend (const C &c)
 
I_Result build ()
 
template<typename C >
Enable_If< Is_Same_Or_Derived< I_Constraint_Base, C >::value, I_Result >::type build (const C &c)
 
template<typename C1 , typename C2 >
Enable_If< Is_Same_Or_Derived< I_Constraint_Base, C1 >::value &&Is_Same_Or_Derived< I_Constraint_Base, C2 >::value, I_Result >::type build (const C1 &c1, const C2 &c2)
 
template<typename C >
Enable_If< Is_Same_Or_Derived< I_Constraint_Base, C >::value, I_Result >::type add_constraint (const C &c)
 
I_Result assign (Degenerate_Element e)
 
template<typename From >
Enable_If< Is_Special< From >::value, I_Result >::type assign (const From &)
 
I_Result set_infinities ()
 
bool is_topologically_closed () const
 
void topological_closure_assign ()
 Assigns to *this its topological closure. More...
 
void remove_inf ()
 
void remove_sup ()
 
int infinity_sign () const
 
bool contains_integer_point () const
 
void drop_some_non_integer_points ()
 
template<typename From >
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type wrap_assign (Bounded_Integer_Type_Width w, Bounded_Integer_Type_Representation r, const From &refinement)
 
memory_size_type total_memory_in_bytes () const
 Returns the total size in bytes of the memory occupied by *this. More...
 
memory_size_type external_memory_in_bytes () const
 Returns the size in bytes of the memory managed by *this. More...
 
void ascii_dump (std::ostream &s) const
 
bool ascii_load (std::istream &s)
 
bool OK () const
 
 Interval ()
 
template<typename T >
 Interval (const T &x)
 
 Interval (const char *s)
 Builds the smallest interval containing the number whose textual representation is contained in s. More...
 
template<typename T >
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type contains (const T &y) const
 
template<typename T >
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type strictly_contains (const T &y) const
 
template<typename T >
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type is_disjoint_from (const T &y) const
 
template<typename From >
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type assign (const From &x)
 
template<typename Type >
Enable_If< Is_Singleton< Type >::value||Is_Interval< Type >::value, bool >::type can_be_exactly_joined_to (const Type &x) const
 
template<typename From >
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type join_assign (const From &x)
 
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton< From1 >::value||Is_Interval< From1 >::value)&&(Is_Singleton< From2 >::value||Is_Interval< From2 >::value)), I_Result >::type join_assign (const From1 &x, const From2 &y)
 
template<typename From >
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type intersect_assign (const From &x)
 
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton< From1 >::value||Is_Interval< From1 >::value)&&(Is_Singleton< From2 >::value||Is_Interval< From2 >::value)), I_Result >::type intersect_assign (const From1 &x, const From2 &y)
 
template<typename From >
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type difference_assign (const From &x)
 Assigns to *this the smallest interval containing the set-theoretic difference of *this and x. More...
 
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton< From1 >::value||Is_Interval< From1 >::value)&&(Is_Singleton< From2 >::value||Is_Interval< From2 >::value)), I_Result >::type difference_assign (const From1 &x, const From2 &y)
 Assigns to *this the smallest interval containing the set-theoretic difference of x and y. More...
 
template<typename From >
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type lower_approximation_difference_assign (const From &x)
 Assigns to *this the largest interval contained in the set-theoretic difference of *this and x. More...
 
template<typename From >
Enable_If< Is_Interval< From >::value, bool >::type simplify_using_context_assign (const From &y)
 Assigns to *this a meet-preserving simplification of *this with respect to y. More...
 
template<typename From >
Enable_If< Is_Interval< From >::value, void >::type empty_intersection_assign (const From &y)
 Assigns to *this an interval having empty intersection with y. The assigned interval should be as large as possible. More...
 
template<typename From >
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type refine_existential (Relation_Symbol rel, const From &x)
 Refines to according to the existential relation rel with x. More...
 
template<typename From >
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type refine_universal (Relation_Symbol rel, const From &x)
 Refines to so that it satisfies the universal relation rel with x. More...
 
template<typename From >
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type neg_assign (const From &x)
 
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton< From1 >::value||Is_Interval< From1 >::value)&&(Is_Singleton< From2 >::value||Is_Interval< From2 >::value)), I_Result >::type add_assign (const From1 &x, const From2 &y)
 
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton< From1 >::value||Is_Interval< From1 >::value)&&(Is_Singleton< From2 >::value||Is_Interval< From2 >::value)), I_Result >::type sub_assign (const From1 &x, const From2 &y)
 
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton< From1 >::value||Is_Interval< From1 >::value)&&(Is_Singleton< From2 >::value||Is_Interval< From2 >::value)), I_Result >::type mul_assign (const From1 &x, const From2 &y)
 
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton< From1 >::value||Is_Interval< From1 >::value)&&(Is_Singleton< From2 >::value||Is_Interval< From2 >::value)), I_Result >::type div_assign (const From1 &x, const From2 &y)
 
template<typename From , typename Iterator >
Enable_If< Is_Interval< From >::value, void >::type CC76_widening_assign (const From &y, Iterator first, Iterator last)
 
template<typename T >
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type contains (const T &y) const
 
template<typename T >
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type strictly_contains (const T &y) const
 
template<typename T >
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type is_disjoint_from (const T &y) const
 
template<typename From >
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type assign (const From &x)
 
template<typename From >
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type join_assign (const From &x)
 
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton< From1 >::value||Is_Interval< From1 >::value)&&(Is_Singleton< From2 >::value||Is_Interval< From2 >::value)), I_Result >::type join_assign (const From1 &x, const From2 &y)
 
template<typename Type >
Enable_If< Is_Singleton< Type >::value||Is_Interval< Type >::value, bool >::type can_be_exactly_joined_to (const Type &x) const
 
template<typename From >
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type intersect_assign (const From &x)
 
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton< From1 >::value||Is_Interval< From1 >::value)&&(Is_Singleton< From2 >::value||Is_Interval< From2 >::value)), I_Result >::type intersect_assign (const From1 &x, const From2 &y)
 
template<typename From >
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type difference_assign (const From &x)
 
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton< From1 >::value||Is_Interval< From1 >::value)&&(Is_Singleton< From2 >::value||Is_Interval< From2 >::value)), I_Result >::type difference_assign (const From1 &x, const From2 &y)
 
template<typename From >
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type refine_existential (Relation_Symbol rel, const From &x)
 
template<typename From >
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type refine_universal (Relation_Symbol rel, const From &x)
 
template<typename From >
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type neg_assign (const From &x)
 
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton< From1 >::value||Is_Interval< From1 >::value)&&(Is_Singleton< From2 >::value||Is_Interval< From2 >::value)), I_Result >::type add_assign (const From1 &x, const From2 &y)
 
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton< From1 >::value||Is_Interval< From1 >::value)&&(Is_Singleton< From2 >::value||Is_Interval< From2 >::value)), I_Result >::type sub_assign (const From1 &x, const From2 &y)
 
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton< From1 >::value||Is_Interval< From1 >::value)&&(Is_Singleton< From2 >::value||Is_Interval< From2 >::value)), I_Result >::type mul_assign (const From1 &x, const From2 &y)
 
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton< From1 >::value||Is_Interval< From1 >::value)&&(Is_Singleton< From2 >::value||Is_Interval< From2 >::value)), I_Result >::type div_assign (const From1 &x, const From2 &y)
 
template<typename C >
Enable_If< Is_Same_Or_Derived< I_Constraint_Base, C >::value, I_Result >::type lower_extend (const C &c)
 
template<typename C >
Enable_If< Is_Same_Or_Derived< I_Constraint_Base, C >::value, I_Result >::type upper_extend (const C &c)
 
template<typename From , typename Iterator >
Enable_If< Is_Interval< From >::value, void >::type CC76_widening_assign (const From &y, Iterator first, Iterator last)
 
template<typename From >
Enable_If< Is_Interval< From >::value, bool >::type simplify_using_context_assign (const From &y)
 
template<typename From >
Enable_If< Is_Interval< From >::value, void >::type empty_intersection_assign (const From &)
 

Static Public Member Functions

static bool is_always_topologically_closed ()
 

Private Member Functions

 PPL_COMPILE_TIME_CHECK (!Info::store_special||!std::numeric_limits< Boundary >::has_infinity,"store_special is meaningless"" when boundary type may contains infinity")
 
Info & w_info () const
 

Private Attributes

Boundary lower_
 
Boundary upper_
 

Related Functions

(Note that these are not member functions.)

template<typename Boundary , typename Info >
void swap (Interval< Boundary, Info > &x, Interval< Boundary, Info > &y)
 Swaps x with y. More...
 
template<typename Boundary , typename Info >
void swap (Interval< Boundary, Info > &x, Interval< Boundary, Info > &y)
 

Detailed Description

template<typename Boundary, typename Info>
class Parma_Polyhedra_Library::Interval< Boundary, Info >

A generic, not necessarily closed, possibly restricted interval.

The class template type parameter Boundary represents the type of the interval boundaries, and can be chosen, among other possibilities, within one of the following number families:

  • a bounded precision native integer type (that is, from signed char to long long and from int8_t to int64_t);
  • a bounded precision floating point type (float, double or long double);
  • an unbounded integer or rational type, as provided by the C++ interface of GMP (mpz_class or mpq_class).

The class template type parameter Info allows to control a number of features of the class, among which:

  • the ability to support open as well as closed boundaries;
  • the ability to represent empty intervals in addition to nonempty ones;
  • the ability to represent intervals of extended number families that contain positive and negative infinities;

Definition at line 81 of file Interval_defs.hh.

Member Typedef Documentation

template<typename Boundary, typename Info>
typedef Boundary Parma_Polyhedra_Library::Interval< Boundary, Info >::boundary_type

Definition at line 92 of file Interval_defs.hh.

template<typename Boundary, typename Info>
typedef Info Parma_Polyhedra_Library::Interval< Boundary, Info >::info_type

Definition at line 93 of file Interval_defs.hh.

template<typename Boundary, typename Info>
typedef Interval_NS::Property Parma_Polyhedra_Library::Interval< Boundary, Info >::Property

Definition at line 95 of file Interval_defs.hh.

Constructor & Destructor Documentation

template<typename Boundary, typename Info>
Parma_Polyhedra_Library::Interval< Boundary, Info >::Interval ( )
inline

Definition at line 585 of file Interval_defs.hh.

585  {
586  }
template<typename Boundary, typename Info>
template<typename T >
Parma_Polyhedra_Library::Interval< Boundary, Info >::Interval ( const T &  x)
inlineexplicit

Definition at line 589 of file Interval_defs.hh.

References Parma_Polyhedra_Library::Boundary_NS::assign().

589  {
590  assign(x);
591  }
I_Result assign(Degenerate_Element e)
template<typename Boundary , typename Info >
Parma_Polyhedra_Library::Interval< Boundary, Info >::Interval ( const char *  s)
explicit

Builds the smallest interval containing the number whose textual representation is contained in s.

Definition at line 143 of file Interval_templates.hh.

References Parma_Polyhedra_Library::Boundary_NS::assign(), Parma_Polyhedra_Library::assign_r(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::result_relation_class(), Parma_Polyhedra_Library::ROUND_DOWN, Parma_Polyhedra_Library::ROUND_UP, Parma_Polyhedra_Library::Interval_NS::SCALAR_INFO, Parma_Polyhedra_Library::Boundary_NS::set_minus_infinity(), Parma_Polyhedra_Library::Boundary_NS::set_plus_infinity(), Parma_Polyhedra_Library::UNIVERSE, Parma_Polyhedra_Library::Boundary_NS::UPPER, Parma_Polyhedra_Library::V_CVT_STR_UNK, Parma_Polyhedra_Library::V_EQ, Parma_Polyhedra_Library::V_EQ_MINUS_INFINITY, Parma_Polyhedra_Library::V_EQ_PLUS_INFINITY, Parma_Polyhedra_Library::V_GE, Parma_Polyhedra_Library::V_GT, Parma_Polyhedra_Library::V_GT_MINUS_INFINITY, Parma_Polyhedra_Library::V_LE, Parma_Polyhedra_Library::V_LT, Parma_Polyhedra_Library::V_LT_PLUS_INFINITY, and Parma_Polyhedra_Library::V_NAN.

143  {
144  // Get the lower bound.
145  Boundary lower_bound;
146  Result lower_r = assign_r(lower_bound, s, ROUND_DOWN);
147  if (lower_r == V_CVT_STR_UNK || lower_r == V_NAN) {
148  throw std::invalid_argument("PPL::Interval(const char* s)"
149  " with s invalid");
150  }
151  lower_r = result_relation_class(lower_r);
152 
153  // Get the upper bound.
154  Boundary upper_bound;
155  Result upper_r = assign_r(upper_bound, s, ROUND_UP);
156  PPL_ASSERT(upper_r != V_CVT_STR_UNK && upper_r != V_NAN);
157  upper_r = result_relation_class(upper_r);
158 
159  // Build the interval.
160  bool lower_open = false;
161  bool upper_open = false;
162  bool lower_boundary_infinity = false;
163  bool upper_boundary_infinity = false;
164  switch (lower_r) {
165  case V_EQ: // Fall through.
166  case V_GE:
167  break;
168  case V_GT:
169  lower_open = true;
170  break;
171  case V_GT_MINUS_INFINITY:
172  lower_open = true;
173  // Fall through.
174  case V_EQ_MINUS_INFINITY:
175  lower_boundary_infinity = true;
176  break;
177  case V_EQ_PLUS_INFINITY: // Fall through.
178  case V_LT_PLUS_INFINITY:
179  if (upper_r == V_EQ_PLUS_INFINITY || upper_r == V_LT_PLUS_INFINITY) {
180  assign(UNIVERSE);
181  }
182  else {
183  assign(EMPTY);
184  }
185  break;
186  default:
187  PPL_UNREACHABLE;
188  break;
189  }
190  switch (upper_r) {
191  case V_EQ: // Fall through.
192  case V_LE:
193  break;
194  case V_LT:
195  upper_open = true;
196  break;
197  case V_EQ_MINUS_INFINITY: // Fall through.
198  case V_GT_MINUS_INFINITY:
199  if (lower_r == V_EQ_MINUS_INFINITY || lower_r == V_GT_MINUS_INFINITY) {
200  assign(UNIVERSE);
201  }
202  else {
203  assign(EMPTY);
204  }
205  break;
206  case V_LT_PLUS_INFINITY:
207  upper_open = true;
208  // Fall through.
209  case V_EQ_PLUS_INFINITY:
210  upper_boundary_infinity = true;
211  break;
212  default:
213  PPL_UNREACHABLE;
214  break;
215  }
216 
217  if (!lower_boundary_infinity
218  && !upper_boundary_infinity
219  && (lower_bound > upper_bound
220  || (lower_open && lower_bound == upper_bound))) {
221  assign(EMPTY);
222  }
223  else {
224  if (lower_boundary_infinity) {
225  set_minus_infinity(LOWER, lower(), info(), lower_open);
226  }
227  else {
229  LOWER, lower_bound, SCALAR_INFO, lower_open);
230  }
231  if (upper_boundary_infinity) {
232  set_plus_infinity(UPPER, upper(), info(), upper_open);
233  }
234  else {
236  UPPER, upper_bound, SCALAR_INFO, upper_open);
237  }
238  }
239 }
Enable_If< Is_Native_Or_Checked< To >::value &&Is_Special< From >::value, Result >::type assign_r(To &to, const From &, Rounding_Dir dir)
The empty element, i.e., the empty set.
The computed result is exact.
Definition: Result_defs.hh:81
Result set_minus_infinity(Boundary_Type type, T &x, Info &info, bool open=false)
Result set_plus_infinity(Boundary_Type type, T &x, Info &info, bool open=false)
A positive integer overflow occurred (rounding up).
Definition: Result_defs.hh:111
Result
Possible outcomes of a checked arithmetic computation.
Definition: Result_defs.hh:76
Not a number result.
Definition: Result_defs.hh:123
The computed result is inexact and rounded down.
Definition: Result_defs.hh:87
Result assign(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type, const T &x, const Info &info, bool should_shrink=false)
I_Result assign(Degenerate_Element e)
Result result_relation_class(Result r)
Converting from unknown string.
Definition: Result_defs.hh:126
const Scalar_As_Interval_Info SCALAR_INFO
The computed result may be inexact and rounded up.
Definition: Result_defs.hh:93
The universe element, i.e., the whole vector space.
The computed result may be inexact and rounded down.
Definition: Result_defs.hh:96
A negative integer overflow occurred (rounding down).
Definition: Result_defs.hh:114
The computed result is inexact and rounded up.
Definition: Result_defs.hh:84

Member Function Documentation

template<typename Boundary, typename Info>
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton<From1>::value || Is_Interval<From1>::value) && (Is_Singleton<From2>::value || Is_Interval<From2>::value)), I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::add_assign ( const From1 &  x,
const From2 &  y 
)
inline

Definition at line 618 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::Boundary_NS::add_assign(), Parma_Polyhedra_Library::Boundary_NS::assign(), Parma_Polyhedra_Library::assign_or_swap(), Parma_Polyhedra_Library::check_empty_arg(), Parma_Polyhedra_Library::combine(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Interval_NS::f_info(), Parma_Polyhedra_Library::Interval_NS::f_lower(), Parma_Polyhedra_Library::f_OK(), Parma_Polyhedra_Library::Interval_NS::f_upper(), Parma_Polyhedra_Library::infinity_sign(), Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::MINUS_INFINITY, Parma_Polyhedra_Library::PLUS_INFINITY, PPL_DIRTY_TEMP, and Parma_Polyhedra_Library::Boundary_NS::UPPER.

618  {
619  PPL_ASSERT(f_OK(x));
620  PPL_ASSERT(f_OK(y));
621  if (check_empty_arg(x) || check_empty_arg(y)) {
622  return assign(EMPTY);
623  }
624  int inf_sign = Parma_Polyhedra_Library::infinity_sign(x);
625  if (inf_sign != 0) {
626  if (Parma_Polyhedra_Library::infinity_sign(y) == -inf_sign) {
627  return assign(EMPTY);
628  }
629  }
630  else {
632  }
633  if (inf_sign < 0) {
634  return assign(MINUS_INFINITY);
635  }
636  else if (inf_sign > 0) {
637  return assign(PLUS_INFINITY);
638  }
639  PPL_DIRTY_TEMP(To_Info, to_info);
640  to_info.clear();
641  Result rl = Boundary_NS::add_assign(LOWER, lower(), to_info,
642  LOWER, f_lower(x), f_info(x),
643  LOWER, f_lower(y), f_info(y));
644  Result ru = Boundary_NS::add_assign(UPPER, upper(), to_info,
645  UPPER, f_upper(x), f_info(x),
646  UPPER, f_upper(y), f_info(y));
647  assign_or_swap(info(), to_info);
648  PPL_ASSERT(OK());
649  return combine(rl, ru);
650 }
The empty element, i.e., the empty set.
Enable_If< Has_Assign_Or_Swap< T >::value, void >::type assign_or_swap(T &to, T &from)
Result
Possible outcomes of a checked arithmetic computation.
Definition: Result_defs.hh:76
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type check_empty_arg(const T &x)
I_Result assign(Degenerate_Element e)
Enable_If< Is_Singleton< T >::value, const T & >::type f_lower(const T &x)
#define PPL_DIRTY_TEMP(T, id)
Plus_Infinity PLUS_INFINITY
Definition: checked.cc:31
Enable_If< Is_Singleton< T >::value, Scalar_As_Interval_Info_Open >::type f_info(const T &, bool open)
Minus_Infinity MINUS_INFINITY
Definition: checked.cc:30
Enable_If< Has_OK< T >::value, bool >::type f_OK(const T &to)
Result add_assign(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
I_Result combine(Result l, Result u)
Enable_If< Is_Singleton< T >::value, const T & >::type f_upper(const T &x)
Enable_If< Is_Native_Or_Checked< T >::value, int >::type infinity_sign(const T &x)
template<typename Boundary, typename Info>
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton<From1>::value || Is_Interval<From1>::value) && (Is_Singleton<From2>::value || Is_Interval<From2>::value)), I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::add_assign ( const From1 &  x,
const From2 &  y 
)
template<typename Boundary, typename Info>
template<typename C >
Enable_If<Is_Same_Or_Derived<I_Constraint_Base, C>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::add_constraint ( const C &  c)
inline

Definition at line 302 of file Interval_defs.hh.

References Parma_Polyhedra_Library::Interval< Boundary, Info >::build().

302  {
303  Interval x;
304  x.build(c);
305  return intersect_assign(x);
306  }
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type intersect_assign(const From &x)
Coefficient c
Definition: PIP_Tree.cc:64
template<typename Boundary , typename Info >
void Parma_Polyhedra_Library::Interval< Boundary, Info >::ascii_dump ( std::ostream &  s) const
inline

Definition at line 1113 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::ascii_dump().

1113  {
1115  s << "info ";
1116  info().ascii_dump(s);
1117  s << " lower ";
1118  ascii_dump(s, lower());
1119  s << " upper ";
1120  ascii_dump(s, upper());
1121  s << '\n';
1122 }
void ascii_dump(std::ostream &s) const
Enable_If< Is_Native_Or_Checked< T >::value, void >::type ascii_dump(std::ostream &s, const T &t)
template<typename Boundary , typename Info >
bool Parma_Polyhedra_Library::Interval< Boundary, Info >::ascii_load ( std::istream &  s)
inline

Definition at line 1126 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::ascii_load().

1126  {
1128  std::string str;
1129  if (!(s >> str) || str != "info") {
1130  return false;
1131  }
1132  if (!info().ascii_load(s)) {
1133  return false;
1134  }
1135  if (!(s >> str) || str != "lower") {
1136  return false;
1137  }
1138  if (!ascii_load(s, lower())) {
1139  return false;
1140  }
1141  if (!(s >> str) || str != "upper") {
1142  return false;
1143  }
1144  if (!ascii_load(s, upper())) {
1145  return false;
1146  }
1147  PPL_ASSERT(OK());
1148  return true;
1149 }
Enable_If< Is_Native_Or_Checked< T >::value, bool >::type ascii_load(std::istream &s, T &t)
template<typename Boundary, typename Info>
template<typename From >
Enable_If<Is_Singleton<From>::value || Is_Interval<From>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::assign ( const From &  x)
inline

Definition at line 243 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::Boundary_NS::assign(), Parma_Polyhedra_Library::assign_or_swap(), Parma_Polyhedra_Library::check_empty_arg(), Parma_Polyhedra_Library::combine(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Interval_NS::f_info(), Parma_Polyhedra_Library::Interval_NS::f_lower(), Parma_Polyhedra_Library::f_OK(), Parma_Polyhedra_Library::Interval_NS::f_upper(), Parma_Polyhedra_Library::Boundary_NS::LOWER, PPL_DIRTY_TEMP, and Parma_Polyhedra_Library::Boundary_NS::UPPER.

243  {
244  PPL_ASSERT(f_OK(x));
245  if (check_empty_arg(x)) {
246  return assign(EMPTY);
247  }
248  PPL_DIRTY_TEMP(To_Info, to_info);
249  to_info.clear();
250  const Result rl = Boundary_NS::assign(LOWER, lower(), to_info,
251  LOWER, f_lower(x), f_info(x));
252  const Result ru = Boundary_NS::assign(UPPER, upper(), to_info,
253  UPPER, f_upper(x), f_info(x));
254  assign_or_swap(info(), to_info);
255  PPL_ASSERT(OK());
256  return combine(rl, ru);
257 }
The empty element, i.e., the empty set.
Enable_If< Has_Assign_Or_Swap< T >::value, void >::type assign_or_swap(T &to, T &from)
Result
Possible outcomes of a checked arithmetic computation.
Definition: Result_defs.hh:76
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type check_empty_arg(const T &x)
Result assign(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type, const T &x, const Info &info, bool should_shrink=false)
I_Result assign(Degenerate_Element e)
Enable_If< Is_Singleton< T >::value, const T & >::type f_lower(const T &x)
#define PPL_DIRTY_TEMP(T, id)
Enable_If< Is_Singleton< T >::value, Scalar_As_Interval_Info_Open >::type f_info(const T &, bool open)
Enable_If< Has_OK< T >::value, bool >::type f_OK(const T &to)
I_Result combine(Result l, Result u)
Enable_If< Is_Singleton< T >::value, const T & >::type f_upper(const T &x)
template<typename Boundary, typename Info>
I_Result Parma_Polyhedra_Library::Interval< Boundary, Info >::assign ( Degenerate_Element  e)
inline

Definition at line 308 of file Interval_defs.hh.

References Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::I_EMPTY, Parma_Polyhedra_Library::I_EXACT, Parma_Polyhedra_Library::I_UNIVERSE, Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::Boundary_NS::set_unbounded(), Parma_Polyhedra_Library::UNIVERSE, and Parma_Polyhedra_Library::Boundary_NS::UPPER.

Referenced by Parma_Polyhedra_Library::operator>>().

308  {
309  I_Result r;
310  info().clear();
311  switch (e) {
312  case EMPTY:
313  lower_ = 1;
314  upper_ = 0;
315  r = I_EMPTY | I_EXACT;
316  break;
317  case UNIVERSE:
318  set_unbounded(LOWER, lower(), info());
319  set_unbounded(UPPER, upper(), info());
320  r = I_UNIVERSE | I_EXACT;
321  break;
322  default:
323  PPL_UNREACHABLE;
324  r = I_EMPTY;
325  break;
326  }
327  PPL_ASSERT(OK());
328  return r;
329  }
The empty element, i.e., the empty set.
I_Result
The result of an operation on intervals.
Result may be the domain universe.
Result is definitely exact.
Result set_unbounded(Boundary_Type type, T &x, Info &info)
The universe element, i.e., the whole vector space.
template<typename Boundary, typename Info>
template<typename From >
Enable_If<Is_Special<From>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::assign ( const From &  )
inline

Definition at line 333 of file Interval_defs.hh.

References Parma_Polyhedra_Library::combine(), Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::Boundary_NS::set_minus_infinity(), Parma_Polyhedra_Library::Boundary_NS::set_plus_infinity(), Parma_Polyhedra_Library::Boundary_NS::UPPER, Parma_Polyhedra_Library::V_NAN, Parma_Polyhedra_Library::VC_MINUS_INFINITY, and Parma_Polyhedra_Library::VC_PLUS_INFINITY.

333  {
334  info().clear();
335  Result rl;
336  Result ru;
337  switch (From::vclass) {
338  case VC_MINUS_INFINITY:
341  break;
342  case VC_PLUS_INFINITY:
345  break;
346  default:
347  PPL_UNREACHABLE;
348  rl = V_NAN;
349  ru = V_NAN;
350  break;
351  }
352  PPL_ASSERT(OK());
353  return combine(rl, ru);
354  }
Result set_minus_infinity(Boundary_Type type, T &x, Info &info, bool open=false)
Result set_plus_infinity(Boundary_Type type, T &x, Info &info, bool open=false)
Result
Possible outcomes of a checked arithmetic computation.
Definition: Result_defs.hh:76
Negative infinity result class.
Definition: Result_defs.hh:34
Not a number result.
Definition: Result_defs.hh:123
Positive infinity result class.
Definition: Result_defs.hh:37
I_Result combine(Result l, Result u)
template<typename Boundary, typename Info>
template<typename From >
Enable_If<Is_Singleton<From>::value || Is_Interval<From>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::assign ( const From &  x)
template<typename Boundary, typename Info>
I_Result Parma_Polyhedra_Library::Interval< Boundary, Info >::build ( )
inline

Definition at line 246 of file Interval_defs.hh.

References Parma_Polyhedra_Library::Boundary_NS::assign(), and Parma_Polyhedra_Library::UNIVERSE.

Referenced by Parma_Polyhedra_Library::Interval< Boundary, Info >::add_constraint().

246  {
247  return assign(UNIVERSE);
248  }
I_Result assign(Degenerate_Element e)
The universe element, i.e., the whole vector space.
template<typename Boundary, typename Info>
template<typename C >
Enable_If<Is_Same_Or_Derived<I_Constraint_Base, C>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::build ( const C &  c)
inline

Definition at line 252 of file Interval_defs.hh.

References Parma_Polyhedra_Library::Boundary_NS::assign(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::UNIVERSE, Parma_Polyhedra_Library::V_EQ, Parma_Polyhedra_Library::V_GE, Parma_Polyhedra_Library::V_GT, Parma_Polyhedra_Library::V_GT_MINUS_INFINITY, Parma_Polyhedra_Library::V_LE, Parma_Polyhedra_Library::V_LGE, Parma_Polyhedra_Library::V_LT, Parma_Polyhedra_Library::V_LT_PLUS_INFINITY, and Parma_Polyhedra_Library::V_NE.

252  {
253  Relation_Symbol rs;
254  switch (c.rel()) {
255  case V_LGE:
256  case V_GT_MINUS_INFINITY:
257  case V_LT_PLUS_INFINITY:
258  return assign(UNIVERSE);
259  default:
260  return assign(EMPTY);
261  case V_LT:
262  case V_LE:
263  case V_GT:
264  case V_GE:
265  case V_EQ:
266  case V_NE:
267  assign(UNIVERSE);
268  rs = static_cast<Relation_Symbol>(c.rel());
269  return refine_existential(rs, c.value());
270  }
271  }
The empty element, i.e., the empty set.
The computed result is exact.
Definition: Result_defs.hh:81
A positive integer overflow occurred (rounding up).
Definition: Result_defs.hh:111
The computed result is inexact and rounded down.
Definition: Result_defs.hh:87
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type refine_existential(Relation_Symbol rel, const From &x)
Refines to according to the existential relation rel with x.
I_Result assign(Degenerate_Element e)
Relation_Symbol
Relation symbols.
The computed result is inexact.
Definition: Result_defs.hh:90
The computed result may be inexact and rounded up.
Definition: Result_defs.hh:93
The universe element, i.e., the whole vector space.
The computed result may be inexact and rounded down.
Definition: Result_defs.hh:96
A negative integer overflow occurred (rounding down).
Definition: Result_defs.hh:114
Coefficient c
Definition: PIP_Tree.cc:64
The computed result is inexact and rounded up.
Definition: Result_defs.hh:84
The computed result may be inexact.
Definition: Result_defs.hh:99
template<typename Boundary, typename Info>
template<typename C1 , typename C2 >
Enable_If<Is_Same_Or_Derived<I_Constraint_Base, C1>::value && Is_Same_Or_Derived<I_Constraint_Base, C2>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::build ( const C1 &  c1,
const C2 &  c2 
)
inline

Definition at line 278 of file Interval_defs.hh.

References Parma_Polyhedra_Library::Boundary_NS::assign(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::I_CHANGED, Parma_Polyhedra_Library::I_UNCHANGED, Parma_Polyhedra_Library::V_LGE, and Parma_Polyhedra_Library::V_NAN.

278  {
279  switch (c1.rel()) {
280  case V_LGE:
281  return build(c2);
282  case V_NAN:
283  return assign(EMPTY);
284  default:
285  break;
286  }
287  switch (c2.rel()) {
288  case V_LGE:
289  return build(c1);
290  case V_NAN:
291  return assign(EMPTY);
292  default:
293  break;
294  }
295  build(c1);
296  const I_Result r = add_constraint(c2);
297  return r - (I_CHANGED | I_UNCHANGED);
298  }
The empty element, i.e., the empty set.
I_Result
The result of an operation on intervals.
Enable_If< Is_Same_Or_Derived< I_Constraint_Base, C >::value, I_Result >::type add_constraint(const C &c)
Not a number result.
Definition: Result_defs.hh:123
I_Result assign(Degenerate_Element e)
Operation has definitely changed the set.
Operation has left the set definitely unchanged.
The computed result may be inexact.
Definition: Result_defs.hh:99
template<typename Boundary, typename Info>
template<typename Type >
Enable_If<Is_Singleton<Type>::value || Is_Interval<Type>::value, bool>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::can_be_exactly_joined_to ( const Type &  x) const
inline

Definition at line 313 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::Boundary_NS::eq(), Parma_Polyhedra_Library::Interval_NS::f_info(), Parma_Polyhedra_Library::Interval_NS::f_lower(), Parma_Polyhedra_Library::Interval_NS::f_upper(), Parma_Polyhedra_Library::Boundary_NS::gt(), Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::Boundary_NS::lt(), PPL_DIRTY_TEMP, and Parma_Polyhedra_Library::Boundary_NS::UPPER.

313  {
314  PPL_DIRTY_TEMP(Boundary, b);
315  if (gt(LOWER, lower(), info(), UPPER, f_upper(x), f_info(x))) {
316  b = lower();
317  return eq(LOWER, b, info(), UPPER, f_upper(x), f_info(x));
318  }
319  else if (lt(UPPER, upper(), info(), LOWER, f_lower(x), f_info(x))) {
320  b = upper();
321  return eq(UPPER, b, info(), LOWER, f_lower(x), f_info(x));
322  }
323  return true;
324 }
bool lt(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
bool gt(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Enable_If< Is_Singleton< T >::value, const T & >::type f_lower(const T &x)
bool eq(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
#define PPL_DIRTY_TEMP(T, id)
Enable_If< Is_Singleton< T >::value, Scalar_As_Interval_Info_Open >::type f_info(const T &, bool open)
Enable_If< Is_Singleton< T >::value, const T & >::type f_upper(const T &x)
template<typename Boundary, typename Info>
template<typename Type >
Enable_If<Is_Singleton<Type>::value || Is_Interval<Type>::value, bool>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::can_be_exactly_joined_to ( const Type &  x) const
template<typename Boundary, typename Info>
template<typename From , typename Iterator >
Enable_If<Is_Interval<From>::value, void>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::CC76_widening_assign ( const From &  y,
Iterator  first,
Iterator  last 
)

Definition at line 88 of file Interval_templates.hh.

References Parma_Polyhedra_Library::Interval< Boundary, Info >::lower(), Parma_Polyhedra_Library::Interval< Boundary, Info >::lower_extend(), Parma_Polyhedra_Library::Interval< Boundary, Info >::lower_is_boundary_infinity(), Parma_Polyhedra_Library::Interval< Boundary, Info >::upper(), Parma_Polyhedra_Library::Interval< Boundary, Info >::upper_extend(), and Parma_Polyhedra_Library::Interval< Boundary, Info >::upper_is_boundary_infinity().

90  {
91  // We assume that `y' is contained in or equal to `*this'.
92  PPL_ASSERT(contains(y));
93  Interval<Boundary, Info>& x = *this;
94 
95  // Upper bound.
96  if (!x.upper_is_boundary_infinity()) {
97  Boundary& x_ub = x.upper();
98  const Boundary& y_ub = y.upper();
99  PPL_ASSERT(!y.upper_is_boundary_infinity() && y_ub <= x_ub);
100  if (y_ub < x_ub) {
101  Iterator k = std::lower_bound(first, last, x_ub);
102  if (k != last) {
103  if (x_ub < *k) {
104  x_ub = *k;
105  }
106  }
107  else {
108  x.upper_extend();
109  }
110  }
111  }
112 
113  // Lower bound.
114  if (!x.lower_is_boundary_infinity()) {
115  Boundary& x_lb = x.lower();
116  const Boundary& y_lb = y.lower();
117  PPL_ASSERT(!y.lower_is_boundary_infinity() && y_lb >= x_lb);
118  if (y_lb > x_lb) {
119  Iterator k = std::lower_bound(first, last, x_lb);
120  if (k != last) {
121  if (x_lb < *k) {
122  if (k != first) {
123  x_lb = *--k;
124  }
125  else {
126  x.lower_extend();
127  }
128  }
129  }
130  else {
131  if (k != first) {
132  x_lb = *--k;
133  }
134  else {
135  x.lower_extend();
136  }
137  }
138  }
139  }
140 }
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type contains(const T &y) const
template<typename Boundary, typename Info>
template<typename From , typename Iterator >
Enable_If<Is_Interval<From>::value, void>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::CC76_widening_assign ( const From &  y,
Iterator  first,
Iterator  last 
)
template<typename Boundary, typename Info>
bool Parma_Polyhedra_Library::Interval< Boundary, Info >::check_empty ( I_Result  r) const
inline

Definition at line 177 of file Interval_defs.hh.

References Parma_Polyhedra_Library::I_ANY, Parma_Polyhedra_Library::I_EMPTY, and Parma_Polyhedra_Library::I_NOT_EMPTY.

177  {
178  return (r & I_ANY) == I_EMPTY
179  || ((r & I_ANY) != I_NOT_EMPTY && is_empty());
180  }
Result may be empty or not empty.
template<typename Boundary, typename Info>
template<typename T >
Enable_If<Is_Singleton<T>::value || Is_Interval<T>::value, bool>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::contains ( const T &  y) const
inline

Definition at line 193 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::check_empty_arg(), Parma_Polyhedra_Library::Interval_NS::f_info(), Parma_Polyhedra_Library::Interval_NS::f_lower(), Parma_Polyhedra_Library::f_OK(), Parma_Polyhedra_Library::Interval_NS::f_upper(), Parma_Polyhedra_Library::Boundary_NS::ge(), Parma_Polyhedra_Library::Boundary_NS::le(), Parma_Polyhedra_Library::Boundary_NS::LOWER, and Parma_Polyhedra_Library::Boundary_NS::UPPER.

193  {
194  PPL_ASSERT(OK());
195  PPL_ASSERT(f_OK(y));
196  if (check_empty_arg(y)) {
197  return true;
198  }
199  if (check_empty_arg(*this)) {
200  return false;
201  }
202  return le(LOWER, lower(), info(), LOWER, f_lower(y), f_info(y))
203  && ge(UPPER, upper(), info(), UPPER, f_upper(y), f_info(y));
204 }
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type check_empty_arg(const T &x)
Enable_If< Is_Singleton< T >::value, const T & >::type f_lower(const T &x)
bool ge(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Enable_If< Is_Singleton< T >::value, Scalar_As_Interval_Info_Open >::type f_info(const T &, bool open)
Enable_If< Has_OK< T >::value, bool >::type f_OK(const T &to)
Enable_If< Is_Singleton< T >::value, const T & >::type f_upper(const T &x)
bool le(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
template<typename Boundary, typename Info>
template<typename T >
Enable_If<Is_Singleton<T>::value || Is_Interval<T>::value, bool>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::contains ( const T &  y) const
template<typename Boundary, typename Info>
bool Parma_Polyhedra_Library::Interval< Boundary, Info >::contains_integer_point ( ) const
inline

Definition at line 418 of file Interval_defs.hh.

References Parma_Polyhedra_Library::ROUND_DOWN, and Parma_Polyhedra_Library::ROUND_UP.

418  {
419  PPL_ASSERT(OK());
420  if (is_empty()) {
421  return false;
422  }
423  if (!is_bounded()) {
424  return true;
425  }
426  Boundary l;
427  if (lower_is_open()) {
428  add_assign_r(l, lower(), Boundary(1), ROUND_DOWN);
429  floor_assign_r(l, l, ROUND_DOWN);
430  }
431  else {
432  ceil_assign_r(l, lower(), ROUND_DOWN);
433  }
434  Boundary u;
435  if (upper_is_open()) {
436  sub_assign_r(u, upper(), Boundary(1), ROUND_UP);
437  ceil_assign_r(u, u, ROUND_UP);
438  }
439  else {
440  floor_assign_r(u, upper(), ROUND_UP);
441  }
442  return u >= l;
443  }
template<typename Boundary, typename Info>
template<typename From >
Enable_If<Is_Singleton<From>::value || Is_Interval<From>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::difference_assign ( const From &  x)
inline

Definition at line 366 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::Boundary_NS::assign(), Parma_Polyhedra_Library::combine(), Parma_Polyhedra_Library::Boundary_NS::complement(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Interval_NS::f_info(), Parma_Polyhedra_Library::Interval_NS::f_lower(), Parma_Polyhedra_Library::f_OK(), Parma_Polyhedra_Library::Interval_NS::f_upper(), Parma_Polyhedra_Library::Boundary_NS::ge(), Parma_Polyhedra_Library::Boundary_NS::gt(), Parma_Polyhedra_Library::Boundary_NS::le(), Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::Boundary_NS::lt(), Parma_Polyhedra_Library::Boundary_NS::UPPER, and Parma_Polyhedra_Library::V_EQ.

366  {
367  PPL_ASSERT(f_OK(x));
368  if (lt(UPPER, upper(), info(), LOWER, f_lower(x), f_info(x))
369  || gt(LOWER, lower(), info(), UPPER, f_upper(x), f_info(x))) {
370  return combine(V_EQ, V_EQ);
371  }
372  bool nl = ge(LOWER, lower(), info(), LOWER, f_lower(x), f_info(x));
373  bool nu = le(UPPER, upper(), info(), UPPER, f_upper(x), f_info(x));
374  Result rl = V_EQ;
375  Result ru = V_EQ;
376  if (nl) {
377  if (nu) {
378  return assign(EMPTY);
379  }
380  else {
381  info().clear_boundary_properties(LOWER);
382  rl = complement(LOWER, lower(), info(), UPPER, f_upper(x), f_info(x));
383  }
384  }
385  else if (nu) {
386  info().clear_boundary_properties(UPPER);
387  ru = complement(UPPER, upper(), info(), LOWER, f_lower(x), f_info(x));
388  }
389  PPL_ASSERT(OK());
390  return combine(rl, ru);
391 }
The empty element, i.e., the empty set.
The computed result is exact.
Definition: Result_defs.hh:81
bool lt(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Result
Possible outcomes of a checked arithmetic computation.
Definition: Result_defs.hh:76
bool gt(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
I_Result assign(Degenerate_Element e)
Enable_If< Is_Singleton< T >::value, const T & >::type f_lower(const T &x)
bool ge(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Result complement(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type, const T &x, const Info &info)
Enable_If< Is_Singleton< T >::value, Scalar_As_Interval_Info_Open >::type f_info(const T &, bool open)
Enable_If< Has_OK< T >::value, bool >::type f_OK(const T &to)
I_Result combine(Result l, Result u)
Enable_If< Is_Singleton< T >::value, const T & >::type f_upper(const T &x)
bool le(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
template<typename Boundary, typename Info>
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton<From1>::value || Is_Interval<From1>::value) && (Is_Singleton<From2>::value || Is_Interval<From2>::value)), I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::difference_assign ( const From1 &  x,
const From2 &  y 
)
inline

Definition at line 399 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::Boundary_NS::assign(), Parma_Polyhedra_Library::assign_or_swap(), Parma_Polyhedra_Library::combine(), Parma_Polyhedra_Library::Boundary_NS::complement(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Interval_NS::f_info(), Parma_Polyhedra_Library::Interval_NS::f_lower(), Parma_Polyhedra_Library::f_OK(), Parma_Polyhedra_Library::Interval_NS::f_upper(), Parma_Polyhedra_Library::Boundary_NS::ge(), Parma_Polyhedra_Library::Boundary_NS::gt(), Parma_Polyhedra_Library::Boundary_NS::le(), Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::Boundary_NS::lt(), PPL_DIRTY_TEMP, Parma_Polyhedra_Library::Boundary_NS::UPPER, and Parma_Polyhedra_Library::V_EQ.

400  {
401  PPL_ASSERT(f_OK(x));
402  PPL_ASSERT(f_OK(y));
403  PPL_DIRTY_TEMP(To_Info, to_info);
404  to_info.clear();
405  if (lt(UPPER, f_upper(x), f_info(x), LOWER, f_lower(y), f_info(y))
406  || gt(LOWER, f_lower(x), f_info(x), UPPER, f_upper(y), f_info(y))) {
407  return assign(x);
408  }
409  bool nl = ge(LOWER, f_lower(x), f_info(x), LOWER, f_lower(y), f_info(y));
410  bool nu = le(UPPER, f_upper(x), f_info(x), UPPER, f_upper(y), f_info(y));
411  Result rl = V_EQ;
412  Result ru = V_EQ;
413  if (nl) {
414  if (nu) {
415  return assign(EMPTY);
416  }
417  else {
418  rl = complement(LOWER, lower(), info(), UPPER, f_upper(y), f_info(y));
419  ru = Boundary_NS::assign(UPPER, upper(), info(), UPPER, f_upper(x), f_info(x));
420  }
421  }
422  else if (nu) {
423  ru = complement(UPPER, upper(), info(), LOWER, f_lower(y), f_info(y));
424  rl = Boundary_NS::assign(LOWER, lower(), info(),
425  LOWER, f_lower(x), f_info(x));
426  }
427  assign_or_swap(info(), to_info);
428  PPL_ASSERT(OK());
429  return combine(rl, ru);
430 }
The empty element, i.e., the empty set.
The computed result is exact.
Definition: Result_defs.hh:81
Enable_If< Has_Assign_Or_Swap< T >::value, void >::type assign_or_swap(T &to, T &from)
bool lt(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Result
Possible outcomes of a checked arithmetic computation.
Definition: Result_defs.hh:76
bool gt(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Result assign(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type, const T &x, const Info &info, bool should_shrink=false)
I_Result assign(Degenerate_Element e)
Enable_If< Is_Singleton< T >::value, const T & >::type f_lower(const T &x)
bool ge(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
#define PPL_DIRTY_TEMP(T, id)
Result complement(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type, const T &x, const Info &info)
Enable_If< Is_Singleton< T >::value, Scalar_As_Interval_Info_Open >::type f_info(const T &, bool open)
Enable_If< Has_OK< T >::value, bool >::type f_OK(const T &to)
I_Result combine(Result l, Result u)
Enable_If< Is_Singleton< T >::value, const T & >::type f_upper(const T &x)
bool le(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
template<typename Boundary, typename Info>
template<typename From >
Enable_If<Is_Singleton<From>::value || Is_Interval<From>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::difference_assign ( const From &  x)

Assigns to *this the smallest interval containing the set-theoretic difference of *this and x.

template<typename Boundary, typename Info>
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton<From1>::value || Is_Interval<From1>::value) && (Is_Singleton<From2>::value || Is_Interval<From2>::value)), I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::difference_assign ( const From1 &  x,
const From2 &  y 
)

Assigns to *this the smallest interval containing the set-theoretic difference of x and y.

template<typename Boundary, typename Info>
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton<From1>::value || Is_Interval<From1>::value) && (Is_Singleton<From2>::value || Is_Interval<From2>::value)), I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::div_assign ( const From1 &  x,
const From2 &  y 
)
template<typename Boundary, typename Info>
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton<From1>::value || Is_Interval<From1>::value) && (Is_Singleton<From2>::value || Is_Interval<From2>::value)), I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::div_assign ( const From1 &  x,
const From2 &  y 
)
inline

+———–+———–+———–+ | / | yu < 0 | yl > 0 | +———–+———–+———–+ | xu<=0 |xu/yl,xl/yu|xl/yl,xu/yu| +———–+———–+———–+ |xl<=0 xu>=0|xu/yu,xl/yu|xl/yl,xu/yl| +———–+———–+———–+ | xl>=0 |xu/yu,xl/yl|xl/yu,xu/yl| +———–+———–+———–+

Definition at line 889 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::Boundary_NS::assign(), Parma_Polyhedra_Library::assign_or_swap(), Parma_Polyhedra_Library::check_empty_arg(), Parma_Polyhedra_Library::combine(), Parma_Polyhedra_Library::Boundary_NS::div_assign_z(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Interval_NS::f_info(), Parma_Polyhedra_Library::Interval_NS::f_lower(), Parma_Polyhedra_Library::f_OK(), Parma_Polyhedra_Library::Interval_NS::f_upper(), Parma_Polyhedra_Library::I_SINGULARITIES, Parma_Polyhedra_Library::infinity_sign(), Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::MINUS_INFINITY, Parma_Polyhedra_Library::PLUS_INFINITY, PPL_DIRTY_TEMP, Parma_Polyhedra_Library::Boundary_NS::sgn_b(), Parma_Polyhedra_Library::UNIVERSE, and Parma_Polyhedra_Library::Boundary_NS::UPPER.

889  {
890  PPL_ASSERT(f_OK(x));
891  PPL_ASSERT(f_OK(y));
892  if (check_empty_arg(x) || check_empty_arg(y)) {
893  return assign(EMPTY);
894  }
895  int yls = sgn_b(LOWER, f_lower(y), f_info(y));
896  int yus = (yls > 0) ? 1 : sgn_b(UPPER, f_upper(y), f_info(y));
897  if (yls == 0 && yus == 0) {
898  return assign(EMPTY);
899  }
900  int inf_sign = Parma_Polyhedra_Library::infinity_sign(x);
901  if (inf_sign != 0) {
903  return assign(EMPTY);
904  }
905  if (yls == -yus) {
906  return set_infinities();
907  }
908  if (yls < 0 || yus < 0) {
909  inf_sign = -inf_sign;
910  }
911  if (inf_sign < 0) {
912  return assign(MINUS_INFINITY);
913  }
914  else {
915  return assign(PLUS_INFINITY);
916  }
917  }
918  int xls = sgn_b(LOWER, f_lower(x), f_info(x));
919  int xus = (xls > 0) ? 1 : sgn_b(UPPER, f_upper(x), f_info(x));
920 
921  PPL_DIRTY_TEMP(To_Info, to_info);
922  to_info.clear();
923  Result rl;
924  Result ru;
925  PPL_DIRTY_TEMP(To_Boundary, to_lower);
926  if (yls >= 0) {
927  if (xls >= 0) {
928  rl = div_assign_z(LOWER, to_lower, to_info,
929  LOWER, f_lower(x), f_info(x), xls,
930  UPPER, f_upper(y), f_info(y), yus);
931  ru = div_assign_z(UPPER, upper(), to_info,
932  UPPER, f_upper(x), f_info(x), xus,
933  LOWER, f_lower(y), f_info(y), yls);
934  }
935  else if (xus <= 0) {
936  rl = div_assign_z(LOWER, to_lower, to_info,
937  LOWER, f_lower(x), f_info(x), xls,
938  LOWER, f_lower(y), f_info(y), yls);
939  ru = div_assign_z(UPPER, upper(), to_info,
940  UPPER, f_upper(x), f_info(x), xus,
941  UPPER, f_upper(y), f_info(y), yus);
942  }
943  else {
944  rl = div_assign_z(LOWER, to_lower, to_info,
945  LOWER, f_lower(x), f_info(x), xls,
946  LOWER, f_lower(y), f_info(y), yls);
947  ru = div_assign_z(UPPER, upper(), to_info,
948  UPPER, f_upper(x), f_info(x), xus,
949  LOWER, f_lower(y), f_info(y), yls);
950  }
951  }
952  else if (yus <= 0) {
953  if (xls >= 0) {
954  rl = div_assign_z(LOWER, to_lower, to_info,
955  UPPER, f_upper(x), f_info(x), xus,
956  UPPER, f_upper(y), f_info(y), yus);
957  ru = div_assign_z(UPPER, upper(), to_info,
958  LOWER, f_lower(x), f_info(x), xls,
959  LOWER, f_lower(y), f_info(y), yls);
960  }
961  else if (xus <= 0) {
962  rl = div_assign_z(LOWER, to_lower, to_info,
963  UPPER, f_upper(x), f_info(x), xus,
964  LOWER, f_lower(y), f_info(y), yls);
965  ru = div_assign_z(UPPER, upper(), to_info,
966  LOWER, f_lower(x), f_info(x), xls,
967  UPPER, f_upper(y), f_info(y), yus);
968  }
969  else {
970  rl = div_assign_z(LOWER, to_lower, to_info,
971  UPPER, f_upper(x), f_info(x), xus,
972  UPPER, f_upper(y), f_info(y), yus);
973  ru = div_assign_z(UPPER, upper(), to_info,
974  LOWER, f_lower(x), f_info(x), xls,
975  UPPER, f_upper(y), f_info(y), yus);
976  }
977  }
978  else {
979  return static_cast<I_Result>(assign(UNIVERSE) | I_SINGULARITIES);
980  }
981  assign_or_swap(lower(), to_lower);
982  assign_or_swap(info(), to_info);
983  PPL_ASSERT(OK());
984  return combine(rl, ru);
985 }
The empty element, i.e., the empty set.
I_Result
The result of an operation on intervals.
Result div_assign_z(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type1, const T1 &x1, const Info1 &info1, int x1s, Boundary_Type type2, const T2 &x2, const Info2 &info2, int x2s)
Enable_If< Has_Assign_Or_Swap< T >::value, void >::type assign_or_swap(T &to, T &from)
Result
Possible outcomes of a checked arithmetic computation.
Definition: Result_defs.hh:76
Operation is undefined for some combination of values.
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type check_empty_arg(const T &x)
I_Result assign(Degenerate_Element e)
Enable_If< Is_Singleton< T >::value, const T & >::type f_lower(const T &x)
#define PPL_DIRTY_TEMP(T, id)
The universe element, i.e., the whole vector space.
Plus_Infinity PLUS_INFINITY
Definition: checked.cc:31
Enable_If< Is_Singleton< T >::value, Scalar_As_Interval_Info_Open >::type f_info(const T &, bool open)
Minus_Infinity MINUS_INFINITY
Definition: checked.cc:30
Enable_If< Has_OK< T >::value, bool >::type f_OK(const T &to)
I_Result combine(Result l, Result u)
int sgn_b(Boundary_Type type, const T &x, const Info &info)
Enable_If< Is_Singleton< T >::value, const T & >::type f_upper(const T &x)
Enable_If< Is_Native_Or_Checked< T >::value, int >::type infinity_sign(const T &x)
template<typename Boundary, typename Info>
void Parma_Polyhedra_Library::Interval< Boundary, Info >::drop_some_non_integer_points ( )
inline

Definition at line 445 of file Interval_defs.hh.

References Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::Boundary_NS::OPEN, Parma_Polyhedra_Library::ROUND_DOWN, Parma_Polyhedra_Library::ROUND_UP, and Parma_Polyhedra_Library::Boundary_NS::UPPER.

445  {
446  if (is_empty()) {
447  return;
448  }
450  add_assign_r(lower(), lower(), Boundary(1), ROUND_DOWN);
451  floor_assign_r(lower(), lower(), ROUND_DOWN);
452  info().set_boundary_property(LOWER, OPEN, false);
453  }
454  else {
455  ceil_assign_r(lower(), lower(), ROUND_DOWN);
456  }
458  sub_assign_r(upper(), upper(), Boundary(1), ROUND_UP);
459  ceil_assign_r(upper(), upper(), ROUND_UP);
460  info().set_boundary_property(UPPER, OPEN, false);
461  }
462  else {
463  floor_assign_r(upper(), upper(), ROUND_UP);
464  }
465  }
static const Property OPEN(Property::OPEN_)
template<typename Boundary, typename Info>
template<typename From >
Enable_If<Is_Interval<From>::value, void>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::empty_intersection_assign ( const From &  )

Definition at line 432 of file Interval_templates.hh.

References Parma_Polyhedra_Library::Boundary_NS::assign(), and Parma_Polyhedra_Library::EMPTY.

432  {
433  // FIXME: write me.
434  assign(EMPTY);
435 }
The empty element, i.e., the empty set.
I_Result assign(Degenerate_Element e)
template<typename Boundary, typename Info>
template<typename From >
Enable_If<Is_Interval<From>::value, void>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::empty_intersection_assign ( const From &  y)

Assigns to *this an interval having empty intersection with y. The assigned interval should be as large as possible.

template<typename Boundary , typename Info >
memory_size_type Parma_Polyhedra_Library::Interval< Boundary, Info >::external_memory_in_bytes ( ) const
inline

Returns the size in bytes of the memory managed by *this.

Definition at line 31 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::external_memory_in_bytes().

31  {
34 }
Enable_If< Is_Native< T >::value, memory_size_type >::type external_memory_in_bytes(const T &)
For native types, returns the size in bytes of the memory managed by the type of the (unused) paramet...
template<typename Boundary, typename Info>
int Parma_Polyhedra_Library::Interval< Boundary, Info >::infinity_sign ( ) const
inline

Definition at line 405 of file Interval_defs.hh.

References Parma_Polyhedra_Library::Boundary_NS::is_reverse_infinity(), Parma_Polyhedra_Library::Boundary_NS::LOWER, and Parma_Polyhedra_Library::Boundary_NS::UPPER.

Referenced by Parma_Polyhedra_Library::infinity_sign().

405  {
406  PPL_ASSERT(OK());
407  if (is_reverse_infinity(LOWER, lower(), info())) {
408  return 1;
409  }
410  else if (is_reverse_infinity(UPPER, upper(), info())) {
411  return -1;
412  }
413  else {
414  return 0;
415  }
416  }
bool is_reverse_infinity(Boundary_Type type, const T &x, const Info &info)
template<typename Boundary, typename Info>
Info& Parma_Polyhedra_Library::Interval< Boundary, Info >::info ( )
inline
template<typename Boundary, typename Info>
const Info& Parma_Polyhedra_Library::Interval< Boundary, Info >::info ( ) const
inline

Definition at line 136 of file Interval_defs.hh.

136  {
137  return *this;
138  }
template<typename Boundary, typename Info>
template<typename From >
Enable_If<Is_Singleton<From>::value || Is_Interval<From>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::intersect_assign ( const From &  x)
inline

Definition at line 331 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::Interval_NS::f_info(), Parma_Polyhedra_Library::Interval_NS::f_lower(), Parma_Polyhedra_Library::f_OK(), Parma_Polyhedra_Library::Interval_NS::f_upper(), Parma_Polyhedra_Library::I_ANY, Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::max_assign(), Parma_Polyhedra_Library::min_assign(), and Parma_Polyhedra_Library::Boundary_NS::UPPER.

331  {
332  PPL_ASSERT(f_OK(x));
333  max_assign(LOWER, lower(), info(), LOWER, f_lower(x), f_info(x));
334  min_assign(UPPER, upper(), info(), UPPER, f_upper(x), f_info(x));
335  PPL_ASSERT(OK());
336  return I_ANY;
337 }
Result may be empty or not empty.
void max_assign(N &x, const N &y)
Assigns to x the maximum between x and y.
Enable_If< Is_Singleton< T >::value, const T & >::type f_lower(const T &x)
Enable_If< Is_Singleton< T >::value, Scalar_As_Interval_Info_Open >::type f_info(const T &, bool open)
Enable_If< Has_OK< T >::value, bool >::type f_OK(const T &to)
Enable_If< Is_Singleton< T >::value, const T & >::type f_upper(const T &x)
void min_assign(N &x, const N &y)
Assigns to x the minimum between x and y.
template<typename Boundary, typename Info>
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton<From1>::value || Is_Interval<From1>::value) && (Is_Singleton<From2>::value || Is_Interval<From2>::value)), I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::intersect_assign ( const From1 &  x,
const From2 &  y 
)
inline

Definition at line 345 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::assign_or_swap(), Parma_Polyhedra_Library::Interval_NS::f_info(), Parma_Polyhedra_Library::Interval_NS::f_lower(), Parma_Polyhedra_Library::f_OK(), Parma_Polyhedra_Library::Interval_NS::f_upper(), Parma_Polyhedra_Library::I_NOT_EMPTY, Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::max_assign(), Parma_Polyhedra_Library::min_assign(), PPL_DIRTY_TEMP, and Parma_Polyhedra_Library::Boundary_NS::UPPER.

346  {
347  PPL_ASSERT(f_OK(x));
348  PPL_ASSERT(f_OK(y));
349  PPL_DIRTY_TEMP(To_Info, to_info);
350  to_info.clear();
351  max_assign(LOWER, lower(), to_info,
352  LOWER, f_lower(x), f_info(x),
353  LOWER, f_lower(y), f_info(y));
354  min_assign(UPPER, upper(), to_info,
355  UPPER, f_upper(x), f_info(x),
356  UPPER, f_upper(y), f_info(y));
357  assign_or_swap(info(), to_info);
358  PPL_ASSERT(OK());
359  return I_NOT_EMPTY;
360 }
Enable_If< Has_Assign_Or_Swap< T >::value, void >::type assign_or_swap(T &to, T &from)
void max_assign(N &x, const N &y)
Assigns to x the maximum between x and y.
Enable_If< Is_Singleton< T >::value, const T & >::type f_lower(const T &x)
#define PPL_DIRTY_TEMP(T, id)
Enable_If< Is_Singleton< T >::value, Scalar_As_Interval_Info_Open >::type f_info(const T &, bool open)
Enable_If< Has_OK< T >::value, bool >::type f_OK(const T &to)
Enable_If< Is_Singleton< T >::value, const T & >::type f_upper(const T &x)
void min_assign(N &x, const N &y)
Assigns to x the minimum between x and y.
template<typename Boundary, typename Info>
template<typename From >
Enable_If<Is_Singleton<From>::value || Is_Interval<From>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::intersect_assign ( const From &  x)
template<typename Boundary, typename Info>
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton<From1>::value || Is_Interval<From1>::value) && (Is_Singleton<From2>::value || Is_Interval<From2>::value)), I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::intersect_assign ( const From1 &  x,
const From2 &  y 
)
template<typename Boundary, typename Info>
static bool Parma_Polyhedra_Library::Interval< Boundary, Info >::is_always_topologically_closed ( )
inlinestatic

Definition at line 364 of file Interval_defs.hh.

364  {
365  return !Info::store_open;
366  }
template<typename Boundary, typename Info>
bool Parma_Polyhedra_Library::Interval< Boundary, Info >::is_bounded ( ) const
inline

Definition at line 216 of file Interval_defs.hh.

216  {
217  PPL_ASSERT(OK());
219  }
template<typename Boundary, typename Info>
template<typename T >
Enable_If<Is_Singleton<T>::value || Is_Interval<T>::value, bool>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::is_disjoint_from ( const T &  y) const
inline

Definition at line 229 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::check_empty_arg(), Parma_Polyhedra_Library::Interval_NS::f_info(), Parma_Polyhedra_Library::Interval_NS::f_lower(), Parma_Polyhedra_Library::f_OK(), Parma_Polyhedra_Library::Interval_NS::f_upper(), Parma_Polyhedra_Library::Boundary_NS::gt(), Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::Boundary_NS::lt(), and Parma_Polyhedra_Library::Boundary_NS::UPPER.

229  {
230  PPL_ASSERT(OK());
231  PPL_ASSERT(f_OK(y));
232  if (check_empty_arg(*this) || check_empty_arg(y)) {
233  return true;
234  }
235  return gt(LOWER, lower(), info(), UPPER, f_upper(y), f_info(y))
236  || lt(UPPER, upper(), info(), LOWER, f_lower(y), f_info(y));
237 }
bool lt(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
bool gt(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type check_empty_arg(const T &x)
Enable_If< Is_Singleton< T >::value, const T & >::type f_lower(const T &x)
Enable_If< Is_Singleton< T >::value, Scalar_As_Interval_Info_Open >::type f_info(const T &, bool open)
Enable_If< Has_OK< T >::value, bool >::type f_OK(const T &to)
Enable_If< Is_Singleton< T >::value, const T & >::type f_upper(const T &x)
template<typename Boundary, typename Info>
template<typename T >
Enable_If<Is_Singleton<T>::value || Is_Interval<T>::value, bool>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::is_disjoint_from ( const T &  y) const
template<typename Boundary, typename Info>
bool Parma_Polyhedra_Library::Interval< Boundary, Info >::is_empty ( ) const
inline
template<typename Boundary, typename Info>
bool Parma_Polyhedra_Library::Interval< Boundary, Info >::is_singleton ( ) const
inline
template<typename Boundary, typename Info>
bool Parma_Polyhedra_Library::Interval< Boundary, Info >::is_topologically_closed ( ) const
inline

Definition at line 368 of file Interval_defs.hh.

368  {
369  PPL_ASSERT(OK());
371  || is_empty()
374  }
template<typename Boundary, typename Info>
bool Parma_Polyhedra_Library::Interval< Boundary, Info >::is_universe ( ) const
inline

Definition at line 221 of file Interval_defs.hh.

221  {
222  PPL_ASSERT(OK());
224  }
template<typename Boundary, typename Info>
template<typename From >
Enable_If<Is_Singleton<From>::value || Is_Interval<From>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::join_assign ( const From &  x)
inline

Definition at line 263 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::Boundary_NS::assign(), Parma_Polyhedra_Library::check_empty_arg(), Parma_Polyhedra_Library::combine(), Parma_Polyhedra_Library::Interval_NS::f_info(), Parma_Polyhedra_Library::Interval_NS::f_lower(), Parma_Polyhedra_Library::f_OK(), Parma_Polyhedra_Library::Interval_NS::f_upper(), Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::max_assign(), Parma_Polyhedra_Library::min_assign(), Parma_Polyhedra_Library::Boundary_NS::UPPER, and Parma_Polyhedra_Library::V_EQ.

263  {
264  PPL_ASSERT(f_OK(x));
265  if (check_empty_arg(*this)) {
266  return assign(x);
267  }
268  if (check_empty_arg(x)) {
269  return combine(V_EQ, V_EQ);
270  }
271  Result rl;
272  Result ru;
273  rl = min_assign(LOWER, lower(), info(), LOWER, f_lower(x), f_info(x));
274  ru = max_assign(UPPER, upper(), info(), UPPER, f_upper(x), f_info(x));
275  PPL_ASSERT(OK());
276  return combine(rl, ru);
277 }
The computed result is exact.
Definition: Result_defs.hh:81
Result
Possible outcomes of a checked arithmetic computation.
Definition: Result_defs.hh:76
void max_assign(N &x, const N &y)
Assigns to x the maximum between x and y.
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type check_empty_arg(const T &x)
I_Result assign(Degenerate_Element e)
Enable_If< Is_Singleton< T >::value, const T & >::type f_lower(const T &x)
Enable_If< Is_Singleton< T >::value, Scalar_As_Interval_Info_Open >::type f_info(const T &, bool open)
Enable_If< Has_OK< T >::value, bool >::type f_OK(const T &to)
I_Result combine(Result l, Result u)
Enable_If< Is_Singleton< T >::value, const T & >::type f_upper(const T &x)
void min_assign(N &x, const N &y)
Assigns to x the minimum between x and y.
template<typename Boundary, typename Info>
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton<From1>::value || Is_Interval<From1>::value) && (Is_Singleton<From2>::value || Is_Interval<From2>::value)), I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::join_assign ( const From1 &  x,
const From2 &  y 
)
inline

Definition at line 285 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::Boundary_NS::assign(), Parma_Polyhedra_Library::assign_or_swap(), Parma_Polyhedra_Library::check_empty_arg(), Parma_Polyhedra_Library::combine(), Parma_Polyhedra_Library::Interval_NS::f_info(), Parma_Polyhedra_Library::Interval_NS::f_lower(), Parma_Polyhedra_Library::f_OK(), Parma_Polyhedra_Library::Interval_NS::f_upper(), Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::max_assign(), Parma_Polyhedra_Library::min_assign(), PPL_DIRTY_TEMP, and Parma_Polyhedra_Library::Boundary_NS::UPPER.

285  {
286  PPL_ASSERT(f_OK(x));
287  PPL_ASSERT(f_OK(y));
288  if (check_empty_arg(x)) {
289  return assign(y);
290  }
291  if (check_empty_arg(y)) {
292  return assign(x);
293  }
294  PPL_DIRTY_TEMP(To_Info, to_info);
295  to_info.clear();
296  Result rl;
297  Result ru;
298  rl = min_assign(LOWER, lower(), to_info,
299  LOWER, f_lower(x), f_info(x),
300  LOWER, f_lower(y), f_info(y));
301  ru = max_assign(UPPER, upper(), to_info,
302  UPPER, f_upper(x), f_info(x),
303  UPPER, f_upper(y), f_info(y));
304  assign_or_swap(info(), to_info);
305  PPL_ASSERT(OK());
306  return combine(rl, ru);
307 }
Enable_If< Has_Assign_Or_Swap< T >::value, void >::type assign_or_swap(T &to, T &from)
Result
Possible outcomes of a checked arithmetic computation.
Definition: Result_defs.hh:76
void max_assign(N &x, const N &y)
Assigns to x the maximum between x and y.
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type check_empty_arg(const T &x)
I_Result assign(Degenerate_Element e)
Enable_If< Is_Singleton< T >::value, const T & >::type f_lower(const T &x)
#define PPL_DIRTY_TEMP(T, id)
Enable_If< Is_Singleton< T >::value, Scalar_As_Interval_Info_Open >::type f_info(const T &, bool open)
Enable_If< Has_OK< T >::value, bool >::type f_OK(const T &to)
I_Result combine(Result l, Result u)
Enable_If< Is_Singleton< T >::value, const T & >::type f_upper(const T &x)
void min_assign(N &x, const N &y)
Assigns to x the minimum between x and y.
template<typename Boundary, typename Info>
template<typename From >
Enable_If<Is_Singleton<From>::value || Is_Interval<From>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::join_assign ( const From &  x)
template<typename Boundary, typename Info>
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton<From1>::value || Is_Interval<From1>::value) && (Is_Singleton<From2>::value || Is_Interval<From2>::value)), I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::join_assign ( const From1 &  x,
const From2 &  y 
)
template<typename Boundary, typename Info>
const Boundary& Parma_Polyhedra_Library::Interval< Boundary, Info >::lower ( ) const
inline

Definition at line 144 of file Interval_defs.hh.

144  {
145  return lower_;
146  }
template<typename Boundary, typename Info>
template<typename From >
Enable_If<Is_Singleton<From>::value || Is_Interval<From>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::lower_approximation_difference_assign ( const From &  x)

Assigns to *this the largest interval contained in the set-theoretic difference of *this and x.

template<typename Boundary, typename Info>
I_Constraint<boundary_type> Parma_Polyhedra_Library::Interval< Boundary, Info >::lower_constraint ( ) const
inline

Definition at line 156 of file Interval_defs.hh.

References Parma_Polyhedra_Library::GREATER_OR_EQUAL, Parma_Polyhedra_Library::GREATER_THAN, Parma_Polyhedra_Library::i_constraint(), Parma_Polyhedra_Library::Boundary_NS::LOWER, and Parma_Polyhedra_Library::Boundary_NS::SPECIAL.

156  {
157  PPL_ASSERT(!is_empty());
158  if (info().get_boundary_property(LOWER, SPECIAL)) {
159  return I_Constraint<boundary_type>();
160  }
162  lower(), true);
163  }
I_Constraint< T > i_constraint(I_Constraint_Rel rel, const T &v)
static const Property SPECIAL(Property::SPECIAL_)
template<typename Boundary, typename Info>
template<typename C >
Enable_If<Is_Same_Or_Derived<I_Constraint_Base, C>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::lower_extend ( const C &  c)

Definition at line 34 of file Interval_templates.hh.

References Parma_Polyhedra_Library::Interval_NS::f_info(), Parma_Polyhedra_Library::I_ANY, Parma_Polyhedra_Library::I_EXACT, Parma_Polyhedra_Library::I_NOT_EMPTY, Parma_Polyhedra_Library::I_UNCHANGED, Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::min_assign(), Parma_Polyhedra_Library::V_EQ, Parma_Polyhedra_Library::V_GE, Parma_Polyhedra_Library::V_GT, Parma_Polyhedra_Library::V_LGE, and Parma_Polyhedra_Library::V_NAN.

34  {
35  PPL_ASSERT(OK());
36  bool open;
37  switch (c.rel()) {
38  case V_LGE:
39  return lower_extend();
40  case V_NAN:
41  return I_NOT_EMPTY | I_EXACT | I_UNCHANGED;
42  case V_GT:
43  open = true;
44  break;
45  case V_GE: // Fall through.
46  case V_EQ:
47  open = false;
48  break;
49  default:
50  PPL_UNREACHABLE;
51  return I_NOT_EMPTY | I_EXACT | I_UNCHANGED;
52  }
53  min_assign(LOWER, lower(), info(), LOWER, c.value(), f_info(c.value(), open));
54  PPL_ASSERT(OK());
55  return I_ANY;
56 }
The computed result is exact.
Definition: Result_defs.hh:81
Result may be empty or not empty.
Not a number result.
Definition: Result_defs.hh:123
The computed result is inexact and rounded down.
Definition: Result_defs.hh:87
const Info & f_info(const Interval< Boundary, Info > &x)
Result is definitely exact.
The computed result may be inexact and rounded down.
Definition: Result_defs.hh:96
Coefficient c
Definition: PIP_Tree.cc:64
Operation has left the set definitely unchanged.
The computed result may be inexact.
Definition: Result_defs.hh:99
void min_assign(N &x, const N &y)
Assigns to x the minimum between x and y.
template<typename Boundary, typename Info>
I_Result Parma_Polyhedra_Library::Interval< Boundary, Info >::lower_extend ( )
inline
template<typename Boundary, typename Info>
template<typename C >
Enable_If<Is_Same_Or_Derived<I_Constraint_Base, C>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::lower_extend ( const C &  c)
template<typename Boundary, typename Info>
bool Parma_Polyhedra_Library::Interval< Boundary, Info >::lower_is_boundary_infinity ( ) const
inline
template<typename Boundary, typename Info>
bool Parma_Polyhedra_Library::Interval< Boundary, Info >::lower_is_domain_inf ( ) const
inline
template<typename Boundary, typename Info>
bool Parma_Polyhedra_Library::Interval< Boundary, Info >::lower_is_open ( ) const
inline
template<typename Boundary , typename Info >
void Parma_Polyhedra_Library::Interval< Boundary, Info >::m_swap ( Interval< Boundary, Info > &  y)
inline

Swaps *this with y.

Definition at line 44 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::Interval< Boundary, Info >::info(), Parma_Polyhedra_Library::Interval< Boundary, Info >::lower(), Parma_Polyhedra_Library::swap(), and Parma_Polyhedra_Library::Interval< Boundary, Info >::upper().

Referenced by Parma_Polyhedra_Library::Interval< Boundary, Info >::swap().

44  {
45  using std::swap;
46  swap(lower(), y.lower());
47  swap(upper(), y.upper());
48  swap(info(), y.info());
49 }
void swap(CO_Tree &x, CO_Tree &y)
void swap(Interval< Boundary, Info > &x, Interval< Boundary, Info > &y)
Swaps x with y.
template<typename Boundary, typename Info>
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton<From1>::value || Is_Interval<From1>::value) && (Is_Singleton<From2>::value || Is_Interval<From2>::value)), I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::mul_assign ( const From1 &  x,
const From2 &  y 
)
inline

+———+———–+———–+—————–+ | * | yl > 0 | yu < 0 | yl < 0, yu > 0 | +———+———–+———–+—————–+ | xl > 0 |xl*yl,xu*yu|xu*yl,xl*yu| xu*yl,xu*yu | +———+———–+———–+—————–+ | xu < 0 |xl*yu,xu*yl|xu*yu,xl*yl| xl*yu,xl*yl | +———+———–+———–+—————–+ |xl<0 xu>0|xl*yu,xu*yu|xu*yl,xl*yl|min(xl*yu,xu*yl),| | | | |max(xl*yl,xu*yu) | +———+———–+———–+—————–+

Definition at line 714 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::Boundary_NS::assign(), Parma_Polyhedra_Library::assign_or_swap(), Parma_Polyhedra_Library::check_empty_arg(), Parma_Polyhedra_Library::combine(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Interval_NS::f_info(), Parma_Polyhedra_Library::Interval_NS::f_lower(), Parma_Polyhedra_Library::f_OK(), Parma_Polyhedra_Library::Interval_NS::f_upper(), Parma_Polyhedra_Library::Boundary_NS::gt(), Parma_Polyhedra_Library::infinity_sign(), Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::Boundary_NS::lt(), Parma_Polyhedra_Library::MINUS_INFINITY, Parma_Polyhedra_Library::Boundary_NS::mul_assign(), Parma_Polyhedra_Library::Boundary_NS::mul_assign_z(), Parma_Polyhedra_Library::PLUS_INFINITY, PPL_DIRTY_TEMP, Parma_Polyhedra_Library::Boundary_NS::sgn_b(), and Parma_Polyhedra_Library::Boundary_NS::UPPER.

714  {
715  PPL_ASSERT(f_OK(x));
716  PPL_ASSERT(f_OK(y));
717  if (check_empty_arg(x) || check_empty_arg(y)) {
718  return assign(EMPTY);
719  }
720  int xls = sgn_b(LOWER, f_lower(x), f_info(x));
721  int xus = (xls > 0) ? 1 : sgn_b(UPPER, f_upper(x), f_info(x));
722  int yls = sgn_b(LOWER, f_lower(y), f_info(y));
723  int yus = (yls > 0) ? 1 : sgn_b(UPPER, f_upper(y), f_info(y));
724  int inf_sign = Parma_Polyhedra_Library::infinity_sign(x);
725  int ls;
726  int us;
727  if (inf_sign != 0) {
728  ls = yls;
729  us = yus;
730  goto inf;
731  }
732  else {
734  if (inf_sign != 0) {
735  ls = xls;
736  us = xus;
737  inf:
738  if (ls == 0 && us == 0) {
739  return assign(EMPTY);
740  }
741  if (ls == -us) {
742  return set_infinities();
743  }
744  if (ls < 0 || us < 0) {
745  inf_sign = -inf_sign;
746  }
747  if (inf_sign < 0) {
748  return assign(MINUS_INFINITY);
749  }
750  else {
751  return assign(PLUS_INFINITY);
752  }
753  }
754  }
755 
756  PPL_DIRTY_TEMP(To_Info, to_info);
757  to_info.clear();
758  Result rl;
759  Result ru;
760  PPL_DIRTY_TEMP(To_Boundary, to_lower);
761 
762  if (xls >= 0) {
763  if (yls >= 0) {
764  // 0 <= xl <= xu, 0 <= yl <= yu
765  rl = mul_assign_z(LOWER, to_lower, to_info,
766  LOWER, f_lower(x), f_info(x), xls,
767  LOWER, f_lower(y), f_info(y), yls);
768  ru = mul_assign_z(UPPER, upper(), to_info,
769  UPPER, f_upper(x), f_info(x), xus,
770  UPPER, f_upper(y), f_info(y), yus);
771  }
772  else if (yus <= 0) {
773  // 0 <= xl <= xu, yl <= yu <= 0
774  rl = mul_assign_z(LOWER, to_lower, to_info,
775  UPPER, f_upper(x), f_info(x), xus,
776  LOWER, f_lower(y), f_info(y), yls);
777  ru = mul_assign_z(UPPER, upper(), to_info,
778  LOWER, f_lower(x), f_info(x), xls,
779  UPPER, f_upper(y), f_info(y), yus);
780  }
781  else {
782  // 0 <= xl <= xu, yl < 0 < yu
783  rl = mul_assign_z(LOWER, to_lower, to_info,
784  UPPER, f_upper(x), f_info(x), xus,
785  LOWER, f_lower(y), f_info(y), yls);
786  ru = mul_assign_z(UPPER, upper(), to_info,
787  UPPER, f_upper(x), f_info(x), xus,
788  UPPER, f_upper(y), f_info(y), yus);
789  }
790  }
791  else if (xus <= 0) {
792  if (yls >= 0) {
793  // xl <= xu <= 0, 0 <= yl <= yu
794  rl = mul_assign_z(LOWER, to_lower, to_info,
795  LOWER, f_lower(x), f_info(x), xls,
796  UPPER, f_upper(y), f_info(y), yus);
797  ru = mul_assign_z(UPPER, upper(), to_info,
798  UPPER, f_upper(x), f_info(x), xus,
799  LOWER, f_lower(y), f_info(y), yls);
800  }
801  else if (yus <= 0) {
802  // xl <= xu <= 0, yl <= yu <= 0
803  rl = mul_assign_z(LOWER, to_lower, to_info,
804  UPPER, f_upper(x), f_info(x), xus,
805  UPPER, f_upper(y), f_info(y), yus);
806  ru = mul_assign_z(UPPER, upper(), to_info,
807  LOWER, f_lower(x), f_info(x), xls,
808  LOWER, f_lower(y), f_info(y), yls);
809  }
810  else {
811  // xl <= xu <= 0, yl < 0 < yu
812  rl = mul_assign_z(LOWER, to_lower, to_info,
813  LOWER, f_lower(x), f_info(x), xls,
814  UPPER, f_upper(y), f_info(y), yus);
815  ru = mul_assign_z(UPPER, upper(), to_info,
816  LOWER, f_lower(x), f_info(x), xls,
817  LOWER, f_lower(y), f_info(y), yls);
818  }
819  }
820  else if (yls >= 0) {
821  // xl < 0 < xu, 0 <= yl <= yu
822  rl = mul_assign_z(LOWER, to_lower, to_info,
823  LOWER, f_lower(x), f_info(x), xls,
824  UPPER, f_upper(y), f_info(y), yus);
825  ru = mul_assign_z(UPPER, upper(), to_info,
826  UPPER, f_upper(x), f_info(x), xus,
827  UPPER, f_upper(y), f_info(y), yus);
828  }
829  else if (yus <= 0) {
830  // xl < 0 < xu, yl <= yu <= 0
831  rl = mul_assign_z(LOWER, to_lower, to_info,
832  UPPER, f_upper(x), f_info(x), xus,
833  LOWER, f_lower(y), f_info(y), yls);
834  ru = mul_assign_z(UPPER, upper(), to_info,
835  LOWER, f_lower(x), f_info(x), xls,
836  LOWER, f_lower(y), f_info(y), yls);
837  }
838  else {
839  // xl < 0 < xu, yl < 0 < yu
840  PPL_DIRTY_TEMP(To_Boundary, tmp);
841  PPL_DIRTY_TEMP(To_Info, tmp_info);
842  tmp_info.clear();
843  Result tmp_r;
844  tmp_r = Boundary_NS::mul_assign(LOWER, tmp, tmp_info,
845  UPPER, f_upper(x), f_info(x),
846  LOWER, f_lower(y), f_info(y));
847  rl = Boundary_NS::mul_assign(LOWER, to_lower, to_info,
848  LOWER, f_lower(x), f_info(x),
849  UPPER, f_upper(y), f_info(y));
850  if (gt(LOWER, to_lower, to_info, LOWER, tmp, tmp_info)) {
851  to_lower = tmp;
852  rl = tmp_r;
853  }
854  tmp_info.clear();
855  tmp_r = Boundary_NS::mul_assign(UPPER, tmp, tmp_info,
856  UPPER, f_upper(x), f_info(x),
857  UPPER, f_upper(y), f_info(y));
858  ru = Boundary_NS::mul_assign(UPPER, upper(), to_info,
859  LOWER, f_lower(x), f_info(x),
860  LOWER, f_lower(y), f_info(y));
861  if (lt(UPPER, upper(), to_info, UPPER, tmp, tmp_info)) {
862  upper() = tmp;
863  ru = tmp_r;
864  }
865  }
866  assign_or_swap(lower(), to_lower);
867  assign_or_swap(info(), to_info);
868  PPL_ASSERT(OK());
869  return combine(rl, ru);
870 }
The empty element, i.e., the empty set.
Enable_If< Has_Assign_Or_Swap< T >::value, void >::type assign_or_swap(T &to, T &from)
bool lt(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Result
Possible outcomes of a checked arithmetic computation.
Definition: Result_defs.hh:76
bool gt(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type check_empty_arg(const T &x)
I_Result assign(Degenerate_Element e)
Enable_If< Is_Singleton< T >::value, const T & >::type f_lower(const T &x)
Result mul_assign_z(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type1, const T1 &x1, const Info1 &info1, int x1s, Boundary_Type type2, const T2 &x2, const Info2 &info2, int x2s)
#define PPL_DIRTY_TEMP(T, id)
Result mul_assign(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Plus_Infinity PLUS_INFINITY
Definition: checked.cc:31
Enable_If< Is_Singleton< T >::value, Scalar_As_Interval_Info_Open >::type f_info(const T &, bool open)
Minus_Infinity MINUS_INFINITY
Definition: checked.cc:30
Enable_If< Has_OK< T >::value, bool >::type f_OK(const T &to)
I_Result combine(Result l, Result u)
int sgn_b(Boundary_Type type, const T &x, const Info &info)
Enable_If< Is_Singleton< T >::value, const T & >::type f_upper(const T &x)
Enable_If< Is_Native_Or_Checked< T >::value, int >::type infinity_sign(const T &x)
template<typename Boundary, typename Info>
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton<From1>::value || Is_Interval<From1>::value) && (Is_Singleton<From2>::value || Is_Interval<From2>::value)), I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::mul_assign ( const From1 &  x,
const From2 &  y 
)
template<typename Boundary, typename Info>
template<typename From >
Enable_If<Is_Singleton<From>::value || Is_Interval<From>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::neg_assign ( const From &  x)
inline

Definition at line 594 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::Boundary_NS::assign(), Parma_Polyhedra_Library::assign_or_swap(), Parma_Polyhedra_Library::check_empty_arg(), Parma_Polyhedra_Library::combine(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Interval_NS::f_info(), Parma_Polyhedra_Library::Interval_NS::f_lower(), Parma_Polyhedra_Library::f_OK(), Parma_Polyhedra_Library::Interval_NS::f_upper(), Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::Boundary_NS::neg_assign(), PPL_DIRTY_TEMP, and Parma_Polyhedra_Library::Boundary_NS::UPPER.

594  {
595  PPL_ASSERT(f_OK(x));
596  if (check_empty_arg(x)) {
597  return assign(EMPTY);
598  }
599  PPL_DIRTY_TEMP(To_Info, to_info);
600  to_info.clear();
601  Result rl;
602  Result ru;
603  PPL_DIRTY_TEMP(To_Boundary, to_lower);
604  rl = Boundary_NS::neg_assign(LOWER, to_lower, to_info, UPPER, f_upper(x), f_info(x));
605  ru = Boundary_NS::neg_assign(UPPER, upper(), to_info, LOWER, f_lower(x), f_info(x));
606  assign_or_swap(lower(), to_lower);
607  assign_or_swap(info(), to_info);
608  PPL_ASSERT(OK());
609  return combine(rl, ru);
610 }
The empty element, i.e., the empty set.
Enable_If< Has_Assign_Or_Swap< T >::value, void >::type assign_or_swap(T &to, T &from)
Result
Possible outcomes of a checked arithmetic computation.
Definition: Result_defs.hh:76
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type check_empty_arg(const T &x)
Result neg_assign(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type, const T &x, const Info &info)
I_Result assign(Degenerate_Element e)
Enable_If< Is_Singleton< T >::value, const T & >::type f_lower(const T &x)
#define PPL_DIRTY_TEMP(T, id)
Enable_If< Is_Singleton< T >::value, Scalar_As_Interval_Info_Open >::type f_info(const T &, bool open)
Enable_If< Has_OK< T >::value, bool >::type f_OK(const T &to)
I_Result combine(Result l, Result u)
Enable_If< Is_Singleton< T >::value, const T & >::type f_upper(const T &x)
template<typename Boundary, typename Info>
template<typename From >
Enable_If<Is_Singleton<From>::value || Is_Interval<From>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::neg_assign ( const From &  x)
template<typename Boundary, typename Info>
bool Parma_Polyhedra_Library::Interval< Boundary, Info >::OK ( ) const
inline

Definition at line 524 of file Interval_defs.hh.

References Parma_Polyhedra_Library::Boundary_NS::is_minus_infinity(), Parma_Polyhedra_Library::is_not_a_number(), Parma_Polyhedra_Library::Boundary_NS::is_open(), Parma_Polyhedra_Library::Boundary_NS::is_plus_infinity(), Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::Boundary_NS::SPECIAL, and Parma_Polyhedra_Library::Boundary_NS::UPPER.

524  {
525  if (!Info::may_be_empty && is_empty()) {
526 #ifndef NDEBUG
527  std::cerr << "The interval is unexpectedly empty.\n";
528 #endif
529  return false;
530  }
531 
532  if (is_open(LOWER, lower(), info())) {
533  if (is_plus_infinity(LOWER, lower(), info())) {
534 #ifndef NDEBUG
535  std::cerr << "The lower boundary is +inf open.\n";
536 #endif
537  }
538  }
539  else if (!Info::may_contain_infinity
540  && (is_minus_infinity(LOWER, lower(), info())
541  || is_plus_infinity(LOWER, lower(), info()))) {
542 #ifndef NDEBUG
543  std::cerr << "The lower boundary is unexpectedly infinity.\n";
544 #endif
545  return false;
546  }
547  if (!info().get_boundary_property(LOWER, SPECIAL)) {
548  if (is_not_a_number(lower())) {
549 #ifndef NDEBUG
550  std::cerr << "The lower boundary is not a number.\n";
551 #endif
552  return false;
553  }
554  }
555 
556  if (is_open(UPPER, upper(), info())) {
557  if (is_minus_infinity(UPPER, upper(), info())) {
558 #ifndef NDEBUG
559  std::cerr << "The upper boundary is -inf open.\n";
560 #endif
561  }
562  }
563  else if (!Info::may_contain_infinity
564  && (is_minus_infinity(UPPER, upper(), info())
565  || is_plus_infinity(UPPER, upper(), info()))) {
566 #ifndef NDEBUG
567  std::cerr << "The upper boundary is unexpectedly infinity."
568  << std::endl;
569 #endif
570  return false;
571  }
572  if (!info().get_boundary_property(UPPER, SPECIAL)) {
573  if (is_not_a_number(upper())) {
574 #ifndef NDEBUG
575  std::cerr << "The upper boundary is not a number.\n";
576 #endif
577  return false;
578  }
579  }
580 
581  // Everything OK.
582  return true;
583  }
Enable_If< Is_Native_Or_Checked< T >::value, bool >::type is_minus_infinity(const T &x)
static const Property SPECIAL(Property::SPECIAL_)
bool is_open(Boundary_Type type, const T &x, const Info &info)
Enable_If< Is_Native_Or_Checked< T >::value, bool >::type is_not_a_number(const T &x)
Enable_If< Is_Native_Or_Checked< T >::value, bool >::type is_plus_infinity(const T &x)
template<typename Boundary, typename Info>
template<typename T >
Enable_If<Is_Singleton<T>::value || Is_Interval<T>::value, Interval&>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::operator*= ( const T &  x)
inline

Definition at line 118 of file Interval_defs.hh.

References Parma_Polyhedra_Library::Boundary_NS::mul_assign().

118  {
119  mul_assign(*this, x);
120  return *this;
121  }
Enable_If<((Is_Singleton< From1 >::value||Is_Interval< From1 >::value)&&(Is_Singleton< From2 >::value||Is_Interval< From2 >::value)), I_Result >::type mul_assign(const From1 &x, const From2 &y)
template<typename Boundary, typename Info>
template<typename T >
Enable_If<Is_Singleton<T>::value || Is_Interval<T>::value, Interval&>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::operator+= ( const T &  x)
inline

Definition at line 106 of file Interval_defs.hh.

References Parma_Polyhedra_Library::Boundary_NS::add_assign().

106  {
107  add_assign(*this, x);
108  return *this;
109  }
Enable_If<((Is_Singleton< From1 >::value||Is_Interval< From1 >::value)&&(Is_Singleton< From2 >::value||Is_Interval< From2 >::value)), I_Result >::type add_assign(const From1 &x, const From2 &y)
template<typename Boundary, typename Info>
template<typename T >
Enable_If<Is_Singleton<T>::value || Is_Interval<T>::value, Interval&>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::operator-= ( const T &  x)
inline

Definition at line 112 of file Interval_defs.hh.

References Parma_Polyhedra_Library::Boundary_NS::sub_assign().

112  {
113  sub_assign(*this, x);
114  return *this;
115  }
Enable_If<((Is_Singleton< From1 >::value||Is_Interval< From1 >::value)&&(Is_Singleton< From2 >::value||Is_Interval< From2 >::value)), I_Result >::type sub_assign(const From1 &x, const From2 &y)
template<typename Boundary, typename Info>
template<typename T >
Enable_If<Is_Singleton<T>::value || Is_Interval<T>::value, Interval&>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::operator/= ( const T &  x)
inline

Definition at line 124 of file Interval_defs.hh.

References Parma_Polyhedra_Library::Boundary_NS::div_assign().

124  {
125  div_assign(*this, x);
126  return *this;
127  }
Enable_If<((Is_Singleton< From1 >::value||Is_Interval< From1 >::value)&&(Is_Singleton< From2 >::value||Is_Interval< From2 >::value)), I_Result >::type div_assign(const From1 &x, const From2 &y)
template<typename Boundary, typename Info>
template<typename T >
Enable_If<Is_Singleton<T>::value || Is_Interval<T>::value, Interval&>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::operator= ( const T &  x)
inline

Definition at line 99 of file Interval_defs.hh.

References Parma_Polyhedra_Library::Boundary_NS::assign().

99  {
100  assign(x);
101  return *this;
102  }
I_Result assign(Degenerate_Element e)
template<typename Boundary, typename Info>
Parma_Polyhedra_Library::Interval< Boundary, Info >::PPL_COMPILE_TIME_CHECK ( !Info::store_special||!std::numeric_limits< Boundary >::has_infinity  ,
"store_special is meaningless"" when boundary type may contains infinity"   
)
private
template<typename Boundary, typename Info>
template<typename From >
Enable_If<Is_Singleton<From>::value || Is_Interval<From>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::refine_existential ( Relation_Symbol  rel,
const From &  x 
)
inline

Definition at line 437 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::Boundary_NS::assign(), Parma_Polyhedra_Library::check_empty_arg(), Parma_Polyhedra_Library::combine(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Boundary_NS::eq(), Parma_Polyhedra_Library::EQUAL, Parma_Polyhedra_Library::Interval_NS::f_info(), Parma_Polyhedra_Library::f_is_singleton(), Parma_Polyhedra_Library::Interval_NS::f_lower(), Parma_Polyhedra_Library::f_OK(), Parma_Polyhedra_Library::Interval_NS::f_upper(), Parma_Polyhedra_Library::Boundary_NS::ge(), Parma_Polyhedra_Library::GREATER_OR_EQUAL, Parma_Polyhedra_Library::GREATER_THAN, Parma_Polyhedra_Library::Boundary_NS::gt(), Parma_Polyhedra_Library::I_ANY, Parma_Polyhedra_Library::I_EMPTY, Parma_Polyhedra_Library::Boundary_NS::le(), Parma_Polyhedra_Library::LESS_OR_EQUAL, Parma_Polyhedra_Library::LESS_THAN, Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::Boundary_NS::lt(), Parma_Polyhedra_Library::NOT_EQUAL, Parma_Polyhedra_Library::Boundary_NS::UPPER, and Parma_Polyhedra_Library::V_EQ.

437  {
438  PPL_ASSERT(OK());
439  PPL_ASSERT(f_OK(x));
440  if (check_empty_arg(x)) {
441  return assign(EMPTY);
442  }
443  switch (rel) {
444  case LESS_THAN:
445  {
446  if (lt(UPPER, upper(), info(), UPPER, f_upper(x), f_info(x))) {
447  return combine(V_EQ, V_EQ);
448  }
449  info().clear_boundary_properties(UPPER);
451  UPPER, f_upper(x), f_info(x), true);
452  return I_ANY;
453  }
454  case LESS_OR_EQUAL:
455  {
456  if (le(UPPER, upper(), info(), UPPER, f_upper(x), f_info(x))) {
457  return combine(V_EQ, V_EQ);
458  }
459  info().clear_boundary_properties(UPPER);
461  UPPER, f_upper(x), f_info(x));
462  return I_ANY;
463  }
464  case GREATER_THAN:
465  {
466  if (gt(LOWER, lower(), info(), LOWER, f_lower(x), f_info(x))) {
467  return combine(V_EQ, V_EQ);
468  }
469  info().clear_boundary_properties(LOWER);
471  LOWER, f_lower(x), f_info(x), true);
472  return I_ANY;
473  }
474  case GREATER_OR_EQUAL:
475  {
476  if (ge(LOWER, lower(), info(), LOWER, f_lower(x), f_info(x))) {
477  return combine(V_EQ, V_EQ);
478  }
479  info().clear_boundary_properties(LOWER);
481  LOWER, f_lower(x), f_info(x));
482  return I_ANY;
483  }
484  case EQUAL:
485  return intersect_assign(x);
486  case NOT_EQUAL:
487  {
488  if (!f_is_singleton(x)) {
489  return combine(V_EQ, V_EQ);
490  }
491  if (check_empty_arg(*this)) {
492  return I_EMPTY;
493  }
494  if (eq(LOWER, lower(), info(), LOWER, f_lower(x), f_info(x))) {
495  remove_inf();
496  }
497  if (eq(UPPER, upper(), info(), UPPER, f_upper(x), f_info(x))) {
498  remove_sup();
499  }
500  return I_ANY;
501  }
502  default:
503  PPL_UNREACHABLE;
504  return I_EMPTY;
505  }
506 }
The empty element, i.e., the empty set.
The computed result is exact.
Definition: Result_defs.hh:81
bool f_is_singleton(const Interval< Boundary, Info > &x)
bool lt(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Result may be empty or not empty.
bool gt(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type check_empty_arg(const T &x)
Result assign(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type, const T &x, const Info &info, bool should_shrink=false)
I_Result assign(Degenerate_Element e)
Enable_If< Is_Singleton< T >::value, const T & >::type f_lower(const T &x)
bool eq(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
bool ge(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type intersect_assign(const From &x)
Enable_If< Is_Singleton< T >::value, Scalar_As_Interval_Info_Open >::type f_info(const T &, bool open)
Enable_If< Has_OK< T >::value, bool >::type f_OK(const T &to)
I_Result combine(Result l, Result u)
Enable_If< Is_Singleton< T >::value, const T & >::type f_upper(const T &x)
bool le(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
template<typename Boundary, typename Info>
template<typename From >
Enable_If<Is_Singleton<From>::value || Is_Interval<From>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::refine_existential ( Relation_Symbol  rel,
const From &  x 
)

Refines to according to the existential relation rel with x.

The to interval is restricted to become, upon successful exit, the smallest interval of its type that contains the set

\[ \{\, a \in \mathtt{to} \mid \exists b \in \mathtt{x} \st a \mathrel{\mathtt{rel}} b \,\}. \]

Returns
???
template<typename Boundary, typename Info>
template<typename From >
Enable_If<Is_Singleton<From>::value || Is_Interval<From>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::refine_universal ( Relation_Symbol  rel,
const From &  x 
)
inline

Definition at line 512 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::Boundary_NS::assign(), Parma_Polyhedra_Library::check_empty_arg(), Parma_Polyhedra_Library::combine(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Boundary_NS::eq(), Parma_Polyhedra_Library::EQUAL, Parma_Polyhedra_Library::Interval_NS::f_info(), Parma_Polyhedra_Library::f_is_singleton(), Parma_Polyhedra_Library::Interval_NS::f_lower(), Parma_Polyhedra_Library::f_OK(), Parma_Polyhedra_Library::Interval_NS::f_upper(), Parma_Polyhedra_Library::Boundary_NS::ge(), Parma_Polyhedra_Library::GREATER_OR_EQUAL, Parma_Polyhedra_Library::GREATER_THAN, Parma_Polyhedra_Library::Boundary_NS::gt(), Parma_Polyhedra_Library::I_ANY, Parma_Polyhedra_Library::I_EMPTY, Parma_Polyhedra_Library::Boundary_NS::is_open(), Parma_Polyhedra_Library::Boundary_NS::le(), Parma_Polyhedra_Library::LESS_OR_EQUAL, Parma_Polyhedra_Library::LESS_THAN, Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::Boundary_NS::lt(), Parma_Polyhedra_Library::NOT_EQUAL, PPL_USED, Parma_Polyhedra_Library::Interval_NS::SCALAR_INFO, Parma_Polyhedra_Library::Boundary_NS::UPPER, and Parma_Polyhedra_Library::V_EQ.

513  {
514  PPL_ASSERT(OK());
515  PPL_ASSERT(f_OK(x));
516  if (check_empty_arg(x)) {
517  return combine(V_EQ, V_EQ);
518  }
519  switch (rel) {
520  case LESS_THAN:
521  {
522  if (lt(UPPER, upper(), info(), LOWER, f_lower(x), f_info(x))) {
523  return combine(V_EQ, V_EQ);
524  }
525  info().clear_boundary_properties(UPPER);
528  !is_open(LOWER, f_lower(x), f_info(x)));
529  PPL_USED(ru);
530  return I_ANY;
531  }
532  case LESS_OR_EQUAL:
533  {
534  if (le(UPPER, upper(), info(), LOWER, f_lower(x), f_info(x))) {
535  return combine(V_EQ, V_EQ);
536  }
537  info().clear_boundary_properties(UPPER);
539  LOWER, f_lower(x), SCALAR_INFO);
540  PPL_USED(ru);
541  return I_ANY;
542  }
543  case GREATER_THAN:
544  {
545  if (gt(LOWER, lower(), info(), UPPER, f_upper(x), f_info(x))) {
546  return combine(V_EQ, V_EQ);
547  }
548  info().clear_boundary_properties(LOWER);
551  !is_open(UPPER, f_upper(x), f_info(x)));
552  PPL_USED(rl);
553  return I_ANY;
554  }
555  case GREATER_OR_EQUAL:
556  {
557  if (ge(LOWER, lower(), info(), UPPER, f_upper(x), f_info(x))) {
558  return combine(V_EQ, V_EQ);
559  }
560  info().clear_boundary_properties(LOWER);
562  UPPER, f_upper(x), SCALAR_INFO);
563  PPL_USED(rl);
564  return I_ANY;
565  }
566  case EQUAL:
567  if (!f_is_singleton(x)) {
568  return assign(EMPTY);
569  }
570  return intersect_assign(x);
571  case NOT_EQUAL:
572  {
573  if (check_empty_arg(*this)) {
574  return I_EMPTY;
575  }
576  if (eq(LOWER, lower(), info(), LOWER, f_lower(x), f_info(x))) {
577  remove_inf();
578  }
579  if (eq(UPPER, upper(), info(), UPPER, f_upper(x), f_info(x))) {
580  remove_sup();
581  }
582  return I_ANY;
583  }
584  default:
585  PPL_UNREACHABLE;
586  return I_EMPTY;
587  }
588 }
The empty element, i.e., the empty set.
The computed result is exact.
Definition: Result_defs.hh:81
bool f_is_singleton(const Interval< Boundary, Info > &x)
bool lt(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Result may be empty or not empty.
Result
Possible outcomes of a checked arithmetic computation.
Definition: Result_defs.hh:76
bool gt(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type check_empty_arg(const T &x)
Result assign(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type, const T &x, const Info &info, bool should_shrink=false)
I_Result assign(Degenerate_Element e)
bool is_open(Boundary_Type type, const T &x, const Info &info)
Enable_If< Is_Singleton< T >::value, const T & >::type f_lower(const T &x)
bool eq(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
const Scalar_As_Interval_Info SCALAR_INFO
bool ge(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type intersect_assign(const From &x)
Enable_If< Is_Singleton< T >::value, Scalar_As_Interval_Info_Open >::type f_info(const T &, bool open)
Enable_If< Has_OK< T >::value, bool >::type f_OK(const T &to)
I_Result combine(Result l, Result u)
#define PPL_USED(v)
No-op macro that allows to avoid unused variable warnings from the compiler.
Definition: compiler.hh:39
Enable_If< Is_Singleton< T >::value, const T & >::type f_upper(const T &x)
bool le(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
template<typename Boundary, typename Info>
template<typename From >
Enable_If<Is_Singleton<From>::value || Is_Interval<From>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::refine_universal ( Relation_Symbol  rel,
const From &  x 
)

Refines to so that it satisfies the universal relation rel with x.

The to interval is restricted to become, upon successful exit, the smallest interval of its type that contains the set

\[ \{\, a \in \mathtt{to} \mid \forall b \in \mathtt{x} \itc a \mathrel{\mathtt{rel}} b \,\}. \]

Returns
???
template<typename Boundary, typename Info>
void Parma_Polyhedra_Library::Interval< Boundary, Info >::remove_inf ( )
inline

Definition at line 389 of file Interval_defs.hh.

References Parma_Polyhedra_Library::Boundary_NS::LOWER, and Parma_Polyhedra_Library::Boundary_NS::OPEN.

389  {
390  PPL_ASSERT(!is_empty());
391  if (!Info::store_open) {
392  return;
393  }
394  info().set_boundary_property(LOWER, OPEN, true);
395  }
static const Property OPEN(Property::OPEN_)
template<typename Boundary, typename Info>
void Parma_Polyhedra_Library::Interval< Boundary, Info >::remove_sup ( )
inline

Definition at line 397 of file Interval_defs.hh.

References Parma_Polyhedra_Library::Boundary_NS::OPEN, and Parma_Polyhedra_Library::Boundary_NS::UPPER.

397  {
398  PPL_ASSERT(!is_empty());
399  if (!Info::store_open) {
400  return;
401  }
402  info().set_boundary_property(UPPER, OPEN, true);
403  }
static const Property OPEN(Property::OPEN_)
template<typename Boundary, typename Info>
I_Result Parma_Polyhedra_Library::Interval< Boundary, Info >::set_infinities ( )
inline

Definition at line 356 of file Interval_defs.hh.

References Parma_Polyhedra_Library::combine(), Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::Boundary_NS::set_minus_infinity(), Parma_Polyhedra_Library::Boundary_NS::set_plus_infinity(), and Parma_Polyhedra_Library::Boundary_NS::UPPER.

356  {
357  info().clear();
360  PPL_ASSERT(OK());
361  return combine(rl, ru);
362  }
Result set_minus_infinity(Boundary_Type type, T &x, Info &info, bool open=false)
Result set_plus_infinity(Boundary_Type type, T &x, Info &info, bool open=false)
Result
Possible outcomes of a checked arithmetic computation.
Definition: Result_defs.hh:76
I_Result combine(Result l, Result u)
template<typename Boundary, typename Info>
template<typename From >
Enable_If<Is_Interval<From>::value, bool>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::simplify_using_context_assign ( const From &  y)

Definition at line 406 of file Interval_templates.hh.

References Parma_Polyhedra_Library::Interval_NS::f_info(), Parma_Polyhedra_Library::Interval_NS::f_lower(), Parma_Polyhedra_Library::Interval_NS::f_upper(), Parma_Polyhedra_Library::Boundary_NS::gt(), Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::Boundary_NS::lt(), and Parma_Polyhedra_Library::Boundary_NS::UPPER.

406  {
407  // FIXME: the following code wrongly assumes that intervals are closed
408  if (lt(UPPER, upper(), info(), LOWER, f_lower(y), f_info(y))) {
409  lower_extend();
410  return false;
411  }
412  if (gt(LOWER, lower(), info(), UPPER, f_upper(y), f_info(y))) {
413  upper_extend();
414  return false;
415  }
416  // Weakening the upper bound.
417  if (!upper_is_boundary_infinity() && !y.upper_is_boundary_infinity()
418  && y.upper() <= upper()) {
419  upper_extend();
420  }
421  // Weakening the lower bound.
422  if (!lower_is_boundary_infinity() && !y.lower_is_boundary_infinity()
423  && y.lower() >= lower()) {
424  lower_extend();
425  }
426  return true;
427 }
bool lt(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
const Boundary & f_upper(const Interval< Boundary, Info > &x)
bool gt(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
const Info & f_info(const Interval< Boundary, Info > &x)
const Boundary & f_lower(const Interval< Boundary, Info > &x)
template<typename Boundary, typename Info>
template<typename From >
Enable_If<Is_Interval<From>::value, bool>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::simplify_using_context_assign ( const From &  y)

Assigns to *this a meet-preserving simplification of *this with respect to y.

Returns
false if and only if the meet of *this and y is empty.
template<typename Boundary, typename Info>
template<typename T >
Enable_If<Is_Singleton<T>::value || Is_Interval<T>::value, bool>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::strictly_contains ( const T &  y) const
inline

Definition at line 210 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::check_empty_arg(), Parma_Polyhedra_Library::Interval_NS::f_info(), Parma_Polyhedra_Library::Interval_NS::f_lower(), Parma_Polyhedra_Library::f_OK(), Parma_Polyhedra_Library::Interval_NS::f_upper(), Parma_Polyhedra_Library::Boundary_NS::ge(), Parma_Polyhedra_Library::Boundary_NS::gt(), Parma_Polyhedra_Library::Boundary_NS::le(), Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::Boundary_NS::lt(), and Parma_Polyhedra_Library::Boundary_NS::UPPER.

210  {
211  PPL_ASSERT(OK());
212  PPL_ASSERT(f_OK(y));
213  if (check_empty_arg(y)) {
214  return !check_empty_arg(*this);
215  }
216  if (check_empty_arg(*this)) {
217  return false;
218  }
219  return (lt(LOWER, lower(), info(), LOWER, f_lower(y), f_info(y))
220  && ge(UPPER, upper(), info(), UPPER, f_upper(y), f_info(y)))
221  || (le(LOWER, lower(), info(), LOWER, f_lower(y), f_info(y))
222  && gt(UPPER, upper(), info(), UPPER, f_upper(y), f_info(y)));
223 }
bool lt(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
bool gt(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type check_empty_arg(const T &x)
Enable_If< Is_Singleton< T >::value, const T & >::type f_lower(const T &x)
bool ge(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Enable_If< Is_Singleton< T >::value, Scalar_As_Interval_Info_Open >::type f_info(const T &, bool open)
Enable_If< Has_OK< T >::value, bool >::type f_OK(const T &to)
Enable_If< Is_Singleton< T >::value, const T & >::type f_upper(const T &x)
bool le(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
template<typename Boundary, typename Info>
template<typename T >
Enable_If<Is_Singleton<T>::value || Is_Interval<T>::value, bool>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::strictly_contains ( const T &  y) const
template<typename Boundary, typename Info>
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton<From1>::value || Is_Interval<From1>::value) && (Is_Singleton<From2>::value || Is_Interval<From2>::value)), I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::sub_assign ( const From1 &  x,
const From2 &  y 
)
inline

Definition at line 658 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::Boundary_NS::assign(), Parma_Polyhedra_Library::assign_or_swap(), Parma_Polyhedra_Library::check_empty_arg(), Parma_Polyhedra_Library::combine(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Interval_NS::f_info(), Parma_Polyhedra_Library::Interval_NS::f_lower(), Parma_Polyhedra_Library::f_OK(), Parma_Polyhedra_Library::Interval_NS::f_upper(), Parma_Polyhedra_Library::infinity_sign(), Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::MINUS_INFINITY, Parma_Polyhedra_Library::PLUS_INFINITY, PPL_DIRTY_TEMP, Parma_Polyhedra_Library::Boundary_NS::sub_assign(), and Parma_Polyhedra_Library::Boundary_NS::UPPER.

658  {
659  PPL_ASSERT(f_OK(x));
660  PPL_ASSERT(f_OK(y));
661  if (check_empty_arg(x) || check_empty_arg(y)) {
662  return assign(EMPTY);
663  }
664  int inf_sign = Parma_Polyhedra_Library::infinity_sign(x);
665  if (inf_sign != 0) {
666  if (Parma_Polyhedra_Library::infinity_sign(y) == inf_sign) {
667  return assign(EMPTY);
668  }
669  }
670  else {
672  }
673  if (inf_sign < 0) {
674  return assign(MINUS_INFINITY);
675  }
676  else if (inf_sign > 0) {
677  return assign(PLUS_INFINITY);
678  }
679  PPL_DIRTY_TEMP(To_Info, to_info);
680  to_info.clear();
681  Result rl;
682  Result ru;
683  PPL_DIRTY_TEMP(To_Boundary, to_lower);
684  rl = Boundary_NS::sub_assign(LOWER, to_lower, to_info,
685  LOWER, f_lower(x), f_info(x),
686  UPPER, f_upper(y), f_info(y));
687  ru = Boundary_NS::sub_assign(UPPER, upper(), to_info,
688  UPPER, f_upper(x), f_info(x),
689  LOWER, f_lower(y), f_info(y));
690  assign_or_swap(lower(), to_lower);
691  assign_or_swap(info(), to_info);
692  PPL_ASSERT(OK());
693  return combine(rl, ru);
694 }
The empty element, i.e., the empty set.
Enable_If< Has_Assign_Or_Swap< T >::value, void >::type assign_or_swap(T &to, T &from)
Result
Possible outcomes of a checked arithmetic computation.
Definition: Result_defs.hh:76
Enable_If< Is_Singleton< T >::value||Is_Interval< T >::value, bool >::type check_empty_arg(const T &x)
I_Result assign(Degenerate_Element e)
Enable_If< Is_Singleton< T >::value, const T & >::type f_lower(const T &x)
Result sub_assign(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
#define PPL_DIRTY_TEMP(T, id)
Plus_Infinity PLUS_INFINITY
Definition: checked.cc:31
Enable_If< Is_Singleton< T >::value, Scalar_As_Interval_Info_Open >::type f_info(const T &, bool open)
Minus_Infinity MINUS_INFINITY
Definition: checked.cc:30
Enable_If< Has_OK< T >::value, bool >::type f_OK(const T &to)
I_Result combine(Result l, Result u)
Enable_If< Is_Singleton< T >::value, const T & >::type f_upper(const T &x)
Enable_If< Is_Native_Or_Checked< T >::value, int >::type infinity_sign(const T &x)
template<typename Boundary, typename Info>
template<typename From1 , typename From2 >
Enable_If<((Is_Singleton<From1>::value || Is_Interval<From1>::value) && (Is_Singleton<From2>::value || Is_Interval<From2>::value)), I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::sub_assign ( const From1 &  x,
const From2 &  y 
)
template<typename Boundary, typename Info>
void Parma_Polyhedra_Library::Interval< Boundary, Info >::topological_closure_assign ( )
inline

Assigns to *this its topological closure.

Definition at line 377 of file Interval_defs.hh.

References Parma_Polyhedra_Library::Boundary_NS::LOWER, Parma_Polyhedra_Library::Boundary_NS::OPEN, and Parma_Polyhedra_Library::Boundary_NS::UPPER.

377  {
378  if (!Info::store_open || is_empty()) {
379  return;
380  }
382  info().set_boundary_property(LOWER, OPEN, false);
383  }
385  info().set_boundary_property(UPPER, OPEN, false);
386  }
387  }
static const Property OPEN(Property::OPEN_)
template<typename Boundary , typename Info >
memory_size_type Parma_Polyhedra_Library::Interval< Boundary, Info >::total_memory_in_bytes ( ) const
inline

Returns the total size in bytes of the memory occupied by *this.

Definition at line 38 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::external_memory_in_bytes().

38  {
39  return sizeof(*this) + external_memory_in_bytes();
40 }
memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
template<typename Boundary, typename Info>
const Boundary& Parma_Polyhedra_Library::Interval< Boundary, Info >::upper ( ) const
inline

Definition at line 152 of file Interval_defs.hh.

152  {
153  return upper_;
154  }
template<typename Boundary, typename Info>
I_Constraint<boundary_type> Parma_Polyhedra_Library::Interval< Boundary, Info >::upper_constraint ( ) const
inline

Definition at line 164 of file Interval_defs.hh.

References Parma_Polyhedra_Library::i_constraint(), Parma_Polyhedra_Library::LESS_OR_EQUAL, Parma_Polyhedra_Library::LESS_THAN, Parma_Polyhedra_Library::Boundary_NS::SPECIAL, and Parma_Polyhedra_Library::Boundary_NS::UPPER.

164  {
165  PPL_ASSERT(!is_empty());
166  if (info().get_boundary_property(UPPER, SPECIAL)) {
167  return I_Constraint<boundary_type>();
168  }
170  upper(), true);
171  }
I_Constraint< T > i_constraint(I_Constraint_Rel rel, const T &v)
static const Property SPECIAL(Property::SPECIAL_)
template<typename Boundary, typename Info>
template<typename C >
Enable_If<Is_Same_Or_Derived<I_Constraint_Base, C>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::upper_extend ( const C &  c)

Definition at line 61 of file Interval_templates.hh.

References Parma_Polyhedra_Library::Interval_NS::f_info(), Parma_Polyhedra_Library::I_ANY, Parma_Polyhedra_Library::I_EXACT, Parma_Polyhedra_Library::I_NOT_EMPTY, Parma_Polyhedra_Library::I_UNCHANGED, Parma_Polyhedra_Library::max_assign(), Parma_Polyhedra_Library::Boundary_NS::UPPER, Parma_Polyhedra_Library::V_EQ, Parma_Polyhedra_Library::V_LE, Parma_Polyhedra_Library::V_LGE, Parma_Polyhedra_Library::V_LT, and Parma_Polyhedra_Library::V_NAN.

61  {
62  PPL_ASSERT(OK());
63  bool open;
64  switch (c.rel()) {
65  case V_LGE:
66  return lower_extend();
67  case V_NAN:
68  return I_NOT_EMPTY | I_EXACT | I_UNCHANGED;
69  case V_LT:
70  open = true;
71  break;
72  case V_LE: // Fall through.
73  case V_EQ:
74  open = false;
75  break;
76  default:
77  PPL_UNREACHABLE;
78  return I_NOT_EMPTY | I_EXACT | I_UNCHANGED;
79  }
80  max_assign(UPPER, upper(), info(), UPPER, c.value(), f_info(c.value(), open));
81  PPL_ASSERT(OK());
82  return I_ANY;
83 }
The computed result is exact.
Definition: Result_defs.hh:81
Result may be empty or not empty.
void max_assign(N &x, const N &y)
Assigns to x the maximum between x and y.
Not a number result.
Definition: Result_defs.hh:123
const Info & f_info(const Interval< Boundary, Info > &x)
Result is definitely exact.
The computed result may be inexact and rounded up.
Definition: Result_defs.hh:93
Coefficient c
Definition: PIP_Tree.cc:64
The computed result is inexact and rounded up.
Definition: Result_defs.hh:84
Operation has left the set definitely unchanged.
The computed result may be inexact.
Definition: Result_defs.hh:99
template<typename Boundary, typename Info>
I_Result Parma_Polyhedra_Library::Interval< Boundary, Info >::upper_extend ( )
inline
template<typename Boundary, typename Info>
template<typename C >
Enable_If<Is_Same_Or_Derived<I_Constraint_Base, C>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::upper_extend ( const C &  c)
template<typename Boundary, typename Info>
bool Parma_Polyhedra_Library::Interval< Boundary, Info >::upper_is_boundary_infinity ( ) const
inline
template<typename Boundary, typename Info>
bool Parma_Polyhedra_Library::Interval< Boundary, Info >::upper_is_domain_sup ( ) const
inline
template<typename Boundary, typename Info>
bool Parma_Polyhedra_Library::Interval< Boundary, Info >::upper_is_open ( ) const
inline
template<typename Boundary, typename Info>
Info& Parma_Polyhedra_Library::Interval< Boundary, Info >::w_info ( ) const
inlineprivate

Definition at line 87 of file Interval_defs.hh.

87  {
88  return const_cast<Interval&>(*this);
89  }
template<typename Boundary, typename Info>
template<typename From >
Enable_If<Is_Singleton<From>::value || Is_Interval<From>::value, I_Result>::type Parma_Polyhedra_Library::Interval< Boundary, Info >::wrap_assign ( Bounded_Integer_Type_Width  w,
Bounded_Integer_Type_Representation  r,
const From &  refinement 
)
inline

Definition at line 469 of file Interval_defs.hh.

References Parma_Polyhedra_Library::Boundary_NS::assign(), Parma_Polyhedra_Library::I_EMPTY, Parma_Polyhedra_Library::Boundary_NS::le(), Parma_Polyhedra_Library::Boundary_NS::LOWER, PPL_DIRTY_TEMP, Parma_Polyhedra_Library::result_overflow(), Parma_Polyhedra_Library::ROUND_UP, Parma_Polyhedra_Library::Boundary_NS::set_unbounded(), Parma_Polyhedra_Library::SIGNED_2_COMPLEMENT, Parma_Polyhedra_Library::Boundary_NS::smod_2exp_assign(), Parma_Polyhedra_Library::Boundary_NS::umod_2exp_assign(), Parma_Polyhedra_Library::UNSIGNED, and Parma_Polyhedra_Library::Boundary_NS::UPPER.

471  {
472  if (is_empty()) {
473  return I_EMPTY;
474  }
476  return assign(refinement);
477  }
478  PPL_DIRTY_TEMP(Boundary, u);
479  Result result = sub_2exp_assign_r(u, upper(), w, ROUND_UP);
480  if (result_overflow(result) == 0 && u > lower()) {
481  return assign(refinement);
482  }
483  info().clear();
484  switch (r) {
485  case UNSIGNED:
487  LOWER, lower(), info(), w);
489  UPPER, upper(), info(), w);
490  break;
491  case SIGNED_2_COMPLEMENT:
493  LOWER, lower(), info(), w);
495  UPPER, upper(), info(), w);
496  break;
497  default:
498  PPL_UNREACHABLE;
499  break;
500  }
501  if (le(LOWER, lower(), info(), UPPER, upper(), info())) {
502  return intersect_assign(refinement);
503  }
504  PPL_DIRTY_TEMP(Interval, tmp);
505  tmp.info().clear();
506  Boundary_NS::assign(LOWER, tmp.lower(), tmp.info(),
507  LOWER, lower(), info());
508  set_unbounded(UPPER, tmp.upper(), tmp.info());
509  tmp.intersect_assign(refinement);
510  lower_extend();
511  intersect_assign(refinement);
512  return join_assign(tmp);
513  }
int result_overflow(Result r)
Result
Possible outcomes of a checked arithmetic computation.
Definition: Result_defs.hh:76
Result assign(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type, const T &x, const Info &info, bool should_shrink=false)
I_Result assign(Degenerate_Element e)
Result set_unbounded(Boundary_Type type, T &x, Info &info)
#define PPL_DIRTY_TEMP(T, id)
Result umod_2exp_assign(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type, const T &x, const Info &info, unsigned int exp)
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type intersect_assign(const From &x)
Signed binary where negative values are represented by the two's complement of the absolute value...
Enable_If< Is_Singleton< From >::value||Is_Interval< From >::value, I_Result >::type join_assign(const From &x)
Result smod_2exp_assign(Boundary_Type to_type, To &to, To_Info &to_info, Boundary_Type type, const T &x, const Info &info, unsigned int exp)
bool le(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)

Friends And Related Function Documentation

template<typename Boundary , typename Info >
void swap ( Interval< Boundary, Info > &  x,
Interval< Boundary, Info > &  y 
)
related

Swaps x with y.

template<typename Boundary , typename Info >
void swap ( Interval< Boundary, Info > &  x,
Interval< Boundary, Info > &  y 
)
related

Definition at line 1223 of file Interval_inlines.hh.

References Parma_Polyhedra_Library::Interval< Boundary, Info >::m_swap().

1223  {
1224  x.m_swap(y);
1225 }

Member Data Documentation

template<typename Boundary, typename Info>
Boundary Parma_Polyhedra_Library::Interval< Boundary, Info >::lower_
private

Definition at line 767 of file Interval_defs.hh.

template<typename Boundary, typename Info>
Boundary Parma_Polyhedra_Library::Interval< Boundary, Info >::upper_
private

Definition at line 768 of file Interval_defs.hh.


The documentation for this class was generated from the following files: