PPL 1.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions | Related Functions | List of all members
Parma_Polyhedra_Library::Box< ITV > Class Template Reference
C++ Language Interface

A not necessarily closed, iso-oriented hyperrectangle. More...

`#include <ppl.hh>`

## Public Types
typedef ITV | interval_type
| The type of intervals used to implement the box.

## Public Member Functions
const ITV & | get_interval (Variable var) const
| Returns a reference the interval that bounds `var`. More...
void | set_interval (Variable var, const ITV &i)
| Sets to `i` the interval that bounds `var`. More...
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`, `d` and `closed` accordingly. More...
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`, `d` and `closed` accordingly. More...
Constraint_System | constraints () const
| Returns a system of constraints defining `*this`.
Constraint_System | minimized_constraints () const
| Returns a minimized system of constraints defining `*this`.
Congruence_System | congruences () const
| Returns a system of congruences approximating `*this`.
Congruence_System | minimized_congruences () const
| Returns a minimized system of congruences approximating `*this`.
memory_size_type | total_memory_in_bytes () const
| Returns the total size in bytes of the memory occupied by `*this`.
memory_size_type | external_memory_in_bytes () const
| Returns the size in bytes of the memory managed by `*this`.
int32_t | hash_code () const
| Returns a 32-bit hash code for `*this`. More...
void | ascii_dump () const
| Writes to `std::cerr` an ASCII representation of `*this`.
void | ascii_dump (std::ostream &s) const
| Writes to `s` an ASCII representation of `*this`.
void | print () const
| Prints `*this` to `std::cerr` using `operator<<`.
void | set_empty ()
| Causes the box to become empty, i.e., to represent the empty set.
Constructors, Assignment, Swap and Destructor
| Box (dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
| Builds a universe or empty box of the specified space dimension. More...
| Box (const Box &y, Complexity_Class complexity=ANY_COMPLEXITY)
| Ordinary copy constructor. More...
template<typename Other_ITV >
| Box (const Box< Other_ITV > &y, Complexity_Class complexity=ANY_COMPLEXITY)
| Builds a conservative, upward approximation of `y`. More...
| Box (const Constraint_System &cs)
| Builds a box from the system of constraints `cs`. More...
| Box (const Constraint_System &cs, Recycle_Input dummy)
| Builds a box recycling a system of constraints `cs`. More...
| Box (const Generator_System &gs)
| Builds a box from the system of generators `gs`. More...
| Box (const Generator_System &gs, Recycle_Input dummy)
| Builds a box recycling the system of generators `gs`. More...
| Box (const Congruence_System &cgs)
| Box (const Congruence_System &cgs, Recycle_Input dummy)
template<typename T >
| Box (const BD_Shape< T > &bds, Complexity_Class complexity=POLYNOMIAL_COMPLEXITY)
| Builds a box containing the BDS `bds`. More...
template<typename T >
| Box (const Octagonal_Shape< T > &oct, Complexity_Class complexity=POLYNOMIAL_COMPLEXITY)
| Builds a box containing the octagonal shape `oct`. More...
| Box (const Polyhedron &ph, Complexity_Class complexity=ANY_COMPLEXITY)
| Builds a box containing the polyhedron `ph`. More...
| Box (const Grid &gr, Complexity_Class complexity=POLYNOMIAL_COMPLEXITY)
| Builds a box containing the grid `gr`. More...
template<typename D1 , typename D2 , typename R >
| Box (const Partially_Reduced_Product< D1, D2, R > &dp, Complexity_Class complexity=ANY_COMPLEXITY)
| Builds a box containing the partially reduced product `dp`. More...
Box & | operator= (const Box &y)
| The assignment operator (`*this` and `y` can be dimension-incompatible).
void | m_swap (Box &y)
| Swaps `*this` with `y` (`*this` and `y` can be dimension-incompatible).
Member Functions that Do Not Modify the Box
dimension_type | space_dimension () const
| Returns the dimension of the vector space enclosing `*this`.
dimension_type | affine_dimension () const
| Returns , if `*this` is empty; otherwise, returns the affine dimension of `*this`.
bool | is_empty () const
| Returns `true` if and only if `*this` is an empty box.
bool | is_universe () const
| Returns `true` if and only if `*this` is a universe box.
bool | is_topologically_closed () const
| Returns `true` if and only if `*this` is a topologically closed subset of the vector space.
bool | is_discrete () const
| Returns `true` if and only if `*this` is discrete.
bool | is_bounded () const
| Returns `true` if and only if `*this` is a bounded box.
bool | contains_integer_point () const
| Returns `true` if and only if `*this` contains at least one integer point.
bool | constrains (Variable var) const
| Returns `true` if and only if `var` is constrained in `*this`. More...
Poly_Con_Relation | relation_with (const Constraint &c) const
| Returns the relations holding between `*this` and the constraint `c`. More...
Poly_Con_Relation | relation_with (const Congruence &cg) const
| Returns the relations holding between `*this` and the congruence `cg`. More...
Poly_Gen_Relation | relation_with (const Generator &g) const
| Returns the relations holding between `*this` and the generator `g`. More...
bool | bounds_from_above (const Linear_Expression &expr) const
| Returns `true` if and only if `expr` is bounded from above in `*this`. More...
bool | bounds_from_below (const Linear_Expression &expr) const
| Returns `true` if and only if `expr` is bounded from below in `*this`. More...
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. More...
bool | maximize (const Linear_Expression &expr, Coefficient &sup_n, Coefficient &sup_d, bool &maximum, Generator &g) 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 and a point where `expr` reaches it are computed. More...
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. More...
bool | minimize (const Linear_Expression &expr, Coefficient &inf_n, Coefficient &inf_d, bool &minimum, Generator &g) 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 and a point where `expr` reaches it are computed. More...
bool | frequency (const Linear_Expression &expr, Coefficient &freq_n, Coefficient &freq_d, Coefficient &val_n, Coefficient &val_d) const
| Returns `true` if and only if there exist a unique value `val` such that `*this` saturates the equality `expr = val`. More...
bool | contains (const Box &y) const
| Returns `true` if and only if `*this` contains `y`. More...
bool | strictly_contains (const Box &y) const
| Returns `true` if and only if `*this` strictly contains `y`. More...
bool | is_disjoint_from (const Box &y) const
| Returns `true` if and only if `*this` and `y` are disjoint. More...
bool | OK () const
| Returns `true` if and only if `*this` satisfies all its invariants.
Space-Dimension Preserving Member Functions that May Modify the Box
void | add_constraint (const Constraint &c)
| Adds a copy of constraint `c` to the system of constraints defining `*this`. More...
void | add_constraints (const Constraint_System &cs)
| Adds the constraints in `cs` to the system of constraints defining `*this`. More...
void | add_recycled_constraints (Constraint_System &cs)
| Adds the constraints in `cs` to the system of constraints defining `*this`. More...
void | add_congruence (const Congruence &cg)
| Adds to `*this` a constraint equivalent to the congruence `cg`. More...
void | add_congruences (const Congruence_System &cgs)
| Adds to `*this` constraints equivalent to the congruences in `cgs`. More...
void | add_recycled_congruences (Congruence_System &cgs)
| Adds to `*this` constraints equivalent to the congruences in `cgs`. More...
void | refine_with_constraint (const Constraint &c)
| Use the constraint `c` to refine `*this`. More...
void | refine_with_constraints (const Constraint_System &cs)
| Use the constraints in `cs` to refine `*this`. More...
void | refine_with_congruence (const Congruence &cg)
| Use the congruence `cg` to refine `*this`. More...
void | refine_with_congruences (const Congruence_System &cgs)
| Use the congruences in `cgs` to refine `*this`. More...
void | propagate_constraint (const Constraint &c)
| Use the constraint `c` for constraint propagation on `*this`. More...
void | propagate_constraints (const Constraint_System &cs, dimension_type max_iterations=0)
| Use the constraints in `cs` for constraint propagation on `*this`. More...
void | unconstrain (Variable var)
| Computes the cylindrification of `*this` with respect to space dimension `var`, assigning the result to `*this`. More...
void | unconstrain (const Variables_Set &vars)
| Computes the cylindrification of `*this` with respect to the set of space dimensions `vars`, assigning the result to `*this`. More...
void | intersection_assign (const Box &y)
| Assigns to `*this` the intersection of `*this` and `y`. More...
void | upper_bound_assign (const Box &y)
| Assigns to `*this` the smallest box containing the union of `*this` and `y`. More...
bool | upper_bound_assign_if_exact (const Box &y)
| If the upper bound of `*this` and `y` is exact, it is assigned to `*this` and `true` is returned, otherwise `false` is returned. More...
void | difference_assign (const Box &y)
| Assigns to `*this` the difference of `*this` and `y`. More...
bool | simplify_using_context_assign (const Box &y)
| Assigns to `*this` a meet-preserving simplification of `*this` with respect to `y`. If `false` is returned, then the intersection is empty. More...
void | affine_image (Variable var, const Linear_Expression &expr, Coefficient_traits::const_reference denominator=Coefficient_one())
| Assigns to `*this` the affine image of `*this` under the function mapping variable `var` to the affine expression specified by `expr` and `denominator`. More...
void | affine_form_image (Variable var, const Linear_Form< ITV > &lf)
| Assigns to `*this` the affine form image of `*this` under the function mapping variable `var` into the affine expression(s) specified by `lf`. More...
void | affine_preimage (Variable var, const Linear_Expression &expr, Coefficient_traits::const_reference denominator=Coefficient_one())
| Assigns to `*this` the affine preimage of `*this` under the function mapping variable `var` to the affine expression specified by `expr` and `denominator`. More...
void | generalized_affine_image (Variable var, Relation_Symbol relsym, const Linear_Expression &expr, Coefficient_traits::const_reference denominator=Coefficient_one())
| Assigns to `*this` the image of `*this` with respect to the generalized affine relation , where is the relation symbol encoded by `relsym`. More...
void | generalized_affine_preimage (Variable var, Relation_Symbol relsym, const Linear_Expression &expr, Coefficient_traits::const_reference denominator=Coefficient_one())
| Assigns to `*this` the preimage of `*this` with respect to the generalized affine relation , where is the relation symbol encoded by `relsym`. More...
void | generalized_affine_image (const Linear_Expression &lhs, Relation_Symbol relsym, const Linear_Expression &rhs)
| Assigns to `*this` the image of `*this` with respect to the generalized affine relation , where is the relation symbol encoded by `relsym`. More...
void | generalized_affine_preimage (const Linear_Expression &lhs, Relation_Symbol relsym, const Linear_Expression &rhs)
| Assigns to `*this` the preimage of `*this` with respect to the generalized affine relation , where is the relation symbol encoded by `relsym`. More...
void | bounded_affine_image (Variable var, const Linear_Expression &lb_expr, const Linear_Expression &ub_expr, Coefficient_traits::const_reference denominator=Coefficient_one())
| Assigns to `*this` the image of `*this` with respect to the bounded affine relation . More...
void | bounded_affine_preimage (Variable var, const Linear_Expression &lb_expr, const Linear_Expression &ub_expr, Coefficient_traits::const_reference denominator=Coefficient_one())
| Assigns to `*this` the preimage of `*this` with respect to the bounded affine relation . More...
void | time_elapse_assign (const Box &y)
| Assigns to `*this` the result of computing the time-elapse between `*this` and `y`. More...
void | topological_closure_assign ()
| Assigns to `*this` its topological closure.
void | wrap_assign (const Variables_Set &vars, Bounded_Integer_Type_Width w, Bounded_Integer_Type_Representation r, Bounded_Integer_Type_Overflow o, const Constraint_System *cs_p=0, unsigned complexity_threshold=16, bool wrap_individually=true)
| Wraps the specified dimensions of the vector space. More...
void | drop_some_non_integer_points (Complexity_Class complexity=ANY_COMPLEXITY)
| Possibly tightens `*this` by dropping some points with non-integer coordinates. More...
void | drop_some_non_integer_points (const Variables_Set &vars, Complexity_Class complexity=ANY_COMPLEXITY)
| Possibly tightens `*this` by dropping some points with non-integer coordinates for the space dimensions corresponding to `vars`. More...
template<typename T >
Enable_If< Is_Same< T, Box >::value &&Is_Same_Or_Derived< Interval_Base, ITV >::value, void >::type | CC76_widening_assign (const T &y, unsigned *tp=0)
| Assigns to `*this` the result of computing the CC76-widening between `*this` and `y`. More...
template<typename T , typename Iterator >
Enable_If< Is_Same< T, Box >::value &&Is_Same_Or_Derived< Interval_Base, ITV >::value, void >::type | CC76_widening_assign (const T &y, Iterator first, Iterator last)
| Assigns to `*this` the result of computing the CC76-widening between `*this` and `y`. More...
void | widening_assign (const Box &y, unsigned *tp=0)
| Same as CC76_widening_assign(y, tp).
void | limited_CC76_extrapolation_assign (const Box &y, const Constraint_System &cs, unsigned *tp=0)
| Improves the result of the CC76-extrapolation computation by also enforcing those constraints in `cs` that are satisfied by all the points of `*this`. More...
template<typename T >
Enable_If< Is_Same< T, Box >::value &&Is_Same_Or_Derived< Interval_Base, ITV >::value, void >::type | CC76_narrowing_assign (const T &y)
| Assigns to `*this` the result of restoring in `y` the constraints of `*this` that were lost by CC76-extrapolation applications. More...
Member Functions that May Modify the Dimension of the Vector Space
void | add_space_dimensions_and_embed (dimension_type m)
| Adds `m` new dimensions and embeds the old box into the new space. More...
void | add_space_dimensions_and_project (dimension_type m)
| Adds `m` new dimensions to the box and does not embed it in the new vector space. More...
void | concatenate_assign (const Box &y)
| Seeing a box as a set of tuples (its points), assigns to `*this` all the tuples that can be obtained by concatenating, in the order given, a tuple of `*this` with a tuple of `y`. More...
void | remove_space_dimensions (const Variables_Set &vars)
| Removes all the specified dimensions. More...
void | remove_higher_space_dimensions (dimension_type new_dimension)
| Removes the higher dimensions so that the resulting space will have dimension `new_dimension`. More...
template<typename Partial_Function >
void | map_space_dimensions (const Partial_Function &pfunc)
| Remaps the dimensions of the vector space according to a partial function. More...
void | expand_space_dimension (Variable var, dimension_type m)
| Creates `m` copies of the space dimension corresponding to `var`. More...
void | fold_space_dimensions (const Variables_Set &vars, Variable dest)
| Folds the space dimensions in `vars` into `dest`. More...

## Static Public Member Functions
static dimension_type | max_space_dimension ()
| Returns the maximum space dimension that a Box can handle.
static bool | can_recycle_constraint_systems ()
| Returns false indicating that this domain does not recycle constraints.
static bool | can_recycle_congruence_systems ()
| Returns false indicating that this domain does not recycle congruences.

## Related Functions
(Note that these are not member functions.)
template<typename ITV >
void | swap (Box< ITV > &x, Box< ITV > &y)
| Swaps `x` with `y`. More...
template<typename ITV >
bool | operator== (const Box< ITV > &x, const Box< ITV > &y)
| Returns `true` if and only if `x` and `y` are the same box. More...
template<typename ITV >
bool | operator!= (const Box< ITV > &x, const Box< ITV > &y)
| Returns `true` if and only if `x` and `y` are not the same box. More...
template<typename ITV >
std::ostream & | operator<< (std::ostream &s, const Box< ITV > &box)
| Output operator. More...
template<typename To , typename ITV >
bool | rectilinear_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, Rounding_Dir dir)
| Computes the rectilinear (or Manhattan) distance between `x` and `y`. More...
template<typename Temp , typename To , typename ITV >
bool | rectilinear_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, Rounding_Dir dir)
| Computes the rectilinear (or Manhattan) distance between `x` and `y`. More...
template<typename Temp , typename To , typename ITV >
bool | rectilinear_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2)
| Computes the rectilinear (or Manhattan) distance between `x` and `y`. More...
template<typename To , typename ITV >
bool | euclidean_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, Rounding_Dir dir)
| Computes the euclidean distance between `x` and `y`. More...
template<typename Temp , typename To , typename ITV >
bool | euclidean_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, Rounding_Dir dir)
| Computes the euclidean distance between `x` and `y`. More...
template<typename Temp , typename To , typename ITV >
bool | euclidean_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2)
| Computes the euclidean distance between `x` and `y`. More...
template<typename To , typename ITV >
bool | l_infinity_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, Rounding_Dir dir)
| Computes the distance between `x` and `y`. More...
template<typename Temp , typename To , typename ITV >
bool | l_infinity_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, Rounding_Dir dir)
| Computes the distance between `x` and `y`. More...
template<typename Temp , typename To , typename ITV >
bool | l_infinity_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2)
| Computes the distance between `x` and `y`. More...
template<typename Temp , typename To , typename ITV >
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)
template<typename Temp , typename To , typename ITV >
bool | rectilinear_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, const Rounding_Dir dir)
template<typename To , typename ITV >
bool | rectilinear_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, const Rounding_Dir dir)
template<typename Temp , typename To , typename ITV >
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)
template<typename Temp , typename To , typename ITV >
bool | euclidean_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, const Rounding_Dir dir)
template<typename To , typename ITV >
bool | euclidean_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, const Rounding_Dir dir)
template<typename Temp , typename To , typename ITV >
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)
template<typename Temp , typename To , typename ITV >
bool | l_infinity_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, const Rounding_Dir dir)
template<typename To , typename ITV >
bool | l_infinity_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const Box< ITV > &x, const Box< ITV > &y, const Rounding_Dir dir)
template<typename ITV >
void | swap (Box< ITV > &x, Box< ITV > &y)
template<typename ITV >
std::ostream & | operator<< (std::ostream &s, const Box< ITV > &box)

## Detailed Description

### template<typename ITV>
class Parma_Polyhedra_Library::Box< ITV >

A not necessarily closed, iso-oriented hyperrectangle.

A Box object represents the smash product of not necessarily closed and possibly unbounded intervals represented by objects of class `ITV`, where is the space dimension of the box.

An interval constraint (resp., interval congruence) is a syntactic constraint (resp., congruence) that only mentions a single space dimension.

The Box domain optimally supports:

- tautological and inconsistent constraints and congruences;
- the interval constraints that are optimally supported by the template argument class `ITV`;
- the interval congruences that are optimally supported by the template argument class `ITV`.

Depending on the method, using a constraint or congruence that is not optimally supported by the domain will either raise an exception or result in a (possibly non-optimal) upward approximation.

The user interface for the Box domain is meant to be as similar as possible to the one developed for the polyhedron class C_Polyhedron.

## Constructor & Destructor Documentation

template<typename ITV >

Parma_Polyhedra_Library::Box< ITV >::Box | ( | dimension_type | num_dimensions = `0`,
|  | Degenerate_Element | kind = `UNIVERSE`
| ) |  |
| inline explicit

Builds a universe or empty box of the specified space dimension.

Parameters

  num_dimensions | The number of dimensions of the vector space enclosing the box;
  kind | Specifies whether the universe or the empty box has to be built.

template<typename ITV >

Parma_Polyhedra_Library::Box< ITV >::Box | ( | const Box< ITV > & | y,
|  | Complexity_Class | complexity = `ANY_COMPLEXITY`
| ) |  |
| inline

Ordinary copy constructor.

The complexity argument is ignored.

template<typename ITV >
template<typename Other_ITV >

Parma_Polyhedra_Library::Box< ITV >::Box | ( | const Box< Other_ITV > & | y,
|  | Complexity_Class | complexity = `ANY_COMPLEXITY`
| ) |  |
| inline explicit

Builds a conservative, upward approximation of `y`.

The complexity argument is ignored.

template<typename ITV >

Parma_Polyhedra_Library::Box< ITV >::Box | ( | const Constraint_System & | cs | ) |
| inline explicit

Builds a box from the system of constraints `cs`.

The box inherits the space dimension of `cs`.

Parameters

  cs | A system of constraints: constraints that are not interval constraints are ignored (even though they may have contributed to the space dimension).

template<typename ITV >

Parma_Polyhedra_Library::Box< ITV >::Box | ( | const Constraint_System & | cs,
|  | Recycle_Input | dummy
| ) |  |
| inline

Builds a box recycling a system of constraints `cs`.

The box inherits the space dimension of `cs`.

Parameters

  cs | A system of constraints: constraints that are not interval constraints are ignored (even though they may have contributed to the space dimension).
  dummy | A dummy tag to syntactically differentiate this one from the other constructors.

template<typename ITV >

Parma_Polyhedra_Library::Box< ITV >::Box | ( | const Generator_System & | gs | ) |
| explicit

Builds a box from the system of generators `gs`.

Builds the smallest box containing the polyhedron defined by `gs`. The box inherits the space dimension of `gs`.

Exceptions

  std::invalid_argument | Thrown if the system of generators is not empty but has no points.

template<typename ITV >

Parma_Polyhedra_Library::Box< ITV >::Box | ( | const Generator_System & | gs,
|  | Recycle_Input | dummy
| ) |  |
| inline

Builds a box recycling the system of generators `gs`.

Builds the smallest box containing the polyhedron defined by `gs`. The box inherits the space dimension of `gs`.

Parameters

  gs | The generator system describing the polyhedron to be approximated.
  dummy | A dummy tag to syntactically differentiate this one from the other constructors.

Exceptions

  std::invalid_argument | Thrown if the system of generators is not empty but has no points.

template<typename ITV >

Parma_Polyhedra_Library::Box< ITV >::Box | ( | const Congruence_System & | cgs | ) |
| inline explicit

Builds the smallest box containing the grid defined by a system of congruences `cgs`. The box inherits the space dimension of `cgs`.

Parameters

  cgs | A system of congruences: congruences that are not non-relational equality constraints are ignored (though they may have contributed to the space dimension).

template<typename ITV >

Parma_Polyhedra_Library::Box< ITV >::Box | ( | const Congruence_System & | cgs,
|  | Recycle_Input | dummy
| ) |  |
| inline

Builds the smallest box containing the grid defined by a system of congruences `cgs`, recycling `cgs`. The box inherits the space dimension of `cgs`.

Parameters

  cgs | A system of congruences: congruences that are not non-relational equality constraints are ignored (though they will contribute to the space dimension).
  dummy | A dummy tag to syntactically differentiate this one from the other constructors.

template<typename ITV >
template<typename T >

Parma_Polyhedra_Library::Box< ITV >::Box | ( | const BD_Shape< T > & | bds,
|  | Complexity_Class | complexity = `POLYNOMIAL_COMPLEXITY`
| ) |  |
| explicit

Builds a box containing the BDS `bds`.

Builds the smallest box containing `bds` using a polynomial algorithm. The `complexity` argument is ignored.

template<typename ITV >
template<typename T >

Parma_Polyhedra_Library::Box< ITV >::Box | ( | const Octagonal_Shape< T > & | oct,
|  | Complexity_Class | complexity = `POLYNOMIAL_COMPLEXITY`
| ) |  |
| explicit

Builds a box containing the octagonal shape `oct`.

Builds the smallest box containing `oct` using a polynomial algorithm. The `complexity` argument is ignored.

template<typename ITV >

Parma_Polyhedra_Library::Box< ITV >::Box | ( | const Polyhedron & | ph,
|  | Complexity_Class | complexity = `ANY_COMPLEXITY`
| ) |  |
| explicit

Builds a box containing the polyhedron `ph`.

Builds a box containing `ph` using algorithms whose complexity does not exceed the one specified by `complexity`. If `complexity` is `ANY_COMPLEXITY`, then the built box is the smallest one containing `ph`.

template<typename ITV >

Parma_Polyhedra_Library::Box< ITV >::Box | ( | const Grid & | gr,
|  | Complexity_Class | complexity = `POLYNOMIAL_COMPLEXITY`
| ) |  |
| explicit

Builds a box containing the grid `gr`.

Builds the smallest box containing `gr` using a polynomial algorithm. The `complexity` argument is ignored.

template<typename ITV >
template<typename D1 , typename D2 , typename R >

Parma_Polyhedra_Library::Box< ITV >::Box | ( | const Partially_Reduced_Product< D1, D2, R > & | dp,
|  | Complexity_Class | complexity = `ANY_COMPLEXITY`
| ) |  |
| explicit

Builds a box containing the partially reduced product `dp`.

Builds a box containing `ph` using algorithms whose complexity does not exceed the one specified by `complexity`.

## Member Function Documentation

template<typename ITV >

bool Parma_Polyhedra_Library::Box< ITV >::constrains | ( | Variable | var | ) | const

Returns `true` if and only if `var` is constrained in `*this`.

Exceptions

  std::invalid_argument | Thrown if `var` is not a space dimension of `*this`.

template<typename ITV >

Poly_Con_Relation Parma_Polyhedra_Library::Box< ITV >::relation_with | ( | const Constraint & | c | ) | const

Returns the relations holding between `*this` and the constraint `c`.

Exceptions

  std::invalid_argument | Thrown if `*this` and constraint `c` are dimension-incompatible.

template<typename ITV >

Poly_Con_Relation Parma_Polyhedra_Library::Box< ITV >::relation_with | ( | const Congruence & | cg | ) | const

Returns the relations holding between `*this` and the congruence `cg`.

Exceptions

  std::invalid_argument | Thrown if `*this` and constraint `cg` are dimension-incompatible.

template<typename ITV >

Poly_Gen_Relation Parma_Polyhedra_Library::Box< ITV >::relation_with | ( | const Generator & | g | ) | const

Returns the relations holding between `*this` and the generator `g`.

Exceptions

  std::invalid_argument | Thrown if `*this` and generator `g` are dimension-incompatible.

template<typename ITV >

bool Parma_Polyhedra_Library::Box< ITV >::bounds_from_above | ( | const Linear_Expression & | expr | ) | const
| inline

Returns `true` if and only if `expr` is bounded from above in `*this`.

Exceptions

  std::invalid_argument | Thrown if `expr` and `*this` are dimension-incompatible.

template<typename ITV >

bool Parma_Polyhedra_Library::Box< ITV >::bounds_from_below | ( | const Linear_Expression & | expr | ) | const
| inline

Returns `true` if and only if `expr` is bounded from below in `*this`.

Exceptions

  std::invalid_argument | Thrown if `expr` and `*this` are dimension-incompatible.

template<typename ITV >

bool Parma_Polyhedra_Library::Box< ITV >::maximize | ( | const Linear_Expression & | expr,
|  | Coefficient & | sup_n,
|  | Coefficient & | sup_d,
|  | bool & | maximum
| ) |  | const
| inline

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.

Parameters

  expr | The linear expression to be maximized subject to `*this`;
  sup_n | The numerator of the supremum value;
  sup_d | The denominator of the supremum value;
  maximum | `true` if and only if the supremum is also the maximum value.

Exceptions

  std::invalid_argument | Thrown if `expr` and `*this` are dimension-incompatible.

If `*this` is empty or `expr` is not bounded from above, `false` is returned and `sup_n`, `sup_d` and `maximum` are left untouched.

template<typename ITV >

bool Parma_Polyhedra_Library::Box< ITV >::maximize | ( | const Linear_Expression & | expr,
|  | Coefficient & | sup_n,
|  | Coefficient & | sup_d,
|  | bool & | maximum,
|  | Generator & | g
| ) |  | const
| inline

Returns `true` if and only if `*this` is not empty and `expr` is bounded from above in `*this`, in which case the supremum value and a point where `expr` reaches it are computed.

Parameters

  expr | The linear expression to be maximized subject to `*this`;
  sup_n | The numerator of the supremum value;
  sup_d | The denominator of the supremum value;
  maximum | `true` if and only if the supremum is also the maximum value;
  g | When maximization succeeds, will be assigned the point or closure point where `expr` reaches its supremum value.

Exceptions

  std::invalid_argument | Thrown if `expr` and `*this` are dimension-incompatible.

If `*this` is empty or `expr` is not bounded from above, `false` is returned and `sup_n`, `sup_d`, `maximum` and `g` are left untouched.

template<typename ITV >

bool Parma_Polyhedra_Library::Box< ITV >::minimize | ( | const Linear_Expression & | expr,
|  | Coefficient & | inf_n,
|  | Coefficient & | inf_d,
|  | bool & | minimum
| ) |  | const
| inline

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.

Parameters

  expr | The linear expression to be minimized subject to `*this`;
  inf_n | The numerator of the infimum value;
  inf_d | The denominator of the infimum value;
  minimum | `true` if and only if the infimum is also the minimum value.

Exceptions

  std::invalid_argument | Thrown if `expr` and `*this` are dimension-incompatible.

If `*this` is empty or `expr` is not bounded from below, `false` is returned and `inf_n`, `inf_d` and `minimum` are left untouched.

template<typename ITV >

bool Parma_Polyhedra_Library::Box< ITV >::minimize | ( | const Linear_Expression & | expr,
|  | Coefficient & | inf_n,
|  | Coefficient & | inf_d,
|  | bool & | minimum,
|  | Generator & | g
| ) |  | const
| inline

Returns `true` if and only if `*this` is not empty and `expr` is bounded from below in `*this`, in which case the infimum value and a point where `expr` reaches it are computed.

Parameters

  expr | The linear expression to be minimized subject to `*this`;
  inf_n | The numerator of the infimum value;
  inf_d | The denominator of the infimum value;
  minimum | `true` if and only if the infimum is also the minimum value;
  g | When minimization succeeds, will be assigned a point or closure point where `expr` reaches its infimum value.

Exceptions

  std::invalid_argument | Thrown if `expr` and `*this` are dimension-incompatible.

If `*this` is empty or `expr` is not bounded from below, `false` is returned and `inf_n`, `inf_d`, `minimum` and `g` are left untouched.

template<typename ITV >

bool Parma_Polyhedra_Library::Box< ITV >::frequency | ( | const Linear_Expression & | expr,
|  | Coefficient & | freq_n,
|  | Coefficient & | freq_d,
|  | Coefficient & | val_n,
|  | Coefficient & | val_d
| ) |  | const

Returns `true` if and only if there exist a unique value `val` such that `*this` saturates the equality `expr = val`.

Parameters

  expr | The linear expression for which the frequency is needed;
  freq_n | If `true` is returned, the value is set to ; Present for interface compatibility with class Grid, where the frequency can have a non-zero value;
  freq_d | If `true` is returned, the value is set to ;
  val_n | The numerator of `val`;
  val_d | The denominator of `val`;

Exceptions

  std::invalid_argument | Thrown if `expr` and `*this` are dimension-incompatible.

If `false` is returned, then `freq_n`, `freq_d`, `val_n` and `val_d` are left untouched.

template<typename ITV >

bool Parma_Polyhedra_Library::Box< ITV >::contains | ( | const Box< ITV > & | y | ) | const

Returns `true` if and only if `*this` contains `y`.

Exceptions

  std::invalid_argument | Thrown if `x` and `y` are dimension-incompatible.

template<typename ITV >

bool Parma_Polyhedra_Library::Box< ITV >::strictly_contains | ( | const Box< ITV > & | y | ) | const
| inline

Returns `true` if and only if `*this` strictly contains `y`.

Exceptions

  std::invalid_argument | Thrown if `x` and `y` are dimension-incompatible.

template<typename ITV >

bool Parma_Polyhedra_Library::Box< ITV >::is_disjoint_from | ( | const Box< ITV > & | y | ) | const

Returns `true` if and only if `*this` and `y` are disjoint.

Exceptions

  std::invalid_argument | Thrown if `x` and `y` are dimension-incompatible.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::add_constraint | ( | const Constraint & | c | ) |
| inline

Adds a copy of constraint `c` to the system of constraints defining `*this`.

Parameters

  c | The constraint to be added.

Exceptions

  std::invalid_argument | Thrown if `*this` and constraint `c` are dimension-incompatible, or `c` is not optimally supported by the Box domain.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::add_constraints | ( | const Constraint_System & | cs | ) |
| inline

Adds the constraints in `cs` to the system of constraints defining `*this`.

Parameters

  cs | The constraints to be added.

Exceptions

  std::invalid_argument | Thrown if `*this` and `cs` are dimension-incompatible, or `cs` contains a constraint which is not optimally supported by the box domain.

template<typename T >

void Parma_Polyhedra_Library::Box< T >::add_recycled_constraints | ( | Constraint_System & | cs | ) |
| inline

Adds the constraints in `cs` to the system of constraints defining `*this`.

Parameters

  cs | The constraints to be added. They may be recycled.

Exceptions

  std::invalid_argument | Thrown if `*this` and `cs` are dimension-incompatible, or `cs` contains a constraint which is not optimally supported by the box domain.

Warning
  The only assumption that can be made on `cs` upon successful or exceptional return is that it can be safely destroyed.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::add_congruence | ( | const Congruence & | cg | ) |
| inline

Adds to `*this` a constraint equivalent to the congruence `cg`.

Parameters

  cg | The congruence to be added.

Exceptions

  std::invalid_argument | Thrown if `*this` and congruence `cg` are dimension-incompatible, or `cg` is not optimally supported by the box domain.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::add_congruences | ( | const Congruence_System & | cgs | ) |
| inline

Adds to `*this` constraints equivalent to the congruences in `cgs`.

Parameters

  cgs | The congruences to be added.

Exceptions

  std::invalid_argument | Thrown if `*this` and `cgs` are dimension-incompatible, or `cgs` contains a congruence which is not optimally supported by the box domain.

template<typename T >

void Parma_Polyhedra_Library::Box< T >::add_recycled_congruences | ( | Congruence_System & | cgs | ) |
| inline

Adds to `*this` constraints equivalent to the congruences in `cgs`.

Parameters

  cgs | The congruence system to be added to `*this`. The congruences in `cgs` may be recycled.

Exceptions

  std::invalid_argument | Thrown if `*this` and `cgs` are dimension-incompatible, or `cgs` contains a congruence which is not optimally supported by the box domain.

Warning
  The only assumption that can be made on `cgs` upon successful or exceptional return is that it can be safely destroyed.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::refine_with_constraint | ( | const Constraint & | c | ) |
| inline

Use the constraint `c` to refine `*this`.

Parameters

  c | The constraint to be used for refinement.

Exceptions

  std::invalid_argument | Thrown if `*this` and `c` are dimension-incompatible.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::refine_with_constraints | ( | const Constraint_System & | cs | ) |
| inline

Use the constraints in `cs` to refine `*this`.

Parameters

  cs | The constraints to be used for refinement. To avoid termination problems, each constraint in `cs` will be used for a single refinement step.

Exceptions

  std::invalid_argument | Thrown if `*this` and `cs` are dimension-incompatible.

Note
  The user is warned that the accuracy of this refinement operator depends on the order of evaluation of the constraints in `cs`, which is in general unpredictable. If a fine control on such an order is needed, the user should consider calling the method `refine_with_constraint(const Constraint& c)` inside an appropriate looping construct.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::refine_with_congruence | ( | const Congruence & | cg | ) |
| inline

Use the congruence `cg` to refine `*this`.

Parameters

  cg | The congruence to be used for refinement.

Exceptions

  std::invalid_argument | Thrown if `*this` and `cg` are dimension-incompatible.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::refine_with_congruences | ( | const Congruence_System & | cgs | ) |
| inline

Use the congruences in `cgs` to refine `*this`.

Parameters

  cgs | The congruences to be used for refinement.

Exceptions

  std::invalid_argument | Thrown if `*this` and `cgs` are dimension-incompatible.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::propagate_constraint | ( | const Constraint & | c | ) |
| inline

Use the constraint `c` for constraint propagation on `*this`.

Parameters

  c | The constraint to be used for constraint propagation.

Exceptions

  std::invalid_argument | Thrown if `*this` and `c` are dimension-incompatible.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::propagate_constraints | ( | const Constraint_System & | cs,
|  | dimension_type | max_iterations = `0`
| ) |  |
| inline

Use the constraints in `cs` for constraint propagation on `*this`.

Parameters

  cs | The constraints to be used for constraint propagation.
  max_iterations | The maximum number of propagation steps for each constraint in `cs`. If zero (the default), the number of propagation steps will be unbounded, possibly resulting in an infinite loop.

Exceptions

  std::invalid_argument | Thrown if `*this` and `cs` are dimension-incompatible.

Warning
  This method may lead to non-termination if `max_iterations` is 0.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::unconstrain | ( | Variable | var | ) |
| inline

Computes the cylindrification of `*this` with respect to space dimension `var`, assigning the result to `*this`.

Parameters

  var | The space dimension that will be unconstrained.

Exceptions

  std::invalid_argument | Thrown if `var` is not a space dimension of `*this`.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::unconstrain | ( | const Variables_Set & | vars | ) |

Computes the cylindrification of `*this` with respect to the set of space dimensions `vars`, assigning the result to `*this`.

Parameters

  vars | The set of space dimension that will be unconstrained.

Exceptions

  std::invalid_argument | Thrown if `*this` is dimension-incompatible with one of the Variable objects contained in `vars`.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::intersection_assign | ( | const Box< ITV > & | y | ) |

Assigns to `*this` the intersection of `*this` and `y`.

Exceptions

  std::invalid_argument | Thrown if `*this` and `y` are dimension-incompatible.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::upper_bound_assign | ( | const Box< ITV > & | y | ) |

Assigns to `*this` the smallest box containing the union of `*this` and `y`.

Exceptions

  std::invalid_argument | Thrown if `*this` and `y` are dimension-incompatible.

template<typename ITV >

bool Parma_Polyhedra_Library::Box< ITV >::upper_bound_assign_if_exact | ( | const Box< ITV > & | y | ) |
| inline

If the upper bound of `*this` and `y` is exact, it is assigned to `*this` and `true` is returned, otherwise `false` is returned.

Exceptions

  std::invalid_argument | Thrown if `*this` and `y` are dimension-incompatible.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::difference_assign | ( | const Box< ITV > & | y | ) |

Assigns to `*this` the difference of `*this` and `y`.

Exceptions

  std::invalid_argument | Thrown if `*this` and `y` are dimension-incompatible.

template<typename ITV >

bool Parma_Polyhedra_Library::Box< ITV >::simplify_using_context_assign | ( | const Box< ITV > & | y | ) |

Assigns to `*this` a meet-preserving simplification of `*this` with respect to `y`. If `false` is returned, then the intersection is empty.

Exceptions

  std::invalid_argument | Thrown if `*this` and `y` are dimension-incompatible.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::affine_image | ( | Variable | var,
|  | const Linear_Expression & | expr,
|  | Coefficient_traits::const_reference | denominator = `Coefficient_one()`
| ) |  |

Assigns to `*this` the affine image of `*this` under the function mapping variable `var` to the affine expression specified by `expr` and `denominator`.

Parameters

  var | The variable to which the affine expression is assigned;
  expr | The numerator of the affine expression;
  denominator | The denominator of the affine expression (optional argument with default value 1).

Exceptions

  std::invalid_argument | Thrown if `denominator` is zero or if `expr` and `*this` are dimension-incompatible or if `var` is not a space dimension of `*this`.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::affine_form_image | ( | Variable | var,
|  | const Linear_Form< ITV > & | lf
| ) |  |

Assigns to `*this` the affine form image of `*this` under the function mapping variable `var` into the affine expression(s) specified by `lf`.

Parameters

  var | The variable to which the affine expression is assigned.
  lf | The linear form on intervals with floating point boundaries that defines the affine expression(s). ALL of its coefficients MUST be bounded.

Exceptions

  std::invalid_argument | Thrown if `lf` and `*this` are dimension-incompatible or if `var` is not a dimension of `*this`.

This function is used in abstract interpretation to model an assignment of a value that is correctly overapproximated by `lf` to the floating point variable represented by `var`.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::affine_preimage | ( | Variable | var,
|  | const Linear_Expression & | expr,
|  | Coefficient_traits::const_reference | denominator = `Coefficient_one()`
| ) |  |

Assigns to `*this` the affine preimage of `*this` under the function mapping variable `var` to the affine expression specified by `expr` and `denominator`.

Parameters

  var | The variable to which the affine expression is substituted;
  expr | The numerator of the affine expression;
  denominator | The denominator of the affine expression (optional argument with default value 1).

Exceptions

  std::invalid_argument | Thrown if `denominator` is zero or if `expr` and `*this` are dimension-incompatible or if `var` is not a space dimension of `*this`.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::generalized_affine_image | ( | Variable | var,
|  | Relation_Symbol | relsym,
|  | const Linear_Expression & | expr,
|  | Coefficient_traits::const_reference | denominator = `Coefficient_one()`
| ) |  |

Assigns to `*this` the image of `*this` with respect to the generalized affine relation , where is the relation symbol encoded by `relsym`.

Parameters

  var | The left hand side variable of the generalized affine relation;
  relsym | The relation symbol;
  expr | The numerator of the right hand side affine expression;
  denominator | The denominator of the right hand side affine expression (optional argument with default value 1).

Exceptions

  std::invalid_argument | Thrown if `denominator` is zero or if `expr` and `*this` are dimension-incompatible or if `var` is not a space dimension of `*this`.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::generalized_affine_preimage | ( | Variable | var,
|  | Relation_Symbol | relsym,
|  | const Linear_Expression & | expr,
|  | Coefficient_traits::const_reference | denominator = `Coefficient_one()`
| ) |  |

Assigns to `*this` the preimage of `*this` with respect to the generalized affine relation , where is the relation symbol encoded by `relsym`.

Parameters

  var | The left hand side variable of the generalized affine relation;
  relsym | The relation symbol;
  expr | The numerator of the right hand side affine expression;
  denominator | The denominator of the right hand side affine expression (optional argument with default value 1).

Exceptions

  std::invalid_argument | Thrown if `denominator` is zero or if `expr` and `*this` are dimension-incompatible or if `var` is not a space dimension of `*this`.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::generalized_affine_image | ( | const Linear_Expression & | lhs,
|  | Relation_Symbol | relsym,
|  | const Linear_Expression & | rhs
| ) |  |

Assigns to `*this` the image of `*this` with respect to the generalized affine relation , where is the relation symbol encoded by `relsym`.

Parameters

  lhs | The left hand side affine expression;
  relsym | The relation symbol;
  rhs | The right hand side affine expression.

Exceptions

  std::invalid_argument | Thrown if `*this` is dimension-incompatible with `lhs` or `rhs`.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::generalized_affine_preimage | ( | const Linear_Expression & | lhs,
|  | Relation_Symbol | relsym,
|  | const Linear_Expression & | rhs
| ) |  |

Assigns to `*this` the preimage of `*this` with respect to the generalized affine relation , where is the relation symbol encoded by `relsym`.

Parameters

  lhs | The left hand side affine expression;
  relsym | The relation symbol;
  rhs | The right hand side affine expression.

Exceptions

  std::invalid_argument | Thrown if `*this` is dimension-incompatible with `lhs` or `rhs`.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::bounded_affine_image | ( | Variable | var,
|  | const Linear_Expression & | lb_expr,
|  | const Linear_Expression & | ub_expr,
|  | Coefficient_traits::const_reference | denominator = `Coefficient_one()`
| ) |  |

Assigns to `*this` the image of `*this` with respect to the bounded affine relation .

Parameters

  var | The variable updated by the affine relation;
  lb_expr | The numerator of the lower bounding affine expression;
  ub_expr | The numerator of the upper bounding affine expression;
  denominator | The (common) denominator for the lower and upper bounding affine expressions (optional argument with default value 1).

Exceptions

  std::invalid_argument | Thrown if `denominator` is zero or if `lb_expr` (resp., `ub_expr`) and `*this` are dimension-incompatible or if `var` is not a space dimension of `*this`.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::bounded_affine_preimage | ( | Variable | var,
|  | const Linear_Expression & | lb_expr,
|  | const Linear_Expression & | ub_expr,
|  | Coefficient_traits::const_reference | denominator = `Coefficient_one()`
| ) |  |

Assigns to `*this` the preimage of `*this` with respect to the bounded affine relation .

Parameters

  var | The variable updated by the affine relation;
  lb_expr | The numerator of the lower bounding affine expression;
  ub_expr | The numerator of the upper bounding affine expression;
  denominator | The (common) denominator for the lower and upper bounding affine expressions (optional argument with default value 1).

Exceptions

  std::invalid_argument | Thrown if `denominator` is zero or if `lb_expr` (resp., `ub_expr`) and `*this` are dimension-incompatible or if `var` is not a space dimension of `*this`.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::time_elapse_assign | ( | const Box< ITV > & | y | ) |

Assigns to `*this` the result of computing the time-elapse between `*this` and `y`.

Exceptions

  std::invalid_argument | Thrown if `*this` and `y` are dimension-incompatible.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::wrap_assign | ( | const Variables_Set & | vars,
|  | Bounded_Integer_Type_Width | w,
|  | Bounded_Integer_Type_Representation | r,
|  | Bounded_Integer_Type_Overflow | o,
|  | const Constraint_System * | cs_p = `0`,
|  | unsigned | complexity_threshold = `16`,
|  | bool | wrap_individually = `true`
| ) |  |

Wraps the specified dimensions of the vector space.

Parameters

  vars | The set of Variable objects corresponding to the space dimensions to be wrapped.
  w | The width of the bounded integer type corresponding to all the dimensions to be wrapped.
  r | The representation of the bounded integer type corresponding to all the dimensions to be wrapped.
  o | The overflow behavior of the bounded integer type corresponding to all the dimensions to be wrapped.
  cs_p | Possibly null pointer to a constraint system. When non-null, the pointed-to constraint system is assumed to represent the conditional or looping construct guard with respect to which wrapping is performed. Since wrapping requires the computation of upper bounds and due to non-distributivity of constraint refinement over upper bounds, passing a constraint system in this way can be more precise than refining the result of the wrapping operation with the constraints in `*cs_p`.
  complexity_threshold | A precision parameter which is ignored for the Box domain.
  wrap_individually | A precision parameter which is ignored for the Box domain.

Exceptions

  std::invalid_argument | Thrown if `*this` is dimension-incompatible with one of the Variable objects contained in `vars` or with `*cs_p`.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::drop_some_non_integer_points | ( | Complexity_Class | complexity = `ANY_COMPLEXITY` | ) |

Possibly tightens `*this` by dropping some points with non-integer coordinates.

Parameters

  complexity | The maximal complexity of any algorithms used.

Note
  Currently there is no optimality guarantee, not even if `complexity` is `ANY_COMPLEXITY`.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::drop_some_non_integer_points | ( | const Variables_Set & | vars,
|  | Complexity_Class | complexity = `ANY_COMPLEXITY`
| ) |  |

Possibly tightens `*this` by dropping some points with non-integer coordinates for the space dimensions corresponding to `vars`.

Parameters

  vars | Points with non-integer coordinates for these variables/space-dimensions can be discarded.
  complexity | The maximal complexity of any algorithms used.

Note
  Currently there is no optimality guarantee, not even if `complexity` is `ANY_COMPLEXITY`.

template<typename ITV >
template<typename T >

Enable_If<Is_Same<T, Box>::value && Is_Same_Or_Derived<Interval_Base, ITV>::value, void>::type Parma_Polyhedra_Library::Box< ITV >::CC76_widening_assign | ( | const T & | y,
|  | unsigned * | tp = `0`
| ) |  |

Assigns to `*this` the result of computing the CC76-widening between `*this` and `y`.

Parameters

  y | A box that must be contained in `*this`.
  tp | An optional pointer to an unsigned variable storing the number of available tokens (to be used when applying the widening with tokens delay technique).

Exceptions

  std::invalid_argument | Thrown if `*this` and `y` are dimension-incompatible.

template<typename ITV >
template<typename T , typename Iterator >

Enable_If<Is_Same<T, Box>::value && Is_Same_Or_Derived<Interval_Base, ITV>::value, void>::type Parma_Polyhedra_Library::Box< ITV >::CC76_widening_assign | ( | const T & | y,
|  | Iterator | first,
|  | Iterator | last
| ) |  |

Assigns to `*this` the result of computing the CC76-widening between `*this` and `y`.

Parameters

  y | A box that must be contained in `*this`.
  first | An iterator that points to the first stop-point.
  last | An iterator that points one past the last stop-point.

Exceptions

  std::invalid_argument | Thrown if `*this` and `y` are dimension-incompatible.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::limited_CC76_extrapolation_assign | ( | const Box< ITV > & | y,
|  | const Constraint_System & | cs,
|  | unsigned * | tp = `0`
| ) |  |

Improves the result of the CC76-extrapolation computation by also enforcing those constraints in `cs` that are satisfied by all the points of `*this`.

Parameters

  y | A box that must be contained in `*this`.
  cs | The system of constraints used to improve the widened box.
  tp | An optional pointer to an unsigned variable storing the number of available tokens (to be used when applying the widening with tokens delay technique).

Exceptions

  std::invalid_argument | Thrown if `*this`, `y` and `cs` are dimension-incompatible or if `cs` contains a strict inequality.

template<typename ITV >
template<typename T >

Enable_If<Is_Same<T, Box>::value && Is_Same_Or_Derived<Interval_Base, ITV>::value, void>::type Parma_Polyhedra_Library::Box< ITV >::CC76_narrowing_assign | ( | const T & | y | ) |

Assigns to `*this` the result of restoring in `y` the constraints of `*this` that were lost by CC76-extrapolation applications.

Parameters

  y | A Box that must contain `*this`.

Exceptions

  std::invalid_argument | Thrown if `*this` and `y` are dimension-incompatible.

Note
  As was the case for widening operators, the argument `y` is meant to denote the value computed in the previous iteration step, whereas `*this` denotes the value computed in the current iteration step (in the decreasing iteration sequence). Hence, the call `x.CC76_narrowing_assign(y)` will assign to `x` the result of the computation .

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::add_space_dimensions_and_embed | ( | dimension_type | m | ) |
| inline

Adds `m` new dimensions and embeds the old box into the new space.

Parameters

  m | The number of dimensions to add.

The new dimensions will be those having the highest indexes in the new box, which is defined by a system of interval constraints in which the variables running through the new dimensions are unconstrained. For instance, when starting from the box and adding a third dimension, the result will be the box

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::add_space_dimensions_and_project | ( | dimension_type | m | ) |
| inline

Adds `m` new dimensions to the box and does not embed it in the new vector space.

Parameters

  m | The number of dimensions to add.

The new dimensions will be those having the highest indexes in the new box, which is defined by a system of bounded differences in which the variables running through the new dimensions are all constrained to be equal to 0. For instance, when starting from the box and adding a third dimension, the result will be the box

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::concatenate_assign | ( | const Box< ITV > & | y | ) |

Seeing a box as a set of tuples (its points), assigns to `*this` all the tuples that can be obtained by concatenating, in the order given, a tuple of `*this` with a tuple of `y`.

Let and be the boxes corresponding, on entry, to `*this` and `y`, respectively. Upon successful completion, `*this` will represent the box such that

Another way of seeing it is as follows: first increases the space dimension of `*this` by adding `y.space_dimension()` new dimensions; then adds to the system of constraints of `*this` a renamed-apart version of the constraints of `y`.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::remove_space_dimensions | ( | const Variables_Set & | vars | ) |
| inline

Removes all the specified dimensions.

Parameters

  vars | The set of Variable objects corresponding to the dimensions to be removed.

Exceptions

  std::invalid_argument | Thrown if `*this` is dimension-incompatible with one of the Variable objects contained in `vars`.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::remove_higher_space_dimensions | ( | dimension_type | new_dimension | ) |

Removes the higher dimensions so that the resulting space will have dimension `new_dimension`.

Exceptions

  std::invalid_argument | Thrown if `new_dimension` is greater than the space dimension of `*this`.

template<typename ITV >
template<typename Partial_Function >

void Parma_Polyhedra_Library::Box< ITV >::map_space_dimensions | ( | const Partial_Function & | pfunc | ) |

Remaps the dimensions of the vector space according to a partial function.

Parameters

  pfunc | The partial function specifying the destiny of each dimension.

The template type parameter Partial_Function must provide the following methods.

bool has_empty_codomain() const

returns `true` if and only if the represented partial function has an empty co-domain (i.e., it is always undefined). The `has_empty_codomain()` method will always be called before the methods below. However, if `has_empty_codomain()` returns `true`, none of the functions below will be called.

dimension_type max_in_codomain() const

returns the maximum value that belongs to the co-domain of the partial function.

bool maps(dimension_type i, dimension_type& j) const

Let be the represented function and be the value of `i`. If is defined in , then is assigned to `j` and `true` is returned. If is undefined in , then `false` is returned.

The result is undefined if `pfunc` does not encode a partial function with the properties described in the specification of the mapping operator.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::expand_space_dimension | ( | Variable | var,
|  | dimension_type | m
| ) |  |
| inline

Creates `m` copies of the space dimension corresponding to `var`.

Parameters

  var | The variable corresponding to the space dimension to be replicated;
  m | The number of replicas to be created.

Exceptions

  std::invalid_argument | Thrown if `var` does not correspond to a dimension of the vector space.
  std::length_error | Thrown if adding `m` new space dimensions would cause the vector space to exceed dimension `max_space_dimension()`.

If `*this` has space dimension , with , and `var` has space dimension , then the -th space dimension is expanded to `m` new space dimensions , , , .

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::fold_space_dimensions | ( | const Variables_Set & | vars,
|  | Variable | dest
| ) |  |

Folds the space dimensions in `vars` into `dest`.

Parameters

  vars | The set of Variable objects corresponding to the space dimensions to be folded;
  dest | The variable corresponding to the space dimension that is the destination of the folding operation.

Exceptions

  std::invalid_argument | Thrown if `*this` is dimension-incompatible with `dest` or with one of the Variable objects contained in `vars`. Also thrown if `dest` is contained in `vars`.

If `*this` has space dimension , with , `dest` has space dimension , `vars` is a set of variables whose maximum space dimension is also less than or equal to , and `dest` is not a member of `vars`, then the space dimensions corresponding to variables in `vars` are folded into the -th space dimension.

template<typename ITV >

const ITV & Parma_Polyhedra_Library::Box< ITV >::get_interval | ( | Variable | var | ) | const
| inline

Returns a reference the interval that bounds `var`.

Exceptions

  std::invalid_argument | Thrown if `var` is not a space dimension of `*this`.

template<typename ITV >

void Parma_Polyhedra_Library::Box< ITV >::set_interval | ( | Variable | var,
|  | const ITV & | i
| ) |  |
| inline

Sets to `i` the interval that bounds `var`.

Exceptions

  std::invalid_argument | Thrown if `var` is not a space dimension of `*this`.

template<typename ITV >

bool Parma_Polyhedra_Library::Box< ITV >::has_lower_bound | ( | Variable | var,
|  | Coefficient & | n,
|  | Coefficient & | d,
|  | bool & | closed
| ) |  | const
| inline

If the space dimension of `var` is unbounded below, return `false`. Otherwise return `true` and set `n`, `d` and `closed` accordingly.

Note
  It is assumed that `*this` is a non-empty box having space dimension greater than or equal to that of `var`. An undefined behavior is obtained if this assumption is not met.

Let be the interval corresponding to variable `var` in the non-empty box `*this`. If is not bounded from below, simply return `false` (leaving all other parameters unchanged). Otherwise, set `n`, `d` and `closed` as follows:

- `n` and `d` are assigned the integers and such that the fraction corresponds to the greatest lower bound of . The fraction is in canonical form, meaning that and have no common factors, is positive, and if is zero then is one;
- `closed` is set to `true` if and only if the lower boundary of is closed (i.e., it is included in the interval).

template<typename ITV >

bool Parma_Polyhedra_Library::Box< ITV >::has_upper_bound | ( | Variable | var,
|  | Coefficient & | n,
|  | Coefficient & | d,
|  | bool & | closed
| ) |  | const
| inline

If the space dimension of `var` is unbounded above, return `false`. Otherwise return `true` and set `n`, `d` and `closed` accordingly.

Note
  It is assumed that `*this` is a non-empty box having space dimension greater than or equal to that of `var`. An undefined behavior is obtained if this assumption is not met.

Let be the interval corresponding to variable `var` in the non-empty box `*this`. If is not bounded from above, simply return `false` (leaving all other parameters unchanged). Otherwise, set `n`, `d` and `closed` as follows:

- `n` and `d` are assigned the integers and such that the fraction corresponds to the least upper bound of . The fraction is in canonical form, meaning that and have no common factors, is positive, and if is zero then is one;
- `closed` is set to `true` if and only if the upper boundary of is closed (i.e., it is included in the interval).

template<typename ITV >

int32_t Parma_Polyhedra_Library::Box< ITV >::hash_code | ( |  | ) | const
| inline

Returns a 32-bit hash code for `*this`.

If `x` and `y` are such that `x == y`, then `x.hash_code() == y.hash_code()`.

## Friends And Related Function Documentation

template<typename ITV >

void swap | ( | Box< ITV > & | x,
|  | Box< ITV > & | y
| ) |  |
| related

Swaps `x` with `y`.

template<typename ITV >

bool operator== | ( | const Box< ITV > & | x,
|  | const Box< ITV > & | y
| ) |  |
| related

Returns `true` if and only if `x` and `y` are the same box.

Note that `x` and `y` may be dimension-incompatible boxes: in this case, the value `false` is returned.

template<typename ITV >

bool operator!= | ( | const Box< ITV > & | x,
|  | const Box< ITV > & | y
| ) |  |
| related

Returns `true` if and only if `x` and `y` are not the same box.

Note that `x` and `y` may be dimension-incompatible boxes: in this case, the value `true` is returned.

template<typename ITV >

std::ostream & operator<< | ( | std::ostream & | s,
|  | const Box< ITV > & | box
| ) |  |
| related

Output operator.

template<typename To , typename ITV >

bool rectilinear_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r,
|  | const Box< ITV > & | x,
|  | const Box< ITV > & | y,
|  | Rounding_Dir | dir
| ) |  |
| related

Computes the rectilinear (or Manhattan) distance between `x` and `y`.

If the rectilinear distance between `x` and `y` is defined, stores an approximation of it into `r` and returns `true`; returns `false` otherwise.

The direction of the approximation is specified by `dir`.

All computations are performed using variables of type `Checked_Number<To, Extended_Number_Policy>`.

template<typename Temp , typename To , typename ITV >

bool rectilinear_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r,
|  | const Box< ITV > & | x,
|  | const Box< ITV > & | y,
|  | Rounding_Dir | dir
| ) |  |
| related

Computes the rectilinear (or Manhattan) distance between `x` and `y`.

If the rectilinear distance between `x` and `y` is defined, stores an approximation of it into `r` and returns `true`; returns `false` otherwise.

The direction of the approximation is specified by `dir`.

All computations are performed using variables of type `Checked_Number<Temp, Extended_Number_Policy>`.

template<typename Temp , typename To , typename ITV >

bool rectilinear_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r,
|  | const Box< ITV > & | x,
|  | const Box< ITV > & | y,
|  | Rounding_Dir | dir,
|  | Temp & | tmp0,
|  | Temp & | tmp1,
|  | Temp & | tmp2
| ) |  |
| related

Computes the rectilinear (or Manhattan) distance between `x` and `y`.

If the rectilinear distance between `x` and `y` is defined, stores an approximation of it into `r` and returns `true`; returns `false` otherwise.

The direction of the approximation is specified by `dir`.

All computations are performed using the temporary variables `tmp0`, `tmp1` and `tmp2`.

template<typename To , typename ITV >

bool euclidean_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r,
|  | const Box< ITV > & | x,
|  | const Box< ITV > & | y,
|  | Rounding_Dir | dir
| ) |  |
| related

Computes the euclidean distance between `x` and `y`.

If the euclidean distance between `x` and `y` is defined, stores an approximation of it into `r` and returns `true`; returns `false` otherwise.

The direction of the approximation is specified by `dir`.

All computations are performed using variables of type `Checked_Number<To, Extended_Number_Policy>`.

template<typename Temp , typename To , typename ITV >

bool euclidean_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r,
|  | const Box< ITV > & | x,
|  | const Box< ITV > & | y,
|  | Rounding_Dir | dir
| ) |  |
| related

Computes the euclidean distance between `x` and `y`.

If the euclidean distance between `x` and `y` is defined, stores an approximation of it into `r` and returns `true`; returns `false` otherwise.

The direction of the approximation is specified by `dir`.

All computations are performed using variables of type `Checked_Number<Temp, Extended_Number_Policy>`.

template<typename Temp , typename To , typename ITV >

bool euclidean_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r,
|  | const Box< ITV > & | x,
|  | const Box< ITV > & | y,
|  | Rounding_Dir | dir,
|  | Temp & | tmp0,
|  | Temp & | tmp1,
|  | Temp & | tmp2
| ) |  |
| related

Computes the euclidean distance between `x` and `y`.

If the euclidean distance between `x` and `y` is defined, stores an approximation of it into `r` and returns `true`; returns `false` otherwise.

The direction of the approximation is specified by `dir`.

All computations are performed using the temporary variables `tmp0`, `tmp1` and `tmp2`.

template<typename To , typename ITV >

bool l_infinity_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r,
|  | const Box< ITV > & | x,
|  | const Box< ITV > & | y,
|  | Rounding_Dir | dir
| ) |  |
| related

Computes the distance between `x` and `y`.

If the distance between `x` and `y` is defined, stores an approximation of it into `r` and returns `true`; returns `false` otherwise.

The direction of the approximation is specified by `dir`.

All computations are performed using variables of type `Checked_Number<To, Extended_Number_Policy>`.

template<typename Temp , typename To , typename ITV >

bool l_infinity_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r,
|  | const Box< ITV > & | x,
|  | const Box< ITV > & | y,
|  | Rounding_Dir | dir
| ) |  |
| related

Computes the distance between `x` and `y`.

If the distance between `x` and `y` is defined, stores an approximation of it into `r` and returns `true`; returns `false` otherwise.

The direction of the approximation is specified by `dir`.

All computations are performed using variables of type `Checked_Number<Temp, Extended_Number_Policy>`.

template<typename Temp , typename To , typename ITV >

bool l_infinity_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r,
|  | const Box< ITV > & | x,
|  | const Box< ITV > & | y,
|  | Rounding_Dir | dir,
|  | Temp & | tmp0,
|  | Temp & | tmp1,
|  | Temp & | tmp2
| ) |  |
| related

Computes the distance between `x` and `y`.

If the distance between `x` and `y` is defined, stores an approximation of it into `r` and returns `true`; returns `false` otherwise.

The direction of the approximation is specified by `dir`.

All computations are performed using the temporary variables `tmp0`, `tmp1` and `tmp2`.

template<typename Temp , typename To , typename ITV >

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
| ) |  |
| related

template<typename Temp , typename To , typename ITV >

bool rectilinear_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r,
|  | const Box< ITV > & | x,
|  | const Box< ITV > & | y,
|  | const Rounding_Dir | dir
| ) |  |
| related

template<typename To , typename ITV >

bool rectilinear_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r,
|  | const Box< ITV > & | x,
|  | const Box< ITV > & | y,
|  | const Rounding_Dir | dir
| ) |  |
| related

template<typename Temp , typename To , typename ITV >

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
| ) |  |
| related

template<typename Temp , typename To , typename ITV >

bool euclidean_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r,
|  | const Box< ITV > & | x,
|  | const Box< ITV > & | y,
|  | const Rounding_Dir | dir
| ) |  |
| related

template<typename To , typename ITV >

bool euclidean_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r,
|  | const Box< ITV > & | x,
|  | const Box< ITV > & | y,
|  | const Rounding_Dir | dir
| ) |  |
| related

template<typename Temp , typename To , typename ITV >

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
| ) |  |
| related

template<typename Temp , typename To , typename ITV >

bool l_infinity_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r,
|  | const Box< ITV > & | x,
|  | const Box< ITV > & | y,
|  | const Rounding_Dir | dir
| ) |  |
| related

template<typename To , typename ITV >

bool l_infinity_distance_assign | ( | Checked_Number< To, Extended_Number_Policy > & | r,
|  | const Box< ITV > & | x,
|  | const Box< ITV > & | y,
|  | const Rounding_Dir | dir
| ) |  |
| related

template<typename ITV >

void swap | ( | Box< ITV > & | x,
|  | Box< ITV > & | y
| ) |  |
| related

template<typename ITV >

std::ostream & operator<< | ( | std::ostream & | s,
|  | const Box< ITV > & | box
| ) |  |
| related

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

- ppl.hh