PPL  1.2
Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R > Class Template Reference

The partially reduced product of two abstractions. More...

#include <Partially_Reduced_Product_defs.hh>

Public Member Functions

 Partially_Reduced_Product (dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
 Builds an object having the specified properties. More...
 
 Partially_Reduced_Product (const Congruence_System &cgs)
 Builds a pair, copying a system of congruences. More...
 
 Partially_Reduced_Product (Congruence_System &cgs)
 Builds a pair, recycling a system of congruences. More...
 
 Partially_Reduced_Product (const Constraint_System &cs)
 Builds a pair, copying a system of constraints. More...
 
 Partially_Reduced_Product (Constraint_System &cs)
 Builds a pair, recycling a system of constraints. More...
 
 Partially_Reduced_Product (const C_Polyhedron &ph, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a product, from a C polyhedron. More...
 
 Partially_Reduced_Product (const NNC_Polyhedron &ph, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a product, from an NNC polyhedron. More...
 
 Partially_Reduced_Product (const Grid &gr, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a product, from a grid. More...
 
template<typename Interval >
 Partially_Reduced_Product (const Box< Interval > &box, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a product out of a box. More...
 
template<typename U >
 Partially_Reduced_Product (const BD_Shape< U > &bd, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a product out of a BD shape. More...
 
template<typename U >
 Partially_Reduced_Product (const Octagonal_Shape< U > &os, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a product out of an octagonal shape. More...
 
 Partially_Reduced_Product (const Partially_Reduced_Product &y, Complexity_Class complexity=ANY_COMPLEXITY)
 Ordinary copy constructor. More...
 
template<typename E1 , typename E2 , typename S >
 Partially_Reduced_Product (const Partially_Reduced_Product< E1, E2, S > &y, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a conservative, upward approximation of y. More...
 
Partially_Reduced_Productoperator= (const Partially_Reduced_Product &y)
 The assignment operator. (*this and y can be dimension-incompatible.) More...
 
bool reduce () const
 Reduce. More...
 
Member Functions that Do Not Modify the Partially_Reduced_Product
dimension_type space_dimension () const
 Returns the dimension of the vector space enclosing *this. More...
 
dimension_type affine_dimension () const
 Returns the minimum affine dimension (see also grid affine dimension) of the components of *this. More...
 
const D1 & domain1 () const
 Returns a constant reference to the first of the pair. More...
 
const D2 & domain2 () const
 Returns a constant reference to the second of the pair. More...
 
Constraint_System constraints () const
 Returns a system of constraints which approximates *this. More...
 
Constraint_System minimized_constraints () const
 Returns a system of constraints which approximates *this, in reduced form. More...
 
Congruence_System congruences () const
 Returns a system of congruences which approximates *this. More...
 
Congruence_System minimized_congruences () const
 Returns a system of congruences which approximates *this, in reduced form. More...
 
Poly_Con_Relation relation_with (const Constraint &c) const
 Returns the relations holding between *this and c. More...
 
Poly_Con_Relation relation_with (const Congruence &cg) const
 Returns the relations holding between *this and cg. More...
 
Poly_Gen_Relation relation_with (const Generator &g) const
 Returns the relations holding between *this and g. More...
 
bool is_empty () const
 Returns true if and only if either of the components of *this are empty. More...
 
bool is_universe () const
 Returns true if and only if both of the components of *this are the universe. More...
 
bool is_topologically_closed () const
 Returns true if and only if both of the components of *this are topologically closed subsets of the vector space. More...
 
bool is_disjoint_from (const Partially_Reduced_Product &y) const
 Returns true if and only if *this and y are componentwise disjoint. More...
 
bool is_discrete () const
 Returns true if and only if a component of *this is discrete. More...
 
bool is_bounded () const
 Returns true if and only if a component of *this is bounded. More...
 
bool constrains (Variable var) const
 Returns true if and only if var is constrained in *this. More...
 
bool bounds_from_above (const Linear_Expression &expr) const
 Returns true if and only if expr is bounded in *this. More...
 
bool bounds_from_below (const Linear_Expression &expr) const
 Returns true if and only if expr is bounded 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 i *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 contains (const Partially_Reduced_Product &y) const
 Returns true if and only if each component of *this contains the corresponding component of y. More...
 
bool strictly_contains (const Partially_Reduced_Product &y) const
 Returns true if and only if each component of *this strictly contains the corresponding component of y. More...
 
bool OK () const
 Checks if all the invariants are satisfied. More...
 
Space Dimension Preserving Member Functions that May Modify the Partially_Reduced_Product
void add_constraint (const Constraint &c)
 Adds constraint c to *this. More...
 
void refine_with_constraint (const Constraint &c)
 Use the constraint c to refine *this. More...
 
void add_congruence (const Congruence &cg)
 Adds a copy of congruence cg to *this. More...
 
void refine_with_congruence (const Congruence &cg)
 Use the congruence cg to refine *this. More...
 
void add_congruences (const Congruence_System &cgs)
 Adds a copy of the congruences in cgs to *this. More...
 
void refine_with_congruences (const Congruence_System &cgs)
 Use the congruences in cgs to refine *this. More...
 
void add_recycled_congruences (Congruence_System &cgs)
 Adds the congruences in cgs to *this. More...
 
void add_constraints (const Constraint_System &cs)
 Adds a copy of the constraint system in cs to *this. More...
 
void refine_with_constraints (const Constraint_System &cs)
 Use the constraints in cs to refine *this. More...
 
void add_recycled_constraints (Constraint_System &cs)
 Adds the constraint system in cs to *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 Partially_Reduced_Product &y)
 Assigns to *this the componentwise intersection of *this and y. More...
 
void upper_bound_assign (const Partially_Reduced_Product &y)
 Assigns to *this an upper bound of *this and y computed on the corresponding components. More...
 
bool upper_bound_assign_if_exact (const Partially_Reduced_Product &y)
 Assigns to *this an upper bound of *this and y computed on the corresponding components. If it is exact on each of the components of *this, true is returned, otherwise false is returned. More...
 
void difference_assign (const Partially_Reduced_Product &y)
 Assigns to *this an approximation of the set-theoretic difference of *this and y. 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_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 $\mathrm{var}' \relsym \frac{\mathrm{expr}}{\mathrm{denominator}}$, where $\mathord{\relsym}$ is the relation symbol encoded by relsym (see also generalized affine relation.) 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 $\mathrm{var}' \relsym \frac{\mathrm{expr}}{\mathrm{denominator}}$, where $\mathord{\relsym}$ is the relation symbol encoded by relsym. (see also generalized affine relation.) 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 $\mathrm{lhs}' \relsym \mathrm{rhs}$, where $\mathord{\relsym}$ is the relation symbol encoded by relsym. (see also generalized affine relation.) 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 $\mathrm{lhs}' \relsym \mathrm{rhs}$, where $\mathord{\relsym}$ is the relation symbol encoded by relsym. (see also generalized affine relation.) 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 $\frac{\mathrm{lb\_expr}}{\mathrm{denominator}} \leq \mathrm{var}' \leq \frac{\mathrm{ub\_expr}}{\mathrm{denominator}}$. 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 $\frac{\mathrm{lb\_expr}}{\mathrm{denominator}} \leq \mathrm{var}' \leq \frac{\mathrm{ub\_expr}}{\mathrm{denominator}}$. More...
 
void time_elapse_assign (const Partially_Reduced_Product &y)
 Assigns to *this the result of computing the time-elapse between *this and y. (See also time-elapse.) More...
 
void topological_closure_assign ()
 Assigns to *this its topological closure. More...
 
void widening_assign (const Partially_Reduced_Product &y, unsigned *tp=NULL)
 Assigns to *this the result of computing the "widening" between *this and y. 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...
 
Member Functions that May Modify the Dimension of the Vector Space
void add_space_dimensions_and_embed (dimension_type m)
 Adds m new space dimensions and embeds the components of *this in the new vector space. More...
 
void add_space_dimensions_and_project (dimension_type m)
 Adds m new space dimensions and does not embed the components in the new vector space. More...
 
void concatenate_assign (const Partially_Reduced_Product &y)
 Assigns to the first (resp., second) component of *this the "concatenation" of the first (resp., second) components of *this and y, taken in this order. See also Concatenating Polyhedra. More...
 
void remove_space_dimensions (const Variables_Set &vars)
 Removes all the specified dimensions from the vector space. More...
 
void remove_higher_space_dimensions (dimension_type new_dimension)
 Removes the higher dimensions of the vector space 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...
 
Miscellaneous Member Functions
 ~Partially_Reduced_Product ()
 Destructor. More...
 
void m_swap (Partially_Reduced_Product &y)
 Swaps *this with product y. (*this and y can be dimension-incompatible.) More...
 
void ascii_dump () const
 Writes to std::cerr an ASCII representation of *this. More...
 
void ascii_dump (std::ostream &s) const
 Writes to s an ASCII representation of *this. More...
 
void print () const
 Prints *this to std::cerr using operator<<. More...
 
bool ascii_load (std::istream &s)
 Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this accordingly. Returns true if successful, false otherwise. More...
 
memory_size_type total_memory_in_bytes () const
 Returns the total size in bytes of the memory occupied by *this. More...
 
memory_size_type external_memory_in_bytes () const
 Returns the size in bytes of the memory managed by *this. More...
 
int32_t hash_code () const
 Returns a 32-bit hash code for *this. More...
 

Static Public Member Functions

static dimension_type max_space_dimension ()
 Returns the maximum space dimension this product can handle. More...
 

Protected Types

typedef D1 Domain1
 The type of the first component. More...
 
typedef D2 Domain2
 The type of the second component. More...
 

Protected Member Functions

void clear_reduced_flag () const
 Clears the reduced flag. More...
 
void set_reduced_flag () const
 Sets the reduced flag. More...
 
bool is_reduced () const
 Return true if and only if the reduced flag is set. More...
 

Protected Attributes

D1 d1
 The first component. More...
 
D2 d2
 The second component. More...
 
bool reduced
 Flag to record whether the components are reduced with respect to each other and the reduction class. More...
 

Private Member Functions

void throw_space_dimension_overflow (const char *method, const char *reason)
 

Friends

bool operator== (const Partially_Reduced_Product< D1, D2, R > &x, const Partially_Reduced_Product< D1, D2, R > &y)
 
std::ostream & Parma_Polyhedra_Library::IO_Operators::operator<< (std::ostream &s, const Partially_Reduced_Product< D1, D2, R > &dp)
 

Related Functions

(Note that these are not member functions.)

template<typename D1 , typename D2 , typename R >
std::ostream & operator<< (std::ostream &s, const Partially_Reduced_Product< D1, D2, R > &dp)
 Output operator. More...
 
template<typename D1 , typename D2 , typename R >
void swap (Partially_Reduced_Product< D1, D2, R > &x, Partially_Reduced_Product< D1, D2, R > &y)
 Swaps x with y. More...
 
template<typename D1 , typename D2 , typename R >
bool operator== (const Partially_Reduced_Product< D1, D2, R > &x, const Partially_Reduced_Product< D1, D2, R > &y)
 Returns true if and only if the components of x and y are pairwise equal. More...
 
template<typename D1 , typename D2 , typename R >
bool operator!= (const Partially_Reduced_Product< D1, D2, R > &x, const Partially_Reduced_Product< D1, D2, R > &y)
 Returns true if and only if the components of x and y are not pairwise equal. More...
 
template<typename D1 , typename D2 , typename R >
bool operator== (const Partially_Reduced_Product< D1, D2, R > &x, const Partially_Reduced_Product< D1, D2, R > &y)
 
template<typename D1 , typename D2 , typename R >
bool operator!= (const Partially_Reduced_Product< D1, D2, R > &x, const Partially_Reduced_Product< D1, D2, R > &y)
 
template<typename D1 , typename D2 , typename R >
std::ostream & operator<< (std::ostream &s, const Partially_Reduced_Product< D1, D2, R > &dp)
 
template<typename D1 , typename D2 , typename R >
void swap (Partially_Reduced_Product< D1, D2, R > &x, Partially_Reduced_Product< D1, D2, R > &y)
 

Detailed Description

template<typename D1, typename D2, typename R>
class Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >

The partially reduced product of two abstractions.

Warning
At present, the supported instantiations for the two domain templates D1 and D2 are the simple pointset domains: C_Polyhedron, NNC_Polyhedron, Grid, Octagonal_Shape<T>, BD_Shape<T>, Box<T>.

An object of the class Partially_Reduced_Product<D1, D2, R> represents the (partially reduced) product of two pointset domains D1 and D2 where the form of any reduction is defined by the reduction class R.

Suppose $D_1$ and $D_2$ are two abstract domains with concretization functions: $\fund{\gamma_1}{D_1}{\Rset^n}$ and $\fund{\gamma_2}{D_2}{\Rset^n}$, respectively.

The partially reduced product $D = D_1 \times D_2$, for any reduction class R, has a concretization $\fund{\gamma}{D}{\Rset^n}$ where, if $d = (d_1, d_2) \in D$

\[ \gamma(d) = \gamma_1(d_1) \inters \gamma_2(d_2). \]

The operations are defined to be the result of applying the corresponding operations on each of the components provided the product is already reduced by the reduction method defined by R. In particular, if R is the No_Reduction<D1, D2> class, then the class Partially_Reduced_Product<D1, D2, R> domain is the direct product as defined in [CC79].

How the results on the components are interpreted and combined depend on the specific test. For example, the test for emptiness will first make sure the product is reduced (using the reduction method provided by R if it is not already known to be reduced) and then test if either component is empty; thus, if R defines no reduction between its components and $d = (G, P) \in (\Gset \times \Pset)$ is a direct product in one dimension where $G$ denotes the set of numbers that are integral multiples of 3 while $P$ denotes the set of numbers between 1 and 2, then an operation that tests for emptiness should return false. However, the test for the universe returns true if and only if the test is_universe() on both components returns true.

In all the examples it is assumed that the template R is the No_Reduction<D1, D2> class and that variables x and y are defined (where they are used) as follows:
Variable x(0);
Variable y(1);
Example 1
The following code builds a direct product of a Grid and NNC Polyhedron, corresponding to the positive even integer pairs in $\Rset^2$, given as a system of congruences:
Congruence_System cgs;
cgs.insert((x %= 0) / 2);
cgs.insert((y %= 0) / 2);
Partially_Reduced_Product<Grid, NNC_Polyhedron, No_Reduction<D1, D2> >
dp(cgs);
dp.add_constraint(x >= 0);
dp.add_constraint(y >= 0);
Example 2
The following code builds the same product in $\Rset^2$:
Partially_Reduced_Product<Grid, NNC_Polyhedron, No_Reduction<D1, D2> > dp(2);
dp.add_constraint(x >= 0);
dp.add_constraint(y >= 0);
dp.add_congruence((x %= 0) / 2);
dp.add_congruence((y %= 0) / 2);
Example 3
The following code will write "dp is empty":
Partially_Reduced_Product<Grid, NNC_Polyhedron, No_Reduction<D1, D2> > dp(1);
dp.add_congruence((x %= 0) / 2);
dp.add_congruence((x %= 1) / 2);
if (dp.is_empty())
cout << "dp is empty." << endl;
else
cout << "dp is not empty." << endl;
Example 4
The following code will write "dp is not empty":
Partially_Reduced_Product<Grid, NNC_Polyhedron, No_Reduction<D1, D2> > dp(1);
dp.add_congruence((x %= 0) / 2);
dp.add_constraint(x >= 1);
dp.add_constraint(x <= 1);
if (dp.is_empty())
cout << "dp is empty." << endl;
else
cout << "dp is not empty." << endl;

Definition at line 418 of file Partially_Reduced_Product_defs.hh.

Member Typedef Documentation

template<typename D1, typename D2, typename R>
typedef D1 Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::Domain1
protected

The type of the first component.

Definition at line 1623 of file Partially_Reduced_Product_defs.hh.

template<typename D1, typename D2, typename R>
typedef D2 Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::Domain2
protected

The type of the second component.

Definition at line 1626 of file Partially_Reduced_Product_defs.hh.

Constructor & Destructor Documentation

template<typename D1 , typename D2 , typename R >
Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::Partially_Reduced_Product ( dimension_type  num_dimensions = 0,
Degenerate_Element  kind = UNIVERSE 
)
inlineexplicit

Builds an object having the specified properties.

Parameters
num_dimensionsThe number of dimensions of the vector space enclosing the pair;
kindSpecifies whether a universe or an empty pair has to be built.
Exceptions
std::length_errorThrown if num_dimensions exceeds the maximum allowed space dimension.

Definition at line 46 of file Partially_Reduced_Product_inlines.hh.

48  : d1(num_dimensions <= max_space_dimension()
49  ? num_dimensions
50  : (throw_space_dimension_overflow("Partially_Reduced_Product(n, k)",
51  "n exceeds the maximum "
52  "allowed space dimension"),
53  num_dimensions),
54  kind),
55  d2(num_dimensions, kind) {
57 }
static dimension_type max_space_dimension()
Returns the maximum space dimension this product can handle.
void throw_space_dimension_overflow(const char *method, const char *reason)
template<typename D1 , typename D2 , typename R >
Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::Partially_Reduced_Product ( const Congruence_System cgs)
inlineexplicit

Builds a pair, copying a system of congruences.

The pair inherits the space dimension of the congruence system.

Parameters
cgsThe system of congruences to be approximated by the pair.
Exceptions
std::length_errorThrown if num_dimensions exceeds the maximum allowed space dimension.

Definition at line 62 of file Partially_Reduced_Product_inlines.hh.

template<typename D1 , typename D2 , typename R >
Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::Partially_Reduced_Product ( Congruence_System cgs)
inlineexplicit

Builds a pair, recycling a system of congruences.

The pair inherits the space dimension of the congruence system.

Parameters
cgsThe system of congruences to be approximates by the pair. Its data-structures may be recycled to build the pair.
Exceptions
std::length_errorThrown if num_dimensions exceeds the maximum allowed space dimension.

Definition at line 70 of file Partially_Reduced_Product_inlines.hh.

71  : d1(const_cast<const Congruence_System&>(cgs)), d2(cgs) {
73 }
template<typename D1 , typename D2 , typename R >
Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::Partially_Reduced_Product ( const Constraint_System cs)
inlineexplicit

Builds a pair, copying a system of constraints.

The pair inherits the space dimension of the constraint system.

Parameters
csThe system of constraints to be approximated by the pair.
Exceptions
std::length_errorThrown if num_dimensions exceeds the maximum allowed space dimension.

Definition at line 78 of file Partially_Reduced_Product_inlines.hh.

template<typename D1 , typename D2 , typename R >
Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::Partially_Reduced_Product ( Constraint_System cs)
inlineexplicit

Builds a pair, recycling a system of constraints.

The pair inherits the space dimension of the constraint system.

Parameters
csThe system of constraints to be approximated by the pair.
Exceptions
std::length_errorThrown if the space dimension of cs exceeds the maximum allowed space dimension.

Definition at line 86 of file Partially_Reduced_Product_inlines.hh.

87  : d1(const_cast<const Constraint_System&>(cs)), d2(cs) {
89 }
template<typename D1 , typename D2 , typename R >
Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::Partially_Reduced_Product ( const C_Polyhedron ph,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
inlineexplicit

Builds a product, from a C polyhedron.

Builds a product containing ph using algorithms whose complexity does not exceed the one specified by complexity. If complexity is ANY_COMPLEXITY, then the built product is the smallest one containing ph. The product inherits the space dimension of the polyhedron.

Parameters
phThe polyhedron to be approximated by the product.
complexityThe complexity that will not be exceeded.
Exceptions
std::length_errorThrown if the space dimension of ph exceeds the maximum allowed space dimension.

Definition at line 94 of file Partially_Reduced_Product_inlines.hh.

template<typename D1 , typename D2 , typename R >
Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::Partially_Reduced_Product ( const NNC_Polyhedron ph,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
inlineexplicit

Builds a product, from an NNC polyhedron.

Builds a product containing ph using algorithms whose complexity does not exceed the one specified by complexity. If complexity is ANY_COMPLEXITY, then the built product is the smallest one containing ph. The product inherits the space dimension of the polyhedron.

Parameters
phThe polyhedron to be approximated by the product.
complexityThe complexity that will not be exceeded.
Exceptions
std::length_errorThrown if the space dimension of ph exceeds the maximum allowed space dimension.

Definition at line 103 of file Partially_Reduced_Product_inlines.hh.

105  : d1(ph, complexity), d2(ph, complexity) {
107 }
template<typename D1 , typename D2 , typename R >
Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::Partially_Reduced_Product ( const Grid gr,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
inlineexplicit

Builds a product, from a grid.

Builds a product containing gr. The product inherits the space dimension of the grid.

Parameters
grThe grid to be approximated by the product.
complexityThe complexity is ignored.
Exceptions
std::length_errorThrown if the space dimension of gr exceeds the maximum allowed space dimension.

Definition at line 112 of file Partially_Reduced_Product_inlines.hh.

template<typename D1 , typename D2 , typename R >
template<typename Interval >
Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::Partially_Reduced_Product ( const Box< Interval > &  box,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
inline

Builds a product out of a box.

Builds a product containing box. The product inherits the space dimension of the box.

Parameters
boxThe box representing the pair to be built.
complexityThe complexity is ignored.
Exceptions
std::length_errorThrown if the space dimension of box exceeds the maximum allowed space dimension.

Definition at line 121 of file Partially_Reduced_Product_inlines.hh.

template<typename D1 , typename D2 , typename R >
template<typename U >
Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::Partially_Reduced_Product ( const BD_Shape< U > &  bd,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
inline

Builds a product out of a BD shape.

Builds a product containing bd. The product inherits the space dimension of the BD shape.

Parameters
bdThe BD shape representing the product to be built.
complexityThe complexity is ignored.
Exceptions
std::length_errorThrown if the space dimension of bd exceeds the maximum allowed space dimension.

Definition at line 130 of file Partially_Reduced_Product_inlines.hh.

template<typename D1 , typename D2 , typename R >
template<typename U >
Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::Partially_Reduced_Product ( const Octagonal_Shape< U > &  os,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
inline

Builds a product out of an octagonal shape.

Builds a product containing os. The product inherits the space dimension of the octagonal shape.

Parameters
osThe octagonal shape representing the product to be built.
complexityThe complexity is ignored.
Exceptions
std::length_errorThrown if the space dimension of os exceeds the maximum allowed space dimension.

Definition at line 139 of file Partially_Reduced_Product_inlines.hh.

template<typename D1 , typename D2 , typename R >
Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::Partially_Reduced_Product ( const Partially_Reduced_Product< D1, D2, R > &  y,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
inline

Ordinary copy constructor.

Definition at line 147 of file Partially_Reduced_Product_inlines.hh.

References Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::reduced.

149  : d1(y.d1), d2(y.d2) {
150  reduced = y.reduced;
151 }
bool reduced
Flag to record whether the components are reduced with respect to each other and the reduction class...
template<typename D1 , typename D2 , typename R >
template<typename E1 , typename E2 , typename S >
Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::Partially_Reduced_Product ( const Partially_Reduced_Product< E1, E2, S > &  y,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
inlineexplicit

Builds a conservative, upward approximation of y.

The complexity argument is ignored.

Definition at line 157 of file Partially_Reduced_Product_inlines.hh.

References Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::domain1(), Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::domain2(), and Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::intersection_assign().

159  : d1(y.space_dimension()), d2(y.space_dimension()), reduced(false) {
160  Partially_Reduced_Product<D1, D2, R> pg1(y.domain1(), complexity);
161  Partially_Reduced_Product<D1, D2, R> pg2(y.domain2(), complexity);
162  pg1.intersection_assign(pg2);
163  m_swap(pg1);
164 }
void m_swap(Partially_Reduced_Product &y)
Swaps *this with product y. (*this and y can be dimension-incompatible.)
bool reduced
Flag to record whether the components are reduced with respect to each other and the reduction class...
template<typename D1 , typename D2 , typename R >
Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::~Partially_Reduced_Product ( )
inline

Destructor.

Definition at line 168 of file Partially_Reduced_Product_inlines.hh.

168  {
169 }

Member Function Documentation

template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::add_congruence ( const Congruence cg)
inline

Adds a copy of congruence cg to *this.

Exceptions
std::invalid_argumentThrown if *this and congruence cg are dimension-incompatible.

Definition at line 404 of file Partially_Reduced_Product_inlines.hh.

404  {
405  d1.add_congruence(cg);
406  d2.add_congruence(cg);
408 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::add_congruences ( const Congruence_System cgs)
inline

Adds a copy of the congruences in cgs to *this.

Parameters
cgsThe congruence system to be added.
Exceptions
std::invalid_argumentThrown if *this and cgs are dimension-incompatible.

Definition at line 439 of file Partially_Reduced_Product_inlines.hh.

439  {
440  d1.add_congruences(cgs);
441  d2.add_congruences(cgs);
443 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::add_constraint ( const Constraint c)
inline

Adds constraint c to *this.

Exceptions
std::invalid_argumentThrown if *this and c are dimension-incompatible.

Definition at line 388 of file Partially_Reduced_Product_inlines.hh.

388  {
389  d1.add_constraint(c);
390  d2.add_constraint(c);
392 }
Coefficient c
Definition: PIP_Tree.cc:64
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::add_constraints ( const Constraint_System cs)
inline

Adds a copy of the constraint system in cs to *this.

Parameters
csThe constraint system to be added.
Exceptions
std::invalid_argumentThrown if *this and cs are dimension-incompatible.

Definition at line 421 of file Partially_Reduced_Product_inlines.hh.

421  {
422  d1.add_constraints(cs);
423  d2.add_constraints(cs);
425 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::add_recycled_congruences ( Congruence_System cgs)

Adds the congruences in cgs to *this.

Parameters
cgsThe congruence system to be added that may be recycled.
Exceptions
std::invalid_argumentThrown if *this and cs are dimension-incompatible.
Warning
The only assumption that can be made about cgs upon successful or exceptional return is that it can be safely destroyed.

Definition at line 131 of file Partially_Reduced_Product_templates.hh.

131  {
132  if (d1.can_recycle_congruence_systems()) {
133  d2.refine_with_congruences(cgs);
134  d1.add_recycled_congruences(cgs);
135  }
136  else {
137  if (d2.can_recycle_congruence_systems()) {
138  d1.refine_with_congruences(cgs);
139  d2.add_recycled_congruences(cgs);
140  }
141  else {
142  d1.add_congruences(cgs);
143  d2.add_congruences(cgs);
144  }
145  }
147 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::add_recycled_constraints ( Constraint_System cs)

Adds the constraint system in cs to *this.

Parameters
csThe constraint system to be added that may be recycled.
Exceptions
std::invalid_argumentThrown if *this and cs are dimension-incompatible.
Warning
The only assumption that can be made about cs upon successful or exceptional return is that it can be safely destroyed.

Definition at line 110 of file Partially_Reduced_Product_templates.hh.

110  {
111  if (d1.can_recycle_constraint_systems()) {
112  d2.refine_with_constraints(cs);
113  d1.add_recycled_constraints(cs);
114  }
115  else {
116  if (d2.can_recycle_constraint_systems()) {
117  d1.refine_with_constraints(cs);
118  d2.add_recycled_constraints(cs);
119  }
120  else {
121  d1.add_constraints(cs);
122  d2.add_constraints(cs);
123  }
124  }
126 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::add_space_dimensions_and_embed ( dimension_type  m)
inline

Adds m new space dimensions and embeds the components of *this in the new vector space.

Parameters
mThe number of dimensions to add.
Exceptions
std::length_errorThrown if adding m new space dimensions would cause the vector space to exceed dimension max_space_dimension().

Definition at line 584 of file Partially_Reduced_Product_inlines.hh.

584  {
585  d1.add_space_dimensions_and_embed(m);
586  d2.add_space_dimensions_and_embed(m);
587 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::add_space_dimensions_and_project ( dimension_type  m)
inline

Adds m new space dimensions and does not embed the components in the new vector space.

Parameters
mThe number of space dimensions to add.
Exceptions
std::length_errorThrown if adding m new space dimensions would cause the vector space to exceed dimension max_space_dimension().

Definition at line 592 of file Partially_Reduced_Product_inlines.hh.

592  {
593  d1.add_space_dimensions_and_project(m);
594  d2.add_space_dimensions_and_project(m);
595 }
template<typename D1 , typename D2 , typename R >
dimension_type Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::affine_dimension ( ) const
inline

Returns the minimum affine dimension (see also grid affine dimension) of the components of *this.

Definition at line 192 of file Partially_Reduced_Product_inlines.hh.

192  {
193  reduce();
194  const dimension_type d1_dim = d1.affine_dimension();
195  const dimension_type d2_dim = d2.affine_dimension();
196  return std::min(d1_dim, d2_dim);
197 }
size_t dimension_type
An unsigned integral type for representing space dimensions.
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::affine_image ( Variable  var,
const Linear_Expression expr,
Coefficient_traits::const_reference  denominator = Coefficient_one() 
)
inline

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

Parameters
varThe variable to which the affine expression is assigned;
exprThe numerator of the affine expression;
denominatorThe denominator of the affine expression (optional argument with default value 1).
Exceptions
std::invalid_argumentThrown if denominator is zero or if expr and *this are dimension-incompatible or if var is not a space dimension of *this.

Definition at line 269 of file Partially_Reduced_Product_inlines.hh.

271  {
272  d1.affine_image(var, expr, denominator);
273  d2.affine_image(var, expr, denominator);
275 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::affine_preimage ( Variable  var,
const Linear_Expression expr,
Coefficient_traits::const_reference  denominator = Coefficient_one() 
)
inline

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

Parameters
varThe variable to which the affine expression is substituted;
exprThe numerator of the affine expression;
denominatorThe denominator of the affine expression (optional argument with default value 1).
Exceptions
std::invalid_argumentThrown if denominator is zero or if expr and *this are dimension-incompatible or if var is not a space dimension of *this.

Definition at line 280 of file Partially_Reduced_Product_inlines.hh.

282  {
283  d1.affine_preimage(var, expr, denominator);
284  d2.affine_preimage(var, expr, denominator);
286 }
template<typename D1, typename D2, typename R>
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::ascii_dump ( ) const

Writes to std::cerr an ASCII representation of *this.

template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::ascii_dump ( std::ostream &  s) const
inline

Writes to s an ASCII representation of *this.

Definition at line 705 of file Partially_Reduced_Product_inlines.hh.

References Parma_Polyhedra_Library::Implementation::BD_Shapes::no, and Parma_Polyhedra_Library::Implementation::BD_Shapes::yes.

705  {
706  const char yes = '+';
707  const char no = '-';
708  s << "Partially_Reduced_Product\n";
709  s << (reduced ? yes : no) << "reduced\n";
710  s << "Domain 1:\n";
711  d1.ascii_dump(s);
712  s << "Domain 2:\n";
713  d2.ascii_dump(s);
714 }
bool reduced
Flag to record whether the components are reduced with respect to each other and the reduction class...
template<typename D1 , typename D2 , typename R >
bool Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::ascii_load ( std::istream &  s)

Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this accordingly. Returns true if successful, false otherwise.

Definition at line 474 of file Partially_Reduced_Product_templates.hh.

References Parma_Polyhedra_Library::Implementation::BD_Shapes::no, and Parma_Polyhedra_Library::Implementation::BD_Shapes::yes.

474  {
475  const char yes = '+';
476  const char no = '-';
477  std::string str;
478  if (!(s >> str) || str != "Partially_Reduced_Product") {
479  return false;
480  }
481  if (!(s >> str)
482  || (str[0] != yes && str[0] != no)
483  || str.substr(1) != "reduced") {
484  return false;
485  }
486  reduced = (str[0] == yes);
487  if (!(s >> str) || str != "Domain") {
488  return false;
489  }
490  if (!(s >> str) || str != "1:") {
491  return false;
492  }
493  if (!d1.ascii_load(s)) {
494  return false;
495  }
496  if (!(s >> str) || str != "Domain") {
497  return false;
498  }
499  if (!(s >> str) || str != "2:") {
500  return false;
501  }
502  return d2.ascii_load(s);
503 }
bool reduced
Flag to record whether the components are reduced with respect to each other and the reduction class...
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::bounded_affine_image ( Variable  var,
const Linear_Expression lb_expr,
const Linear_Expression ub_expr,
Coefficient_traits::const_reference  denominator = Coefficient_one() 
)
inline

Assigns to *this the image of *this with respect to the bounded affine relation $\frac{\mathrm{lb\_expr}}{\mathrm{denominator}} \leq \mathrm{var}' \leq \frac{\mathrm{ub\_expr}}{\mathrm{denominator}}$.

Parameters
varThe variable updated by the affine relation;
lb_exprThe numerator of the lower bounding affine expression;
ub_exprThe numerator of the upper bounding affine expression;
denominatorThe (common) denominator for the lower and upper bounding affine expressions (optional argument with default value 1).
Exceptions
std::invalid_argumentThrown 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.

Definition at line 338 of file Partially_Reduced_Product_inlines.hh.

341  {
342  d1.bounded_affine_image(var, lb_expr, ub_expr, denominator);
343  d2.bounded_affine_image(var, lb_expr, ub_expr, denominator);
345 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::bounded_affine_preimage ( Variable  var,
const Linear_Expression lb_expr,
const Linear_Expression ub_expr,
Coefficient_traits::const_reference  denominator = Coefficient_one() 
)
inline

Assigns to *this the preimage of *this with respect to the bounded affine relation $\frac{\mathrm{lb\_expr}}{\mathrm{denominator}} \leq \mathrm{var}' \leq \frac{\mathrm{ub\_expr}}{\mathrm{denominator}}$.

Parameters
varThe variable updated by the affine relation;
lb_exprThe numerator of the lower bounding affine expression;
ub_exprThe numerator of the upper bounding affine expression;
denominatorThe (common) denominator for the lower and upper bounding affine expressions (optional argument with default value 1).
Exceptions
std::invalid_argumentThrown 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.

Definition at line 350 of file Partially_Reduced_Product_inlines.hh.

353  {
354  d1.bounded_affine_preimage(var, lb_expr, ub_expr, denominator);
355  d2.bounded_affine_preimage(var, lb_expr, ub_expr, denominator);
357 }
template<typename D1 , typename D2 , typename R >
bool Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::bounds_from_above ( const Linear_Expression expr) const
inline

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

This method is the same as bounds_from_below.

Exceptions
std::invalid_argumentThrown if expr and *this are dimension-incompatible.

Definition at line 545 of file Partially_Reduced_Product_inlines.hh.

545  {
546  reduce();
547  return d1.bounds_from_above(expr) || d2.bounds_from_above(expr);
548 }
template<typename D1 , typename D2 , typename R >
bool Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::bounds_from_below ( const Linear_Expression expr) const
inline

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

This method is the same as bounds_from_above.

Exceptions
std::invalid_argumentThrown if expr and *this are dimension-incompatible.

Definition at line 553 of file Partially_Reduced_Product_inlines.hh.

553  {
554  reduce();
555  return d1.bounds_from_below(expr) || d2.bounds_from_below(expr);
556 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::clear_reduced_flag ( ) const
inlineprotected

Clears the reduced flag.

Definition at line 691 of file Partially_Reduced_Product_inlines.hh.

References Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::reduced.

Referenced by Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::OK().

691  {
692  const_cast<Partially_Reduced_Product&>(*this).reduced = false;
693 }
Partially_Reduced_Product(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds an object having the specified properties.
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::concatenate_assign ( const Partially_Reduced_Product< D1, D2, R > &  y)
inline

Assigns to the first (resp., second) component of *this the "concatenation" of the first (resp., second) components of *this and y, taken in this order. See also Concatenating Polyhedra.

Exceptions
std::length_errorThrown if the concatenation would cause the vector space to exceed dimension max_space_dimension().

Definition at line 600 of file Partially_Reduced_Product_inlines.hh.

References Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d1, Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d2, and Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::is_reduced().

600  {
601  d1.concatenate_assign(y.d1);
602  d2.concatenate_assign(y.d2);
603  if (!is_reduced() || !y.is_reduced()) {
605  }
606 }
bool is_reduced() const
Return true if and only if the reduced flag is set.
template<typename D1 , typename D2 , typename R >
Congruence_System Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::congruences ( ) const

Returns a system of congruences which approximates *this.

Definition at line 82 of file Partially_Reduced_Product_templates.hh.

References Parma_Polyhedra_Library::Congruence_System::begin(), Parma_Polyhedra_Library::Congruence_System::end(), and Parma_Polyhedra_Library::Congruence_System::insert().

82  {
83  reduce();
84  Congruence_System cgs = d2.congruences();
85  const Congruence_System& cgs1 = d1.congruences();
86  for (Congruence_System::const_iterator i = cgs1.begin(),
87  cgs_end = cgs1.end(); i != cgs_end; ++i) {
88  cgs.insert(*i);
89  }
90  return cgs;
91 }
template<typename D1 , typename D2 , typename R >
bool Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::constrains ( Variable  var) const
inline

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

Exceptions
std::invalid_argumentThrown if var is not a space dimension of *this.

Definition at line 560 of file Partially_Reduced_Product_inlines.hh.

560  {
561  reduce();
562  return d1.constrains(var) || d2.constrains(var);
563 }
template<typename D1 , typename D2 , typename R >
Constraint_System Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::constraints ( ) const

Returns a system of constraints which approximates *this.

Definition at line 49 of file Partially_Reduced_Product_templates.hh.

References Parma_Polyhedra_Library::Constraint_System::begin(), Parma_Polyhedra_Library::Constraint_System::end(), and Parma_Polyhedra_Library::Constraint_System::insert().

49  {
50  reduce();
51  Constraint_System cs = d2.constraints();
52  const Constraint_System& cs1 = d1.constraints();
53  for (Constraint_System::const_iterator i = cs1.begin(),
54  cs_end = cs1.end(); i != cs_end; ++i) {
55  cs.insert(*i);
56  }
57  return cs;
58 }
Constraint_System_const_iterator const_iterator
template<typename D1 , typename D2 , typename R >
bool Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::contains ( const Partially_Reduced_Product< D1, D2, R > &  y) const
inline

Returns true if and only if each component of *this contains the corresponding component of y.

Exceptions
std::invalid_argumentThrown if *this and y are dimension-incompatible.

Definition at line 653 of file Partially_Reduced_Product_inlines.hh.

References Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d1, Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d2, and Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::reduce().

653  {
654  reduce();
655  y.reduce();
656  return d1.contains(y.d1) && d2.contains(y.d2);
657 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::difference_assign ( const Partially_Reduced_Product< D1, D2, R > &  y)
inline

Assigns to *this an approximation of the set-theoretic difference of *this and y.

Exceptions
std::invalid_argumentThrown if *this and y are dimension-incompatible.

Definition at line 228 of file Partially_Reduced_Product_inlines.hh.

References Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d1, Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d2, and Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::reduce().

228  {
229  reduce();
230  y.reduce();
231  d1.difference_assign(y.d1);
232  d2.difference_assign(y.d2);
234 }
template<typename D1 , typename D2 , typename R >
const D1 & Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::domain1 ( ) const
inline
template<typename D1 , typename D2 , typename R >
const D2 & Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::domain2 ( ) const
inline
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::drop_some_non_integer_points ( Complexity_Class  complexity = ANY_COMPLEXITY)
inline

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

Parameters
complexityThe maximal complexity of any algorithms used.
Note
Currently there is no optimality guarantee, not even if complexity is ANY_COMPLEXITY.

Definition at line 457 of file Partially_Reduced_Product_inlines.hh.

457  {
458  reduce();
459  d1.drop_some_non_integer_points(complexity);
460  d2.drop_some_non_integer_points(complexity);
462 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::drop_some_non_integer_points ( const Variables_Set vars,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
inline

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

Parameters
varsPoints with non-integer coordinates for these variables/space-dimensions can be discarded.
complexityThe maximal complexity of any algorithms used.
Note
Currently there is no optimality guarantee, not even if complexity is ANY_COMPLEXITY.

Definition at line 467 of file Partially_Reduced_Product_inlines.hh.

468  {
469  reduce();
470  d1.drop_some_non_integer_points(vars, complexity);
471  d2.drop_some_non_integer_points(vars, complexity);
473 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::expand_space_dimension ( Variable  var,
dimension_type  m 
)
inline

Creates m copies of the space dimension corresponding to var.

Parameters
varThe variable corresponding to the space dimension to be replicated;
mThe number of replicas to be created.
Exceptions
std::invalid_argumentThrown if var does not correspond to a dimension of the vector space.
std::length_errorThrown if adding m new space dimensions would cause the vector space to exceed dimension max_space_dimension().

If *this has space dimension $n$, with $n > 0$, and var has space dimension $k \leq n$, then the $k$-th space dimension is expanded to m new space dimensions $n$, $n+1$, $\dots$, $n+m-1$.

Definition at line 636 of file Partially_Reduced_Product_inlines.hh.

636  {
637  d1.expand_space_dimension(var, m);
638  d2.expand_space_dimension(var, m);
639 }
template<typename D1 , typename D2 , typename R >
memory_size_type Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::external_memory_in_bytes ( ) const
inline

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

Definition at line 173 of file Partially_Reduced_Product_inlines.hh.

173  {
174  return d1.external_memory_in_bytes() + d2.external_memory_in_bytes();
175 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::fold_space_dimensions ( const Variables_Set vars,
Variable  dest 
)
inline

Folds the space dimensions in vars into dest.

Parameters
varsThe set of Variable objects corresponding to the space dimensions to be folded;
destThe variable corresponding to the space dimension that is the destination of the folding operation.
Exceptions
std::invalid_argumentThrown 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 $n$, with $n > 0$, dest has space dimension $k \leq n$, vars is a set of variables whose maximum space dimension is also less than or equal to $n$, and dest is not a member of vars, then the space dimensions corresponding to variables in vars are folded into the $k$-th space dimension.

Definition at line 644 of file Partially_Reduced_Product_inlines.hh.

645  {
646  d1.fold_space_dimensions(vars, dest);
647  d2.fold_space_dimensions(vars, dest);
648 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::generalized_affine_image ( Variable  var,
Relation_Symbol  relsym,
const Linear_Expression expr,
Coefficient_traits::const_reference  denominator = Coefficient_one() 
)
inline

Assigns to *this the image of *this with respect to the generalized affine relation $\mathrm{var}' \relsym \frac{\mathrm{expr}}{\mathrm{denominator}}$, where $\mathord{\relsym}$ is the relation symbol encoded by relsym (see also generalized affine relation.)

Parameters
varThe left hand side variable of the generalized affine relation;
relsymThe relation symbol;
exprThe numerator of the right hand side affine expression;
denominatorThe denominator of the right hand side affine expression (optional argument with default value 1).
Exceptions
std::invalid_argumentThrown if denominator is zero or if expr and *this are dimension-incompatible or if var is not a space dimension of *this or if *this is a C_Polyhedron and relsym is a strict relation symbol.

Definition at line 291 of file Partially_Reduced_Product_inlines.hh.

294  {
295  d1.generalized_affine_image(var, relsym, expr, denominator);
296  d2.generalized_affine_image(var, relsym, expr, denominator);
298 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::generalized_affine_image ( const Linear_Expression lhs,
Relation_Symbol  relsym,
const Linear_Expression rhs 
)
inline

Assigns to *this the image of *this with respect to the generalized affine relation $\mathrm{lhs}' \relsym \mathrm{rhs}$, where $\mathord{\relsym}$ is the relation symbol encoded by relsym. (see also generalized affine relation.)

Parameters
lhsThe left hand side affine expression;
relsymThe relation symbol;
rhsThe right hand side affine expression.
Exceptions
std::invalid_argumentThrown if *this is dimension-incompatible with lhs or rhs or if *this is a C_Polyhedron and relsym is a strict relation symbol.

Definition at line 315 of file Partially_Reduced_Product_inlines.hh.

317  {
318  d1.generalized_affine_image(lhs, relsym, rhs);
319  d2.generalized_affine_image(lhs, relsym, rhs);
321 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::generalized_affine_preimage ( Variable  var,
Relation_Symbol  relsym,
const Linear_Expression expr,
Coefficient_traits::const_reference  denominator = Coefficient_one() 
)
inline

Assigns to *this the preimage of *this with respect to the generalized affine relation $\mathrm{var}' \relsym \frac{\mathrm{expr}}{\mathrm{denominator}}$, where $\mathord{\relsym}$ is the relation symbol encoded by relsym. (see also generalized affine relation.)

Parameters
varThe left hand side variable of the generalized affine relation;
relsymThe relation symbol;
exprThe numerator of the right hand side affine expression;
denominatorThe denominator of the right hand side affine expression (optional argument with default value 1).
Exceptions
std::invalid_argumentThrown if denominator is zero or if expr and *this are dimension-incompatible or if var is not a space dimension of *this or if *this is a C_Polyhedron and relsym is a strict relation symbol.

Definition at line 303 of file Partially_Reduced_Product_inlines.hh.

306  {
307  d1.generalized_affine_preimage(var, relsym, expr, denominator);
308  d2.generalized_affine_preimage(var, relsym, expr, denominator);
310 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::generalized_affine_preimage ( const Linear_Expression lhs,
Relation_Symbol  relsym,
const Linear_Expression rhs 
)
inline

Assigns to *this the preimage of *this with respect to the generalized affine relation $\mathrm{lhs}' \relsym \mathrm{rhs}$, where $\mathord{\relsym}$ is the relation symbol encoded by relsym. (see also generalized affine relation.)

Parameters
lhsThe left hand side affine expression;
relsymThe relation symbol;
rhsThe right hand side affine expression.
Exceptions
std::invalid_argumentThrown if *this is dimension-incompatible with lhs or rhs or if *this is a C_Polyhedron and relsym is a strict relation symbol.

Definition at line 326 of file Partially_Reduced_Product_inlines.hh.

328  {
329  d1.generalized_affine_preimage(lhs, relsym, rhs);
330  d2.generalized_affine_preimage(lhs, relsym, rhs);
332 }
template<typename D1 , typename D2 , typename R >
int32_t Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::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().

Definition at line 718 of file Partially_Reduced_Product_inlines.hh.

References Parma_Polyhedra_Library::hash_code_from_dimension().

718  {
720 }
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
int32_t hash_code_from_dimension(dimension_type dim)
Returns the hash code for space dimension dim.
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::intersection_assign ( const Partially_Reduced_Product< D1, D2, R > &  y)
inline

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

Exceptions
std::invalid_argumentThrown if *this and y are dimension-incompatible.

Definition at line 219 of file Partially_Reduced_Product_inlines.hh.

References Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d1, and Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d2.

Referenced by Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::Partially_Reduced_Product().

219  {
220  d1.intersection_assign(y.d1);
221  d2.intersection_assign(y.d2);
223 }
template<typename D1 , typename D2 , typename R >
bool Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::is_bounded ( ) const
inline

Returns true if and only if a component of *this is bounded.

Definition at line 537 of file Partially_Reduced_Product_inlines.hh.

template<typename D1 , typename D2 , typename R >
bool Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::is_discrete ( ) const
inline

Returns true if and only if a component of *this is discrete.

Definition at line 530 of file Partially_Reduced_Product_inlines.hh.

template<typename D1 , typename D2 , typename R >
bool Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::is_disjoint_from ( const Partially_Reduced_Product< D1, D2, R > &  y) const
inline

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

Exceptions
std::invalid_argumentThrown if x and y are dimension-incompatible.

Definition at line 522 of file Partially_Reduced_Product_inlines.hh.

References Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d1, Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d2, and Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::reduce().

522  {
523  reduce();
524  y.reduce();
525  return d1.is_disjoint_from(y.d1) || d2.is_disjoint_from(y.d2);
526 }
template<typename D1 , typename D2 , typename R >
bool Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::is_empty ( ) const
inline

Returns true if and only if either of the components of *this are empty.

Definition at line 501 of file Partially_Reduced_Product_inlines.hh.

Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::Pointset_Powerset().

template<typename D1 , typename D2 , typename R >
bool Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::is_reduced ( ) const
inlineprotected

Return true if and only if the reduced flag is set.

Definition at line 685 of file Partially_Reduced_Product_inlines.hh.

Referenced by Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::concatenate_assign(), and Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::reduce().

685  {
686  return reduced;
687 }
bool reduced
Flag to record whether the components are reduced with respect to each other and the reduction class...
template<typename D1 , typename D2 , typename R >
bool Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::is_topologically_closed ( ) const
inline

Returns true if and only if both of the components of *this are topologically closed subsets of the vector space.

Definition at line 514 of file Partially_Reduced_Product_inlines.hh.

514  {
515  reduce();
516  return d1.is_topologically_closed() && d2.is_topologically_closed();
517 }
template<typename D1 , typename D2 , typename R >
bool Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::is_universe ( ) const
inline

Returns true if and only if both of the components of *this are the universe.

Definition at line 508 of file Partially_Reduced_Product_inlines.hh.

508  {
509  return d1.is_universe() && d2.is_universe();
510 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::m_swap ( Partially_Reduced_Product< D1, D2, R > &  y)
inline

Swaps *this with product y. (*this and y can be dimension-incompatible.)

Definition at line 379 of file Partially_Reduced_Product_inlines.hh.

References Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d1, Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d2, Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::reduced, and Parma_Polyhedra_Library::swap().

Referenced by Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::swap().

379  {
380  using std::swap;
381  swap(d1, y.d1);
382  swap(d2, y.d2);
383  swap(reduced, y.reduced);
384 }
void swap(CO_Tree &x, CO_Tree &y)
void swap(Partially_Reduced_Product< D1, D2, R > &x, Partially_Reduced_Product< D1, D2, R > &y)
Swaps x with y.
bool reduced
Flag to record whether the components are reduced with respect to each other and the reduction class...
template<typename D1 , typename D2 , typename R >
template<typename Partial_Function >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::map_space_dimensions ( const Partial_Function pfunc)
inline

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

If pfunc maps only some of the dimensions of *this then the rest will be projected away.

If the highest dimension mapped to by pfunc is higher than the highest dimension in *this then the number of dimensions in this will be increased to the highest dimension mapped to by pfunc.

Parameters
pfuncThe partial function specifying the destiny of each space dimension.

The template class 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 codomain (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 codomain of the partial function. The max_in_codomain() method is called at most once.

bool maps(dimension_type i, dimension_type& j) const

Let $f$ be the represented function and $k$ be the value of i. If $f$ is defined in $k$, then $f(k)$ is assigned to j and true is returned. If $f$ is undefined in $k$, then false is returned. This method is called at most $n$ times, where $n$ is the dimension of the vector space enclosing *this.

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

Definition at line 628 of file Partially_Reduced_Product_inlines.hh.

628  {
629  d1.map_space_dimensions(pfunc);
630  d2.map_space_dimensions(pfunc);
631 }
template<typename D1 , typename D2 , typename R >
dimension_type Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::max_space_dimension ( )
inlinestatic

Returns the maximum space dimension this product can handle.

Definition at line 37 of file Partially_Reduced_Product_inlines.hh.

References Parma_Polyhedra_Library::max_space_dimension().

37  {
40  : D2::max_space_dimension();
41 }
dimension_type max_space_dimension()
Returns the maximum space dimension this library can handle.
static dimension_type max_space_dimension()
Returns the maximum space dimension this product can handle.
template<typename D1 , typename D2 , typename R >
bool Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::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.

Parameters
exprThe linear expression to be maximized subject to *this;
sup_nThe numerator of the supremum value;
sup_dThe denominator of the supremum value;
maximumtrue if the supremum value can be reached in this.
Exceptions
std::invalid_argumentThrown if expr and *this are dimension-incompatible.

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

Definition at line 230 of file Partially_Reduced_Product_templates.hh.

References PPL_DIRTY_TEMP_COEFFICIENT.

233  {
234  reduce();
235 
236  if (is_empty()) {
237  return false;
238  }
239 
244  bool maximum1;
245  bool maximum2;
246  bool r1 = d1.maximize(expr, sup1_n, sup1_d, maximum1);
247  bool r2 = d2.maximize(expr, sup2_n, sup2_d, maximum2);
248  // If neither is bounded from above, return false.
249  if (!r1 && !r2) {
250  return false;
251  }
252  // If only d2 is bounded from above, then use the values for d2.
253  if (!r1) {
254  sup_n = sup2_n;
255  sup_d = sup2_d;
256  maximum = maximum2;
257  return true;
258  }
259  // If only d1 is bounded from above, then use the values for d1.
260  if (!r2) {
261  sup_n = sup1_n;
262  sup_d = sup1_d;
263  maximum = maximum1;
264  return true;
265  }
266  // If both d1 and d2 are bounded from above, then use the minimum values.
267  if (sup2_d * sup1_n >= sup1_d * sup2_n) {
268  sup_n = sup1_n;
269  sup_d = sup1_d;
270  maximum = maximum1;
271  }
272  else {
273  sup_n = sup2_n;
274  sup_d = sup2_d;
275  maximum = maximum2;
276  }
277  return true;
278 }
#define PPL_DIRTY_TEMP_COEFFICIENT(id)
Declare a local variable named id, of type Coefficient, and containing an unknown initial value...
bool is_empty() const
Returns true if and only if either of the components of *this are empty.
template<typename D1 , typename D2 , typename R >
bool Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::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.

Parameters
exprThe linear expression to be maximized subject to *this;
sup_nThe numerator of the supremum value;
sup_dThe denominator of the supremum value;
maximumtrue if the supremum value can be reached in this.
gWhen maximization succeeds, will be assigned the point or closure point where expr reaches its supremum value.
Exceptions
std::invalid_argumentThrown if expr and *this are dimension-incompatible.

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

Definition at line 337 of file Partially_Reduced_Product_templates.hh.

References PPL_DIRTY_TEMP_COEFFICIENT.

341  {
342  reduce();
343 
344  if (is_empty()) {
345  return false;
346  }
347  PPL_ASSERT(reduced);
348 
353  bool maximum1;
354  bool maximum2;
355  Generator g1(point());
356  Generator g2(point());
357  bool r1 = d1.maximize(expr, sup1_n, sup1_d, maximum1, g1);
358  bool r2 = d2.maximize(expr, sup2_n, sup2_d, maximum2, g2);
359  // If neither is bounded from above, return false.
360  if (!r1 && !r2) {
361  return false;
362  }
363  // If only d2 is bounded from above, then use the values for d2.
364  if (!r1) {
365  sup_n = sup2_n;
366  sup_d = sup2_d;
367  maximum = maximum2;
368  g = g2;
369  return true;
370  }
371  // If only d1 is bounded from above, then use the values for d1.
372  if (!r2) {
373  sup_n = sup1_n;
374  sup_d = sup1_d;
375  maximum = maximum1;
376  g = g1;
377  return true;
378  }
379  // If both d1 and d2 are bounded from above, then use the minimum values.
380  if (sup2_d * sup1_n >= sup1_d * sup2_n) {
381  sup_n = sup1_n;
382  sup_d = sup1_d;
383  maximum = maximum1;
384  g = g1;
385  }
386  else {
387  sup_n = sup2_n;
388  sup_d = sup2_d;
389  maximum = maximum2;
390  g = g2;
391  }
392  return true;
393 }
#define PPL_DIRTY_TEMP_COEFFICIENT(id)
Declare a local variable named id, of type Coefficient, and containing an unknown initial value...
bool is_empty() const
Returns true if and only if either of the components of *this are empty.
bool reduced
Flag to record whether the components are reduced with respect to each other and the reduction class...
template<typename D1 , typename D2 , typename R >
bool Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::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 i *this, in which case the infimum value is computed.

Parameters
exprThe linear expression to be minimized subject to *this;
inf_nThe numerator of the infimum value;
inf_dThe denominator of the infimum value;
minimumtrue if the infimum value can be reached in this.
Exceptions
std::invalid_argumentThrown 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.

Definition at line 283 of file Partially_Reduced_Product_templates.hh.

References PPL_DIRTY_TEMP_COEFFICIENT.

286  {
287  reduce();
288 
289  if (is_empty()) {
290  return false;
291  }
292  PPL_ASSERT(reduced);
293 
298  bool minimum1;
299  bool minimum2;
300  bool r1 = d1.minimize(expr, inf1_n, inf1_d, minimum1);
301  bool r2 = d2.minimize(expr, inf2_n, inf2_d, minimum2);
302  // If neither is bounded from below, return false.
303  if (!r1 && !r2) {
304  return false;
305  }
306  // If only d2 is bounded from below, then use the values for d2.
307  if (!r1) {
308  inf_n = inf2_n;
309  inf_d = inf2_d;
310  minimum = minimum2;
311  return true;
312  }
313  // If only d1 is bounded from below, then use the values for d1.
314  if (!r2) {
315  inf_n = inf1_n;
316  inf_d = inf1_d;
317  minimum = minimum1;
318  return true;
319  }
320  // If both d1 and d2 are bounded from below, then use the minimum values.
321  if (inf2_d * inf1_n <= inf1_d * inf2_n) {
322  inf_n = inf1_n;
323  inf_d = inf1_d;
324  minimum = minimum1;
325  }
326  else {
327  inf_n = inf2_n;
328  inf_d = inf2_d;
329  minimum = minimum2;
330  }
331  return true;
332 }
#define PPL_DIRTY_TEMP_COEFFICIENT(id)
Declare a local variable named id, of type Coefficient, and containing an unknown initial value...
bool is_empty() const
Returns true if and only if either of the components of *this are empty.
bool reduced
Flag to record whether the components are reduced with respect to each other and the reduction class...
template<typename D1 , typename D2 , typename R >
bool Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::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.

Parameters
exprThe linear expression to be minimized subject to *this;
inf_nThe numerator of the infimum value;
inf_dThe denominator of the infimum value;
minimumtrue if the infimum value can be reached in this.
gWhen minimization succeeds, will be assigned the point or closure point where expr reaches its infimum value.
Exceptions
std::invalid_argumentThrown 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 point are left untouched.

Definition at line 398 of file Partially_Reduced_Product_templates.hh.

References PPL_DIRTY_TEMP_COEFFICIENT.

402  {
403  reduce();
404 
405  if (is_empty()) {
406  return false;
407  }
408  PPL_ASSERT(reduced);
409 
414  bool minimum1;
415  bool minimum2;
416  Generator g1(point());
417  Generator g2(point());
418  bool r1 = d1.minimize(expr, inf1_n, inf1_d, minimum1, g1);
419  bool r2 = d2.minimize(expr, inf2_n, inf2_d, minimum2, g2);
420  // If neither is bounded from below, return false.
421  if (!r1 && !r2) {
422  return false;
423  }
424  // If only d2 is bounded from below, then use the values for d2.
425  if (!r1) {
426  inf_n = inf2_n;
427  inf_d = inf2_d;
428  minimum = minimum2;
429  g = g2;
430  return true;
431  }
432  // If only d1 is bounded from below, then use the values for d1.
433  if (!r2) {
434  inf_n = inf1_n;
435  inf_d = inf1_d;
436  minimum = minimum1;
437  g = g1;
438  return true;
439  }
440  // If both d1 and d2 are bounded from below, then use the minimum values.
441  if (inf2_d * inf1_n <= inf1_d * inf2_n) {
442  inf_n = inf1_n;
443  inf_d = inf1_d;
444  minimum = minimum1;
445  g = g1;
446  }
447  else {
448  inf_n = inf2_n;
449  inf_d = inf2_d;
450  minimum = minimum2;
451  g = g2;
452  }
453  return true;
454 }
#define PPL_DIRTY_TEMP_COEFFICIENT(id)
Declare a local variable named id, of type Coefficient, and containing an unknown initial value...
bool is_empty() const
Returns true if and only if either of the components of *this are empty.
bool reduced
Flag to record whether the components are reduced with respect to each other and the reduction class...
template<typename D1 , typename D2 , typename R >
Congruence_System Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::minimized_congruences ( ) const

Returns a system of congruences which approximates *this, in reduced form.

Definition at line 95 of file Partially_Reduced_Product_templates.hh.

References Parma_Polyhedra_Library::Congruence_System::begin(), Parma_Polyhedra_Library::Congruence_System::end(), Parma_Polyhedra_Library::Congruence_System::insert(), and Parma_Polyhedra_Library::Grid::minimized_congruences().

95  {
96  reduce();
97  Congruence_System cgs = d2.congruences();
98  const Congruence_System& cgs1 = d1.congruences();
99  for (Congruence_System::const_iterator i = cgs1.begin(),
100  cgs_end = cgs1.end(); i != cgs_end; ++i) {
101  cgs.insert(*i);
102  }
103  Grid gr(cgs);
104  return gr.minimized_congruences();
105 }
template<typename D1 , typename D2 , typename R >
Constraint_System Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::minimized_constraints ( ) const

Returns a system of constraints which approximates *this, in reduced form.

Definition at line 62 of file Partially_Reduced_Product_templates.hh.

References Parma_Polyhedra_Library::Constraint_System::begin(), Parma_Polyhedra_Library::Constraint_System::end(), Parma_Polyhedra_Library::Constraint_System::has_strict_inequalities(), Parma_Polyhedra_Library::Constraint_System::insert(), and Parma_Polyhedra_Library::Polyhedron::minimized_constraints().

62  {
63  reduce();
64  Constraint_System cs = d2.constraints();
65  const Constraint_System& cs1 = d1.constraints();
66  for (Constraint_System::const_iterator i = cs1.begin(),
67  cs_end = cs1.end(); i != cs_end; ++i) {
68  cs.insert(*i);
69  }
70  if (cs.has_strict_inequalities()) {
71  NNC_Polyhedron ph(cs);
72  return ph.minimized_constraints();
73  }
74  else {
75  C_Polyhedron ph(cs);
76  return ph.minimized_constraints();
77  }
78 }
Constraint_System_const_iterator const_iterator
template<typename D1 , typename D2 , typename R >
bool Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::OK ( ) const
inline

Checks if all the invariants are satisfied.

Definition at line 458 of file Partially_Reduced_Product_templates.hh.

References Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::clear_reduced_flag(), and Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::reduce().

458  {
459  if (reduced) {
460  Partially_Reduced_Product<D1, D2, R> dp1 = *this;
461  Partially_Reduced_Product<D1, D2, R> dp2 = *this;
462  /* Force dp1 reduction */
463  dp1.clear_reduced_flag();
464  dp1.reduce();
465  if (dp1 != dp2) {
466  return false;
467  }
468  }
469  return d1.OK() && d2.OK();
470 }
bool reduced
Flag to record whether the components are reduced with respect to each other and the reduction class...
template<typename D1 , typename D2 , typename R >
Partially_Reduced_Product< D1, D2, R > & Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::operator= ( const Partially_Reduced_Product< D1, D2, R > &  y)
inline

The assignment operator. (*this and y can be dimension-incompatible.)

Definition at line 478 of file Partially_Reduced_Product_inlines.hh.

References Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d1, Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d2, and Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::reduced.

478  {
479  d1 = y.d1;
480  d2 = y.d2;
481  reduced = y.reduced;
482  return *this;
483 }
bool reduced
Flag to record whether the components are reduced with respect to each other and the reduction class...
template<typename D1, typename D2, typename R>
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::print ( ) const

Prints *this to std::cerr using operator<<.

template<typename D1 , typename D2 , typename R >
bool Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::reduce ( ) const
inline

Reduce.

Definition at line 671 of file Partially_Reduced_Product_inlines.hh.

References Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d1, Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d2, and Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::is_reduced().

Referenced by Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::contains(), Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::difference_assign(), Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::is_disjoint_from(), Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::OK(), Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::operator==(), Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::strictly_contains(), Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::time_elapse_assign(), Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::upper_bound_assign(), Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::upper_bound_assign_if_exact(), and Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::widening_assign().

671  {
673  = const_cast<Partially_Reduced_Product&>(*this);
674  if (dp.is_reduced()) {
675  return false;
676  }
677  R r;
678  r.product_reduce(dp.d1, dp.d2);
680  return true;
681 }
Partially_Reduced_Product(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds an object having the specified properties.
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::refine_with_congruence ( const Congruence cg)
inline

Use the congruence cg to refine *this.

Parameters
cgThe congruence to be used for refinement.
Exceptions
std::invalid_argumentThrown if *this and cg are dimension-incompatible.

Definition at line 412 of file Partially_Reduced_Product_inlines.hh.

412  {
413  d1.refine_with_congruence(cg);
414  d2.refine_with_congruence(cg);
416 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::refine_with_congruences ( const Congruence_System cgs)
inline

Use the congruences in cgs to refine *this.

Parameters
cgsThe congruences to be used for refinement.
Exceptions
std::invalid_argumentThrown if *this and cgs are dimension-incompatible.

Definition at line 448 of file Partially_Reduced_Product_inlines.hh.

448  {
449  d1.refine_with_congruences(cgs);
450  d2.refine_with_congruences(cgs);
452 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::refine_with_constraint ( const Constraint c)
inline

Use the constraint c to refine *this.

Parameters
cThe constraint to be used for refinement.
Exceptions
std::invalid_argumentThrown if *this and c are dimension-incompatible.

Definition at line 396 of file Partially_Reduced_Product_inlines.hh.

396  {
397  d1.refine_with_constraint(c);
398  d2.refine_with_constraint(c);
400 }
Coefficient c
Definition: PIP_Tree.cc:64
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::refine_with_constraints ( const Constraint_System cs)
inline

Use the constraints in cs to refine *this.

Parameters
csThe constraints to be used for refinement.
Exceptions
std::invalid_argumentThrown if *this and cs are dimension-incompatible.

Definition at line 430 of file Partially_Reduced_Product_inlines.hh.

430  {
431  d1.refine_with_constraints(cs);
432  d2.refine_with_constraints(cs);
434 }
template<typename D1 , typename D2 , typename R >
Poly_Con_Relation Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::relation_with ( const Constraint c) const

Returns the relations holding between *this and c.

Definition at line 166 of file Partially_Reduced_Product_templates.hh.

References Parma_Polyhedra_Library::Poly_Con_Relation::implies(), Parma_Polyhedra_Library::Poly_Con_Relation::is_disjoint(), Parma_Polyhedra_Library::Poly_Con_Relation::is_included(), Parma_Polyhedra_Library::Poly_Con_Relation::nothing(), and Parma_Polyhedra_Library::Poly_Con_Relation::saturates().

166  {
167  reduce();
168  Poly_Con_Relation relation1 = d1.relation_with(c);
169  Poly_Con_Relation relation2 = d2.relation_with(c);
170 
171  Poly_Con_Relation result = Poly_Con_Relation::nothing();
172 
173  if (relation1.implies(Poly_Con_Relation::is_included())) {
174  result = result && Poly_Con_Relation::is_included();
175  }
176  else if (relation2.implies(Poly_Con_Relation::is_included())) {
177  result = result && Poly_Con_Relation::is_included();
178  }
179  if (relation1.implies(Poly_Con_Relation::saturates())) {
180  result = result && Poly_Con_Relation::saturates();
181  }
182  else if (relation2.implies(Poly_Con_Relation::saturates())) {
183  result = result && Poly_Con_Relation::saturates();
184  }
185  if (relation1.implies(Poly_Con_Relation::is_disjoint())) {
186  result = result && Poly_Con_Relation::is_disjoint();
187  }
188  else if (relation2.implies(Poly_Con_Relation::is_disjoint())) {
189  result = result && Poly_Con_Relation::is_disjoint();
190  }
191 
192  return result;
193 }
static Poly_Con_Relation is_disjoint()
The polyhedron and the set of points satisfying the constraint are disjoint.
static Poly_Con_Relation is_included()
The polyhedron is included in the set of points satisfying the constraint.
static Poly_Con_Relation saturates()
The polyhedron is included in the set of points saturating the constraint.
Coefficient c
Definition: PIP_Tree.cc:64
static Poly_Con_Relation nothing()
The assertion that says nothing.
template<typename D1 , typename D2 , typename R >
Poly_Con_Relation Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::relation_with ( const Congruence cg) const

Returns the relations holding between *this and cg.

Definition at line 198 of file Partially_Reduced_Product_templates.hh.

References Parma_Polyhedra_Library::Poly_Con_Relation::implies(), Parma_Polyhedra_Library::Poly_Con_Relation::is_disjoint(), Parma_Polyhedra_Library::Poly_Con_Relation::is_included(), Parma_Polyhedra_Library::Poly_Con_Relation::nothing(), and Parma_Polyhedra_Library::Poly_Con_Relation::saturates().

198  {
199  reduce();
200  Poly_Con_Relation relation1 = d1.relation_with(cg);
201  Poly_Con_Relation relation2 = d2.relation_with(cg);
202 
203  Poly_Con_Relation result = Poly_Con_Relation::nothing();
204 
205  if (relation1.implies(Poly_Con_Relation::is_included())) {
206  result = result && Poly_Con_Relation::is_included();
207  }
208  else if (relation2.implies(Poly_Con_Relation::is_included())) {
209  result = result && Poly_Con_Relation::is_included();
210  }
211  if (relation1.implies(Poly_Con_Relation::saturates())) {
212  result = result && Poly_Con_Relation::saturates();
213  }
214  else if (relation2.implies(Poly_Con_Relation::saturates())) {
215  result = result && Poly_Con_Relation::saturates();
216  }
217  if (relation1.implies(Poly_Con_Relation::is_disjoint())) {
218  result = result && Poly_Con_Relation::is_disjoint();
219  }
220  else if (relation2.implies(Poly_Con_Relation::is_disjoint())) {
221  result = result && Poly_Con_Relation::is_disjoint();
222  }
223 
224  return result;
225 }
static Poly_Con_Relation is_disjoint()
The polyhedron and the set of points satisfying the constraint are disjoint.
static Poly_Con_Relation is_included()
The polyhedron is included in the set of points satisfying the constraint.
static Poly_Con_Relation saturates()
The polyhedron is included in the set of points saturating the constraint.
static Poly_Con_Relation nothing()
The assertion that says nothing.
template<typename D1 , typename D2 , typename R >
Poly_Gen_Relation Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::relation_with ( const Generator g) const

Returns the relations holding between *this and g.

Definition at line 152 of file Partially_Reduced_Product_templates.hh.

References Parma_Polyhedra_Library::Poly_Gen_Relation::nothing(), and Parma_Polyhedra_Library::Poly_Gen_Relation::subsumes().

152  {
153  reduce();
154  if (Poly_Gen_Relation::nothing() == d1.relation_with(g)
155  || Poly_Gen_Relation::nothing() == d2.relation_with(g)) {
157  }
158  else {
160  }
161 }
static Poly_Gen_Relation subsumes()
Adding the generator would not change the polyhedron.
static Poly_Gen_Relation nothing()
The assertion that says nothing.
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::remove_higher_space_dimensions ( dimension_type  new_dimension)
inline

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

Exceptions
std::invalid_argumentThrown if new_dimensions is greater than the space dimension of *this.

Definition at line 619 of file Partially_Reduced_Product_inlines.hh.

619  {
620  d1.remove_higher_space_dimensions(new_dimension);
621  d2.remove_higher_space_dimensions(new_dimension);
622 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::remove_space_dimensions ( const Variables_Set vars)
inline

Removes all the specified dimensions from the vector space.

Parameters
varsThe set of Variable objects corresponding to the space dimensions to be removed.
Exceptions
std::invalid_argumentThrown if *this is dimension-incompatible with one of the Variable objects contained in vars.

Definition at line 611 of file Partially_Reduced_Product_inlines.hh.

611  {
612  d1.remove_space_dimensions(vars);
613  d2.remove_space_dimensions(vars);
614 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::set_reduced_flag ( ) const
inlineprotected

Sets the reduced flag.

Definition at line 697 of file Partially_Reduced_Product_inlines.hh.

References Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::reduced.

697  {
698  const_cast<Partially_Reduced_Product&>(*this).reduced = true;
699 }
Partially_Reduced_Product(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds an object having the specified properties.
template<typename D1 , typename D2 , typename R >
dimension_type Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::space_dimension ( ) const
inline

Returns the dimension of the vector space enclosing *this.

Definition at line 185 of file Partially_Reduced_Product_inlines.hh.

Referenced by Parma_Polyhedra_Library::Box< ITV >::Box().

185  {
186  PPL_ASSERT(d1.space_dimension() == d2.space_dimension());
187  return d1.space_dimension();
188 }
template<typename D1 , typename D2 , typename R >
bool Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::strictly_contains ( const Partially_Reduced_Product< D1, D2, R > &  y) const
inline

Returns true if and only if each component of *this strictly contains the corresponding component of y.

Exceptions
std::invalid_argumentThrown if *this and y are dimension-incompatible.

Definition at line 662 of file Partially_Reduced_Product_inlines.hh.

References Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d1, Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d2, and Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::reduce().

662  {
663  reduce();
664  y.reduce();
665  return (d1.contains(y.d1) && d2.strictly_contains(y.d2))
666  || (d2.contains(y.d2) && d1.strictly_contains(y.d1));
667 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::throw_space_dimension_overflow ( const char *  method,
const char *  reason 
)
private

Definition at line 39 of file Partially_Reduced_Product_templates.hh.

40  {
41  std::ostringstream s;
42  s << "PPL::Partially_Reduced_Product::" << method << ":" << std::endl
43  << reason << ".";
44  throw std::length_error(s.str());
45 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::time_elapse_assign ( const Partially_Reduced_Product< D1, D2, R > &  y)
inline

Assigns to *this the result of computing the time-elapse between *this and y. (See also time-elapse.)

Exceptions
std::invalid_argumentThrown if *this and y are dimension-incompatible.

Definition at line 362 of file Partially_Reduced_Product_inlines.hh.

References Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d1, Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d2, and Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::reduce().

362  {
363  reduce();
364  y.reduce();
365  d1.time_elapse_assign(y.d1);
366  d2.time_elapse_assign(y.d2);
367  PPL_ASSERT_HEAVY(OK());
368 }
bool OK() const
Checks if all the invariants are satisfied.
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::topological_closure_assign ( )
inline

Assigns to *this its topological closure.

Definition at line 372 of file Partially_Reduced_Product_inlines.hh.

372  {
373  d1.topological_closure_assign();
374  d2.topological_closure_assign();
375 }
template<typename D1 , typename D2 , typename R >
memory_size_type Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::total_memory_in_bytes ( ) const
inline

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

Definition at line 179 of file Partially_Reduced_Product_inlines.hh.

References Parma_Polyhedra_Library::external_memory_in_bytes().

179  {
180  return sizeof(*this) + external_memory_in_bytes();
181 }
memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::unconstrain ( Variable  var)
inline

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

Parameters
varThe space dimension that will be unconstrained.
Exceptions
std::invalid_argumentThrown if var is not a space dimension of *this.

Definition at line 202 of file Partially_Reduced_Product_inlines.hh.

202  {
203  reduce();
204  d1.unconstrain(var);
205  d2.unconstrain(var);
206 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::unconstrain ( const Variables_Set vars)
inline

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

Parameters
varsThe set of space dimension that will be unconstrained.
Exceptions
std::invalid_argumentThrown if *this is dimension-incompatible with one of the Variable objects contained in vars.

Definition at line 210 of file Partially_Reduced_Product_inlines.hh.

210  {
211  reduce();
212  d1.unconstrain(vars);
213  d2.unconstrain(vars);
214 }
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::upper_bound_assign ( const Partially_Reduced_Product< D1, D2, R > &  y)
inline

Assigns to *this an upper bound of *this and y computed on the corresponding components.

Exceptions
std::invalid_argumentThrown if *this and y are dimension-incompatible.

Definition at line 239 of file Partially_Reduced_Product_inlines.hh.

References Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d1, Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d2, and Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::reduce().

239  {
240  reduce();
241  y.reduce();
242  d1.upper_bound_assign(y.d1);
243  d2.upper_bound_assign(y.d2);
244 }
template<typename D1 , typename D2 , typename R >
bool Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::upper_bound_assign_if_exact ( const Partially_Reduced_Product< D1, D2, R > &  y)
inline

Assigns to *this an upper bound of *this and y computed on the corresponding components. If it is exact on each of the components of *this, true is returned, otherwise false is returned.

Exceptions
std::invalid_argumentThrown if *this and y are dimension-incompatible.

Definition at line 249 of file Partially_Reduced_Product_inlines.hh.

References Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d1, Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d2, Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::reduce(), and Parma_Polyhedra_Library::swap().

249  {
250  reduce();
251  y.reduce();
252  D1 d1_copy = d1;
253  bool ub_exact = d1_copy.upper_bound_assign_if_exact(y.d1);
254  if (!ub_exact) {
255  return false;
256  }
257  ub_exact = d2.upper_bound_assign_if_exact(y.d2);
258  if (!ub_exact) {
259  return false;
260  }
261  using std::swap;
262  swap(d1, d1_copy);
263  return true;
264 }
void swap(CO_Tree &x, CO_Tree &y)
void swap(Partially_Reduced_Product< D1, D2, R > &x, Partially_Reduced_Product< D1, D2, R > &y)
Swaps x with y.
template<typename D1 , typename D2 , typename R >
void Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::widening_assign ( const Partially_Reduced_Product< D1, D2, R > &  y,
unsigned *  tp = NULL 
)
inline

Assigns to *this the result of computing the "widening" between *this and y.

This widening uses either the congruence or generator systems depending on which of the systems describing x and y are up to date and minimized.

Parameters
yA product that must be contained in *this;
tpAn 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_argumentThrown if *this and y are dimension-incompatible.

Definition at line 568 of file Partially_Reduced_Product_inlines.hh.

References Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d1, Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d2, and Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::reduce().

569  {
570  // FIXME(0.10.1): In general this is _NOT_ a widening since the reduction
571  // may mean that the sequence does not satisfy the ascending
572  // chain condition.
573  // However, for the direct, smash and constraints product
574  // it may be ok - but this still needs checking.
575  reduce();
576  y.reduce();
577  d1.widening_assign(y.d1, tp);
578  d2.widening_assign(y.d2, tp);
579 }

Friends And Related Function Documentation

template<typename D1 , typename D2 , typename R >
bool operator!= ( const Partially_Reduced_Product< D1, D2, R > &  x,
const Partially_Reduced_Product< D1, D2, R > &  y 
)
related

Returns true if and only if the components of x and y are not pairwise equal.

Note that x and y may be dimension-incompatible: in those cases, the value true is returned.

template<typename D1 , typename D2 , typename R >
bool operator!= ( const Partially_Reduced_Product< D1, D2, R > &  x,
const Partially_Reduced_Product< D1, D2, R > &  y 
)
related

Definition at line 735 of file Partially_Reduced_Product_inlines.hh.

736  {
737  return !(x == y);
738 }
template<typename D1 , typename D2 , typename R >
std::ostream & operator<< ( std::ostream &  s,
const Partially_Reduced_Product< D1, D2, R > &  dp 
)
related

Output operator.

Writes a textual representation of dp on s.

template<typename D1 , typename D2 , typename R >
std::ostream & operator<< ( std::ostream &  s,
const Partially_Reduced_Product< D1, D2, R > &  dp 
)
related

Definition at line 743 of file Partially_Reduced_Product_inlines.hh.

References Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d1, and Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::d2.

744  {
745  return s << "Domain 1:\n"
746  << dp.d1
747  << "Domain 2:\n"
748  << dp.d2;
749 }
template<typename D1 , typename D2 , typename R >
bool operator== ( const Partially_Reduced_Product< D1, D2, R > &  x,
const Partially_Reduced_Product< D1, D2, R > &  y 
)
related

Returns true if and only if the components of x and y are pairwise equal.

Note that x and y may be dimension-incompatible: in those cases, the value false is returned.

template<typename D1 , typename D2 , typename R >
bool operator== ( const Partially_Reduced_Product< D1, D2, R > &  x,
const Partially_Reduced_Product< D1, D2, R > &  y 
)
related
template<typename D1, typename D2, typename R>
bool operator== ( const Partially_Reduced_Product< D1, D2, R > &  x,
const Partially_Reduced_Product< D1, D2, R > &  y 
)
friend
template<typename D1, typename D2, typename R>
std::ostream& Parma_Polyhedra_Library::IO_Operators::operator<< ( std::ostream &  s,
const Partially_Reduced_Product< D1, D2, R > &  dp 
)
friend
template<typename D1 , typename D2 , typename R >
void swap ( Partially_Reduced_Product< D1, D2, R > &  x,
Partially_Reduced_Product< D1, D2, R > &  y 
)
related

Swaps x with y.

template<typename D1 , typename D2 , typename R >
void swap ( Partially_Reduced_Product< D1, D2, R > &  x,
Partially_Reduced_Product< D1, D2, R > &  y 
)
related

Definition at line 812 of file Partially_Reduced_Product_inlines.hh.

References Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::m_swap().

813  {
814  x.m_swap(y);
815 }

Member Data Documentation


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