PPL
1.2
|
A system of grid generators. More...
#include <Grid_Generator_System_defs.hh>
Classes | |
class | const_iterator |
An iterator over a system of grid generators. More... | |
Public Types | |
typedef Grid_Generator | row_type |
Public Member Functions | |
Grid_Generator_System (Representation r=default_representation) | |
Default constructor: builds an empty system of generators. More... | |
Grid_Generator_System (const Grid_Generator &g, Representation r=default_representation) | |
Builds the singleton system containing only generator g . More... | |
Grid_Generator_System (dimension_type dim, Representation r=default_representation) | |
Builds an empty system of generators of dimension dim . More... | |
Grid_Generator_System (const Grid_Generator_System &gs) | |
Grid_Generator_System (const Grid_Generator_System &gs, Representation r) | |
Copy constructor with specified representation. More... | |
~Grid_Generator_System () | |
Destructor. More... | |
Grid_Generator_System & | operator= (const Grid_Generator_System &y) |
Assignment operator. More... | |
Representation | representation () const |
Returns the current representation of *this. More... | |
void | set_representation (Representation r) |
Converts *this to the specified representation. More... | |
dimension_type | space_dimension () const |
Returns the dimension of the vector space enclosing *this . More... | |
void | clear () |
Removes all the generators from the generator system and sets its space dimension to 0. More... | |
void | insert (const Grid_Generator &g) |
Inserts into *this a copy of the generator g , increasing the number of space dimensions if needed. More... | |
void | insert (Grid_Generator &g, Recycle_Input) |
Inserts into *this the generator g , increasing the number of space dimensions if needed. More... | |
void | insert (Grid_Generator_System &gs, Recycle_Input) |
Inserts into *this the generators in gs , increasing the number of space dimensions if needed. More... | |
bool | empty () const |
Returns true if and only if *this has no generators. More... | |
const_iterator | begin () const |
Returns the const_iterator pointing to the first generator, if this is not empty; otherwise, returns the past-the-end const_iterator. More... | |
const_iterator | end () const |
Returns the past-the-end const_iterator. More... | |
dimension_type | num_rows () const |
Returns the number of rows (generators) in the system. More... | |
dimension_type | num_parameters () const |
Returns the number of parameters in the system. More... | |
dimension_type | num_lines () const |
Returns the number of lines in the system. More... | |
bool | has_points () const |
Returns true if and only if *this contains one or more points. More... | |
bool | is_equal_to (const Grid_Generator_System &y) const |
Returns true if *this is identical to y . More... | |
bool | OK () const |
Checks if all the invariants are satisfied. 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... | |
void | m_swap (Grid_Generator_System &y) |
Swaps *this with y . More... | |
Static Public Member Functions | |
static dimension_type | max_space_dimension () |
Returns the maximum space dimension a Grid_Generator_System can handle. More... | |
static void | initialize () |
Initializes the class. More... | |
static void | finalize () |
Finalizes the class. More... | |
static const Grid_Generator_System & | zero_dim_univ () |
Returns the singleton system containing only Grid_Generator::zero_dim_point(). More... | |
Static Public Attributes | |
static const Representation | default_representation = SPARSE |
Private Member Functions | |
const Grid_Generator & | operator[] (dimension_type k) const |
Returns a constant reference to the k- th generator of the system. More... | |
void | affine_image (Variable v, const Linear_Expression &expr, Coefficient_traits::const_reference denominator) |
Assigns to a given variable an affine expression. More... | |
void | set_sorted (bool b) |
Sets the sortedness flag of the system to b . More... | |
void | add_universe_rows_and_columns (dimension_type dims) |
Adds dims rows and dims columns of zeroes to the matrix, initializing the added rows as in the universe system. More... | |
void | set_space_dimension (dimension_type space_dim) |
Resizes the system to the specified space dimension. More... | |
void | remove_space_dimensions (const Variables_Set &vars) |
Removes all the specified dimensions from the generator system. More... | |
void | shift_space_dimensions (Variable v, dimension_type n) |
void | unset_pending_rows () |
Sets the index to indicate that the system has no pending rows. More... | |
void | permute_space_dimensions (const std::vector< Variable > &cycle) |
Permutes the space dimensions of the matrix. More... | |
bool | has_no_rows () const |
void | remove_trailing_rows (dimension_type n) |
Makes the system shrink by removing its n trailing rows. More... | |
void | insert_verbatim (const Grid_Generator &g) |
Topology | topology () const |
Returns the system topology. More... | |
dimension_type | first_pending_row () const |
Returns the index of the first pending row. More... | |
void | set_index_first_pending_row (dimension_type i) |
Sets the index of the first pending row to i . More... | |
void | remove_invalid_lines_and_parameters () |
Removes all the invalid lines and parameters. More... | |
Private Attributes | |
Linear_System< Grid_Generator > | sys |
Static Private Attributes | |
static const Grid_Generator_System * | zero_dim_univ_p = 0 |
Holds (between class initialization and finalization) a pointer to the singleton system containing only Grid_Generator::zero_dim_point(). More... | |
Friends | |
class | Polyhedron |
class | Grid |
bool | operator== (const Grid_Generator_System &x, const Grid_Generator_System &y) |
Related Functions | |
(Note that these are not member functions.) | |
std::ostream & | operator<< (std::ostream &s, const Grid_Generator_System &gs) |
std::ostream & | operator<< (std::ostream &s, const Grid_Generator_System &gs) |
Output operator. More... | |
void | swap (Grid_Generator_System &x, Grid_Generator_System &y) |
Swaps x with y . More... | |
bool | operator== (const Grid_Generator_System &x, const Grid_Generator_System &y) |
Returns true if and only if x and y are identical. More... | |
bool | operator== (const Grid_Generator_System &x, const Grid_Generator_System &y) |
void | swap (Grid_Generator_System &x, Grid_Generator_System &y) |
A system of grid generators.
An object of the class Grid_Generator_System is a system of grid generators, i.e., a multiset of objects of the class Grid_Generator (lines, parameters and points). When inserting generators in a system, space dimensions are automatically adjusted so that all the generators in the system are defined on the same vector space. A system of grid generators which is meant to define a non-empty grid must include at least one point: the reason is that lines and parameters need a supporting point (lines only specify directions while parameters only specify direction and distance.
x
and y
are defined as follows:
gs
and gs1
. Definition at line 175 of file Grid_Generator_System_defs.hh.
Definition at line 177 of file Grid_Generator_System_defs.hh.
|
inlineexplicit |
Default constructor: builds an empty system of generators.
Definition at line 58 of file Grid_Generator_System_inlines.hh.
References space_dimension(), and sys.
|
inlineexplicit |
Builds the singleton system containing only generator g
.
Definition at line 85 of file Grid_Generator_System_inlines.hh.
References sys.
|
inlineexplicit |
Builds an empty system of generators of dimension dim
.
Definition at line 76 of file Grid_Generator_System_inlines.hh.
References space_dimension(), and sys.
|
inline |
Ordinary copy constructor. The new Grid_Generator_System will have the same representation as `gs'.
Definition at line 65 of file Grid_Generator_System_inlines.hh.
|
inline |
Copy constructor with specified representation.
Definition at line 70 of file Grid_Generator_System_inlines.hh.
|
inline |
|
private |
Adds dims
rows and dims
columns of zeroes to the matrix, initializing the added rows as in the universe system.
dims | The number of rows and columns to be added: must be strictly positive. |
Turns the matrix
into the
matrix
where
is the
unit matrix of the form
. The matrix is expanded avoiding reallocation whenever possible.
Definition at line 199 of file Grid_Generator_System.cc.
References Parma_Polyhedra_Library::Grid_Generator::expr, Parma_Polyhedra_Library::Grid_Generator::LINE_OR_EQUALITY, Parma_Polyhedra_Library::NECESSARILY_CLOSED, and Parma_Polyhedra_Library::Grid_Generator::OK().
Referenced by Parma_Polyhedra_Library::Grid::add_space_dimensions().
|
private |
Assigns to a given variable an affine expression.
v | The variable to which the affine transformation is assigned; |
expr | The numerator of the affine transformation: ![]() |
denominator | The denominator of the affine transformation; |
We allow affine transformations (see the Section Operations on Rational Grids)to have rational coefficients. Since the coefficients of linear expressions are integers we also provide an integer denominator
that will be used as denominator of the affine transformation. The denominator is required to be a positive integer and its default value is 1.
The affine transformation assigns to every variable v
, in every column, the follow expression:
expr
is a constant parameter and unaltered by this computation.
Definition at line 80 of file Grid_Generator_System.cc.
References Parma_Polyhedra_Library::Scalar_Products::assign(), Parma_Polyhedra_Library::Linear_Expression::coefficient(), Parma_Polyhedra_Library::Grid_Generator::expr, num_rows(), Parma_Polyhedra_Library::Grid_Generator::OK(), PPL_DIRTY_TEMP_COEFFICIENT, remove_invalid_lines_and_parameters(), Parma_Polyhedra_Library::Linear_Expression::set_coefficient(), Parma_Polyhedra_Library::Variable::space_dimension(), Parma_Polyhedra_Library::Linear_Expression::space_dimension(), and sys.
void Parma_Polyhedra_Library::Grid_Generator_System::ascii_dump | ( | std::ostream & | s | ) | const |
Writes to s
an ASCII representation of *this
.
Definition at line 126 of file Grid_Generator_System.cc.
void Parma_Polyhedra_Library::Grid_Generator_System::ascii_dump | ( | ) | const |
Writes to std::cerr
an ASCII representation of *this
.
Referenced by Parma_Polyhedra_Library::Grid::OK().
bool Parma_Polyhedra_Library::Grid_Generator_System::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.
Resizes the matrix of generators using the numbers of rows and columns read from s
, then initializes the coordinates of each generator and its type reading the contents from s
.
Definition at line 131 of file Grid_Generator_System.cc.
|
inline |
Returns the const_iterator pointing to the first generator, if this
is not empty; otherwise, returns the past-the-end const_iterator.
Definition at line 225 of file Grid_Generator_System_inlines.hh.
References sys.
Referenced by Parma_Polyhedra_Library::Grid::map_space_dimensions(), operator<<(), and Parma_Polyhedra_Library::Grid::simplify_using_context_assign().
|
inline |
Removes all the generators from the generator system and sets its space dimension to 0.
Definition at line 131 of file Grid_Generator_System_inlines.hh.
References space_dimension(), and sys.
Referenced by Parma_Polyhedra_Library::Grid::conversion(), and insert().
|
inline |
Returns true
if and only if *this
has no generators.
Definition at line 214 of file Grid_Generator_System_inlines.hh.
References sys.
Referenced by Parma_Polyhedra_Library::Box< ITV >::Box(), and Parma_Polyhedra_Library::Grid_Certificate::Grid_Certificate().
|
inline |
Returns the past-the-end const_iterator.
Definition at line 230 of file Grid_Generator_System_inlines.hh.
References sys.
Referenced by Parma_Polyhedra_Library::Grid::map_space_dimensions(), operator<<(), and Parma_Polyhedra_Library::Grid::simplify_using_context_assign().
|
inline |
Returns the size in bytes of the memory managed by *this
.
Definition at line 144 of file Grid_Generator_System_inlines.hh.
References sys.
Referenced by total_memory_in_bytes().
|
static |
Finalizes the class.
Definition at line 151 of file Grid_Generator_System.cc.
Referenced by Parma_Polyhedra_Library::Init::~Init().
|
inlineprivate |
Returns the index of the first pending row.
Definition at line 260 of file Grid_Generator_System_inlines.hh.
References sys.
Referenced by Parma_Polyhedra_Library::Grid::conversion().
|
inlineprivate |
Definition at line 240 of file Grid_Generator_System_inlines.hh.
References sys.
Referenced by Parma_Polyhedra_Library::Grid::add_recycled_grid_generators(), Parma_Polyhedra_Library::Grid::construct(), Parma_Polyhedra_Library::Grid::generator_widening_assign(), Parma_Polyhedra_Library::Grid::map_space_dimensions(), Parma_Polyhedra_Library::Grid::OK(), and Parma_Polyhedra_Library::Grid::simplify().
bool Parma_Polyhedra_Library::Grid_Generator_System::has_points | ( | ) | const |
Returns true
if and only if *this
contains one or more points.
Definition at line 255 of file Grid_Generator_System.cc.
Referenced by Parma_Polyhedra_Library::Grid::add_recycled_grid_generators(), and Parma_Polyhedra_Library::Grid::construct().
|
static |
Initializes the class.
Definition at line 144 of file Grid_Generator_System.cc.
References Parma_Polyhedra_Library::Grid_Generator::zero_dim_point().
Referenced by Parma_Polyhedra_Library::Init::Init().
void Parma_Polyhedra_Library::Grid_Generator_System::insert | ( | const Grid_Generator & | g | ) |
Inserts into *this
a copy of the generator g
, increasing the number of space dimensions if needed.
If g
is an all-zero parameter then the only action is to ensure that the space dimension of *this
is at least the space dimension of g
.
Definition at line 56 of file Grid_Generator_System.cc.
Referenced by Parma_Polyhedra_Library::Affine_Space::Affine_Space(), Parma_Polyhedra_Library::Grid::construct(), Parma_Polyhedra_Library::Grid::generalized_affine_image(), Parma_Polyhedra_Library::Grid::generalized_affine_preimage(), Parma_Polyhedra_Library::Grid::Grid(), Parma_Polyhedra_Library::Grid::map_space_dimensions(), Parma_Polyhedra_Library::Grid::select_wider_generators(), and Parma_Polyhedra_Library::Grid::upper_bound_assign().
void Parma_Polyhedra_Library::Grid_Generator_System::insert | ( | Grid_Generator & | g, |
Recycle_Input | |||
) |
Inserts into *this
the generator g
, increasing the number of space dimensions if needed.
Definition at line 62 of file Grid_Generator_System.cc.
References Parma_Polyhedra_Library::Grid_Generator::all_homogeneous_terms_are_zero(), Parma_Polyhedra_Library::Grid_Generator::is_parameter(), and Parma_Polyhedra_Library::Grid_Generator::space_dimension().
void Parma_Polyhedra_Library::Grid_Generator_System::insert | ( | Grid_Generator_System & | gs, |
Recycle_Input | |||
) |
Inserts into *this
the generators in gs
, increasing the number of space dimensions if needed.
Definition at line 36 of file Grid_Generator_System.cc.
References clear(), num_rows(), set_space_dimension(), space_dimension(), sys, and unset_pending_rows().
|
inlineprivate |
Definition at line 250 of file Grid_Generator_System_inlines.hh.
References sys.
Referenced by Parma_Polyhedra_Library::Grid::conversion().
|
inline |
Returns true
if *this
is identical to y
.
Definition at line 53 of file Grid_Generator_System_inlines.hh.
References sys.
Referenced by operator==().
|
inline |
Swaps *this
with y
.
Definition at line 139 of file Grid_Generator_System_inlines.hh.
Referenced by Parma_Polyhedra_Library::Grid::OK(), and swap().
|
inlinestatic |
Returns the maximum space dimension a Grid_Generator_System can handle.
Definition at line 114 of file Grid_Generator_System_inlines.hh.
References Parma_Polyhedra_Library::Linear_System< Row >::max_space_dimension().
Referenced by Parma_Polyhedra_Library::Grid::max_space_dimension().
PPL::dimension_type Parma_Polyhedra_Library::Grid_Generator_System::num_lines | ( | ) | const |
Returns the number of lines in the system.
Definition at line 266 of file Grid_Generator_System.cc.
Referenced by Parma_Polyhedra_Library::Grid::generator_widening_assign(), and Parma_Polyhedra_Library::Grid::quick_equivalence_test().
PPL::dimension_type Parma_Polyhedra_Library::Grid_Generator_System::num_parameters | ( | ) | const |
Returns the number of parameters in the system.
Definition at line 291 of file Grid_Generator_System.cc.
Referenced by Parma_Polyhedra_Library::Grid::generator_widening_assign(), and Parma_Polyhedra_Library::Grid_Certificate::Grid_Certificate().
|
inline |
Returns the number of rows (generators) in the system.
Definition at line 154 of file Grid_Generator_System_inlines.hh.
References sys.
Referenced by affine_image(), Parma_Polyhedra_Library::Grid::conversion(), Parma_Polyhedra_Library::Grid::generator_widening_assign(), Parma_Polyhedra_Library::Grid_Certificate::Grid_Certificate(), insert(), Parma_Polyhedra_Library::Grid::normalize_divisors(), Parma_Polyhedra_Library::Grid::quick_equivalence_test(), Parma_Polyhedra_Library::Grid::simplify(), Parma_Polyhedra_Library::Grid::time_elapse_assign(), and Parma_Polyhedra_Library::Grid::upper_triangular().
bool Parma_Polyhedra_Library::Grid_Generator_System::OK | ( | ) | const |
Checks if all the invariants are satisfied.
Definition at line 158 of file Grid_Generator_System.cc.
References Parma_Polyhedra_Library::NOT_NECESSARILY_CLOSED.
|
inline |
Assignment operator.
Definition at line 97 of file Grid_Generator_System_inlines.hh.
References swap().
|
inlineprivate |
Returns a constant reference to the k-
th generator of the system.
Definition at line 235 of file Grid_Generator_System_inlines.hh.
References sys.
|
inlineprivate |
Permutes the space dimensions of the matrix.
Definition at line 48 of file Grid_Generator_System_inlines.hh.
Referenced by Parma_Polyhedra_Library::Grid::map_space_dimensions().
void Parma_Polyhedra_Library::Grid_Generator_System::print | ( | ) | const |
Prints *this
to std::cerr
using operator<<
.
|
private |
Removes all the invalid lines and parameters.
The invalid lines and parameters are those with all the homogeneous terms set to zero.
Definition at line 235 of file Grid_Generator_System.cc.
References Parma_Polyhedra_Library::Grid_Generator::all_homogeneous_terms_are_zero(), and Parma_Polyhedra_Library::Grid_Generator::is_line_or_parameter().
Referenced by affine_image().
|
private |
Removes all the specified dimensions from the generator system.
The space dimension of the variable with the highest space dimension in vars
must be at most the space dimension of this
.
Definition at line 217 of file Grid_Generator_System.cc.
|
inlineprivate |
Makes the system shrink by removing its n
trailing rows.
Definition at line 245 of file Grid_Generator_System_inlines.hh.
References sys.
|
inline |
Returns the current representation of *this.
Definition at line 104 of file Grid_Generator_System_inlines.hh.
References sys.
Referenced by Parma_Polyhedra_Library::Grid::conversion().
|
inlineprivate |
Sets the index of the first pending row to i
.
Definition at line 42 of file Grid_Generator_System_inlines.hh.
References sys.
|
inline |
Converts *this to the specified representation.
Definition at line 109 of file Grid_Generator_System_inlines.hh.
References sys.
|
inlineprivate |
Sets the sortedness flag of the system to b
.
Definition at line 32 of file Grid_Generator_System_inlines.hh.
References sys.
Referenced by Parma_Polyhedra_Library::Grid::map_space_dimensions().
|
private |
Resizes the system to the specified space dimension.
Definition at line 229 of file Grid_Generator_System.cc.
Referenced by Parma_Polyhedra_Library::Grid::add_recycled_grid_generators(), Parma_Polyhedra_Library::Grid::add_space_dimensions(), Parma_Polyhedra_Library::Grid::construct(), Parma_Polyhedra_Library::Grid::conversion(), Parma_Polyhedra_Library::Grid::generalized_affine_image(), Parma_Polyhedra_Library::Grid::generalized_affine_preimage(), Parma_Polyhedra_Library::Grid::Grid(), and insert().
|
private |
Shift by n
positions the coefficients of variables, starting from the coefficient of v
. This increases the space dimension by n
.
Definition at line 223 of file Grid_Generator_System.cc.
|
inline |
Returns the dimension of the vector space enclosing *this
.
Definition at line 120 of file Grid_Generator_System_inlines.hh.
References sys.
Referenced by Parma_Polyhedra_Library::Grid::add_recycled_grid_generators(), Parma_Polyhedra_Library::Grid::add_space_dimensions(), clear(), Parma_Polyhedra_Library::Grid::construct(), Parma_Polyhedra_Library::Grid::conversion(), Grid_Generator_System(), insert(), Parma_Polyhedra_Library::Grid::normalize_divisors(), Parma_Polyhedra_Library::Grid::simplify(), Parma_Polyhedra_Library::Grid::throw_dimension_incompatible(), and Parma_Polyhedra_Library::Grid::upper_triangular().
|
inlineprivate |
Returns the system topology.
Definition at line 255 of file Grid_Generator_System_inlines.hh.
References sys.
Referenced by Parma_Polyhedra_Library::Grid::conversion().
|
inline |
Returns the total size in bytes of the memory occupied by *this
.
Definition at line 149 of file Grid_Generator_System_inlines.hh.
References external_memory_in_bytes().
|
inlineprivate |
Sets the index to indicate that the system has no pending rows.
Definition at line 37 of file Grid_Generator_System_inlines.hh.
References sys.
Referenced by insert(), and Parma_Polyhedra_Library::Grid::simplify().
|
inlinestatic |
Returns the singleton system containing only Grid_Generator::zero_dim_point().
Definition at line 125 of file Grid_Generator_System_inlines.hh.
References zero_dim_univ_p.
|
friend |
Definition at line 510 of file Grid_Generator_System_defs.hh.
|
related |
Output operator.
Writes false
if gs
is empty. Otherwise, writes on s
the generators of gs
, all in one row and separated by ", ".
|
related |
Definition at line 180 of file Grid_Generator_System.cc.
|
related |
Returns true
if and only if x
and y
are identical.
|
related |
Definition at line 266 of file Grid_Generator_System_inlines.hh.
References is_equal_to().
|
friend |
|
friend |
Definition at line 509 of file Grid_Generator_System_defs.hh.
|
related |
Swaps x
with y
.
Referenced by m_swap(), and operator=().
|
related |
Definition at line 273 of file Grid_Generator_System_inlines.hh.
References m_swap().
|
static |
Definition at line 179 of file Grid_Generator_System_defs.hh.
|
private |
Definition at line 488 of file Grid_Generator_System_defs.hh.
Referenced by affine_image(), begin(), clear(), Parma_Polyhedra_Library::Grid::conversion(), empty(), end(), external_memory_in_bytes(), first_pending_row(), Parma_Polyhedra_Library::Grid::Grid(), Grid_Generator_System(), has_no_rows(), insert(), insert_verbatim(), is_equal_to(), m_swap(), Parma_Polyhedra_Library::Grid::normalize_divisors(), num_rows(), operator[](), remove_trailing_rows(), representation(), set_index_first_pending_row(), set_representation(), set_sorted(), Parma_Polyhedra_Library::Grid::simplify(), space_dimension(), Parma_Polyhedra_Library::Grid::time_elapse_assign(), topology(), and unset_pending_rows().
|
staticprivate |
Holds (between class initialization and finalization) a pointer to the singleton system containing only Grid_Generator::zero_dim_point().
Definition at line 494 of file Grid_Generator_System_defs.hh.
Referenced by zero_dim_univ().