24 #ifndef PPL_BD_Shape_defs_hh
25 #define PPL_BD_Shape_defs_hh 1
58 namespace IO_Operators {
70 operator<<(std::ostream& s, const BD_Shape<T>& bds);
106 template <
typename To,
typename T>
123 template <
typename Temp,
typename To,
typename T>
140 template <
typename Temp,
typename To,
typename T>
160 template <
typename To,
typename T>
177 template <
typename Temp,
typename To,
typename T>
194 template <
typename Temp,
typename To,
typename T>
214 template <
typename To,
typename T>
231 template <
typename Temp,
typename To,
typename T>
248 template <
typename Temp,
typename To,
typename T>
261 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
293 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
301 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
304 #endif // defined(PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS)
305 void compute_leader_indices(
const std::vector<dimension_type>& predecessor,
306 std::vector<dimension_type>& indices);
411 template <
typename T>
472 template <
typename U>
538 template <
typename Interval>
577 template <
typename U>
1043 template <
typename Interval_Info>
1076 template <
typename Interval_Info>
1112 template <
typename U>
1224 Coefficient_traits::const_reference denominator
1244 template <
typename Interval_Info>
1269 Coefficient_traits::const_reference denominator
1299 Coefficient_traits::const_reference denominator
1352 Coefficient_traits::const_reference
1407 Coefficient_traits::const_reference denominator
1439 Coefficient_traits::const_reference denominator
1501 unsigned complexity_threshold = 16,
1502 bool wrap_individually =
true);
1578 template <
typename Iterator>
1580 Iterator first, Iterator last,
1828 template <
typename Partial_Function>
1884 template <
typename Interval_Info>
1916 template <
typename Temp,
typename To,
typename U>
1917 friend bool Parma_Polyhedra_Library
1921 Temp& tmp0, Temp& tmp1, Temp& tmp2);
1922 template <
typename Temp,
typename To,
typename U>
1923 friend bool Parma_Polyhedra_Library
1927 Temp& tmp0, Temp& tmp1, Temp& tmp2);
1928 template <
typename Temp,
typename To,
typename U>
1929 friend bool Parma_Polyhedra_Library
1933 Temp& tmp0, Temp& tmp1, Temp& tmp2);
1942 #define PPL_IN_BD_Shape_CLASS
1943 #include "BDS_Status_idefs.hh"
1944 #undef PPL_IN_BD_Shape_CLASS
2146 template <
bool integer_upper_bound>
2180 Coefficient_traits::const_reference numer,
2181 Coefficient_traits::const_reference denom);
2191 Coefficient_traits::const_reference denominator
2217 Coefficient_traits::const_reference sc_denom,
2224 template <
typename Interval_Info>
2232 template <
typename Interval_Info>
2244 template <
typename Interval_Info>
2254 template <
typename Interval_Info>
2265 template <
typename Interval_Info>
2277 template <
typename Interval_Info>
2283 template <
typename Interval_Info>
2307 Coefficient_traits::const_reference sc_denom,
2308 const N& minus_lb_v);
2331 friend std::ostream&
2332 Parma_Polyhedra_Library::IO_Operators
2353 const char* le_name,
2356 template<
typename Interval_Info>
2359 const char* lf_name,
2374 #endif // !defined(PPL_BD_Shape_defs_hh)
bool marked_empty() const
Returns true if the BDS is known to be empty.
void BHMZ05_widening_assign(const BD_Shape &y, unsigned *tp=0)
Assigns to *this the result of computing the BHMZ05-widening of *this and y.
void limited_CC76_extrapolation_assign(const BD_Shape &y, const Constraint_System &cs, unsigned *tp=0)
Improves the result of the CC76-extrapolation computation by also enforcing those constraints in cs t...
void deduce_u_minus_v_bounds(dimension_type v, dimension_type last_v, const Linear_Expression &sc_expr, Coefficient_traits::const_reference sc_denom, const N &minus_lb_v)
An helper function for the computation of affine relations.
bool operator!=(const Box< ITV > &x, const Box< ITV > &y)
static bool can_recycle_congruence_systems()
Returns false indicating that this domain cannot recycle congruences.
A linear equality or inequality.
void unconstrain(Variable var)
Computes the cylindrification of *this with respect to space dimension var, assigning the result to *...
void left_inhomogeneous_refine(const dimension_type &right_t, const dimension_type &right_w_id, const Linear_Form< Interval< T, Interval_Info > > &left, const Linear_Form< Interval< T, Interval_Info > > &right)
Auxiliary function for refine with linear form that handle the general case: .
void swap(CO_Tree &x, CO_Tree &y)
void refine_with_constraint(const Constraint &c)
Uses a copy of constraint c to refine the system of bounded differences defining *this.
size_t dimension_type
An unsigned integral type for representing space dimensions.
An std::set of variables' indexes.
void fold_space_dimensions(const Variables_Set &vars, Variable dest)
Folds the space dimensions in vars into dest.
memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
void upper_bound_assign(const BD_Shape &y)
Assigns to *this the smallest BDS containing the union of *this and y.
bool max_min(const Linear_Expression &expr, bool maximize, Coefficient &ext_n, Coefficient &ext_d, bool &included, Generator &g) const
Maximizes or minimizes expr subject to *this.
bool is_disjoint_from(const BD_Shape &y) const
Returns true if and only if *this and y are disjoint.
void widening_assign(const BD_Shape &y, unsigned *tp=0)
Same as H79_widening_assign(y, tp).
A line, ray, point or closure point.
void map_space_dimensions(const Partial_Function &pfunc)
Remaps the dimensions of the vector space according to a partial function.
bool is_shortest_path_reduced() const
Returns true if and only if this->dbm is shortest-path closed and this->redundancy_dbm correctly flag...
Rounding_Dir
Rounding directions for arithmetic computations.
BD_Shape(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds a universe or empty BDS of the specified space dimension.
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 . ...
void concatenate_assign(const BD_Shape &y)
Assigns to *this the concatenation of *this and y, taken in this order.
Checked_Number< T, Debug_WRD_Extended_Number_Policy > N
The (extended) numeric type of the inhomogeneous term of the inequalities defining a BDS...
void refine_with_constraints(const Constraint_System &cs)
Uses a copy of the constraints in cs to refine the system of bounded differences defining *this...
void get_limiting_shape(const Constraint_System &cs, BD_Shape &limiting_shape) const
Adds to limiting_shape the bounded differences in cs that are satisfied by *this. ...
void drop_some_non_integer_points(Complexity_Class complexity=ANY_COMPLEXITY)
Possibly tightens *this by dropping some points with non-integer coordinates.
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 into the affine ex...
void m_swap(BD_Shape &y)
Swaps *this with y (*this and y can be dimension-incompatible).
void throw_dimension_incompatible(const char *method, const BD_Shape &y) const
A conjunctive assertion about a BD_Shape object.
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.
T coefficient_type_base
The numeric base type upon which bounded differences are built.
bool BFT00_upper_bound_assign_if_exact(const BD_Shape &y)
If the upper bound of *this and y is exact it is assigned to *this and true is returned, otherwise false is returned.
void CC76_extrapolation_assign(const BD_Shape &y, unsigned *tp=0)
Assigns to *this the result of computing the CC76-extrapolation between *this and y...
BD_Shape & operator=(const BD_Shape &y)
The assignment operator (*this and y can be dimension-incompatible).
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 into the affine...
void affine_form_image(Variable var, const Linear_Form< Interval< T, Interval_Info > > &lf)
Assigns to *this the affine form image of *this under the function mapping variable var into the affi...
void add_constraint(const Constraint &c)
Adds a copy of constraint c to the system of bounded differences defining *this.
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 affine relation , where is the relation symb...
bool strictly_contains(const BD_Shape &y) const
Returns true if and only if *this strictly contains y.
bool marked_shortest_path_closed() const
Returns true if the system of bounded differences is known to be shortest-path closed.
void set_zero_dim_univ()
Turns *this into an zero-dimensional universe BDS.
void inhomogeneous_affine_form_image(const dimension_type &var_id, const Interval< T, Interval_Info > &b)
Auxiliary function for affine form image that handle the general case: .
bool marked_shortest_path_reduced() const
Returns true if the system of bounded differences is known to be shortest-path reduced.
void compute_predecessors(std::vector< dimension_type > &predecessor) const
Compute the (zero-equivalence classes) predecessor relation.
void add_space_dimensions_and_embed(dimension_type m)
Adds m new dimensions and embeds the old BDS into the new space.
bool is_empty() const
Returns true if and only if *this is an empty BDS.
void refine_no_check(const Constraint &c)
Uses the constraint c to refine *this.
void left_one_var_refine(const dimension_type &left_w_id, const dimension_type &right_t, const dimension_type &right_w_id, const Linear_Form< Interval< T, Interval_Info > > &left, const Linear_Form< Interval< T, Interval_Info > > &right)
Auxiliary function for refine with linear form that handle the general case: .
A dimension of the vector space.
Bounded_Integer_Type_Overflow
void shortest_path_closure_assign() const
Assigns to this->dbm its shortest-path closure.
bool bounds(const Linear_Expression &expr, bool from_above) const
Checks if and how expr is bounded in *this.
bool upper_bound_assign_if_exact(const BD_Shape &y)
If the upper bound of *this and y is exact, it is assigned to *this and true is returned, otherwise false is returned.
Complexity_Class
Complexity pseudo-classes.
The base class for convex polyhedra.
void refine_with_congruence(const Congruence &cg)
Uses a copy of congruence cg to refine the system of bounded differences of *this.
static dimension_type max_space_dimension()
Returns the maximum space dimension that a BDS can handle.
A wrapper for numeric types implementing a given policy.
#define PPL_OUTPUT_DECLARATIONS
void time_elapse_assign(const BD_Shape &y)
Assigns to *this the result of computing the time-elapse between *this and y.
bool is_universe() const
Returns true if and only if *this is a universe BDS.
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 ...
void linear_form_upper_bound(const Linear_Form< Interval< T, Interval_Info > > &lf, N &result) const
bool bounds_from_above(const Linear_Expression &expr) const
Returns true if and only if expr is bounded from above in *this.
bool constrains(Variable var) const
Returns true if and only if var is constrained in *this.
void reset_shortest_path_closed()
Marks *this as possibly not shortest-path closed.
int32_t hash_code() const
Returns a 32-bit hash code for *this.
Relation_Symbol
Relation symbols.
Degenerate_Element
Kinds of degenerate abstract elements.
void add_dbm_constraint(dimension_type i, dimension_type j, const N &k)
Adds the constraint dbm[i][j] <= k.
void two_variables_affine_form_image(const dimension_type &var_id, const Linear_Form< Interval< T, Interval_Info > > &lf, const dimension_type &space_dim)
Auxiliary function for affine form image that handle the general case: .
static bool can_recycle_constraint_systems()
Returns false indicating that this domain cannot recycle constraints.
void add_recycled_constraints(Constraint_System &cs)
Adds the constraints in cs to the system of constraints of *this.
bool simplify_using_context_assign(const BD_Shape &y)
Assigns to *this a meet-preserving simplification of *this with respect to y. If false is returned...
bool bounds_from_below(const Linear_Expression &expr) const
Returns true if and only if expr is bounded from below in *this.
Bounded_Integer_Type_Width
static void throw_invalid_argument(const char *method, const char *reason)
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 affine relation , where is the relation s...
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 exp...
void export_interval_constraints(U &dest) const
Applies to dest the interval constraints embedded in *this.
bool is_bounded() const
Returns true if and only if *this is a bounded BDS.
Constraint_System constraints() const
Returns a system of constraints defining *this.
void difference_assign(const BD_Shape &y)
Assigns to *this the smallest BD shape containing the set difference of *this and y...
void intersection_assign(const BD_Shape &y)
Assigns to *this the intersection of *this and y.
memory_size_type total_memory_in_bytes() const
Returns the total size in bytes of the memory occupied by *this.
Congruence_System minimized_congruences() const
Returns a minimal system of (equality) congruences satisfied by *this with the same affine dimension ...
A not necessarily closed, iso-oriented hyperrectangle.
bool ascii_load(std::istream &s)
Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this ...
void refine(Variable var, Relation_Symbol relsym, const Linear_Expression &expr, Coefficient_traits::const_reference denominator=Coefficient_one())
Adds to the BDS the constraint .
bool marked_zero_dim_univ() const
Returns true if the BDS is the zero-dimensional universe.
PPL_COEFFICIENT_TYPE Coefficient
An alias for easily naming the type of PPL coefficients.
void deduce_v_minus_u_bounds(dimension_type v, dimension_type last_v, const Linear_Expression &sc_expr, Coefficient_traits::const_reference sc_denom, const N &ub_v)
An helper function for the computation of affine relations.
N coefficient_type
The (extended) numeric type of the inhomogeneous term of the inequalities defining a BDS...
void remove_space_dimensions(const Variables_Set &vars)
Removes all the specified dimensions.
The universe element, i.e., the whole vector space.
A generic, not necessarily closed, possibly restricted interval.
Constraint_System minimized_constraints() const
Returns a minimized system of constraints defining *this.
void add_recycled_congruences(Congruence_System &cgs)
Adds to *this constraints equivalent to the congruences in cgs.
bool OK() const
Returns true if and only if *this satisfies all its invariants.
void forget_binary_dbm_constraints(dimension_type v)
Removes all binary constraints on row/column v.
void one_variable_affine_form_image(const dimension_type &var_id, const Interval< T, Interval_Info > &b, const Interval< T, Interval_Info > &w_coeff, const dimension_type &w_id, const dimension_type &space_dim)
Auxiliary function for affine formimage" that handle the general case: .
void set_shortest_path_closed()
Marks *this as shortest-path closed.
void refine_with_congruences(const Congruence_System &cgs)
Uses a copy of the congruences in cgs to refine the system of bounded differences defining *this...
The entire library is confined to this namespace.
bool contains(const BD_Shape &y) const
Returns true if and only if *this contains y.
void add_constraints(const Constraint_System &cs)
Adds the constraints in cs to the system of bounded differences defining *this.
bool integer_upper_bound_assign_if_exact(const BD_Shape &y)
If the integer upper bound of *this and y is exact, it is assigned to *this and true is returned; oth...
Poly_Con_Relation relation_with(const Constraint &c) const
Returns the relations holding between *this and the constraint c.
void incremental_shortest_path_closure_assign(Variable var) const
Incrementally computes shortest-path closure, assuming that only constraints affecting variable var n...
void general_refine(const dimension_type &left_w_id, const dimension_type &right_w_id, const Linear_Form< Interval< T, Interval_Info > > &left, const Linear_Form< Interval< T, Interval_Info > > &right)
Auxiliary function for refine with linear form that handle the general case.
A bounded difference shape.
bool is_discrete() const
Returns true if and only if *this is discrete.
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
bool BHZ09_upper_bound_assign_if_exact(const BD_Shape &y)
If the upper bound of *this and y is exact it is assigned to *this and true is returned, otherwise false is returned.
void compute_leaders(std::vector< dimension_type > &leaders) const
Compute the leaders of zero-equivalence classes.
void refine_with_linear_form_inequality(const Linear_Form< Interval< T, Interval_Info > > &left, const Linear_Form< Interval< T, Interval_Info > > &right)
Refines the system of BD_Shape constraints defining *this using the constraint expressed by left rig...
Bit_Matrix redundancy_dbm
A matrix indicating which constraints are redundant.
bool operator==(const Box< ITV > &x, const Box< ITV > &y)
void forget_all_dbm_constraints(dimension_type v)
Removes all the constraints on row/column v.
void refine_fp_interval_abstract_store(Box< Interval< T, Interval_Info > > &store) const
Refines store with the constraints defining *this.
void drop_some_non_integer_points_helper(N &elem)
Congruence_System congruences() const
Returns a system of (equality) congruences satisfied by *this.
bool contains_integer_point() const
Returns true if and only if *this contains at least one integer point.
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.
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.
void limited_H79_extrapolation_assign(const BD_Shape &y, const Constraint_System &cs, unsigned *tp=0)
Improves the result of the H79-widening computation by also enforcing those constraints in cs that ar...
void remove_higher_space_dimensions(dimension_type new_dimension)
Removes the higher dimensions so that the resulting space will have dimension new_dimension.
static void throw_expression_too_complex(const char *method, const Linear_Expression &le)
static bool extract_bounded_difference(const Constraint &c, dimension_type &c_num_vars, dimension_type &c_first_var, dimension_type &c_second_var, Coefficient &c_coeff)
Decodes the constraint c as a bounded difference.
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
void generalized_refine_with_linear_form_inequality(const Linear_Form< Interval< T, Interval_Info > > &left, const Linear_Form< Interval< T, Interval_Info > > &right, Relation_Symbol relsym)
Refines the system of BD_Shape constraints defining *this using the constraint expressed by left rig...
void reset_shortest_path_reduced()
Marks *this as possibly not shortest-path reduced.
void topological_closure_assign()
Assigns to *this its topological closure.
Status status
The status flags to keep track of the internal state.
void set_empty()
Turns *this into an empty BDS.
void CC76_narrowing_assign(const BD_Shape &y)
Assigns to *this the result of restoring in y the constraints of *this that were lost by CC76-extrapo...
Coefficient_traits::const_reference Coefficient_one()
Returns a const reference to a Coefficient with value 1.
void add_congruence(const Congruence &cg)
Adds a copy of congruence cg to the system of congruences of *this.
void expand_space_dimension(Variable var, dimension_type m)
Creates m copies of the space dimension corresponding to var.
dimension_type affine_dimension() const
Returns , if *this is empty; otherwise, returns the affine dimension of *this.
The base class for the square matrices.
void shortest_path_reduction_assign() const
Assigns to this->dbm its shortest-path closure and records into this->redundancy_dbm which of the ent...
void add_congruences(const Congruence_System &cgs)
Adds to *this constraints equivalent to the congruences in cgs.
void H79_widening_assign(const BD_Shape &y, unsigned *tp=0)
Assigns to *this the result of computing the H79-widening between *this and y.
void add_space_dimensions_and_project(dimension_type m)
Adds m new dimensions to the BDS and does not embed it in the new vector space.
void limited_BHMZ05_extrapolation_assign(const BD_Shape &y, const Constraint_System &cs, unsigned *tp=0)
Improves the result of the BHMZ05-widening computation by also enforcing those constraints in cs that...
bool le(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
The relation between a polyhedron and a generator.
Bounded_Integer_Type_Representation
DB_Matrix< N > dbm
The matrix representing the system of bounded differences.
void set_shortest_path_reduced()
Marks *this as shortest-path closed.
The relation between a polyhedron and a constraint.
bool is_topologically_closed() const
Returns true if and only if *this is a topologically closed subset of the vector space.