A system of congruences. More...
#include <Congruence_System.defs.hh>


Classes | |
| class | const_iterator |
| An iterator over a system of congruences. More... | |
Public Member Functions | |
| Congruence_System () | |
| Default constructor: builds an empty system of congruences. | |
| Congruence_System (const Congruence &cg) | |
Builds the singleton system containing only congruence cg. | |
| Congruence_System (const Constraint &c) | |
If c represents the constraint , builds the singleton system containing only constraint . | |
| Congruence_System (const Constraint_System &cs) | |
Builds a system containing copies of any equalities in cs. | |
| Congruence_System (const Congruence_System &cgs) | |
| Ordinary copy constructor. | |
| ~Congruence_System () | |
| Destructor. | |
| Congruence_System & | operator= (const Congruence_System &cgs) |
| Assignment operator. | |
| dimension_type | space_dimension () const |
Returns the dimension of the vector space enclosing *this. | |
| bool | is_equal_to (const Congruence_System &cgs) const |
Returns true if and only if *this is exactly equal to cgs. | |
| bool | has_linear_equalities () const |
Returns true if and only if *this contains one or more linear equalities. | |
| void | clear () |
| Removes all the congruences and sets the space dimension to 0. | |
| void | insert (const Congruence &cg) |
Inserts in *this a copy of the congruence cg, increasing the number of space dimensions if needed. | |
| void | insert (const Constraint &c) |
Inserts in *this a copy of the equality constraint c, seen as a modulo 0 congruence, increasing the number of space dimensions if needed. | |
| void | insert (const Congruence_System &cgs) |
Inserts in *this a copy of the congruences in cgs, increasing the number of space dimensions if needed. | |
| void | recycling_insert (Congruence_System &cgs) |
Inserts into *this the congruences in cgs, increasing the number of space dimensions if needed. | |
| bool | empty () const |
Returns true if and only if *this has no congruences. | |
| const_iterator | begin () const |
Returns the const_iterator pointing to the first congruence, if this is not empty; otherwise, returns the past-the-end const_iterator. | |
| const_iterator | end () const |
| Returns the past-the-end const_iterator. | |
| bool | OK () const |
| Checks if all the invariants are satisfied. | |
| void | ascii_dump () const |
Writes to std::cerr an ASCII representation of *this. | |
| void | ascii_dump (std::ostream &s) const |
Writes to s an ASCII representation of *this. | |
| void | print () const |
Prints *this to std::cerr using operator<<. | |
| 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. | |
| memory_size_type | total_memory_in_bytes () const |
Returns the total size in bytes of the memory occupied by *this. | |
| memory_size_type | external_memory_in_bytes () const |
Returns the size in bytes of the memory managed by *this. | |
| dimension_type | num_equalities () const |
| Returns the number of equalities. | |
| dimension_type | num_proper_congruences () const |
| Returns the number of proper congruences. | |
| void | swap (Congruence_System &cgs) |
Swaps *this with y. | |
| void | add_unit_rows_and_columns (dimension_type dims) |
Adds dims rows and dims columns of zeroes to the matrix, initializing the added rows as in the unit congruence system. | |
Static Public Member Functions | |
| static dimension_type | max_space_dimension () |
| Returns the maximum space dimension a Congruence_System can handle. | |
| static void | initialize () |
| Initializes the class. | |
| static void | finalize () |
| Finalizes the class. | |
| static const Congruence_System & | zero_dim_empty () |
| Returns the system containing only Congruence::zero_dim_false(). | |
Protected Member Functions | |
| bool | satisfies_all_congruences (const Grid_Generator &g) const |
Returns true if g satisfies all the congruences. | |
Private Member Functions | |
| Congruence_System (dimension_type d) | |
Builds an empty (i.e. zero rows) system of dimension d. | |
| void | concatenate (const Congruence_System &cgs) |
Concatenates copies of the congruences from cgs onto *this. | |
| void | normalize_moduli () |
| Adjusts all expressions to have the same moduli. | |
| bool | increase_space_dimension (dimension_type new_space_dim) |
Increase the number of space dimensions to new_space_dim. | |
| void | insert_verbatim (const Congruence &cg) |
Inserts in *this an exact copy of the congruence cg, increasing the number of space dimensions if needed. | |
| Congruence & | operator[] (dimension_type k) |
Returns the k- th congruence of the system. | |
| const Congruence & | operator[] (dimension_type k) const |
Returns a constant reference to the k- th congruence of the system. | |
| bool | has_a_free_dimension () const |
Returns true if and only if any of the dimensions in *this is free of constraint. | |
| void | affine_preimage (dimension_type v, const Linear_Expression &expr, Coefficient_traits::const_reference denominator) |
| Substitutes a given column of coefficients by a given affine expression. | |
| void | remove_higher_space_dimensions (dimension_type new_dimension) |
Removes the higher dimensions of the system so that the resulting system will have dimension new_dimension. | |
| void | resize_no_copy (dimension_type new_num_rows, dimension_type new_num_columns) |
| Resizes the system without worrying about the old contents. | |
Static Private Attributes | |
| static const Congruence_System * | zero_dim_empty_p = 0 |
| Holds (between class initialization and finalization) a pointer to the singleton system containing only Congruence::zero_dim_false(). | |
Friends | |
| class | const_iterator |
| class | Grid |
| class | Grid_Certificate |
| void | std::swap (Parma_Polyhedra_Library::Congruence_System &x, Parma_Polyhedra_Library::Congruence_System &y) |
| bool | operator== (const Congruence_System &x, const Congruence_System &y) |
Related Functions | |
(Note that these are not member functions.) | |
| std::ostream & | operator<< (std::ostream &s, const Congruence_System &cgs) |
| Output operator. | |
| void | swap (Parma_Polyhedra_Library::Congruence_System &x, Parma_Polyhedra_Library::Congruence_System &y) |
Specializes std::swap. | |
A system of congruences.
An object of the class Congruence_System is a system of congruences, i.e., a multiset of objects of the class Congruence. When inserting congruences in a system, space dimensions are automatically adjusted so that all the congruences in the system are defined on the same vector space.
x and y are defined as follows: Variable x(0); Variable y(1);
: Congruence_System cgs; cgs.insert(x %= 0); cgs.insert(y %= 0);
and
, respectively.
: cgs.insert((x + y %= 1) / 2);
x and y values is odd.
containing just the integral points on the x axis: Congruence_System cgs; cgs.insert(x %= 0); cgs.insert((y %= 0) / 0);
Definition at line 122 of file Congruence_System.defs.hh.
| Parma_Polyhedra_Library::Congruence_System::Congruence_System | ( | ) | [inline] |
Default constructor: builds an empty system of congruences.
Definition at line 49 of file Congruence_System.inlines.hh.
Referenced by initialize().
00050 : Matrix(0, 2) { 00051 }
| Parma_Polyhedra_Library::Congruence_System::Congruence_System | ( | const Congruence & | cg | ) | [inline, explicit] |
Builds the singleton system containing only congruence cg.
Definition at line 54 of file Congruence_System.inlines.hh.
References insert().
| Parma_Polyhedra_Library::Congruence_System::Congruence_System | ( | const Constraint & | c | ) | [inline, explicit] |
If c represents the constraint
, builds the singleton system containing only constraint
.
| std::invalid_argument | Thrown if c is not an equality constraint. |
Definition at line 60 of file Congruence_System.inlines.hh.
References insert().
| Parma_Polyhedra_Library::Congruence_System::Congruence_System | ( | const Constraint_System & | cs | ) | [explicit] |
Builds a system containing copies of any equalities in cs.
Definition at line 41 of file Congruence_System.cc.
References Parma_Polyhedra_Library::Constraint_System::begin(), Parma_Polyhedra_Library::Constraint_System::end(), and insert().
00042 : Matrix(0, cs.space_dimension() + 2) { 00043 for (Constraint_System::const_iterator i = cs.begin(), 00044 cs_end = cs.end(); i != cs_end; ++i) 00045 if (i->is_equality()) 00046 insert(*i); 00047 }
| Parma_Polyhedra_Library::Congruence_System::Congruence_System | ( | const Congruence_System & | cgs | ) | [inline] |
Ordinary copy constructor.
Definition at line 66 of file Congruence_System.inlines.hh.
00067 : Matrix(cs) { 00068 }
| Parma_Polyhedra_Library::Congruence_System::~Congruence_System | ( | ) | [inline] |
| Parma_Polyhedra_Library::Congruence_System::Congruence_System | ( | dimension_type | d | ) | [inline, explicit, private] |
Builds an empty (i.e. zero rows) system of dimension d.
Definition at line 71 of file Congruence_System.inlines.hh.
00072 : Matrix(0, d + 2) { 00073 }
| void Parma_Polyhedra_Library::Congruence_System::add_unit_rows_and_columns | ( | dimension_type | dims | ) |
Adds dims rows and dims columns of zeroes to the matrix, initializing the added rows as in the unit congruence 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 507 of file Congruence_System.cc.
References Parma_Polyhedra_Library::Matrix::add_zero_rows_and_columns(), Parma_Polyhedra_Library::Linear_Row::LINE_OR_EQUALITY, Parma_Polyhedra_Library::NECESSARILY_CLOSED, Parma_Polyhedra_Library::Matrix::num_columns(), Parma_Polyhedra_Library::Matrix::num_rows(), Parma_Polyhedra_Library::swap(), and Parma_Polyhedra_Library::Matrix::swap_columns().
Referenced by Parma_Polyhedra_Library::Grid::add_space_dimensions(), and Parma_Polyhedra_Library::Grid::add_space_dimensions_and_project().
00507 { 00508 PPL_ASSERT(num_columns() > 0); 00509 dimension_type col = num_columns() - 1; 00510 dimension_type old_num_rows = num_rows(); 00511 add_zero_rows_and_columns(dims, dims, 00512 Linear_Row::Flags(NECESSARILY_CLOSED, 00513 Linear_Row::LINE_OR_EQUALITY)); 00514 // Swap the modulus column into the new last column. 00515 swap_columns(col, col + dims); 00516 00517 // Swap the added columns to the front of the matrix. 00518 for (dimension_type row = old_num_rows; row-- > 0; ) 00519 std::swap(operator[](row), operator[](row + dims)); 00520 00521 col += dims - 1; 00522 // Set the diagonal element of each added row. 00523 for (dimension_type row = dims; row-- > 0; ) 00524 const_cast<Coefficient&>(operator[](row)[col - row]) = 1; 00525 }
| void Parma_Polyhedra_Library::Congruence_System::affine_preimage | ( | dimension_type | v, | |
| const Linear_Expression & | expr, | |||
| Coefficient_traits::const_reference | denominator | |||
| ) | [private] |
Substitutes a given column of coefficients by a given affine expression.
| v | Index of the column to which the affine transformation is substituted; | |
| 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 substitutes the matrix of congruences by a new matrix whose elements
are built from the old one
as follows:
expr is a constant parameter and unaltered by this computation.
Definition at line 339 of file Congruence_System.cc.
References Parma_Polyhedra_Library::add_mul_assign(), Parma_Polyhedra_Library::Matrix::num_columns(), Parma_Polyhedra_Library::Matrix::num_rows(), Parma_Polyhedra_Library::Row::size(), Parma_Polyhedra_Library::Linear_Expression::space_dimension(), and space_dimension().
Referenced by Parma_Polyhedra_Library::Grid::affine_image(), and Parma_Polyhedra_Library::Grid::affine_preimage().
00341 { 00342 // `v' is the index of a column corresponding to a "user" variable 00343 // (i.e., it cannot be the inhomogeneous term). 00344 PPL_ASSERT(v > 0 && v <= space_dimension()); 00345 PPL_ASSERT(expr.space_dimension() <= space_dimension()); 00346 PPL_ASSERT(denominator > 0); 00347 00348 const dimension_type num_columns = this->num_columns(); 00349 const dimension_type num_rows = this->num_rows(); 00350 const dimension_type expr_size = expr.size(); 00351 const bool not_invertible = (v >= expr_size || expr[v] == 0); 00352 Congruence_System& x = *this; 00353 00354 if (denominator == 1) 00355 // Optimized computation only considering columns having indexes < 00356 // expr_size. 00357 for (dimension_type i = num_rows; i-- > 0; ) { 00358 Congruence& row = x[i]; 00359 Coefficient& row_v = row[v]; 00360 if (row_v != 0) { 00361 for (dimension_type j = expr_size; j-- > 0; ) 00362 if (j != v) 00363 // row[j] = row[j] + row_v * expr[j] 00364 add_mul_assign(row[j], row_v, expr[j]); 00365 if (not_invertible) 00366 row_v = 0; 00367 else 00368 row_v *= expr[v]; 00369 } 00370 } 00371 else 00372 for (dimension_type i = num_rows; i-- > 0; ) { 00373 Congruence& row = x[i]; 00374 Coefficient& row_v = row[v]; 00375 if (row_v != 0) { 00376 for (dimension_type j = num_columns; j-- > 0; ) 00377 if (j != v) { 00378 Coefficient& row_j = row[j]; 00379 row_j *= denominator; 00380 if (j < expr_size) 00381 add_mul_assign(row_j, row_v, expr[j]); 00382 } 00383 if (not_invertible) 00384 row_v = 0; 00385 else 00386 row_v *= expr[v]; 00387 } 00388 } 00389 }
| void Parma_Polyhedra_Library::Congruence_System::ascii_dump | ( | std::ostream & | s | ) | const |
Writes to s an ASCII representation of *this.
Reimplemented from Parma_Polyhedra_Library::Matrix.
Definition at line 392 of file Congruence_System.cc.
References ascii_dump(), Parma_Polyhedra_Library::Matrix::num_columns(), and Parma_Polyhedra_Library::Matrix::num_rows().
00392 { 00393 const Congruence_System& x = *this; 00394 dimension_type x_num_rows = x.num_rows(); 00395 dimension_type x_num_columns = x.num_columns(); 00396 s << x_num_rows << " x " << x_num_columns 00397 << std::endl; 00398 if (x_num_rows && x_num_columns) 00399 for (dimension_type i = 0; i < x_num_rows; ++i) 00400 x[i].ascii_dump(s); 00401 }
| void Parma_Polyhedra_Library::Congruence_System::ascii_dump | ( | ) | const |
Writes to std::cerr an ASCII representation of *this.
Reimplemented from Parma_Polyhedra_Library::Matrix.
Referenced by Parma_Polyhedra_Library::Grid::ascii_dump(), ascii_dump(), and Parma_Polyhedra_Library::Grid::OK().
| bool Parma_Polyhedra_Library::Congruence_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.
Reimplemented from Parma_Polyhedra_Library::Matrix.
Definition at line 406 of file Congruence_System.cc.
References Parma_Polyhedra_Library::ascii_load(), and Parma_Polyhedra_Library::Matrix::num_rows().
00406 { 00407 std::string str; 00408 dimension_type num_rows; 00409 dimension_type num_columns; 00410 if (!(s >> num_rows)) 00411 return false; 00412 if (!(s >> str) || str != "x") 00413 return false; 00414 if (!(s >> num_columns)) 00415 return false; 00416 resize_no_copy(num_rows, num_columns); 00417 00418 Congruence_System& x = *this; 00419 for (dimension_type i = 0; i < x.num_rows(); ++i) 00420 if (!x[i].ascii_load(s)) 00421 return false; 00422 00423 // Check invariants. 00424 PPL_ASSERT(OK()); 00425 return true; 00426 }
| Congruence_System::const_iterator Parma_Polyhedra_Library::Congruence_System::begin | ( | ) | const [inline] |
Returns the const_iterator pointing to the first congruence, if this is not empty; otherwise, returns the past-the-end const_iterator.
Reimplemented from Parma_Polyhedra_Library::Matrix.
Definition at line 176 of file Congruence_System.inlines.hh.
References Parma_Polyhedra_Library::Matrix::begin().
Referenced by Parma_Polyhedra_Library::Polyhedron::add_congruences(), Parma_Polyhedra_Library::Octagonal_Shape< T >::add_congruences(), Parma_Polyhedra_Library::BD_Shape< T >::add_congruences(), Parma_Polyhedra_Library::Box< ITV >::add_congruences_no_check(), Parma_Polyhedra_Library::Grid::add_recycled_congruences(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::approximate_partition(), Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::congruences(), Parma_Polyhedra_Library::Constraint_System::Constraint_System(), Parma_Polyhedra_Library::Grid::difference_assign(), empty(), Parma_Polyhedra_Library::Grid::expand_space_dimension(), Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::minimized_congruences(), operator<<(), Parma_Polyhedra_Library::Congruences_Reduction< D1, D2 >::product_reduce(), Parma_Polyhedra_Library::Box< ITV >::refine_no_check(), Parma_Polyhedra_Library::Polyhedron::refine_with_congruences(), Parma_Polyhedra_Library::Octagonal_Shape< T >::refine_with_congruences(), and Parma_Polyhedra_Library::BD_Shape< T >::refine_with_congruences().
00176 { 00177 const_iterator i(Matrix::begin(), *this); 00178 i.skip_forward(); 00179 return i; 00180 }
| void Parma_Polyhedra_Library::Congruence_System::clear | ( | ) | [inline] |
Removes all the congruences and sets the space dimension to 0.
Reimplemented from Parma_Polyhedra_Library::Matrix.
Definition at line 96 of file Congruence_System.inlines.hh.
References Parma_Polyhedra_Library::Matrix::add_zero_columns().
Referenced by Parma_Polyhedra_Library::Grid::set_zero_dim_univ().
00096 { 00097 Matrix::clear(); 00098 add_zero_columns(2); // Modulus and constant term. 00099 }
| void Parma_Polyhedra_Library::Congruence_System::concatenate | ( | const Congruence_System & | cgs | ) | [private] |
Concatenates copies of the congruences from cgs onto *this.
| cgs | The congruence system to append to this. The number of rows in cgs must be strictly positive. |
The matrix for the new system of congruences is obtained by leaving the old system in the upper left-hand side and placing the congruences of cgs in the lower right-hand side, and padding with zeroes.
Definition at line 528 of file Congruence_System.cc.
References Parma_Polyhedra_Library::Matrix::add_zero_rows_and_columns(), Parma_Polyhedra_Library::Matrix::num_columns(), Parma_Polyhedra_Library::Matrix::num_rows(), operator[](), space_dimension(), Parma_Polyhedra_Library::swap(), and swap().
Referenced by Parma_Polyhedra_Library::Grid::concatenate_assign().
00528 { 00529 // TODO: this implementation is just an executable specification. 00530 Congruence_System cgs = const_cgs; 00531 00532 dimension_type added_rows = cgs.num_rows(); 00533 dimension_type added_columns = cgs.space_dimension(); 00534 00535 dimension_type old_num_rows = num_rows(); 00536 dimension_type old_modi = num_columns() - 1; 00537 dimension_type old_space_dim = space_dimension(); 00538 00539 add_zero_rows_and_columns(added_rows, added_columns, 00540 Row::Flags()); 00541 00542 dimension_type cgs_num_columns = cgs.num_columns(); 00543 dimension_type modi = num_columns() - 1; 00544 00545 // Swap the modulus and the new last column, in the old rows. 00546 for (dimension_type i = old_num_rows; i-- > 0; ) { 00547 Congruence& cg = operator[](i); 00548 std::swap(cg[old_modi], cg[modi]); 00549 } 00550 00551 // Move the congruences into *this from `cgs', shifting the 00552 // coefficients along into the appropriate columns. 00553 for (dimension_type i = added_rows; i-- > 0; ) { 00554 Congruence& cg_old = cgs[i]; 00555 Congruence& cg_new = operator[](old_num_rows + i); 00556 // The inhomogeneous term is moved to the same column. 00557 std::swap(cg_new[0], cg_old[0]); 00558 // All homogeneous terms are shifted by `space_dim' columns. 00559 for (dimension_type j = cgs_num_columns; j-- > 1; ) 00560 std::swap(cg_old[j], cg_new[old_space_dim + j]); 00561 } 00562 }
| bool Parma_Polyhedra_Library::Congruence_System::empty | ( | ) | const [inline] |
| Congruence_System::const_iterator Parma_Polyhedra_Library::Congruence_System::end | ( | ) | const [inline] |
Returns the past-the-end const_iterator.
Reimplemented from Parma_Polyhedra_Library::Matrix.
Definition at line 183 of file Congruence_System.inlines.hh.
References Parma_Polyhedra_Library::Matrix::end().
Referenced by Parma_Polyhedra_Library::Polyhedron::add_congruences(), Parma_Polyhedra_Library::Octagonal_Shape< T >::add_congruences(), Parma_Polyhedra_Library::BD_Shape< T >::add_congruences(), Parma_Polyhedra_Library::Box< ITV >::add_congruences_no_check(), Parma_Polyhedra_Library::Grid::add_recycled_congruences(), Parma_Polyhedra_Library::Pointset_Powerset< PSET >::approximate_partition(), Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::congruences(), Parma_Polyhedra_Library::Constraint_System::Constraint_System(), Parma_Polyhedra_Library::Grid::difference_assign(), empty(), Parma_Polyhedra_Library::Grid::expand_space_dimension(), Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::minimized_congruences(), operator<<(), Parma_Polyhedra_Library::Congruences_Reduction< D1, D2 >::product_reduce(), Parma_Polyhedra_Library::Box< ITV >::refine_no_check(), Parma_Polyhedra_Library::Polyhedron::refine_with_congruences(), Parma_Polyhedra_Library::Octagonal_Shape< T >::refine_with_congruences(), and Parma_Polyhedra_Library::BD_Shape< T >::refine_with_congruences().
00183 { 00184 const const_iterator i(Matrix::end(), *this); 00185 return i; 00186 }
| memory_size_type Parma_Polyhedra_Library::Congruence_System::external_memory_in_bytes | ( | ) | const [inline] |
Returns the size in bytes of the memory managed by *this.
Reimplemented from Parma_Polyhedra_Library::Matrix.
Definition at line 199 of file Congruence_System.inlines.hh.
Referenced by Parma_Polyhedra_Library::Grid::external_memory_in_bytes().
00199 { 00200 return Matrix::external_memory_in_bytes(); 00201 }
| void Parma_Polyhedra_Library::Congruence_System::finalize | ( | ) | [static] |
Finalizes the class.
Definition at line 438 of file Congruence_System.cc.
References zero_dim_empty_p.
00438 { 00439 PPL_ASSERT(zero_dim_empty_p != 0); 00440 delete zero_dim_empty_p; 00441 zero_dim_empty_p = 0; 00442 }
| bool Parma_Polyhedra_Library::Congruence_System::has_a_free_dimension | ( | ) | const [private] |
Returns true if and only if any of the dimensions in *this is free of constraint.
Any equality or proper congruence affecting a dimension constrains that dimension.
This method assumes the system is in minimal form.
Definition at line 307 of file Congruence_System.cc.
References Parma_Polyhedra_Library::Matrix::num_rows(), operator[](), and space_dimension().
00307 { 00308 // Search for a dimension that is free of any congruence or equality 00309 // constraint. Assumes a minimized system. 00310 dimension_type space_dim = space_dimension(); 00311 std::vector<bool> free_dim(space_dim, true); 00312 dimension_type free_dims = space_dim; 00313 for (dimension_type row = num_rows(); row-- > 0; ) { 00314 const Congruence& cg = operator[](row); 00315 for (dimension_type dim = space_dim; dim-- > 0; ) 00316 if (free_dim[dim] && cg[dim+1] != 0) { 00317 if (--free_dims == 0) { 00318 // All dimensions are constrained. 00319 #ifndef NDEBUG 00320 free_dim[dim] = false; 00321 // Check that there are free_dims dimensions marked free 00322 // in free_dim. 00323 dimension_type count = 0; 00324 for (dimension_type i = space_dim; i-- > 0; ) 00325 count += free_dim[i]; 00326 PPL_ASSERT(count == free_dims); 00327 #endif 00328 return true; 00329 } 00330 free_dim[dim] = false; 00331 } 00332 } 00333 // At least one dimension is free of constraint. 00334 return false; 00335 }
| bool Parma_Polyhedra_Library::Congruence_System::has_linear_equalities | ( | ) | const |
Returns true if and only if *this contains one or more linear equalities.
Definition at line 238 of file Congruence_System.cc.
References Parma_Polyhedra_Library::Matrix::num_columns(), and Parma_Polyhedra_Library::Matrix::num_rows().
00238 { 00239 const Congruence_System& cgs = *this; 00240 const dimension_type modulus_index = cgs.num_columns() - 1; 00241 for (dimension_type i = cgs.num_rows(); i-- > 0; ) 00242 if (cgs[i][modulus_index] == 0) 00243 return true; 00244 return false; 00245 }
| bool Parma_Polyhedra_Library::Congruence_System::increase_space_dimension | ( | dimension_type | new_space_dim | ) | [private] |
Increase the number of space dimensions to new_space_dim.
new_space_dim must at least equal to the current space dimension.
Definition at line 51 of file Congruence_System.cc.
References Parma_Polyhedra_Library::Matrix::add_zero_columns(), Parma_Polyhedra_Library::Matrix::num_columns(), Parma_Polyhedra_Library::Matrix::num_rows(), OK(), space_dimension(), and Parma_Polyhedra_Library::Matrix::swap_columns().
Referenced by Parma_Polyhedra_Library::Grid::construct(), Parma_Polyhedra_Library::Grid::Grid(), Parma_Polyhedra_Library::Grid::remove_higher_space_dimensions(), and Parma_Polyhedra_Library::Grid::set_empty().
00051 { 00052 PPL_ASSERT(space_dimension() <= new_space_dim); 00053 00054 const dimension_type cols_to_add = new_space_dim - space_dimension(); 00055 00056 if (cols_to_add) { 00057 if (num_rows()) { 00058 const dimension_type old_num_columns = num_columns(); 00059 add_zero_columns(cols_to_add); 00060 // Move the moduli. 00061 swap_columns(num_columns() - 1, old_num_columns - 1); 00062 } 00063 else 00064 // Empty system. 00065 add_zero_columns(cols_to_add); 00066 } 00067 00068 PPL_ASSERT(OK()); 00069 return true; 00070 }
| void Parma_Polyhedra_Library::Congruence_System::initialize | ( | ) | [static] |
Initializes the class.
Definition at line 431 of file Congruence_System.cc.
References Congruence_System(), zero_dim_empty_p, and Parma_Polyhedra_Library::Congruence::zero_dim_false().
00431 { 00432 PPL_ASSERT(zero_dim_empty_p == 0); 00433 zero_dim_empty_p 00434 = new Congruence_System(Congruence::zero_dim_false()); 00435 }
| void Parma_Polyhedra_Library::Congruence_System::insert | ( | const Congruence_System & | cgs | ) |
Inserts in *this a copy of the congruences in cgs, increasing the number of space dimensions if needed.
The inserted copies will be strongly normalized.
Definition at line 156 of file Congruence_System.cc.
References Parma_Polyhedra_Library::Matrix::add_zero_rows(), Parma_Polyhedra_Library::Matrix::add_zero_rows_and_columns(), Parma_Polyhedra_Library::Matrix::num_columns(), Parma_Polyhedra_Library::Matrix::num_rows(), OK(), Parma_Polyhedra_Library::Matrix::row_capacity, Parma_Polyhedra_Library::Matrix::row_size, swap(), and Parma_Polyhedra_Library::Matrix::swap_columns().
00156 { 00157 Congruence_System& x = *this; 00158 00159 const dimension_type x_num_rows = x.num_rows(); 00160 const dimension_type y_num_rows = y.num_rows(); 00161 const dimension_type old_num_columns = x.num_columns(); 00162 const dimension_type y_num_columns = y.num_columns(); 00163 // Grow to the required size. 00164 if (old_num_columns >= y_num_columns) 00165 add_zero_rows(y_num_rows, Row::Flags()); 00166 else { 00167 add_zero_rows_and_columns(y_num_rows, 00168 y_num_columns - old_num_columns, 00169 Row::Flags()); 00170 // Swap the modulus column into the new last column. 00171 swap_columns(old_num_columns - 1, num_columns() - 1); 00172 } 00173 00174 // Copy the rows of `y', forcing size and capacity. 00175 const dimension_type x_mod_index = x.num_columns() - 1; 00176 const dimension_type y_mod_index = y_num_columns - 1; 00177 for (dimension_type i = y_num_rows; i-- > 0; ) { 00178 Row copy(y[i], x.row_size, x.row_capacity); 00179 // Swap the modulus to the correct column. 00180 std::swap(copy[x_mod_index], copy[y_mod_index]); 00181 std::swap(copy, x[x_num_rows+i]); 00182 } 00183 PPL_ASSERT(OK()); 00184 }
| void Parma_Polyhedra_Library::Congruence_System::insert | ( | const Constraint & | c | ) |
Inserts in *this a copy of the equality constraint c, seen as a modulo 0 congruence, increasing the number of space dimensions if needed.
The modulo 0 congruence will be strongly normalized after being inserted.
| std::invalid_argument | Thrown if c is a relational constraint. |
Definition at line 100 of file Congruence_System.cc.
References Parma_Polyhedra_Library::Matrix::add_recycled_row(), Parma_Polyhedra_Library::Matrix::add_zero_columns(), Parma_Polyhedra_Library::Matrix::has_no_rows(), Parma_Polyhedra_Library::Matrix::num_columns(), OK(), operator[](), Parma_Polyhedra_Library::Matrix::row_capacity, Parma_Polyhedra_Library::Matrix::rows, Parma_Polyhedra_Library::Constraint::space_dimension(), and Parma_Polyhedra_Library::Matrix::swap_columns().
00100 { 00101 const dimension_type cg_size = c.space_dimension() + 2; 00102 const dimension_type old_num_columns = num_columns(); 00103 if (cg_size < old_num_columns) { 00104 // Create a congruence of the required size from `c'. 00105 Congruence cg(c, old_num_columns, row_capacity); 00106 add_recycled_row(cg); 00107 } 00108 else { 00109 if (cg_size > old_num_columns) { 00110 // Resize the system, if necessary. 00111 add_zero_columns(cg_size - old_num_columns); 00112 if (!has_no_rows()) 00113 // Move the moduli to the last column. 00114 swap_columns(old_num_columns - 1, cg_size - 1); 00115 } 00116 Congruence cg(c, cg_size, row_capacity); 00117 add_recycled_row(cg); 00118 } 00119 operator[](rows.size()-1).strong_normalize(); 00120 00121 PPL_ASSERT(OK()); 00122 }
| void Parma_Polyhedra_Library::Congruence_System::insert | ( | const Congruence & | cg | ) | [inline] |
Inserts in *this a copy of the congruence cg, increasing the number of space dimensions if needed.
The copy of cg will be strongly normalized after being inserted.
Definition at line 42 of file Congruence_System.inlines.hh.
References insert_verbatim(), OK(), operator[](), and Parma_Polyhedra_Library::Matrix::rows.
Referenced by Parma_Polyhedra_Library::Grid::add_congruence_no_check(), Congruence_System(), Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::congruences(), Parma_Polyhedra_Library::Box< ITV >::congruences(), Parma_Polyhedra_Library::Grid::construct(), Parma_Polyhedra_Library::Grid::contains_integer_point(), Parma_Polyhedra_Library::Grid::Grid(), Parma_Polyhedra_Library::Grid::intersection_assign(), Parma_Polyhedra_Library::Grid::limited_congruence_extrapolation_assign(), Parma_Polyhedra_Library::Grid::limited_extrapolation_assign(), Parma_Polyhedra_Library::Grid::limited_generator_extrapolation_assign(), Parma_Polyhedra_Library::Partially_Reduced_Product< D1, D2, R >::minimized_congruences(), Parma_Polyhedra_Library::Octagonal_Shape< T >::minimized_congruences(), Parma_Polyhedra_Library::BD_Shape< T >::minimized_congruences(), Parma_Polyhedra_Library::Grid::select_wider_congruences(), and Parma_Polyhedra_Library::Grid::simplify_using_context_assign().
00042 { 00043 insert_verbatim(cg); 00044 static_cast<Congruence&>(operator[](rows.size()-1)).strong_normalize(); 00045 PPL_ASSERT(OK()); 00046 }
| void Parma_Polyhedra_Library::Congruence_System::insert_verbatim | ( | const Congruence & | cg | ) | [private] |
Inserts in *this an exact copy of the congruence cg, increasing the number of space dimensions if needed.
This method inserts a copy of cg in the given form, instead of first strong normalizing cg as insert would do.
Definition at line 73 of file Congruence_System.cc.
References Parma_Polyhedra_Library::Matrix::add_recycled_row(), Parma_Polyhedra_Library::Matrix::add_row(), Parma_Polyhedra_Library::Matrix::add_zero_columns(), Parma_Polyhedra_Library::Matrix::has_no_rows(), Parma_Polyhedra_Library::Matrix::num_columns(), OK(), Parma_Polyhedra_Library::Matrix::row_capacity, Parma_Polyhedra_Library::Row::size(), swap(), and Parma_Polyhedra_Library::Matrix::swap_columns().
Referenced by Parma_Polyhedra_Library::Grid::expand_space_dimension(), and insert().
00073 { 00074 const dimension_type old_num_columns = num_columns(); 00075 const dimension_type cg_size = cg.size(); 00076 00077 if (cg_size > old_num_columns) { 00078 // Resize the system, if necessary. 00079 add_zero_columns(cg_size - old_num_columns); 00080 if (!has_no_rows()) 00081 // Move the moduli to the last column. 00082 swap_columns(old_num_columns - 1, cg_size - 1); 00083 add_row(cg); 00084 } 00085 else if (cg_size < old_num_columns) { 00086 // Create a resized copy of `cg'. 00087 Congruence rc(cg, old_num_columns, row_capacity); 00088 // Move the modulus to its place. 00089 std::swap(rc[cg_size - 1], rc[old_num_columns - 1]); 00090 add_recycled_row(rc); 00091 } 00092 else 00093 // Here cg_size == old_num_columns. 00094 add_row(cg); 00095 00096 PPL_ASSERT(OK()); 00097 }
| bool Parma_Polyhedra_Library::Congruence_System::is_equal_to | ( | const Congruence_System & | cgs | ) | const |
Returns true if and only if *this is exactly equal to cgs.
Definition at line 224 of file Congruence_System.cc.
References Parma_Polyhedra_Library::Matrix::num_columns(), and Parma_Polyhedra_Library::Matrix::num_rows().
Referenced by Parma_Polyhedra_Library::Grid::OK().
00224 { 00225 if (num_rows() != cgs.num_rows()) 00226 return false; 00227 00228 for (dimension_type row = cgs.num_rows(); row-- > 0; ) 00229 for (dimension_type col = cgs.num_columns(); col-- > 0; ) { 00230 if (operator[](row)[col] == cgs[row][col]) 00231 continue; 00232 return false; 00233 } 00234 return true; 00235 }
| dimension_type Parma_Polyhedra_Library::Congruence_System::max_space_dimension | ( | ) | [inline, static] |
Returns the maximum space dimension a Congruence_System can handle.
Definition at line 86 of file Congruence_System.inlines.hh.
References Parma_Polyhedra_Library::Matrix::max_num_columns().
Referenced by Parma_Polyhedra_Library::Grid::max_space_dimension().
00086 { 00087 return Matrix::max_num_columns() - 2; 00088 }
| void Parma_Polyhedra_Library::Congruence_System::normalize_moduli | ( | ) | [private] |
Adjusts all expressions to have the same moduli.
Definition at line 187 of file Congruence_System.cc.
References Parma_Polyhedra_Library::exact_div_assign(), Parma_Polyhedra_Library::lcm_assign(), Parma_Polyhedra_Library::Congruence::modulus(), Parma_Polyhedra_Library::Matrix::num_rows(), OK(), operator[](), PPL_DIRTY_TEMP_COEFFICIENT, Parma_Polyhedra_Library::Matrix::row_size, and Parma_Polyhedra_Library::Row::size().
Referenced by Parma_Polyhedra_Library::Grid::construct(), and Parma_Polyhedra_Library::Grid::simplify().
00187 { 00188 dimension_type row = num_rows(); 00189 if (row > 0) { 00190 // Calculate the LCM of all the moduli. 00191 PPL_DIRTY_TEMP_COEFFICIENT(lcm); 00192 // Find last proper congruence. 00193 while (true) { 00194 lcm = operator[](--row).modulus(); 00195 if (lcm > 0) 00196 break; 00197 if (row == 0) 00198 // All rows are equalities. 00199 return; 00200 } 00201 while (row > 0) { 00202 const Coefficient& modulus = operator[](--row).modulus(); 00203 if (modulus > 0) 00204 lcm_assign(lcm, lcm, modulus); 00205 } 00206 00207 // Represent every row using the LCM as the modulus. 00208 PPL_DIRTY_TEMP_COEFFICIENT(factor); 00209 dimension_type row_size = operator[](0).size(); 00210 for (row = num_rows(); row-- > 0; ) { 00211 const Coefficient& modulus = operator[](row).modulus(); 00212 if (modulus <= 0 || modulus == lcm) 00213 continue; 00214 exact_div_assign(factor, lcm, modulus); 00215 for (dimension_type col = row_size; col-- > 0; ) 00216 operator[](row)[col] *= factor; 00217 operator[](row)[row_size-1] = lcm; 00218 } 00219 } 00220 PPL_ASSERT(OK()); 00221 }
| PPL::dimension_type Parma_Polyhedra_Library::Congruence_System::num_equalities | ( | ) | const |
Returns the number of equalities.
Definition at line 255 of file Congruence_System.cc.
References Parma_Polyhedra_Library::Matrix::num_rows().
Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::approximate_partition_aux(), Parma_Polyhedra_Library::Grid::congruence_widening_assign(), Parma_Polyhedra_Library::Grid_Certificate::Grid_Certificate(), and Parma_Polyhedra_Library::Grid::quick_equivalence_test().
00255 { 00256 const Congruence_System& cgs = *this; 00257 dimension_type n = 0; 00258 for (dimension_type i = num_rows(); i-- > 0 ; ) 00259 if (cgs[i].is_equality()) 00260 ++n; 00261 return n; 00262 }
| PPL::dimension_type Parma_Polyhedra_Library::Congruence_System::num_proper_congruences | ( | ) | const |
Returns the number of proper congruences.
Definition at line 265 of file Congruence_System.cc.
References Parma_Polyhedra_Library::Congruence::is_proper_congruence(), and Parma_Polyhedra_Library::Matrix::num_rows().
Referenced by Parma_Polyhedra_Library::Pointset_Powerset< PSET >::approximate_partition_aux(), and Parma_Polyhedra_Library::Grid_Certificate::Grid_Certificate().
00265 { 00266 const Congruence_System& cgs = *this; 00267 dimension_type n = 0; 00268 for (dimension_type i = num_rows(); i-- > 0 ; ) { 00269 const Congruence& cg = cgs[i]; 00270 if (cg.is_proper_congruence()) 00271 ++n; 00272 } 00273 return n; 00274 }
| bool Parma_Polyhedra_Library::Congruence_System::OK | ( | ) | const |
Checks if all the invariants are satisfied.
Returns true if and only if *this is a valid Matrix, each row in the system is a valid Congruence and the number of columns is consistent with the number of congruences.
Reimplemented from Parma_Polyhedra_Library::Matrix.
Definition at line 445 of file Congruence_System.cc.
References Parma_Polyhedra_Library::Matrix::num_columns(), Parma_Polyhedra_Library::Matrix::num_rows(), Parma_Polyhedra_Library::Congruence::OK(), and Parma_Polyhedra_Library::Matrix::OK().
Referenced by increase_space_dimension(), insert(), insert_verbatim(), normalize_moduli(), Parma_Polyhedra_Library::Grid::OK(), recycling_insert(), remove_higher_space_dimensions(), and Parma_Polyhedra_Library::Grid::simplify().
00445 { 00446 // A Congruence_System must be a valid Matrix. 00447 if (!Matrix::OK()) 00448 return false; 00449 00450 if (num_rows()) { 00451 if (num_columns() < 2) { 00452 #ifndef NDEBUG 00453 std::cerr << "Congruence_System has rows and fewer than two columns." 00454 << std::endl; 00455 #endif 00456 return false; 00457 } 00458 } 00459 00460 // Checking each congruence in the system. 00461 const Congruence_System& x = *this; 00462 for (dimension_type i = num_rows(); i-- > 0; ) { 00463 const Congruence& cg = x[i]; 00464 if (!cg.OK()) 00465 return false; 00466 } 00467 00468 // All checks passed. 00469 return true; 00470 }
| Congruence_System & Parma_Polyhedra_Library::Congruence_System::operator= | ( | const Congruence_System & | cgs | ) | [inline] |
Assignment operator.
Definition at line 80 of file Congruence_System.inlines.hh.
00080 { 00081 Matrix::operator=(y); 00082 return *this; 00083 }
| const Congruence & Parma_Polyhedra_Library::Congruence_System::operator[] | ( | dimension_type | k | ) | const [inline, private] |
Returns a constant reference to the k- th congruence of the system.
Reimplemented from Parma_Polyhedra_Library::Matrix.
Definition at line 37 of file Congruence_System.inlines.hh.
References operator[]().
00037 { 00038 return static_cast<const Congruence&>(Matrix::operator[](k)); 00039 }
| Congruence & Parma_Polyhedra_Library::Congruence_System::operator[] | ( | dimension_type | k | ) | [inline, private] |
Returns the k- th congruence of the system.
Reimplemented from Parma_Polyhedra_Library::Matrix.
Definition at line 32 of file Congruence_System.inlines.hh.
Referenced by concatenate(), has_a_free_dimension(), insert(), normalize_moduli(), operator[](), and recycling_insert().
00032 { 00033 return static_cast<Congruence&>(Matrix::operator[](k)); 00034 }
| void Parma_Polyhedra_Library::Congruence_System::print | ( | ) | const |
Prints *this to std::cerr using operator<<.
Reimplemented from Parma_Polyhedra_Library::Matrix.
| void Parma_Polyhedra_Library::Congruence_System::recycling_insert | ( | Congruence_System & | cgs | ) |
Inserts into *this the congruences in cgs, increasing the number of space dimensions if needed.
Definition at line 125 of file Congruence_System.cc.
References Parma_Polyhedra_Library::Matrix::add_zero_rows(), Parma_Polyhedra_Library::Matrix::add_zero_rows_and_columns(), Parma_Polyhedra_Library::Matrix::num_columns(), Parma_Polyhedra_Library::Matrix::num_rows(), OK(), operator[](), swap(), Parma_Polyhedra_Library::swap(), and Parma_Polyhedra_Library::Matrix::swap_columns().
Referenced by Parma_Polyhedra_Library::Grid::add_recycled_congruences().
00125 { 00126 const dimension_type old_num_rows = num_rows(); 00127 const dimension_type cgs_num_rows = cgs.num_rows(); 00128 const dimension_type old_num_columns = num_columns(); 00129 dimension_type cgs_num_columns = cgs.num_columns(); 00130 if (old_num_columns >= cgs_num_columns) 00131 add_zero_rows(cgs_num_rows, Row::Flags()); 00132 else { 00133 add_zero_rows_and_columns(cgs_num_rows, 00134 cgs_num_columns - old_num_columns, 00135 Row::Flags()); 00136 // Swap the modulus column into the new last column. 00137 swap_columns(old_num_columns - 1, num_columns() - 1); 00138 } 00139 --cgs_num_columns; // Convert to modulus index. 00140 const dimension_type mod_index = num_columns() - 1; 00141 for (dimension_type i = cgs_num_rows; i-- > 0; ) { 00142 // Swap one coefficient at a time into the newly added rows, instead 00143 // of swapping each entire row. This ensures that the added rows 00144 // have the same capacities as the existing rows. 00145 Congruence& new_cg = operator[](old_num_rows + i); 00146 Congruence& old_cg = cgs[i]; 00147 for (dimension_type j = cgs_num_columns; j-- > 0; ) 00148 std::swap(new_cg[j], old_cg[j]); 00149 std::swap(new_cg[mod_index], old_cg[cgs_num_columns]); // Modulus. 00150 } 00151 00152 PPL_ASSERT(OK()); 00153 }
| void Parma_Polyhedra_Library::Congruence_System::remove_higher_space_dimensions | ( | dimension_type | new_dimension | ) | [private] |
Removes the higher dimensions of the system so that the resulting system will have dimension new_dimension.
The value of new_dimension must be at most the space dimension of *this.
Definition at line 566 of file Congruence_System.cc.
References OK(), Parma_Polyhedra_Library::Matrix::remove_trailing_columns(), space_dimension(), and Parma_Polyhedra_Library::Matrix::swap_columns().
Referenced by Parma_Polyhedra_Library::Grid::remove_higher_space_dimensions().
00566 { 00567 dimension_type space_dim = space_dimension(); 00568 00569 PPL_ASSERT(new_dimension <= space_dim); 00570 00571 // The removal of no dimensions from any system is a no-op. Note 00572 // that this case also captures the only legal removal of dimensions 00573 // from a system in a 0-dim space. 00574 if (new_dimension == space_dim) 00575 return; 00576 00577 // Swap the modulus column into the column that will become the last 00578 // column. 00579 swap_columns(new_dimension + 1, space_dim + 1); 00580 00581 remove_trailing_columns(space_dim - new_dimension); 00582 PPL_ASSERT(OK()); 00583 }
| void Parma_Polyhedra_Library::Congruence_System::resize_no_copy | ( | dimension_type | new_num_rows, | |
| dimension_type | new_num_columns | |||
| ) | [inline, private] |
Resizes the system without worrying about the old contents.
| new_num_rows | The number of rows of the resized system; | |
| new_num_columns | The number of columns of the resized system. |
The system is expanded to the specified dimensions avoiding reallocation whenever possible. The contents of the original system is lost.
Definition at line 102 of file Congruence_System.inlines.hh.
Referenced by Parma_Polyhedra_Library::Grid::conversion().
00103 { 00104 Matrix::resize_no_copy(new_num_rows, new_num_columns, Row::Flags()); 00105 }
| bool Parma_Polyhedra_Library::Congruence_System::satisfies_all_congruences | ( | const Grid_Generator & | g | ) | const [protected] |
Returns true if g satisfies all the congruences.
Definition at line 278 of file Congruence_System.cc.
References Parma_Polyhedra_Library::Scalar_Products::assign(), Parma_Polyhedra_Library::Grid_Generator::divisor(), Parma_Polyhedra_Library::Congruence::is_equality(), Parma_Polyhedra_Library::Grid_Generator::is_line(), Parma_Polyhedra_Library::Congruence::modulus(), PPL_DIRTY_TEMP_COEFFICIENT, space_dimension(), and Parma_Polyhedra_Library::Grid_Generator::space_dimension().
Referenced by Parma_Polyhedra_Library::Grid::is_included_in(), Parma_Polyhedra_Library::Grid::is_universe(), and Parma_Polyhedra_Library::Grid::relation_with().
00278 { 00279 PPL_ASSERT(g.space_dimension() <= space_dimension()); 00280 00281 const Congruence_System& cgs = *this; 00282 PPL_DIRTY_TEMP_COEFFICIENT(sp); 00283 if (g.is_line()) 00284 for (dimension_type i = cgs.num_rows(); i-- > 0; ) { 00285 const Congruence& cg = cgs[i]; 00286 Scalar_Products::assign(sp, g, cg); 00287 if (sp != 0) 00288 return false; 00289 } 00290 else { 00291 const Coefficient& divisor = g.divisor(); 00292 for (dimension_type i = cgs.num_rows(); i-- > 0; ) { 00293 const Congruence& cg = cgs[i]; 00294 Scalar_Products::assign(sp, g, cg); 00295 if (cg.is_equality()) { 00296 if (sp != 0) 00297 return false; 00298 } 00299 else if (sp % (cg.modulus() * divisor) != 0) 00300 return false; 00301 } 00302 } 00303 return true; 00304 }
| dimension_type Parma_Polyhedra_Library::Congruence_System::space_dimension | ( | ) | const [inline] |
Returns the dimension of the vector space enclosing *this.
Definition at line 91 of file Congruence_System.inlines.hh.
References Parma_Polyhedra_Library::Matrix::num_columns().
Referenced by Parma_Polyhedra_Library::Polyhedron::add_congruences(), Parma_Polyhedra_Library::Grid::add_congruences(), Parma_Polyhedra_Library::Box< ITV >::add_congruences(), Parma_Polyhedra_Library::Box< ITV >::add_congruences_no_check(), Parma_Polyhedra_Library::Grid::add_recycled_congruences(), affine_preimage(), Parma_Polyhedra_Library::Box< ITV >::Box(), concatenate(), Parma_Polyhedra_Library::Grid::construct(), has_a_free_dimension(), increase_space_dimension(), Parma_Polyhedra_Library::Grid::limited_congruence_extrapolation_assign(), Parma_Polyhedra_Library::Grid::limited_extrapolation_assign(), Parma_Polyhedra_Library::Grid::limited_generator_extrapolation_assign(), Parma_Polyhedra_Library::Octagonal_Shape< T >::Octagonal_Shape(), Parma_Polyhedra_Library::Grid::OK(), Parma_Polyhedra_Library::Box< ITV >::refine_no_check(), Parma_Polyhedra_Library::Polyhedron::refine_with_congruences(), Parma_Polyhedra_Library::Octagonal_Shape< T >::refine_with_congruences(), Parma_Polyhedra_Library::Box< ITV >::refine_with_congruences(), Parma_Polyhedra_Library::BD_Shape< T >::refine_with_congruences(), remove_higher_space_dimensions(), satisfies_all_congruences(), Parma_Polyhedra_Library::Grid::select_wider_congruences(), Parma_Polyhedra_Library::Polyhedron::throw_dimension_incompatible(), Parma_Polyhedra_Library::Grid::throw_dimension_incompatible(), and Parma_Polyhedra_Library::Box< ITV >::throw_dimension_incompatible().
00091 { 00092 return Matrix::num_columns() - 2; 00093 }
| void Parma_Polyhedra_Library::Congruence_System::swap | ( | Congruence_System & | cgs | ) | [inline] |
Swaps *this with y.
Definition at line 194 of file Congruence_System.inlines.hh.
Referenced by concatenate(), Parma_Polyhedra_Library::Grid::construct(), insert(), insert_verbatim(), recycling_insert(), Parma_Polyhedra_Library::Grid::remove_higher_space_dimensions(), and swap().
00194 { 00195 Matrix::swap(y); 00196 }
| memory_size_type Parma_Polyhedra_Library::Congruence_System::total_memory_in_bytes | ( | ) | const [inline] |
Returns the total size in bytes of the memory occupied by *this.
Reimplemented from Parma_Polyhedra_Library::Matrix.
Definition at line 204 of file Congruence_System.inlines.hh.
00204 { 00205 return Matrix::total_memory_in_bytes(); 00206 }
| const Congruence_System & Parma_Polyhedra_Library::Congruence_System::zero_dim_empty | ( | ) | [inline, static] |
Returns the system containing only Congruence::zero_dim_false().
Definition at line 108 of file Congruence_System.inlines.hh.
References zero_dim_empty_p.
Referenced by Parma_Polyhedra_Library::Box< ITV >::congruences(), Parma_Polyhedra_Library::Octagonal_Shape< T >::minimized_congruences(), and Parma_Polyhedra_Library::BD_Shape< T >::minimized_congruences().
00108 { 00109 PPL_ASSERT(zero_dim_empty_p != 0); 00110 return *zero_dim_empty_p; 00111 }
friend class const_iterator [friend] |
Definition at line 407 of file Congruence_System.defs.hh.
friend class Grid [friend] |
Definition at line 408 of file Congruence_System.defs.hh.
friend class Grid_Certificate [friend] |
Definition at line 409 of file Congruence_System.defs.hh.
| std::ostream & operator<< | ( | std::ostream & | s, | |
| const Congruence_System & | cgs | |||
| ) | [related] |
Output operator.
Writes true if cgs is empty. Otherwise, writes on s the congruences of cgs, all in one row and separated by ", ".
Definition at line 474 of file Congruence_System.cc.
References begin(), end(), and Parma_Polyhedra_Library::Congruence::strong_normalize().
00474 { 00475 Congruence_System::const_iterator i = cgs.begin(); 00476 const Congruence_System::const_iterator cgs_end = cgs.end(); 00477 if (i == cgs_end) 00478 return s << "true"; 00479 while (true) { 00480 Congruence cg = *i++; 00481 cg.strong_normalize(); 00482 s << cg; 00483 if (i == cgs_end) 00484 return s; 00485 s << ", "; 00486 } 00487 }
| bool operator== | ( | const Congruence_System & | x, | |
| const Congruence_System & | y | |||
| ) | [friend] |
Definition at line 491 of file Congruence_System.cc.
00491 { 00492 if (x.num_columns() == y.num_columns()) { 00493 dimension_type num_rows = x.num_rows(); 00494 if (num_rows == y.num_rows()) { 00495 while (num_rows--) { 00496 if (x[num_rows] == y[num_rows]) 00497 continue; 00498 return false; 00499 } 00500 return true; 00501 } 00502 } 00503 return false; 00504 }
| void std::swap | ( | Parma_Polyhedra_Library::Congruence_System & | x, | |
| Parma_Polyhedra_Library::Congruence_System & | y | |||
| ) | [friend] |
| void swap | ( | Parma_Polyhedra_Library::Congruence_System & | x, | |
| Parma_Polyhedra_Library::Congruence_System & | y | |||
| ) | [related] |
Specializes std::swap.
Definition at line 215 of file Congruence_System.inlines.hh.
References swap().
00216 { 00217 x.swap(y); 00218 }
const PPL::Congruence_System * Parma_Polyhedra_Library::Congruence_System::zero_dim_empty_p = 0 [static, private] |
Holds (between class initialization and finalization) a pointer to the singleton system containing only Congruence::zero_dim_false().
Definition at line 369 of file Congruence_System.defs.hh.
Referenced by finalize(), initialize(), and zero_dim_empty().
1.6.3