PPL  1.2
Parma_Polyhedra_Library::Affine_Space Class Reference

An affine space. More...

#include <Affine_Space_defs.hh>

Collaboration diagram for Parma_Polyhedra_Library::Affine_Space:

Public Types

typedef Coefficient coefficient_type
 The numeric type of coefficients. More...
 

Public Member Functions

 Affine_Space (dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
 Builds an affine space having the specified properties. More...
 
 Affine_Space (const Constraint_System &cs)
 Builds an affine space, copying a system of constraints. More...
 
 Affine_Space (Constraint_System &cs, Recycle_Input dummy)
 Builds an affine space, recycling a system of constraints. More...
 
 Affine_Space (const Generator_System &gs)
 Builds an affine space, copying a system of affine space generators. More...
 
 Affine_Space (Generator_System &gs, Recycle_Input dummy)
 Builds an affine space, recycling a system of generators. More...
 
template<typename Interval >
 Affine_Space (const Box< Interval > &box, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds an affine space out of a box. More...
 
template<typename U >
 Affine_Space (const BD_Shape< U > &bd, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds an affine space out of a bounded-difference shape. More...
 
template<typename U >
 Affine_Space (const Octagonal_Shape< U > &os, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds an affine space out of an octagonal shape. More...
 
 Affine_Space (const Polyhedron &ph, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds an affine space from a polyhedron using algorithms whose complexity does not exceed the one specified by complexity. If complexity is ANY_COMPLEXITY, then the affine space built is the smallest one containing ph. More...
 
 Affine_Space (const Affine_Space &y, Complexity_Class complexity=ANY_COMPLEXITY)
 Ordinary copy constructor. More...
 
Affine_Spaceoperator= (const Affine_Space &y)
 The assignment operator. (*this and y can be dimension-incompatible.) More...
 
Member Functions that Do Not Modify the Affine_Space
dimension_type space_dimension () const
 Returns the dimension of the vector space enclosing *this. More...
 
dimension_type affine_dimension () const
 Returns $0$, if *this is empty; otherwise, returns affine dimension of *this. More...
 
Constraint_System constraints () const
 Returns a system of equality constraints satisfied by *this with the same affine dimension as *this. More...
 
Constraint_System minimized_constraints () const
 Returns a minimal system of equality constraints satisfied by *this with the same affine dimension as *this. More...
 
const Congruence_Systemcongruences () const
 Returns the system of equality congruences satisfied by *this. More...
 
const Congruence_Systemminimized_congruences () const
 Returns the system of equality congruences satisfied by *this, with no redundant congruences and having the same affine dimension as *this. More...
 
Generator_System generators () const
 Returns a system of generators defining *this. More...
 
Generator_System minimized_generators () const
 Returns a minimized system of generators defining *this. 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...
 
Poly_Con_Relation relation_with (const Constraint &c) const
 Returns the relations holding between *this and c. More...
 
bool is_empty () const
 Returns true if and only if *this is an empty affine space. More...
 
bool is_universe () const
 Returns true if and only if *this is a universe affine space. More...
 
bool is_topologically_closed () const
 Returns true if and only if *this is a topologically closed subset of the vector space. More...
 
bool is_disjoint_from (const Affine_Space &y) const
 Returns true if and only if *this and y are disjoint. More...
 
bool is_discrete () const
 Returns true if and only if *this is discrete. More...
 
bool is_bounded () const
 Returns true if and only if *this is bounded. More...
 
bool contains_integer_point () const
 Returns true if and only if *this contains at least one integer point. 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 &point) const
 Returns true if and only if *this is not empty and expr is bounded from above in *this, in which case the supremum value and a point where expr reaches it are computed. More...
 
bool minimize (const Linear_Expression &expr, Coefficient &inf_n, Coefficient &inf_d, bool &minimum) const
 Returns true if and only if *this is not empty and expr is bounded from below in *this, in which case the infimum value is computed. More...
 
bool minimize (const Linear_Expression &expr, Coefficient &inf_n, Coefficient &inf_d, bool &minimum, Generator &point) const
 Returns true if and only if *this is not empty and expr is bounded from below in *this, in which case the infimum value and a point where expr reaches it are computed. More...
 
bool frequency (const Linear_Expression &expr, Coefficient &freq_n, Coefficient &freq_d, Coefficient &val_n, Coefficient &val_d) const
 Returns true if and only if *this is not empty and expr is discrete in *this, in which case the maximum frequency and the value for expr that is closest to zero are computed. More...
 
bool contains (const Affine_Space &y) const
 Returns true if and only if *this contains y. More...
 
bool strictly_contains (const Affine_Space &y) const
 Returns true if and only if *this strictly contains y. More...
 
bool OK (bool check_not_empty=false) const
 Checks if all the invariants are satisfied. More...
 
Space Dimension Preserving Member Functions that May Modify the Affine_Space
void add_congruence (const Congruence &cg)
 Adds a copy of congruence cg to *this. More...
 
void add_generator (const Generator &g)
 Adds a copy of affine space generator g to the system of generators of *this. More...
 
void add_congruences (const Congruence_System &cgs)
 Adds a copy of each congruence in cgs to *this. More...
 
void add_recycled_congruences (Congruence_System &cgs)
 Adds the congruences in cgs to *this. More...
 
void add_constraint (const Constraint &c)
 Adds to *this a congruence equivalent to constraint c. More...
 
void add_constraints (const Constraint_System &cs)
 Adds to *this congruences equivalent to the constraints in cs. More...
 
void add_recycled_constraints (Constraint_System &cs)
 Adds to *this congruences equivalent to the constraints in cs. More...
 
void refine_with_congruence (const Congruence &cg)
 Uses a copy of the congruence cg to refine *this. More...
 
void refine_with_congruences (const Congruence_System &cgs)
 Uses a copy of the congruences in cgs to refine *this. More...
 
void refine_with_constraint (const Constraint &c)
 Uses a copy of the constraint c to refine *this. More...
 
void refine_with_constraints (const Constraint_System &cs)
 Uses a copy of the constraints in cs to refine *this. More...
 
void add_generators (const Generator_System &gs)
 Adds a copy of the generators in gs to the system of generators of *this. More...
 
void add_recycled_generators (Generator_System &gs)
 Adds the generators in gs to the system of generators of 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 Affine_Space &y)
 Assigns to *this the intersection of *this and y. More...
 
void upper_bound_assign (const Affine_Space &y)
 Assigns to *this the least upper bound of *this and y. More...
 
bool upper_bound_assign_if_exact (const Affine_Space &y)
 If the upper bound of *this and y is exact it is assigned to this and true is returned, otherwise false is returned. More...
 
void difference_assign (const Affine_Space &y)
 Assigns to *this the poly-difference of *this and y. More...
 
bool simplify_using_context_assign (const Affine_Space &y)
 Assigns to *this a meet-preserving simplification of *this with respect to y. If false is returned, then the intersection is empty. More...
 
void affine_image (Variable var, const Linear_Expression &expr, Coefficient_traits::const_reference denominator=Coefficient_one())
 Assigns to *this the affine image of *this under the function mapping variable var to the affine expression specified by expr and denominator. More...
 
void affine_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}' = \frac{\mathrm{expr}}{\mathrm{denominator}} \pmod{\mathrm{modulus}}$. 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}' = \frac{\mathrm{expr}}{\mathrm{denominator}} \pmod{\mathrm{modulus}}$. 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}' = \mathrm{rhs} \pmod{\mathrm{modulus}}$. 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}' = \mathrm{rhs} \pmod{\mathrm{modulus}}$. 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 Affine_Space &y)
 Assigns to *this the result of computing the time-elapse between *this and y. More...
 
void topological_closure_assign ()
 Assigns to *this its topological closure. More...
 
void widening_assign (const Affine_Space &y, unsigned *tp=NULL)
 Does nothing, as the domain of affine spaces has finite height. More...
 
void limited_extrapolation_assign (const Affine_Space &y, const Constraint_System &cs, unsigned *tp=NULL)
 Does nothing, as the domain of affine spaces has finite height. 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 old affine space in the new vector space. More...
 
void add_space_dimensions_and_project (dimension_type m)
 Adds m new space dimensions to the affine space and does not embed it in the new vector space. More...
 
void concatenate_assign (const Affine_Space &y)
 Assigns to *this the concatenation of *this and y, taken in this order. 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 &to_be_folded, Variable var)
 Folds the space dimensions in to_be_folded into var. More...
 
Miscellaneous Member Functions
 ~Affine_Space ()
 Destructor. More...
 
void m_swap (Affine_Space &y)
 Swaps *this with affine space 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 all kinds of Affine_Space can handle. More...
 
static bool can_recycle_constraint_systems ()
 Returns true indicating that this domain has methods that can recycle constraints. More...
 
static bool can_recycle_congruence_systems ()
 Returns true indicating that this domain has methods that can recycle congruences. More...
 

Private Attributes

Grid gr
 The rational grid implementing *this. More...
 

Friends

bool operator== (const Affine_Space &x, const Affine_Space &y)
 

Related Functions

(Note that these are not member functions.)

bool operator== (const Affine_Space &x, const Affine_Space &y)
 
std::ostream & operator<< (std::ostream &s, const Affine_Space &gr)
 
std::ostream & operator<< (std::ostream &s, const Affine_Space &gr)
 Output operator. More...
 
void swap (Affine_Space &x, Affine_Space &y)
 Swaps x with y. More...
 
bool operator== (const Affine_Space &x, const Affine_Space &y)
 Returns true if and only if x and y are the same affine space. More...
 
bool operator!= (const Affine_Space &x, const Affine_Space &y)
 Returns true if and only if x and y are different affine spaces. More...
 
bool operator!= (const Affine_Space &x, const Affine_Space &y)
 
void swap (Affine_Space &x, Affine_Space &y)
 

Exception Throwers

void throw_dimension_incompatible (const char *method, const char *other_name, dimension_type other_dim) const
 
void throw_dimension_incompatible (const char *method, const char *as_name, const Affine_Space &as) const
 
void throw_invalid_constraint (const char *method, const char *c_name) const
 
void throw_invalid_constraints (const char *method, const char *cs_name) const
 
void throw_invalid_generator (const char *method, const char *g_name) const
 
void throw_invalid_generators (const char *method, const char *gs_name) const
 
static void throw_space_dimension_overflow (const char *method, const char *reason)
 

Detailed Description

An affine space.

An object of the class Affine_Space represents an affine space in the vector space $\Rset^n$.

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

The domain of affine spaces support a concept of double description similar to the one developed for polyhedra: hence, an affine space can be specified as either a finite system of equalities or a finite system of generators (see Section Representations of Convex Polyhedra) and it is always possible to obtain either representation. That is, if we know the system of equalities, we can obtain from this a system of generators that define the same affine space and vice versa. These systems can contain redundant members, or they can be in the minimal form.

A key attribute of any affine space is its space dimension (the dimension $n \in \Nset$ of the enclosing vector space):

  • all affine spaces, the empty ones included, are endowed with a space dimension;
  • most operations working on an affine space and another object (another affine space, a congruence, a generator, a set of variables, etc.) will throw an exception if the affine space and the object are not dimension-compatible (see Section Representations of Convex Polyhedra);
  • the only ways in which the space dimension of an affine space can be changed are with explicit calls to operators provided for that purpose, and with standard copy, assignment and swap operators.

Note that two different affine spaces can be defined on the zero-dimension space: the empty affine space and the universe affine space $R^0$.

In all the examples it is assumed that variables x and y are defined (where they are used) as follows:
Variable x(0);
Variable y(1);

FIXME: revise the contents below this point of this comment block.

Example 1
The following code builds an affine space corresponding to the 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);
The following code builds the same affine space as above, but starting from a system of generators specifying three of the points:
Affine_Space_Generator_System gs;
gs.insert(affine space_point(0*x + 0*y));
gs.insert(affine space_point(0*x + 2*y));
gs.insert(affine space_point(2*x + 0*y));
Example 2
The following code builds an affine space corresponding to a line in $\Rset^2$ by adding a single congruence to the universe affine space:
Congruence_System cgs;
cgs.insert(x - y == 0);
The following code builds the same affine space as above, but starting from a system of generators specifying a point and a line:
Affine_Space_Generator_System gs;
gs.insert(affine space_point(0*x + 0*y));
gs.insert(affine space_line(x + y));
Example 3
The following code builds an affine space corresponding to the integral points on the line $x = y$ in $\Rset^2$ constructed by adding an equality and congruence to the universe affine space:
Congruence_System cgs;
cgs.insert(x - y == 0);
cgs.insert(x %= 0);
The following code builds the same affine space as above, but starting from a system of generators specifying a point and a parameter:
Affine_Space_Generator_System gs;
gs.insert(affine space_point(0*x + 0*y));
gs.insert(parameter(x + y));
Example 4
The following code builds the affine space corresponding to a plane by creating the universe affine space in $\Rset^2$: The following code builds the same affine space as above, but starting from the empty affine space in $\Rset^2$ and inserting the appropriate generators (a point, and two lines).
gr.add_grid_generator(affine space_point(0*x + 0*y));
gr.add_grid_generator(affine space_line(x));
gr.add_grid_generator(affine space_line(y));
Note that a generator system must contain a point when describing an affine space. To ensure that this is always the case it is required that the first generator inserted in an empty affine space is a point (otherwise, an exception is thrown).
Example 5
The following code shows the use of the function add_space_dimensions_and_embed: We build the universe affine space in the 1-dimension space $\Rset$. Then we add a single equality congruence, thus obtaining the affine space corresponding to the singleton set $\{ 2 \} \sseq \Rset$. After the last line of code, the resulting affine space is

\[ \bigl\{\, (2, y)^\transpose \in \Rset^2 \bigm| y \in \Rset \,\bigr\}. \]

Example 6
The following code shows the use of the function add_space_dimensions_and_project: The first two lines of code are the same as in Example 4 for add_space_dimensions_and_embed. After the last line of code, the resulting affine space is the singleton set $\bigl\{ (2, 0)^\transpose \bigr\} \sseq \Rset^2$.
Example 7
The following code shows the use of the function affine_image:
gr.add_grid_generator(affine space_point(0*x + 0*y));
gr.add_grid_generator(affine space_point(4*x + 0*y));
gr.add_grid_generator(affine space_point(0*x + 2*y));
Linear_Expression expr = x + 3;
gr.affine_image(x, expr);
In this example the starting affine space is all the pairs of $x$ and $y$ in $\Rset^2$ where $x$ is an integer multiple of 4 and $y$ is an integer multiple of 2. The considered variable is $x$ and the affine expression is $x+3$. The resulting affine space is the given affine space translated 3 integers to the right (all the pairs $(x, y)$ where $x$ is -1 plus an integer multiple of 4 and $y$ is an integer multiple of 2). Moreover, if the affine transformation for the same variable x is instead $x+y$:
Linear_Expression expr = x + y;
the resulting affine space is every second integral point along the $x=y$ line, with this line of points repeated at every fourth integral value along the $x$ axis. Instead, if we do not use an invertible transformation for the same variable; for example, the affine expression $y$:
Linear_Expression expr = y;
the resulting affine space is every second point along the $x=y$ line.
Example 8
The following code shows the use of the function affine_preimage:
gr.add_grid_generator(affine space_point(0*x + 0*y));
gr.add_grid_generator(affine space_point(4*x + 0*y));
gr.add_grid_generator(affine space_point(0*x + 2*y));
Linear_Expression expr = x + 3;
In this example the starting affine space, var and the affine expression and the denominator are the same as in Example 6, while the resulting affine space is similar but translated 3 integers to the left (all the pairs $(x, y)$ where $x$ is -3 plus an integer multiple of 4 and $y$ is an integer multiple of 2).. Moreover, if the affine transformation for x is $x+y$
Linear_Expression expr = x + y;
the resulting affine space is a similar affine space to the result in Example 6, only the affine space is slanted along $x=-y$. Instead, if we do not use an invertible transformation for the same variable x, for example, the affine expression $y$:
Linear_Expression expr = y;
the resulting affine space is every fourth line parallel to the $x$ axis.
Example 9
For this example we also use the variables:
Variable z(2);
Variable w(3);
The following code shows the use of the function remove_space_dimensions:
Affine_Space_Generator_System gs;
gs.insert(affine space_point(3*x + y +0*z + 2*w));
Variables_Set vars;
vars.insert(y);
vars.insert(z);
The starting affine space is the singleton set $\bigl\{ (3, 1, 0, 2)^\transpose \bigr\} \sseq \Rset^4$, while the resulting affine space is $\bigl\{ (3, 2)^\transpose \bigr\} \sseq \Rset^2$. Be careful when removing space dimensions incrementally: since dimensions are automatically renamed after each application of the remove_space_dimensions operator, unexpected results can be obtained. For instance, by using the following code we would obtain a different result:
set<Variable> vars1;
vars1.insert(y);
set<Variable> vars2;
vars2.insert(z);
In this case, the result is the affine space $\bigl\{(3, 0)^\transpose \bigr\} \sseq \Rset^2$: when removing the set of dimensions vars2 we are actually removing variable $w$ of the original affine space. For the same reason, the operator remove_space_dimensions is not idempotent: removing twice the same non-empty set of dimensions is never the same as removing them just once.

Definition at line 357 of file Affine_Space_defs.hh.

Member Typedef Documentation

The numeric type of coefficients.

Definition at line 360 of file Affine_Space_defs.hh.

Constructor & Destructor Documentation

Parma_Polyhedra_Library::Affine_Space::Affine_Space ( dimension_type  num_dimensions = 0,
Degenerate_Element  kind = UNIVERSE 
)
inlineexplicit

Builds an affine space having the specified properties.

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

Definition at line 35 of file Affine_Space_inlines.hh.

Referenced by Affine_Space().

37  : gr(num_dimensions, kind) {
38 }
Grid gr
The rational grid implementing *this.
Parma_Polyhedra_Library::Affine_Space::Affine_Space ( const Constraint_System cs)
inlineexplicit

Builds an affine space, copying a system of constraints.

The affine space inherits the space dimension of the constraint system.

Parameters
csThe system of constraints defining the affine space.
Exceptions
std::invalid_argumentThrown if the constraint system cs contains inequality constraints.
std::length_errorThrown if num_dimensions exceeds the maximum allowed space dimension.

Definition at line 47 of file Affine_Space_inlines.hh.

48  : gr(cs) {
49 }
Grid gr
The rational grid implementing *this.
Parma_Polyhedra_Library::Affine_Space::Affine_Space ( Constraint_System cs,
Recycle_Input  dummy 
)
inline

Builds an affine space, recycling a system of constraints.

The affine space inherits the space dimension of the constraint system.

Parameters
csThe system of constraints defining the affine space. Its data-structures may be recycled to build the affine space.
dummyA dummy tag to syntactically differentiate this one from the other constructors.
Exceptions
std::invalid_argumentThrown if the constraint system cs contains inequality constraints.
std::length_errorThrown if num_dimensions exceeds the maximum allowed space dimension.

Definition at line 52 of file Affine_Space_inlines.hh.

53  : gr(cs, ri) {
54 }
Grid gr
The rational grid implementing *this.
Parma_Polyhedra_Library::Affine_Space::Affine_Space ( const Generator_System gs)
explicit

Builds an affine space, copying a system of affine space generators.

The affine space inherits the space dimension of the generator system.

Parameters
gsThe system of generators defining the affine space.
Exceptions
std::invalid_argumentThrown if the system of generators contains rays or is not empty but has no points.
std::length_errorThrown if num_dimensions exceeds the maximum allowed space dimension.

Definition at line 30 of file Affine_Space.cc.

References Parma_Polyhedra_Library::Linear_Expression::all_homogeneous_terms_are_zero(), Parma_Polyhedra_Library::Generator_System::begin(), Parma_Polyhedra_Library::EMPTY, Parma_Polyhedra_Library::Generator_System::end(), gr, Parma_Polyhedra_Library::Grid_Generator_System::insert(), Parma_Polyhedra_Library::Linear_Expression::linear_combine(), Parma_Polyhedra_Library::Grid::m_swap(), OK(), PPL_DIRTY_TEMP_COEFFICIENT, and Parma_Polyhedra_Library::Generator_System::space_dimension().

30  {
31  dimension_type space_dim = gs.space_dimension();
32  // First find a point or closure point and convert it to a
33  // grid point and add to the (initially empty) set of grid generators.
34  Grid_Generator_System ggs(space_dim);
35  Linear_Expression point_expr;
36  PPL_DIRTY_TEMP_COEFFICIENT(point_divisor);
37  for (Generator_System::const_iterator g = gs.begin(),
38  gs_end = gs.end(); g != gs_end; ++g) {
39  if (g->is_ray()) {
40  throw std::invalid_argument("Affine_Space::Affine_Space(gs):\n"
41  "gs contains rays.");
42  }
43  else if (g->is_point() || g->is_closure_point()) {
44  point_expr = Linear_Expression(*g);
45  ggs.insert(grid_point(point_expr, g->divisor()));
46  goto non_empty;
47  }
48  }
49  // No (closure) point was found.
50  Grid(EMPTY).m_swap(gr);
51  return;
52 
53  non_empty:
54  // Add a grid line for each line. If the generator is a (closure)
55  // point, the grid line must have the direction given by a line
56  // that joins the grid point already inserted and the new point.
58  PPL_DIRTY_TEMP_COEFFICIENT(g_divisor);
59  for (Generator_System::const_iterator g = gs.begin(),
60  gs_end = gs.end(); g != gs_end; ++g) {
61  if (g->is_point() || g->is_closure_point()) {
62  Linear_Expression e = point_expr;
63  e.linear_combine(g->expression(), g->divisor(), -point_divisor,
64  1, space_dim + 1);
65  if (!e.all_homogeneous_terms_are_zero()) {
66  ggs.insert(grid_line(e));
67  }
68  }
69  else {
70  ggs.insert(grid_line(Linear_Expression(*g)));
71  }
72  }
73  Grid(ggs).m_swap(gr);
74  PPL_ASSERT(OK());
75 }
The empty element, i.e., the empty set.
bool OK(bool check_not_empty=false) const
Checks if all the invariants are satisfied.
size_t dimension_type
An unsigned integral type for representing space dimensions.
#define PPL_DIRTY_TEMP_COEFFICIENT(id)
Declare a local variable named id, of type Coefficient, and containing an unknown initial value...
Grid gr
The rational grid implementing *this.
Generator_System_const_iterator const_iterator
Parma_Polyhedra_Library::Affine_Space::Affine_Space ( Generator_System gs,
Recycle_Input  dummy 
)
inline

Builds an affine space, recycling a system of generators.

The affine space inherits the space dimension of the generator system.

Parameters
gsThe system of generators defining the affine space. Its data-structures may be recycled to build the affine space.
dummyA dummy tag to syntactically differentiate this one from the other constructors.
Exceptions
std::invalid_argumentThrown if the system of generators contains rays or is not empty but has no points.
std::length_errorThrown if num_dimensions exceeds the maximum allowed space dimension.

Definition at line 63 of file Affine_Space_inlines.hh.

References Affine_Space().

64  : gr(EMPTY) {
65  Affine_Space(gs).m_swap(*this);
66 }
The empty element, i.e., the empty set.
Grid gr
The rational grid implementing *this.
Affine_Space(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds an affine space having the specified properties.
template<typename Interval >
Parma_Polyhedra_Library::Affine_Space::Affine_Space ( const Box< Interval > &  box,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
explicit

Builds an affine space out of a box.

The affine space inherits the space dimension of the box. The built affine space is the most precise affine space that includes the box.

Parameters
boxThe box representing the affine space to be built.
complexityThis argument is ignored as the algorithm used has polynomial complexity.
Exceptions
std::length_errorThrown if the space dimension of box exceeds the maximum allowed space dimension.
template<typename U >
Parma_Polyhedra_Library::Affine_Space::Affine_Space ( const BD_Shape< U > &  bd,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
inlineexplicit

Builds an affine space out of a bounded-difference shape.

The affine space inherits the space dimension of the BDS. The built affine space is the most precise affine space that includes the BDS.

Parameters
bdThe BDS representing the affine space to be built.
complexityThis argument is ignored as the algorithm used has polynomial complexity.
Exceptions
std::length_errorThrown if the space dimension of bd exceeds the maximum allowed space dimension.

Definition at line 70 of file Affine_Space_inlines.hh.

72  : gr(bd, complexity) {
73 }
Grid gr
The rational grid implementing *this.
template<typename U >
Parma_Polyhedra_Library::Affine_Space::Affine_Space ( const Octagonal_Shape< U > &  os,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
inlineexplicit

Builds an affine space out of an octagonal shape.

The affine space inherits the space dimension of the octagonal shape. The built affine space is the most precise affine space that includes the octagonal shape.

Parameters
osThe octagonal shape representing the affine space to be built.
complexityThis argument is ignored as the algorithm used has polynomial complexity.
Exceptions
std::length_errorThrown if the space dimension of os exceeds the maximum allowed space dimension.

Definition at line 77 of file Affine_Space_inlines.hh.

79  : gr(os, complexity) {
80 }
Grid gr
The rational grid implementing *this.
Parma_Polyhedra_Library::Affine_Space::Affine_Space ( const Polyhedron ph,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
inlineexplicit

Builds an affine space from a polyhedron using algorithms whose complexity does not exceed the one specified by complexity. If complexity is ANY_COMPLEXITY, then the affine space built is the smallest one containing ph.

The affine space inherits the space dimension of ph.

Parameters
phThe polyhedron.
complexityThe complexity class.
Exceptions
std::length_errorThrown if num_dimensions exceeds the maximum allowed space dimension.

Definition at line 57 of file Affine_Space_inlines.hh.

59  : gr(ph, complexity) {
60 }
Grid gr
The rational grid implementing *this.
Parma_Polyhedra_Library::Affine_Space::Affine_Space ( const Affine_Space y,
Complexity_Class  complexity = ANY_COMPLEXITY 
)
inline

Ordinary copy constructor.

The complexity argument is ignored.

Definition at line 41 of file Affine_Space_inlines.hh.

43  : gr(y.gr, complexity) {
44 }
Grid gr
The rational grid implementing *this.
Parma_Polyhedra_Library::Affine_Space::~Affine_Space ( )
inline

Destructor.

Definition at line 83 of file Affine_Space_inlines.hh.

83  {
84 }

Member Function Documentation

void Parma_Polyhedra_Library::Affine_Space::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 117 of file Affine_Space_inlines.hh.

References Parma_Polyhedra_Library::Grid::add_congruence(), and gr.

117  {
118  gr.add_congruence(cg);
119 }
Grid gr
The rational grid implementing *this.
void add_congruence(const Congruence &cg)
Adds a copy of congruence cg to *this.
void Parma_Polyhedra_Library::Affine_Space::add_congruences ( const Congruence_System cgs)
inline

Adds a copy of each congruence in cgs to *this.

Parameters
cgsContains the congruences that will be added to the system of congruences of *this.
Exceptions
std::invalid_argumentThrown if *this and cgs are dimension-incompatible.

Definition at line 122 of file Affine_Space_inlines.hh.

References Parma_Polyhedra_Library::Grid::add_congruences(), and gr.

122  {
123  gr.add_congruences(cgs);
124 }
void add_congruences(const Congruence_System &cgs)
Adds a copy of each congruence in cgs to *this.
Grid gr
The rational grid implementing *this.
void Parma_Polyhedra_Library::Affine_Space::add_constraint ( const Constraint c)
inline

Adds to *this a congruence equivalent to constraint c.

Parameters
cThe constraint to be added.
Exceptions
std::invalid_argumentThrown if *this and c are dimension-incompatible or if constraint c is not optimally supported by the affine space domain.

Definition at line 147 of file Affine_Space_inlines.hh.

References Parma_Polyhedra_Library::Grid::add_constraint(), and gr.

147  {
149 }
Grid gr
The rational grid implementing *this.
void add_constraint(const Constraint &c)
Adds to *this a congruence equivalent to constraint c.
Coefficient c
Definition: PIP_Tree.cc:64
void Parma_Polyhedra_Library::Affine_Space::add_constraints ( const Constraint_System cs)

Adds to *this congruences equivalent to the constraints in cs.

Parameters
csThe constraints to be added.
Exceptions
std::invalid_argumentThrown if *this and cs are dimension-incompatible or if cs contains a constraint whcih is not optimally supported by the affine space domain.

Definition at line 167 of file Affine_Space.cc.

167  {
168  gr.add_constraints(cs);
169 }
void add_constraints(const Constraint_System &cs)
Adds to *this congruences equivalent to the constraints in cs.
Grid gr
The rational grid implementing *this.
void Parma_Polyhedra_Library::Affine_Space::add_generator ( const Generator g)

Adds a copy of affine space generator g to the system of generators of *this.

Exceptions
std::invalid_argumentThrown if *this and generator g are dimension-incompatible, or if *this is an empty affine space and g is not a point.

Definition at line 172 of file Affine_Space.cc.

172  {
173  // FIXME: do we want this method?
174  abort();
175 }
void Parma_Polyhedra_Library::Affine_Space::add_generators ( const Generator_System gs)

Adds a copy of the generators in gs to the system of generators of *this.

Parameters
gsContains the generators that will be added to the system of generators of *this.
Exceptions
std::invalid_argumentThrown if *this and gs are dimension-incompatible, or if *this is empty and the system of generators gs is not empty, but has no points.

Definition at line 190 of file Affine_Space.cc.

190  {
191  // FIXME: do we want this method?
192  abort();
193 }
void Parma_Polyhedra_Library::Affine_Space::add_recycled_congruences ( Congruence_System cgs)

Adds the congruences in cgs to *this.

Parameters
cgsThe congruence system to be added to *this. The congruences in cgs 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 178 of file Affine_Space.cc.

178  {
179  // FIXME: do we want this method?
180  abort();
181 }
void Parma_Polyhedra_Library::Affine_Space::add_recycled_constraints ( Constraint_System cs)
inline

Adds to *this congruences equivalent to the constraints in cs.

Parameters
csThe constraints to be added. They may be recycled.
Exceptions
std::invalid_argumentThrown if *this and cs are dimension-incompatible or if cs contains a constraint whcih is not optimally supported by the affine space domain.
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 152 of file Affine_Space_inlines.hh.

References Parma_Polyhedra_Library::Grid::add_recycled_constraints(), and gr.

152  {
154 }
Grid gr
The rational grid implementing *this.
void add_recycled_constraints(Constraint_System &cs)
Adds to *this congruences equivalent to the constraints in cs.
void Parma_Polyhedra_Library::Affine_Space::add_recycled_generators ( Generator_System gs)

Adds the generators in gs to the system of generators of this.

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

Definition at line 184 of file Affine_Space.cc.

184  {
185  // FIXME: do we want this method?
186  abort();
187 }
void Parma_Polyhedra_Library::Affine_Space::add_space_dimensions_and_embed ( dimension_type  m)

Adds m new space dimensions and embeds the old affine space 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().

The new space dimensions will be those having the highest indexes in the new affine space, which is characterized by a system of congruences in which the variables which are the new dimensions can have any value. For instance, when starting from the affine space $\cL \sseq \Rset^2$ and adding a third space dimension, the result will be the affine space

\[ \bigl\{\, (x, y, z)^\transpose \in \Rset^3 \bigm| (x, y)^\transpose \in \cL \,\bigr\}. \]

Definition at line 351 of file Affine_Space.cc.

351  {
353 }
void add_space_dimensions_and_embed(dimension_type m)
Adds m new space dimensions and embeds the old grid in the new vector space.
Definition: Grid_chdims.cc:77
Grid gr
The rational grid implementing *this.
void Parma_Polyhedra_Library::Affine_Space::add_space_dimensions_and_project ( dimension_type  m)

Adds m new space dimensions to the affine space and does not embed it 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().

The new space dimensions will be those having the highest indexes in the new affine space, which is characterized by a system of congruences in which the variables running through the new dimensions are all constrained to be equal to 0. For instance, when starting from the affine space $\cL \sseq \Rset^2$ and adding a third space dimension, the result will be the affine space

\[ \bigl\{\, (x, y, 0)^\transpose \in \Rset^3 \bigm| (x, y)^\transpose \in \cL \,\bigr\}. \]

Definition at line 356 of file Affine_Space.cc.

356  {
358 }
Grid gr
The rational grid implementing *this.
void add_space_dimensions_and_project(dimension_type m)
Adds m new space dimensions to the grid and does not embed it in the new vector space.
Definition: Grid_chdims.cc:154
PPL::dimension_type Parma_Polyhedra_Library::Affine_Space::affine_dimension ( ) const

Returns $0$, if *this is empty; otherwise, returns affine dimension of *this.

Definition at line 85 of file Affine_Space.cc.

85  {
86  return gr.affine_dimension();
87 }
Grid gr
The rational grid implementing *this.
dimension_type affine_dimension() const
Returns , if *this is empty; otherwise, returns the affine dimension of *this.
Definition: Grid_public.cc:273
void Parma_Polyhedra_Library::Affine_Space::affine_image ( Variable  var,
const Linear_Expression expr,
Coefficient_traits::const_reference  denominator = Coefficient_one() 
)

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

Parameters
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.

When considering the generators of an affine space, the affine transformation

\[ \frac{\sum_{i=0}^{n-1} a_i x_i + b}{\mathrm{denominator}} \]

is assigned to var where expr is $\sum_{i=0}^{n-1} a_i x_i + b$ ( $b$ is the inhomogeneous term).

If congruences are up-to-date, it uses the specialized function affine_preimage() (for the system of congruences) and inverse transformation to reach the same result. To obtain the inverse transformation we use the following observation.

Observation:

  1. The affine transformation is invertible if the coefficient of var in this transformation (i.e., $a_\mathrm{var}$) is different from zero.
  2. If the transformation is invertible, then we can write

    \[ \mathrm{denominator} * {x'}_\mathrm{var} = \sum_{i = 0}^{n - 1} a_i x_i + b = a_\mathrm{var} x_\mathrm{var} + \sum_{i \neq var} a_i x_i + b, \]

    so that the inverse transformation is

    \[ a_\mathrm{var} x_\mathrm{var} = \mathrm{denominator} * {x'}_\mathrm{var} - \sum_{i \neq j} a_i x_i - b. \]

Then, if the transformation is invertible, all the entities that were up-to-date remain up-to-date. Otherwise only generators remain up-to-date.

Definition at line 244 of file Affine_Space.cc.

247  {
248  gr.affine_image(var, expr, denominator);
249 }
Grid gr
The rational grid implementing *this.
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 expre...
void Parma_Polyhedra_Library::Affine_Space::affine_preimage ( Variable  var,
const Linear_Expression expr,
Coefficient_traits::const_reference  denominator = Coefficient_one() 
)

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

Parameters
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 253 of file Affine_Space.cc.

255  {
256  gr.affine_preimage(var, expr, denominator);
257 }
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 e...
Grid gr
The rational grid implementing *this.
void Parma_Polyhedra_Library::Affine_Space::ascii_dump ( ) const

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

void Parma_Polyhedra_Library::Affine_Space::ascii_dump ( std::ostream &  s) const

Writes to s an ASCII representation of *this.

Definition at line 334 of file Affine_Space.cc.

334  {
335  gr.ascii_dump(s);
336 }
void ascii_dump() const
Writes to std::cerr an ASCII representation of *this.
Grid gr
The rational grid implementing *this.
bool Parma_Polyhedra_Library::Affine_Space::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 341 of file Affine_Space.cc.

341  {
342  return gr.ascii_load(s);
343 }
bool ascii_load(std::istream &s)
Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this ...
Grid gr
The rational grid implementing *this.
void Parma_Polyhedra_Library::Affine_Space::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}}$.

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 295 of file Affine_Space.cc.

298  {
299  gr.bounded_affine_image(var, lb_expr, ub_expr, denominator);
300 }
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 . ...
Grid gr
The rational grid implementing *this.
void Parma_Polyhedra_Library::Affine_Space::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}}$.

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 305 of file Affine_Space.cc.

308  {
309  gr.bounded_affine_preimage(var, lb_expr, ub_expr, denominator);
310 }
Grid gr
The rational grid implementing *this.
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 ...
bool Parma_Polyhedra_Library::Affine_Space::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 157 of file Affine_Space_inlines.hh.

References Parma_Polyhedra_Library::Grid::bounds_from_above(), and gr.

157  {
158  return gr.bounds_from_above(expr);
159 }
bool bounds_from_above(const Linear_Expression &expr) const
Returns true if and only if expr is bounded in *this.
Grid gr
The rational grid implementing *this.
bool Parma_Polyhedra_Library::Affine_Space::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 162 of file Affine_Space_inlines.hh.

References Parma_Polyhedra_Library::Grid::bounds_from_below(), and gr.

162  {
163  return gr.bounds_from_below(expr);
164 }
Grid gr
The rational grid implementing *this.
bool bounds_from_below(const Linear_Expression &expr) const
Returns true if and only if expr is bounded in *this.
bool Parma_Polyhedra_Library::Affine_Space::can_recycle_congruence_systems ( )
inlinestatic

Returns true indicating that this domain has methods that can recycle congruences.

Definition at line 142 of file Affine_Space_inlines.hh.

References Parma_Polyhedra_Library::Grid::can_recycle_congruence_systems().

142  {
144 }
static bool can_recycle_congruence_systems()
Returns true indicating that this domain has methods that can recycle congruences.
bool Parma_Polyhedra_Library::Affine_Space::can_recycle_constraint_systems ( )
inlinestatic

Returns true indicating that this domain has methods that can recycle constraints.

Definition at line 137 of file Affine_Space_inlines.hh.

References Parma_Polyhedra_Library::Grid::can_recycle_constraint_systems().

137  {
139 }
static bool can_recycle_constraint_systems()
Returns true indicating that this domain has methods that can recycle constraints.
void Parma_Polyhedra_Library::Affine_Space::concatenate_assign ( const Affine_Space y)

Assigns to *this the concatenation of *this and y, taken in this order.

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

Definition at line 361 of file Affine_Space.cc.

References gr.

361  {
362  gr.concatenate_assign(y.gr);
363 }
Grid gr
The rational grid implementing *this.
void concatenate_assign(const Grid &y)
Assigns to *this the concatenation of *this and y, taken in this order.
Definition: Grid_chdims.cc:225
const PPL::Congruence_System & Parma_Polyhedra_Library::Affine_Space::congruences ( ) const

Returns the system of equality congruences satisfied by *this.

Definition at line 90 of file Affine_Space.cc.

90  {
91  return gr.congruences();
92 }
const Congruence_System & congruences() const
Returns the system of congruences.
Definition: Grid_public.cc:300
Grid gr
The rational grid implementing *this.
bool Parma_Polyhedra_Library::Affine_Space::constrains ( Variable  var) const

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 157 of file Affine_Space.cc.

157  {
158  return gr.constrains(var);
159 }
bool constrains(Variable var) const
Returns true if and only if var is constrained in *this.
Definition: Grid_public.cc:886
Grid gr
The rational grid implementing *this.
Constraint_System Parma_Polyhedra_Library::Affine_Space::constraints ( ) const
inline

Returns a system of equality constraints satisfied by *this with the same affine dimension as *this.

Definition at line 102 of file Affine_Space_inlines.hh.

References Parma_Polyhedra_Library::Grid::constraints(), and gr.

102  {
103  return gr.constraints();
104 }
Grid gr
The rational grid implementing *this.
Constraint_System constraints() const
Returns a system of equality constraints satisfied by *this with the same affine dimension as *this...
bool Parma_Polyhedra_Library::Affine_Space::contains ( const Affine_Space y) const

Returns true if and only if *this contains y.

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

Definition at line 324 of file Affine_Space.cc.

References gr.

324  {
325  return gr.contains(y.gr);
326 }
Grid gr
The rational grid implementing *this.
bool contains(const Grid &y) const
Returns true if and only if *this contains y.
bool Parma_Polyhedra_Library::Affine_Space::contains_integer_point ( ) const

Returns true if and only if *this contains at least one integer point.

Definition at line 152 of file Affine_Space.cc.

152  {
153  return gr.contains_integer_point();
154 }
bool contains_integer_point() const
Returns true if and only if *this contains at least one integer point.
Definition: Grid_public.cc:861
Grid gr
The rational grid implementing *this.
void Parma_Polyhedra_Library::Affine_Space::difference_assign ( const Affine_Space y)

Assigns to *this the poly-difference of *this and y.

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

Definition at line 234 of file Affine_Space.cc.

References gr.

234  {
235  gr.difference_assign(y.gr);
236 }
void difference_assign(const Grid &y)
Assigns to *this the grid-difference of *this and y.
Grid gr
The rational grid implementing *this.
void Parma_Polyhedra_Library::Affine_Space::expand_space_dimension ( Variable  var,
dimension_type  m 
)

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 377 of file Affine_Space.cc.

377  {
378  gr.expand_space_dimension(var, m);
379 }
void expand_space_dimension(Variable var, dimension_type m)
Creates m copies of the space dimension corresponding to var.
Definition: Grid_chdims.cc:406
Grid gr
The rational grid implementing *this.
PPL::memory_size_type Parma_Polyhedra_Library::Affine_Space::external_memory_in_bytes ( ) const

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

Definition at line 346 of file Affine_Space.cc.

346  {
347  return gr.external_memory_in_bytes();
348 }
memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
Grid gr
The rational grid implementing *this.
void Parma_Polyhedra_Library::Affine_Space::fold_space_dimensions ( const Variables_Set to_be_folded,
Variable  var 
)

Folds the space dimensions in to_be_folded into var.

Parameters
to_be_foldedThe set of Variable objects corresponding to the space dimensions to be folded;
varThe variable corresponding to the space dimension that is the destination of the folding operation.
Exceptions
std::invalid_argumentThrown if *this is dimension-incompatible with var or with one of the Variable objects contained in to_be_folded. Also thrown if var is contained in to_be_folded.

If *this has space dimension $n$, with $n > 0$, var has space dimension $k \leq n$, to_be_folded is a set of variables whose maximum space dimension is also less than or equal to $n$, and var is not a member of to_be_folded, then the space dimensions corresponding to variables in to_be_folded are folded into the $k$-th space dimension.

Definition at line 382 of file Affine_Space.cc.

383  {
384  gr.fold_space_dimensions(to_be_folded, var);
385 }
Grid gr
The rational grid implementing *this.
void fold_space_dimensions(const Variables_Set &vars, Variable dest)
Folds the space dimensions in vars into dest.
Definition: Grid_chdims.cc:458
bool Parma_Polyhedra_Library::Affine_Space::frequency ( const Linear_Expression expr,
Coefficient freq_n,
Coefficient freq_d,
Coefficient val_n,
Coefficient val_d 
) const
inline

Returns true if and only if *this is not empty and expr is discrete in *this, in which case the maximum frequency and the value for expr that is closest to zero are computed.

Parameters
exprThe linear expression for which the frequency is needed;
freq_nThe numerator of the maximum frequency of expr;
freq_dThe denominator of the maximum frequency of expr;
val_nThe numerator of a value of expr at a point in the grid that is closest to zero;
val_dThe denominator of a value of expr at a point in the grid that is closest to zero;
Exceptions
std::invalid_argumentThrown if expr and *this are dimension-incompatible.

If *this is empty or expr can take any real number in *this, false is returned and freq_n, freq_d, val_n and val_d are left untouched.

Definition at line 195 of file Affine_Space_inlines.hh.

References Parma_Polyhedra_Library::Grid::frequency(), and gr.

197  {
198  return gr.frequency(expr, freq_n, freq_d, val_n, val_d);
199 }
Grid gr
The rational grid implementing *this.
bool frequency(const Linear_Expression &expr, Coefficient &freq_n, Coefficient &freq_d, Coefficient &val_n, Coefficient &val_d) const
Returns true if and only if *this is not empty and frequency for *this with respect to expr is define...
void Parma_Polyhedra_Library::Affine_Space::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}' = \frac{\mathrm{expr}}{\mathrm{denominator}} \pmod{\mathrm{modulus}}$.

Parameters
varThe left hand side variable of the generalized affine relation;
relsymThe relation symbol where EQUAL is the symbol for a congruence relation;
exprThe numerator of the right hand side affine expression;
denominatorThe denominator of the right hand side affine expression. Optional argument with an automatic value of one;
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 261 of file Affine_Space.cc.

264  {
265  gr.generalized_affine_image(var, relsym, expr, denominator);
266 }
void generalized_affine_image(Variable var, Relation_Symbol relsym, const Linear_Expression &expr, Coefficient_traits::const_reference denominator=Coefficient_one(), Coefficient_traits::const_reference modulus=Coefficient_zero())
Assigns to *this the image of *this with respect to the generalized affine relation ...
Grid gr
The rational grid implementing *this.
void Parma_Polyhedra_Library::Affine_Space::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}' = \mathrm{rhs} \pmod{\mathrm{modulus}}$.

Parameters
lhsThe left hand side affine expression.
relsymThe relation symbol where EQUAL is the symbol for a congruence relation;
rhsThe right hand side affine expression.
Exceptions
std::invalid_argumentThrown if *this is dimension-incompatible with lhs or rhs.

Definition at line 279 of file Affine_Space.cc.

281  {
282  gr.generalized_affine_image(lhs, relsym, rhs);
283 }
void generalized_affine_image(Variable var, Relation_Symbol relsym, const Linear_Expression &expr, Coefficient_traits::const_reference denominator=Coefficient_one(), Coefficient_traits::const_reference modulus=Coefficient_zero())
Assigns to *this the image of *this with respect to the generalized affine relation ...
Grid gr
The rational grid implementing *this.
void Parma_Polyhedra_Library::Affine_Space::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}' = \frac{\mathrm{expr}}{\mathrm{denominator}} \pmod{\mathrm{modulus}}$.

Parameters
varThe left hand side variable of the generalized affine relation;
relsymThe relation symbol where EQUAL is the symbol for a congruence relation;
exprThe numerator of the right hand side affine expression;
denominatorThe denominator of the right hand side affine expression. Optional argument with an automatic value of one;
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 270 of file Affine_Space.cc.

273  {
274  gr.generalized_affine_preimage(var, relsym, expr, denominator);
275 }
Grid gr
The rational grid implementing *this.
void generalized_affine_preimage(Variable var, Relation_Symbol relsym, const Linear_Expression &expr, Coefficient_traits::const_reference denominator=Coefficient_one(), Coefficient_traits::const_reference modulus=Coefficient_zero())
Assigns to *this the preimage of *this with respect to the generalized affine relation ...
void Parma_Polyhedra_Library::Affine_Space::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}' = \mathrm{rhs} \pmod{\mathrm{modulus}}$.

Parameters
lhsThe left hand side affine expression;
relsymThe relation symbol where EQUAL is the symbol for a congruence relation;
rhsThe right hand side affine expression;
Exceptions
std::invalid_argumentThrown if *this is dimension-incompatible with lhs or rhs.

Definition at line 287 of file Affine_Space.cc.

289  {
290  gr.generalized_affine_preimage(lhs, relsym, rhs);
291 }
Grid gr
The rational grid implementing *this.
void generalized_affine_preimage(Variable var, Relation_Symbol relsym, const Linear_Expression &expr, Coefficient_traits::const_reference denominator=Coefficient_one(), Coefficient_traits::const_reference modulus=Coefficient_zero())
Assigns to *this the preimage of *this with respect to the generalized affine relation ...
PPL::Generator_System Parma_Polyhedra_Library::Affine_Space::generators ( ) const

Returns a system of generators defining *this.

Definition at line 100 of file Affine_Space.cc.

100  {
101  // FIXME: implement by filtering the grid generators.
102  abort();
103 }
int32_t Parma_Polyhedra_Library::Affine_Space::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 97 of file Affine_Space_inlines.hh.

References gr, and Parma_Polyhedra_Library::Grid::hash_code().

97  {
98  return gr.hash_code();
99 }
int32_t hash_code() const
Returns a 32-bit hash code for *this.
Grid gr
The rational grid implementing *this.
void Parma_Polyhedra_Library::Affine_Space::intersection_assign ( const Affine_Space y)

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

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

Definition at line 216 of file Affine_Space.cc.

References gr.

216  {
217  gr.intersection_assign(y.gr);
218 }
void intersection_assign(const Grid &y)
Assigns to *this the intersection of *this and y.
Grid gr
The rational grid implementing *this.
bool Parma_Polyhedra_Library::Affine_Space::is_bounded ( ) const

Returns true if and only if *this is bounded.

Definition at line 137 of file Affine_Space.cc.

137  {
138  return gr.is_bounded();
139 }
Grid gr
The rational grid implementing *this.
bool is_bounded() const
Returns true if and only if *this is bounded.
Definition: Grid_public.cc:810
bool Parma_Polyhedra_Library::Affine_Space::is_discrete ( ) const

Returns true if and only if *this is discrete.

An affine space is discrete if it can be defined by a generator system that contains at most one point. This includes the empty affine space and any affine space in dimension zero.

Definition at line 142 of file Affine_Space.cc.

142  {
143  return gr.is_discrete();
144 }
bool is_discrete() const
Returns true if and only if *this is discrete.
Definition: Grid_public.cc:836
Grid gr
The rational grid implementing *this.
bool Parma_Polyhedra_Library::Affine_Space::is_disjoint_from ( const Affine_Space y) const

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

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

Definition at line 329 of file Affine_Space.cc.

References gr.

329  {
330  return gr.is_disjoint_from(y.gr);
331 }
bool is_disjoint_from(const Grid &y) const
Returns true if and only if *this and y are disjoint.
Grid gr
The rational grid implementing *this.
bool Parma_Polyhedra_Library::Affine_Space::is_empty ( ) const

Returns true if and only if *this is an empty affine space.

Definition at line 127 of file Affine_Space.cc.

127  {
128  return gr.is_empty();
129 }
Grid gr
The rational grid implementing *this.
bool is_empty() const
Returns true if and only if *this is an empty grid.
Definition: Grid_public.cc:742
bool Parma_Polyhedra_Library::Affine_Space::is_topologically_closed ( ) const

Returns true if and only if *this is a topologically closed subset of the vector space.

An affine space is always topologically closed.

Definition at line 147 of file Affine_Space.cc.

147  {
148  return true;
149 }
bool Parma_Polyhedra_Library::Affine_Space::is_universe ( ) const

Returns true if and only if *this is a universe affine space.

Definition at line 132 of file Affine_Space.cc.

132  {
133  return gr.is_universe();
134 }
bool is_universe() const
Returns true if and only if *this is a universe grid.
Definition: Grid_public.cc:769
Grid gr
The rational grid implementing *this.
void Parma_Polyhedra_Library::Affine_Space::limited_extrapolation_assign ( const Affine_Space y,
const Constraint_System cs,
unsigned *  tp = NULL 
)

Does nothing, as the domain of affine spaces has finite height.

Parameters
yAn affine space that must be contained in *this;
csA system of constraints, which is ignored.
tpAn optional pointer, which is ignored.
Exceptions
std::invalid_argumentThrown if *this, y and cs are dimension-incompatible.

Definition at line 400 of file Affine_Space.cc.

References space_dimension().

402  {
403  Affine_Space& x = *this;
404 
405  // Dimension-compatibility check.
406  if (x.space_dimension() != y.space_dimension()) {
407  throw_dimension_incompatible("widening_assign(y)", "y", y);
408  }
409 
410  // Assume `y' is contained in or equal to `x'.
411  PPL_EXPECT_HEAVY(copy_contains(x, y));
412 }
void throw_dimension_incompatible(const char *method, const char *other_name, dimension_type other_dim) const
Affine_Space(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds an affine space having the specified properties.
void Parma_Polyhedra_Library::Affine_Space::m_swap ( Affine_Space y)
inline

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

Definition at line 112 of file Affine_Space_inlines.hh.

References gr, and swap().

Referenced by swap().

112  {
113  swap(gr, y.gr);
114 }
Grid gr
The rational grid implementing *this.
void swap(Affine_Space &x, Affine_Space &y)
Swaps x with y.
template<typename Partial_Function >
void Parma_Polyhedra_Library::Affine_Space::map_space_dimensions ( const Partial_Function pfunc)

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 type parameter Partial_Function must provide the following methods.

bool has_empty_codomain() const

returns true if and only if the represented partial function has an empty 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 the affine space.

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

dimension_type Parma_Polyhedra_Library::Affine_Space::max_space_dimension ( )
inlinestatic

Returns the maximum space dimension all kinds of Affine_Space can handle.

Definition at line 30 of file Affine_Space_inlines.hh.

References Parma_Polyhedra_Library::Grid::max_space_dimension().

30  {
32 }
static dimension_type max_space_dimension()
Returns the maximum space dimension all kinds of Grid can handle.
bool Parma_Polyhedra_Library::Affine_Space::maximize ( const Linear_Expression expr,
Coefficient sup_n,
Coefficient sup_d,
bool &  maximum 
) const
inline

Returns true if and only if *this is not empty and expr is bounded from above in *this, in which case the supremum value is computed.

Parameters
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. Always true when this bounds expr. Present for interface compatibility with class Polyhedron, where closure points can result in a value of false.
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 167 of file Affine_Space_inlines.hh.

References gr, and Parma_Polyhedra_Library::Grid::maximize().

169  {
170  return gr.maximize(expr, sup_n, sup_d, maximum);
171 }
Grid gr
The rational grid implementing *this.
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.
bool Parma_Polyhedra_Library::Affine_Space::maximize ( const Linear_Expression expr,
Coefficient sup_n,
Coefficient sup_d,
bool &  maximum,
Generator point 
) const
inline

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

Parameters
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. Always true when this bounds expr. Present for interface compatibility with class Polyhedron, where closure points can result in a value of false;
pointWhen maximization succeeds, will be assigned a 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 point are left untouched.

Definition at line 174 of file Affine_Space_inlines.hh.

References gr, and Parma_Polyhedra_Library::Grid::maximize().

176  {
177  return gr.maximize(expr, sup_n, sup_d, maximum, point);
178 }
Grid gr
The rational grid implementing *this.
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.
bool Parma_Polyhedra_Library::Affine_Space::minimize ( const Linear_Expression expr,
Coefficient inf_n,
Coefficient inf_d,
bool &  minimum 
) const
inline

Returns true if and only if *this is not empty and expr is bounded from below in *this, in which case the infimum value is computed.

Parameters
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 is the infimum value can be reached in this. Always true when this bounds expr. Present for interface compatibility with class Polyhedron, where closure points can result in a value of false.
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 181 of file Affine_Space_inlines.hh.

References gr, and Parma_Polyhedra_Library::Grid::minimize().

183  {
184  return gr.minimize(expr, inf_n, inf_d, minimum);
185 }
Grid gr
The rational grid implementing *this.
bool minimize(const Linear_Expression &expr, Coefficient &inf_n, Coefficient &inf_d, bool &minimum) const
Returns true if and only if *this is not empty and expr is bounded from below in *this, in which case the infimum value is computed.
bool Parma_Polyhedra_Library::Affine_Space::minimize ( const Linear_Expression expr,
Coefficient inf_n,
Coefficient inf_d,
bool &  minimum,
Generator point 
) const
inline

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

Parameters
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 is the infimum value can be reached in this. Always true when this bounds expr. Present for interface compatibility with class Polyhedron, where closure points can result in a value of false;
pointWhen minimization succeeds, will be assigned a 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 188 of file Affine_Space_inlines.hh.

References gr, and Parma_Polyhedra_Library::Grid::minimize().

190  {
191  return gr.minimize(expr, inf_n, inf_d, minimum, point);
192 }
Grid gr
The rational grid implementing *this.
bool minimize(const Linear_Expression &expr, Coefficient &inf_n, Coefficient &inf_d, bool &minimum) const
Returns true if and only if *this is not empty and expr is bounded from below in *this, in which case the infimum value is computed.
const PPL::Congruence_System & Parma_Polyhedra_Library::Affine_Space::minimized_congruences ( ) const

Returns the system of equality congruences satisfied by *this, with no redundant congruences and having the same affine dimension as *this.

Definition at line 95 of file Affine_Space.cc.

95  {
96  return gr.minimized_congruences();
97 }
const Congruence_System & minimized_congruences() const
Returns the system of congruences in minimal form.
Definition: Grid_public.cc:319
Grid gr
The rational grid implementing *this.
Constraint_System Parma_Polyhedra_Library::Affine_Space::minimized_constraints ( ) const
inline

Returns a minimal system of equality constraints satisfied by *this with the same affine dimension as *this.

Definition at line 107 of file Affine_Space_inlines.hh.

References gr, and Parma_Polyhedra_Library::Grid::minimized_constraints().

107  {
108  return gr.minimized_constraints();
109 }
Constraint_System minimized_constraints() const
Returns a minimal system of equality constraints satisfied by *this with the same affine dimension as...
Grid gr
The rational grid implementing *this.
PPL::Generator_System Parma_Polyhedra_Library::Affine_Space::minimized_generators ( ) const

Returns a minimized system of generators defining *this.

Definition at line 106 of file Affine_Space.cc.

106  {
107  // FIXME: implement by filtering the grid generators.
108  abort();
109 }
bool Parma_Polyhedra_Library::Affine_Space::OK ( bool  check_not_empty = false) const

Checks if all the invariants are satisfied.

Returns
true if and only if *this satisfies all the invariants and either check_not_empty is false or *this is not empty.
Parameters
check_not_emptytrue if and only if, in addition to checking the invariants, *this must be checked to be not empty.

The check is performed so as to intrude as little as possible. If the library has been compiled with run-time assertions enabled, error messages are written on std::cerr in case invariants are violated. This is useful for the purpose of debugging the library.

Definition at line 162 of file Affine_Space.cc.

Referenced by Affine_Space().

162  {
163  return gr.OK(check_not_empty);
164 }
bool OK(bool check_not_empty=false) const
Checks if all the invariants are satisfied.
Definition: Grid_public.cc:958
Grid gr
The rational grid implementing *this.
PPL::Affine_Space & Parma_Polyhedra_Library::Affine_Space::operator= ( const Affine_Space y)

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

Definition at line 79 of file Affine_Space.cc.

References gr.

79  {
80  gr = y.gr;
81  return *this;
82 }
Grid gr
The rational grid implementing *this.
void Parma_Polyhedra_Library::Affine_Space::print ( ) const

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

void Parma_Polyhedra_Library::Affine_Space::refine_with_congruence ( const Congruence cg)
inline

Uses a copy of the congruence cg to refine *this.

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

Definition at line 127 of file Affine_Space_inlines.hh.

References gr, and Parma_Polyhedra_Library::Grid::refine_with_congruence().

127  {
129 }
void refine_with_congruence(const Congruence &cg)
Uses a copy of the congruence cg to refine *this.
Grid gr
The rational grid implementing *this.
void Parma_Polyhedra_Library::Affine_Space::refine_with_congruences ( const Congruence_System cgs)
inline

Uses a copy of the congruences in cgs to refine *this.

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

Definition at line 132 of file Affine_Space_inlines.hh.

References gr, and Parma_Polyhedra_Library::Grid::refine_with_congruences().

132  {
134 }
Grid gr
The rational grid implementing *this.
void refine_with_congruences(const Congruence_System &cgs)
Uses a copy of the congruences in cgs to refine *this.
void Parma_Polyhedra_Library::Affine_Space::refine_with_constraint ( const Constraint c)

Uses a copy of the constraint c to refine *this.

Parameters
cThe constraint used. If it is not an equality, it will be ignored
Exceptions
std::invalid_argumentThrown if *this and c are dimension-incompatible.

Definition at line 196 of file Affine_Space.cc.

196  {
198 }
Grid gr
The rational grid implementing *this.
void refine_with_constraint(const Constraint &c)
Uses a copy of the constraint c to refine *this.
Coefficient c
Definition: PIP_Tree.cc:64
void Parma_Polyhedra_Library::Affine_Space::refine_with_constraints ( const Constraint_System cs)

Uses a copy of the constraints in cs to refine *this.

Parameters
csThe constraints used. Constraints that are not equalities are ignored.
Exceptions
std::invalid_argumentThrown if *this and cs are dimension-incompatible.

Definition at line 201 of file Affine_Space.cc.

201  {
203 }
void refine_with_constraints(const Constraint_System &cs)
Uses a copy of the constraints in cs to refine *this.
Grid gr
The rational grid implementing *this.
PPL::Poly_Con_Relation Parma_Polyhedra_Library::Affine_Space::relation_with ( const Congruence cg) const

Returns the relations holding between *this and cg.

Definition at line 112 of file Affine_Space.cc.

112  {
113  return gr.relation_with(cg);
114 }
Poly_Con_Relation relation_with(const Congruence &cg) const
Returns the relations holding between *this and cg.
Definition: Grid_public.cc:386
Grid gr
The rational grid implementing *this.
PPL::Poly_Gen_Relation Parma_Polyhedra_Library::Affine_Space::relation_with ( const Generator g) const

Returns the relations holding between *this and g.

Definition at line 117 of file Affine_Space.cc.

117  {
118  return gr.relation_with(g);
119 }
Poly_Con_Relation relation_with(const Congruence &cg) const
Returns the relations holding between *this and cg.
Definition: Grid_public.cc:386
Grid gr
The rational grid implementing *this.
PPL::Poly_Con_Relation Parma_Polyhedra_Library::Affine_Space::relation_with ( const Constraint c) const

Returns the relations holding between *this and c.

Definition at line 122 of file Affine_Space.cc.

122  {
123  return gr.relation_with(c);
124 }
Poly_Con_Relation relation_with(const Congruence &cg) const
Returns the relations holding between *this and cg.
Definition: Grid_public.cc:386
Grid gr
The rational grid implementing *this.
Coefficient c
Definition: PIP_Tree.cc:64
void Parma_Polyhedra_Library::Affine_Space::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.

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

Definition at line 371 of file Affine_Space.cc.

372  {
373  gr.remove_higher_space_dimensions(new_dimension);
374 }
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...
Definition: Grid_chdims.cc:318
Grid gr
The rational grid implementing *this.
void Parma_Polyhedra_Library::Affine_Space::remove_space_dimensions ( const Variables_Set vars)

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 366 of file Affine_Space.cc.

366  {
368 }
void remove_space_dimensions(const Variables_Set &vars)
Removes all the specified dimensions from the vector space.
Definition: Grid_chdims.cc:273
Grid gr
The rational grid implementing *this.
bool Parma_Polyhedra_Library::Affine_Space::simplify_using_context_assign ( const Affine_Space y)

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

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

Definition at line 239 of file Affine_Space.cc.

References gr.

239  {
240  return gr.simplify_using_context_assign(y.gr);
241 }
bool simplify_using_context_assign(const Grid &y)
Assigns to *this a meet-preserving simplification of *this with respect to y. If false is returned...
Grid gr
The rational grid implementing *this.
dimension_type Parma_Polyhedra_Library::Affine_Space::space_dimension ( ) const
inline

Returns the dimension of the vector space enclosing *this.

Definition at line 87 of file Affine_Space_inlines.hh.

References gr, and Parma_Polyhedra_Library::Grid::space_dimension().

Referenced by limited_extrapolation_assign(), throw_dimension_incompatible(), and widening_assign().

87  {
88  return gr.space_dimension();
89 }
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
Grid gr
The rational grid implementing *this.
bool Parma_Polyhedra_Library::Affine_Space::strictly_contains ( const Affine_Space y) const
inline

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

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

Definition at line 208 of file Affine_Space_inlines.hh.

References gr, and Parma_Polyhedra_Library::Grid::strictly_contains().

208  {
209  return gr.strictly_contains(y.gr);
210 }
bool strictly_contains(const Grid &y) const
Returns true if and only if *this strictly contains y.
Grid gr
The rational grid implementing *this.
void Parma_Polyhedra_Library::Affine_Space::throw_dimension_incompatible ( const char *  method,
const char *  other_name,
dimension_type  other_dim 
) const
protected

Definition at line 423 of file Affine_Space.cc.

425  {
426  std::ostringstream s;
427  s << "PPL::Affine_Space::" << method << ":\n"
428  << "this->space_dimension() == " << space_dimension() << ", "
429  << other_name << ".space_dimension() == " << other_dim << ".";
430  throw std::invalid_argument(s.str());
431 }
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
void Parma_Polyhedra_Library::Affine_Space::throw_dimension_incompatible ( const char *  method,
const char *  as_name,
const Affine_Space as 
) const
protected

Definition at line 435 of file Affine_Space.cc.

References space_dimension().

437  {
438  throw_dimension_incompatible(method, as_name, as.space_dimension());
439 }
void throw_dimension_incompatible(const char *method, const char *other_name, dimension_type other_dim) const
void Parma_Polyhedra_Library::Affine_Space::throw_invalid_constraint ( const char *  method,
const char *  c_name 
) const
protected
void Parma_Polyhedra_Library::Affine_Space::throw_invalid_constraints ( const char *  method,
const char *  cs_name 
) const
protected
void Parma_Polyhedra_Library::Affine_Space::throw_invalid_generator ( const char *  method,
const char *  g_name 
) const
protected
void Parma_Polyhedra_Library::Affine_Space::throw_invalid_generators ( const char *  method,
const char *  gs_name 
) const
protected
static void Parma_Polyhedra_Library::Affine_Space::throw_space_dimension_overflow ( const char *  method,
const char *  reason 
)
staticprotected
void Parma_Polyhedra_Library::Affine_Space::time_elapse_assign ( const Affine_Space y)

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

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

Definition at line 313 of file Affine_Space.cc.

References gr.

313  {
314  gr.time_elapse_assign(y.gr);
315 }
void time_elapse_assign(const Grid &y)
Assigns to *this the result of computing the time-elapse between *this and y.
Grid gr
The rational grid implementing *this.
void Parma_Polyhedra_Library::Affine_Space::topological_closure_assign ( )
inline

Assigns to *this its topological closure.

Definition at line 213 of file Affine_Space_inlines.hh.

213  {
214 }
memory_size_type Parma_Polyhedra_Library::Affine_Space::total_memory_in_bytes ( ) const
inline

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

Definition at line 92 of file Affine_Space_inlines.hh.

References gr, and Parma_Polyhedra_Library::Grid::total_memory_in_bytes().

92  {
93  return gr.total_memory_in_bytes();
94 }
memory_size_type total_memory_in_bytes() const
Returns the total size in bytes of the memory occupied by *this.
Grid gr
The rational grid implementing *this.
void Parma_Polyhedra_Library::Affine_Space::unconstrain ( Variable  var)

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 206 of file Affine_Space.cc.

206  {
207  gr.unconstrain(var);
208 }
Grid gr
The rational grid implementing *this.
void unconstrain(Variable var)
Computes the cylindrification of *this with respect to space dimension var, assigning the result to *...
void Parma_Polyhedra_Library::Affine_Space::unconstrain ( const Variables_Set vars)

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

Parameters
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 211 of file Affine_Space.cc.

211  {
212  gr.unconstrain(vars);
213 }
Grid gr
The rational grid implementing *this.
void unconstrain(Variable var)
Computes the cylindrification of *this with respect to space dimension var, assigning the result to *...
void Parma_Polyhedra_Library::Affine_Space::upper_bound_assign ( const Affine_Space y)

Assigns to *this the least upper bound of *this and y.

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

Definition at line 221 of file Affine_Space.cc.

References gr.

221  {
222  // FIXME: horrible kludge to filter congruences away.
223  gr.upper_bound_assign(y.gr);
225  m_swap(a);
226 }
Grid gr
The rational grid implementing *this.
Affine_Space(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds an affine space having the specified properties.
void m_swap(Affine_Space &y)
Swaps *this with affine space y. (*this and y can be dimension-incompatible.)
Constraint_System constraints() const
Returns a system of equality constraints satisfied by *this with the same affine dimension as *this...
void upper_bound_assign(const Grid &y)
Assigns to *this the least upper bound of *this and y.
bool Parma_Polyhedra_Library::Affine_Space::upper_bound_assign_if_exact ( const Affine_Space y)

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

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

Definition at line 229 of file Affine_Space.cc.

References gr.

229  {
230  return gr.upper_bound_assign_if_exact(y.gr);
231 }
bool upper_bound_assign_if_exact(const Grid &y)
If the upper bound of *this and y is exact it is assigned to this and true is returned, otherwise false is returned.
Grid gr
The rational grid implementing *this.
void Parma_Polyhedra_Library::Affine_Space::widening_assign ( const Affine_Space y,
unsigned *  tp = NULL 
)

Does nothing, as the domain of affine spaces has finite height.

Parameters
yAn affine space that must be contained in *this;
tpAn optional pointer, which is ignored.
Exceptions
std::invalid_argumentThrown if *this and y are dimension-incompatible.

Definition at line 388 of file Affine_Space.cc.

References space_dimension().

388  {
389  Affine_Space& x = *this;
390 
391  // Dimension-compatibility check.
392  if (x.space_dimension() != y.space_dimension())
393  throw_dimension_incompatible("widening_assign(y)", "y", y);
394 
395  // Assume `y' is contained in or equal to `x'.
396  PPL_EXPECT_HEAVY(copy_contains(x, y));
397 }
void throw_dimension_incompatible(const char *method, const char *other_name, dimension_type other_dim) const
Affine_Space(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds an affine space having the specified properties.

Friends And Related Function Documentation

bool operator!= ( const Affine_Space x,
const Affine_Space y 
)
related

Returns true if and only if x and y are different affine spaces.

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

bool operator!= ( const Affine_Space x,
const Affine_Space y 
)
related

Definition at line 203 of file Affine_Space_inlines.hh.

203  {
204  return !(x == y);
205 }
std::ostream & operator<< ( std::ostream &  s,
const Affine_Space gr 
)
related

Output operator.

Writes a textual representation of a on s: false is written if a is an empty affine space; true is written if a is a universe affine space; a minimized system of equalitiy constraints defining a is written otherwise, all equalities in one row separated by ", "s.

std::ostream & operator<< ( std::ostream &  s,
const Affine_Space gr 
)
related

Definition at line 416 of file Affine_Space.cc.

416  {
417  s << gr;
418  return s;
419 }
Grid gr
The rational grid implementing *this.
bool operator== ( const Affine_Space x,
const Affine_Space y 
)
related

Returns true if and only if x and y are the same affine space.

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

bool operator== ( const Affine_Space x,
const Affine_Space y 
)
related

Definition at line 319 of file Affine_Space.cc.

References gr.

319  {
320  return x.gr == y.gr;
321 }
bool operator== ( const Affine_Space x,
const Affine_Space y 
)
friend
void swap ( Affine_Space x,
Affine_Space y 
)
related

Definition at line 218 of file Affine_Space_inlines.hh.

References m_swap().

218  {
219  x.m_swap(y);
220 }

Member Data Documentation


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