PPL  1.2
Box_inlines.hh
Go to the documentation of this file.
1 /* Box class implementation: inline functions.
2  Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
3  Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
4 
5 This file is part of the Parma Polyhedra Library (PPL).
6 
7 The PPL is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 The PPL is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
20 
21 For the most up-to-date information see the Parma Polyhedra Library
22 site: http://bugseng.com/products/ppl/ . */
23 
24 #ifndef PPL_Box_inlines_hh
25 #define PPL_Box_inlines_hh 1
26 
27 #include "Boundary_defs.hh"
32 #include "distances_defs.hh"
33 
34 namespace Parma_Polyhedra_Library {
35 
36 template <typename ITV>
37 inline bool
39  return status.test_empty_up_to_date() && status.test_empty();
40 }
41 
42 template <typename ITV>
43 inline void
45  status.set_empty();
46  status.set_empty_up_to_date();
47 }
48 
49 template <typename ITV>
50 inline void
52  status.reset_empty();
53  status.set_empty_up_to_date();
54 }
55 
56 template <typename ITV>
57 inline void
59  status.set_empty_up_to_date();
60 }
61 
62 template <typename ITV>
63 inline void
65  return status.reset_empty_up_to_date();
66 }
67 
68 template <typename ITV>
69 inline
71  : seq(y.seq), status(y.status) {
72 }
73 
74 template <typename ITV>
75 inline Box<ITV>&
77  seq = y.seq;
78  status = y.status;
79  return *this;
80 }
81 
82 template <typename ITV>
83 inline void
85  Box& x = *this;
86  using std::swap;
87  swap(x.seq, y.seq);
88  swap(x.status, y.status);
89 }
90 
91 template <typename ITV>
92 inline
94  // Recycling is useless: just delegate.
95  Box<ITV> tmp(cs);
96  this->m_swap(tmp);
97 }
98 
99 template <typename ITV>
100 inline
102  // Recycling is useless: just delegate.
103  Box<ITV> tmp(gs);
104  this->m_swap(tmp);
105 }
106 
107 template <typename ITV>
108 inline
110  // Recycling is useless: just delegate.
111  Box<ITV> tmp(cgs);
112  this->m_swap(tmp);
113 }
114 
115 template <typename ITV>
116 inline memory_size_type
118  return sizeof(*this) + external_memory_in_bytes();
119 }
120 
121 template <typename ITV>
122 inline dimension_type
124  return seq.size();
125 }
126 
127 template <typename ITV>
128 inline dimension_type
130  // One dimension is reserved to have a value of type dimension_type
131  // that does not represent a legal dimension.
132  return Sequence().max_size() - 1;
133 }
134 
135 template <typename ITV>
136 inline int32_t
138  return hash_code_from_dimension(space_dimension());
139 }
140 
141 template <typename ITV>
142 inline const ITV&
144  PPL_ASSERT(k < seq.size());
145  return seq[k];
146 }
147 
148 template <typename ITV>
149 inline const ITV&
151  if (space_dimension() < var.space_dimension()) {
152  throw_dimension_incompatible("get_interval(v)", "v", var);
153  }
154  if (is_empty()) {
155  static ITV empty_interval(EMPTY);
156  return empty_interval;
157  }
158 
159  return seq[var.id()];
160 }
161 
162 template <typename ITV>
163 inline void
164 Box<ITV>::set_interval(const Variable var, const ITV& i) {
165  const dimension_type space_dim = space_dimension();
166  if (space_dim < var.space_dimension()) {
167  throw_dimension_incompatible("set_interval(v, i)", "v", var);
168  }
169 
170  if (is_empty() && space_dim >= 2) {
171  // If the box is empty, and has dimension >= 2, setting only one
172  // interval will not make it non-empty.
173  return;
174  }
175  seq[var.id()] = i;
176  reset_empty_up_to_date();
177 
178  PPL_ASSERT(OK());
179 }
180 
181 template <typename ITV>
182 inline bool
184  return marked_empty() || check_empty();
185 }
186 
187 template <typename ITV>
188 inline bool
190  return bounds(expr, true);
191 }
192 
193 template <typename ITV>
194 inline bool
196  return bounds(expr, false);
197 }
198 
199 template <typename ITV>
200 inline bool
202  Coefficient& sup_n, Coefficient& sup_d,
203  bool& maximum) const {
204  return max_min(expr, true, sup_n, sup_d, maximum);
205 }
206 
207 template <typename ITV>
208 inline bool
210  Coefficient& sup_n, Coefficient& sup_d, bool& maximum,
211  Generator& g) const {
212  return max_min(expr, true, sup_n, sup_d, maximum, g);
213 }
214 
215 template <typename ITV>
216 inline bool
218  Coefficient& inf_n, Coefficient& inf_d,
219  bool& minimum) const {
220  return max_min(expr, false, inf_n, inf_d, minimum);
221 }
222 
223 template <typename ITV>
224 inline bool
226  Coefficient& inf_n, Coefficient& inf_d, bool& minimum,
227  Generator& g) const {
228  return max_min(expr, false, inf_n, inf_d, minimum, g);
229 }
230 
231 template <typename ITV>
232 inline bool
234  const Box& x = *this;
235  return x.contains(y) && !y.contains(x);
236 }
237 
238 template <typename ITV>
239 inline void
241  const dimension_type m) {
242  const dimension_type space_dim = space_dimension();
243  // `var' should be one of the dimensions of the vector space.
244  if (var.space_dimension() > space_dim) {
245  throw_dimension_incompatible("expand_space_dimension(v, m)", "v", var);
246  }
247 
248  // The space dimension of the resulting Box should not
249  // overflow the maximum allowed space dimension.
250  if (m > max_space_dimension() - space_dim) {
251  throw_invalid_argument("expand_dimension(v, m)",
252  "adding m new space dimensions exceeds "
253  "the maximum allowed space dimension");
254  }
255 
256  // To expand the space dimension corresponding to variable `var',
257  // we append to the box `m' copies of the corresponding interval.
258  seq.insert(seq.end(), m, seq[var.id()]);
259  PPL_ASSERT(OK());
260 }
261 
262 template <typename ITV>
263 inline bool
264 operator!=(const Box<ITV>& x, const Box<ITV>& y) {
265  return !(x == y);
266 }
267 
268 template <typename ITV>
269 inline bool
271  Coefficient& n, Coefficient& d, bool& closed) const {
272  // NOTE: assertion !is_empty() would be wrong;
273  // see the calls in method Box<ITV>::constraints().
274  PPL_ASSERT(!marked_empty());
275  const dimension_type k = var.id();
276  PPL_ASSERT(k < seq.size());
277  const ITV& seq_k = seq[k];
278 
279  if (seq_k.lower_is_boundary_infinity()) {
280  return false;
281  }
282  closed = !seq_k.lower_is_open();
283 
284  PPL_DIRTY_TEMP(mpq_class, lr);
285  assign_r(lr, seq_k.lower(), ROUND_NOT_NEEDED);
286  n = lr.get_num();
287  d = lr.get_den();
288 
289  return true;
290 }
291 
292 template <typename ITV>
293 inline bool
295  Coefficient& n, Coefficient& d, bool& closed) const {
296  // NOTE: assertion !is_empty() would be wrong;
297  // see the calls in method Box<ITV>::constraints().
298  PPL_ASSERT(!marked_empty());
299  const dimension_type k = var.id();
300  PPL_ASSERT(k < seq.size());
301  const ITV& seq_k = seq[k];
302 
303  if (seq_k.upper_is_boundary_infinity()) {
304  return false;
305  }
306 
307  closed = !seq_k.upper_is_open();
308 
309  PPL_DIRTY_TEMP(mpq_class, ur);
310  assign_r(ur, seq_k.upper(), ROUND_NOT_NEEDED);
311  n = ur.get_num();
312  d = ur.get_den();
313 
314  return true;
315 }
316 
317 template <typename ITV>
318 inline void
320  const dimension_type c_space_dim = c.space_dimension();
321  // Dimension-compatibility check.
322  if (c_space_dim > space_dimension()) {
323  throw_dimension_incompatible("add_constraint(c)", c);
324  }
325 
326  add_constraint_no_check(c);
327 }
328 
329 template <typename ITV>
330 inline void
332  // Dimension-compatibility check.
333  if (cs.space_dimension() > space_dimension()) {
334  throw_dimension_incompatible("add_constraints(cs)", cs);
335  }
336 
337  add_constraints_no_check(cs);
338 }
339 
340 template <typename T>
341 inline void
343  add_constraints(cs);
344 }
345 
346 template <typename ITV>
347 inline void
349  const dimension_type cg_space_dim = cg.space_dimension();
350  // Dimension-compatibility check.
351  if (cg_space_dim > space_dimension()) {
352  throw_dimension_incompatible("add_congruence(cg)", cg);
353  }
354 
355  add_congruence_no_check(cg);
356 }
357 
358 template <typename ITV>
359 inline void
361  if (cgs.space_dimension() > space_dimension()) {
362  throw_dimension_incompatible("add_congruences(cgs)", cgs);
363  }
364  add_congruences_no_check(cgs);
365 }
366 
367 template <typename T>
368 inline void
370  add_congruences(cgs);
371 }
372 
373 template <typename T>
374 inline bool
376  return false;
377 }
378 
379 template <typename T>
380 inline bool
382  return false;
383 }
384 
385 template <typename T>
386 inline void
387 Box<T>::widening_assign(const Box& y, unsigned* tp) {
388  CC76_widening_assign(y, tp);
389 }
390 
391 template <typename ITV>
392 inline Congruence_System
394  // Only equalities can be congruences and these are already minimized.
395  return congruences();
396 }
397 
398 template <typename ITV>
399 inline I_Result
400 Box<ITV>
402  const Constraint::Type type,
403  Coefficient_traits::const_reference numer,
404  Coefficient_traits::const_reference denom) {
405  PPL_ASSERT(denom != 0);
406  // The interval constraint is of the form
407  // `var + numer / denom rel 0',
408  // where `rel' is either the relation `==', `>=', or `>'.
409  // For the purpose of refining the interval, this is
410  // (morally) turned into `var rel -numer/denom'.
411  PPL_DIRTY_TEMP(mpq_class, q);
412  assign_r(q.get_num(), numer, ROUND_NOT_NEEDED);
413  assign_r(q.get_den(), denom, ROUND_NOT_NEEDED);
414  q.canonicalize();
415  // Turn `numer/denom' into `-numer/denom'.
416  q = -q;
417 
418  Relation_Symbol rel_sym;
419  switch (type) {
421  rel_sym = EQUAL;
422  break;
424  rel_sym = (denom > 0) ? GREATER_OR_EQUAL : LESS_OR_EQUAL;
425  break;
427  rel_sym = (denom > 0) ? GREATER_THAN : LESS_THAN;
428  break;
429  default:
430  // Silence compiler warning.
431  PPL_UNREACHABLE;
432  return I_ANY;
433  }
434  I_Result res = itv.add_constraint(i_constraint(rel_sym, q));
435  PPL_ASSERT(itv.OK());
436  return res;
437 }
438 
439 template <typename ITV>
440 inline void
441 Box<ITV>
443  const Constraint::Type type,
444  Coefficient_traits::const_reference numer,
445  Coefficient_traits::const_reference denom) {
446  PPL_ASSERT(!marked_empty());
447  PPL_ASSERT(var_id < space_dimension());
448  PPL_ASSERT(denom != 0);
449  refine_interval_no_check(seq[var_id], type, numer, denom);
450  // FIXME: do check the value returned and set `empty' and
451  // `empty_up_to_date' as appropriate.
452  // This has to be done after reimplementation of intervals.
453  reset_empty_up_to_date();
454  PPL_ASSERT(OK());
455 }
456 
457 template <typename ITV>
458 inline void
460  const dimension_type c_space_dim = c.space_dimension();
461  // Dimension-compatibility check.
462  if (c_space_dim > space_dimension()) {
463  throw_dimension_incompatible("refine_with_constraint(c)", c);
464  }
465 
466  // If the box is already empty, there is nothing left to do.
467  if (marked_empty()) {
468  return;
469  }
470 
471  refine_no_check(c);
472 }
473 
474 template <typename ITV>
475 inline void
477  // Dimension-compatibility check.
478  if (cs.space_dimension() > space_dimension()) {
479  throw_dimension_incompatible("refine_with_constraints(cs)", cs);
480  }
481 
482  // If the box is already empty, there is nothing left to do.
483  if (marked_empty()) {
484  return;
485  }
486  refine_no_check(cs);
487 }
488 
489 template <typename ITV>
490 inline void
492  const dimension_type cg_space_dim = cg.space_dimension();
493  // Dimension-compatibility check.
494  if (cg_space_dim > space_dimension()) {
495  throw_dimension_incompatible("refine_with_congruence(cg)", cg);
496  }
497  // If the box is already empty, there is nothing left to do.
498  if (marked_empty()) {
499  return;
500  }
501  refine_no_check(cg);
502 }
503 
504 template <typename ITV>
505 inline void
507  // Dimension-compatibility check.
508  if (cgs.space_dimension() > space_dimension()) {
509  throw_dimension_incompatible("refine_with_congruences(cgs)", cgs);
510  }
511 
512  // If the box is already empty, there is nothing left to do.
513  if (marked_empty()) {
514  return;
515  }
516 
517  refine_no_check(cgs);
518 }
519 
520 template <typename ITV>
521 inline void
523  const dimension_type c_space_dim = c.space_dimension();
524  // Dimension-compatibility check.
525  if (c_space_dim > space_dimension()) {
526  throw_dimension_incompatible("propagate_constraint(c)", c);
527  }
528 
529  // If the box is already empty, there is nothing left to do.
530  if (marked_empty()) {
531  return;
532  }
533  propagate_constraint_no_check(c);
534 }
535 
536 template <typename ITV>
537 inline void
539  const dimension_type max_iterations) {
540  // Dimension-compatibility check.
541  if (cs.space_dimension() > space_dimension()) {
542  throw_dimension_incompatible("propagate_constraints(cs)", cs);
543  }
544 
545  // If the box is already empty, there is nothing left to do.
546  if (marked_empty()) {
547  return;
548  }
549 
550  propagate_constraints_no_check(cs, max_iterations);
551 }
552 
553 template <typename ITV>
554 inline void
556  const dimension_type var_id = var.id();
557  // Dimension-compatibility check.
558  if (space_dimension() < var_id + 1) {
559  throw_dimension_incompatible("unconstrain(var)", var_id + 1);
560  }
561 
562  // If the box is already empty, there is nothing left to do.
563  if (marked_empty()) {
564  return;
565  }
566 
567  // Here the box might still be empty (but we haven't detected it yet):
568  // check emptiness of the interval for `var' before cylindrification.
569  ITV& seq_var = seq[var_id];
570  if (seq_var.is_empty()) {
571  set_empty();
572  }
573  else {
574  seq_var.assign(UNIVERSE);
575  }
576 
577  PPL_ASSERT(OK());
578 }
579 
581 template <typename Temp, typename To, typename ITV>
582 inline bool
584  const Box<ITV>& x,
585  const Box<ITV>& y,
586  const Rounding_Dir dir,
587  Temp& tmp0,
588  Temp& tmp1,
589  Temp& tmp2) {
590  return l_m_distance_assign<Rectilinear_Distance_Specialization<Temp> >
591  (r, x, y, dir, tmp0, tmp1, tmp2);
592 }
593 
595 template <typename Temp, typename To, typename ITV>
596 inline bool
598  const Box<ITV>& x,
599  const Box<ITV>& y,
600  const Rounding_Dir dir) {
602  PPL_DIRTY_TEMP(Checked_Temp, tmp0);
603  PPL_DIRTY_TEMP(Checked_Temp, tmp1);
604  PPL_DIRTY_TEMP(Checked_Temp, tmp2);
605  return rectilinear_distance_assign(r, x, y, dir, tmp0, tmp1, tmp2);
606 }
607 
609 template <typename To, typename ITV>
610 inline bool
612  const Box<ITV>& x,
613  const Box<ITV>& y,
614  const Rounding_Dir dir) {
615  // FIXME: the following qualification is only to work around a bug
616  // in the Intel C/C++ compiler version 10.1.x.
617  return Parma_Polyhedra_Library
618  ::rectilinear_distance_assign<To, To, ITV>(r, x, y, dir);
619 }
620 
622 template <typename Temp, typename To, typename ITV>
623 inline bool
625  const Box<ITV>& x,
626  const Box<ITV>& y,
627  const Rounding_Dir dir,
628  Temp& tmp0,
629  Temp& tmp1,
630  Temp& tmp2) {
631  return l_m_distance_assign<Euclidean_Distance_Specialization<Temp> >
632  (r, x, y, dir, tmp0, tmp1, tmp2);
633 }
634 
636 template <typename Temp, typename To, typename ITV>
637 inline bool
639  const Box<ITV>& x,
640  const Box<ITV>& y,
641  const Rounding_Dir dir) {
643  PPL_DIRTY_TEMP(Checked_Temp, tmp0);
644  PPL_DIRTY_TEMP(Checked_Temp, tmp1);
645  PPL_DIRTY_TEMP(Checked_Temp, tmp2);
646  return euclidean_distance_assign(r, x, y, dir, tmp0, tmp1, tmp2);
647 }
648 
650 template <typename To, typename ITV>
651 inline bool
653  const Box<ITV>& x,
654  const Box<ITV>& y,
655  const Rounding_Dir dir) {
656  // FIXME: the following qualification is only to work around a bug
657  // in the Intel C/C++ compiler version 10.1.x.
658  return Parma_Polyhedra_Library
659  ::euclidean_distance_assign<To, To, ITV>(r, x, y, dir);
660 }
661 
663 template <typename Temp, typename To, typename ITV>
664 inline bool
666  const Box<ITV>& x,
667  const Box<ITV>& y,
668  const Rounding_Dir dir,
669  Temp& tmp0,
670  Temp& tmp1,
671  Temp& tmp2) {
672  return l_m_distance_assign<L_Infinity_Distance_Specialization<Temp> >
673  (r, x, y, dir, tmp0, tmp1, tmp2);
674 }
675 
677 template <typename Temp, typename To, typename ITV>
678 inline bool
680  const Box<ITV>& x,
681  const Box<ITV>& y,
682  const Rounding_Dir dir) {
684  PPL_DIRTY_TEMP(Checked_Temp, tmp0);
685  PPL_DIRTY_TEMP(Checked_Temp, tmp1);
686  PPL_DIRTY_TEMP(Checked_Temp, tmp2);
687  return l_infinity_distance_assign(r, x, y, dir, tmp0, tmp1, tmp2);
688 }
689 
691 template <typename To, typename ITV>
692 inline bool
694  const Box<ITV>& x,
695  const Box<ITV>& y,
696  const Rounding_Dir dir) {
697  // FIXME: the following qualification is only to work around a bug
698  // in the Intel C/C++ compiler version 10.1.x.
699  return Parma_Polyhedra_Library
700  ::l_infinity_distance_assign<To, To, ITV>(r, x, y, dir);
701 }
702 
704 template <typename ITV>
705 inline void
707  x.m_swap(y);
708 }
709 
710 } // namespace Parma_Polyhedra_Library
711 
712 #endif // !defined(PPL_Box_inlines_hh)
Congruence_System minimized_congruences() const
Returns a minimized system of congruences approximating *this.
Definition: Box_inlines.hh:393
Enable_If< Is_Native_Or_Checked< To >::value &&Is_Special< From >::value, Result >::type assign_r(To &to, const From &, Rounding_Dir dir)
void m_swap(Box &y)
Swaps *this with y (*this and y can be dimension-incompatible).
Definition: Box_inlines.hh:84
bool operator!=(const Box< ITV > &x, const Box< ITV > &y)
Definition: Box_inlines.hh:264
I_Constraint< T > i_constraint(I_Constraint_Rel rel, const T &v)
The empty element, i.e., the empty set.
dimension_type max_space_dimension()
Returns the maximum space dimension this library can handle.
A linear equality or inequality.
std::vector< ITV > Sequence
The type of sequence used to implement the box.
Definition: Box_defs.hh:1756
void propagate_constraints(const Constraint_System &cs, dimension_type max_iterations=0)
Use the constraints in cs for constraint propagation on *this.
Definition: Box_inlines.hh:538
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
Definition: Box_inlines.hh:123
void swap(CO_Tree &x, CO_Tree &y)
I_Result
The result of an operation on intervals.
bool l_infinity_distance_assign(Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, const Rounding_Dir dir)
Definition: Box_inlines.hh:693
size_t dimension_type
An unsigned integral type for representing space dimensions.
Box(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe or empty box of the specified space dimension.
Status status
The status flags to keep track of the internal state.
Definition: Box_defs.hh:1772
bool euclidean_distance_assign(Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, const Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2)
Definition: Box_inlines.hh:624
void refine_with_constraint(const Constraint &c)
Use the constraint c to refine *this.
Definition: Box_inlines.hh:459
A line, ray, point or closure point.
Rounding_Dir
Rounding directions for arithmetic computations.
Result may be empty or not empty.
bool is_empty() const
Returns true if and only if *this is an empty box.
Definition: Box_inlines.hh:183
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
Box & operator=(const Box &y)
The assignment operator (*this and y can be dimension-incompatible).
Definition: Box_inlines.hh:76
void unconstrain(Variable var)
Computes the cylindrification of *this with respect to space dimension var, assigning the result to *...
Definition: Box_inlines.hh:555
void add_constraints(const Constraint_System &cs)
Adds the constraints in cs to the system of constraints defining *this.
Definition: Box_inlines.hh:331
bool rectilinear_distance_assign(Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, const Rounding_Dir dir)
Definition: Box_inlines.hh:597
void refine_with_constraints(const Constraint_System &cs)
Use the constraints in cs to refine *this.
Definition: Box_inlines.hh:476
dimension_type id() const
Returns the index of the Cartesian axis associated to the variable.
A dimension of the vector space.
const ITV & operator[](dimension_type k) const
Returns a reference the interval that bounds the box on the k-th space dimension. ...
Definition: Box_inlines.hh:143
void widening_assign(const Box &y, unsigned *tp=0)
Same as CC76_widening_assign(y, tp).
Definition: Box_inlines.hh:387
Complexity_Class
Complexity pseudo-classes.
memory_size_type total_memory_in_bytes() const
Returns the total size in bytes of the memory occupied by *this.
Definition: Box_inlines.hh:117
void expand_space_dimension(Variable var, dimension_type m)
Creates m copies of the space dimension corresponding to var.
Definition: Box_inlines.hh:240
void propagate_constraint(const Constraint &c)
Use the constraint c for constraint propagation on *this.
Definition: Box_inlines.hh:522
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
A wrapper for numeric types implementing a given policy.
bool rectilinear_distance_assign(Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, const Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2)
Definition: Box_inlines.hh:583
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
void swap(Box< ITV > &x, Box< ITV > &y)
Definition: Box_inlines.hh:706
bool l_infinity_distance_assign(Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, const Rounding_Dir dir)
Definition: Box_inlines.hh:679
void add_recycled_constraints(Constraint_System &cs)
Adds the constraints in cs to the system of constraints defining *this.
Definition: Box_inlines.hh:342
bool rectilinear_distance_assign(Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, const Rounding_Dir dir)
Definition: Box_inlines.hh:611
Relation_Symbol
Relation symbols.
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
void add_recycled_congruences(Congruence_System &cgs)
Adds to *this constraints equivalent to the congruences in cgs.
Definition: Box_inlines.hh:369
void reset_empty_up_to_date()
Invalidates empty flag of *this.
Definition: Box_inlines.hh:64
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...
void set_nonempty()
Marks *this as definitely not empty.
Definition: Box_inlines.hh:51
bool has_upper_bound(Variable var, Coefficient &n, Coefficient &d, bool &closed) const
If the space dimension of var is unbounded above, return false. Otherwise return true and set n...
Definition: Box_inlines.hh:294
Sequence seq
A sequence of intervals, one for each dimension of the vector space.
Definition: Box_defs.hh:1765
static dimension_type max_space_dimension()
Returns the maximum space dimension that a Box can handle.
Definition: Box_inlines.hh:129
A not necessarily closed, iso-oriented hyperrectangle.
Definition: Box_defs.hh:299
static I_Result refine_interval_no_check(ITV &itv, Constraint::Type type, Coefficient_traits::const_reference numer, Coefficient_traits::const_reference denom)
WRITE ME.
Definition: Box_inlines.hh:401
PPL_COEFFICIENT_TYPE Coefficient
An alias for easily naming the type of PPL coefficients.
int32_t hash_code_from_dimension(dimension_type dim)
Returns the hash code for space dimension dim.
int32_t hash_code() const
Returns a 32-bit hash code for *this.
Definition: Box_inlines.hh:137
static bool can_recycle_constraint_systems()
Returns false indicating that this domain does not recycle constraints.
Definition: Box_inlines.hh:375
bool bounds_from_above(const Linear_Expression &expr) const
Returns true if and only if expr is bounded from above in *this.
Definition: Box_inlines.hh:189
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
#define PPL_DIRTY_TEMP(T, id)
bool minimize(const Linear_Expression &expr, Coefficient &inf_n, Coefficient &inf_d, bool &minimum) const
Returns true if and only if *this is not empty and expr is bounded from below in *this, in which case the infimum value is computed.
Definition: Box_inlines.hh:217
The universe element, i.e., the whole vector space.
bool maximize(const Linear_Expression &expr, Coefficient &sup_n, Coefficient &sup_d, bool &maximum) const
Returns true if and only if *this is not empty and expr is bounded from above in *this, in which case the supremum value is computed.
Definition: Box_inlines.hh:201
bool has_lower_bound(Variable var, Coefficient &n, Coefficient &d, bool &closed) const
If the space dimension of var is unbounded below, return false. Otherwise return true and set n...
Definition: Box_inlines.hh:270
The entire library is confined to this namespace.
Definition: version.hh:61
const ITV & get_interval(Variable var) const
Returns a reference the interval that bounds var.
Definition: Box_inlines.hh:150
void add_congruence(const Congruence &cg)
Adds to *this a constraint equivalent to the congruence cg.
Definition: Box_inlines.hh:348
bool l_infinity_distance_assign(Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, const Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2)
Definition: Box_inlines.hh:665
void set_empty_up_to_date()
Asserts the validity of the empty flag of *this.
Definition: Box_inlines.hh:58
void refine_with_congruences(const Congruence_System &cgs)
Use the congruences in cgs to refine *this.
Definition: Box_inlines.hh:506
static bool can_recycle_congruence_systems()
Returns false indicating that this domain does not recycle congruences.
Definition: Box_inlines.hh:381
bool bounds_from_below(const Linear_Expression &expr) const
Returns true if and only if expr is bounded from below in *this.
Definition: Box_inlines.hh:195
bool strictly_contains(const Box &y) const
Returns true if and only if *this strictly contains y.
Definition: Box_inlines.hh:233
bool euclidean_distance_assign(Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, const Rounding_Dir dir)
Definition: Box_inlines.hh:638
bool euclidean_distance_assign(Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, const Rounding_Dir dir)
Definition: Box_inlines.hh:652
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
Coefficient c
Definition: PIP_Tree.cc:64
bool contains(const Box &y) const
Returns true if and only if *this contains y.
void add_constraint(const Constraint &c)
Adds a copy of constraint c to the system of constraints defining *this.
Definition: Box_inlines.hh:319
void add_congruences(const Congruence_System &cgs)
Adds to *this constraints equivalent to the congruences in cgs.
Definition: Box_inlines.hh:360
void add_interval_constraint_no_check(dimension_type var_id, Constraint::Type type, Coefficient_traits::const_reference numer, Coefficient_traits::const_reference denom)
WRITE ME.
Definition: Box_inlines.hh:442
void set_interval(Variable var, const ITV &i)
Sets to i the interval that bounds var.
Definition: Box_inlines.hh:164
bool marked_empty() const
Returns true if and only if the box is known to be empty.
Definition: Box_inlines.hh:38
void refine_with_congruence(const Congruence &cg)
Use the congruence cg to refine *this.
Definition: Box_inlines.hh:491
void set_empty()
Causes the box to become empty, i.e., to represent the empty set.
Definition: Box_inlines.hh:44