|
PPL
1.2
|
A matrix representing octagonal constraints. More...
#include <OR_Matrix_defs.hh>

Classes | |
| class | any_row_iterator |
| A template class to derive both OR_Matrix::iterator and OR_Matrix::const_iterator. More... | |
| class | Pseudo_Row |
| An object that behaves like a matrix's row with respect to the subscript operators. More... | |
Public Types | |
| typedef Pseudo_Row< T > | row_reference_type |
| A (non const) reference to a matrix's row. More... | |
| typedef Pseudo_Row< const T > | const_row_reference_type |
| A const reference to a matrix's row. More... | |
| typedef any_row_iterator< T > | row_iterator |
| A (non const) row iterator. More... | |
| typedef any_row_iterator< const T > | const_row_iterator |
| A const row iterator. More... | |
| typedef DB_Row< T >::iterator | element_iterator |
| A (non const) element iterator. More... | |
| typedef DB_Row< T >::const_iterator | const_element_iterator |
| A const element iterator. More... | |
Public Member Functions | |
| OR_Matrix (dimension_type num_dimensions) | |
| Builds a matrix with specified dimensions. More... | |
| OR_Matrix (const OR_Matrix &y) | |
| Copy constructor. More... | |
| template<typename U > | |
| OR_Matrix (const OR_Matrix< U > &y) | |
Constructs a conservative approximation of y. More... | |
| ~OR_Matrix () | |
| Destructor. More... | |
| OR_Matrix & | operator= (const OR_Matrix &y) |
| Assignment operator. More... | |
| void | m_swap (OR_Matrix &y) |
Swaps *this with y. More... | |
| void | grow (dimension_type new_dim) |
| Makes the matrix grow by adding more space dimensions. More... | |
| void | shrink (dimension_type new_dim) |
| Makes the matrix shrink by removing the last space dimensions. More... | |
| void | resize_no_copy (dimension_type new_dim) |
| Resizes the matrix without worrying about the old contents. More... | |
| dimension_type | space_dimension () const |
| Returns the space-dimension of the matrix. More... | |
| dimension_type | num_rows () const |
| Returns the number of rows in the matrix. More... | |
| row_iterator | row_begin () |
Returns an iterator pointing to the first row, if *this is not empty; otherwise, returns the past-the-end const_iterator. More... | |
| row_iterator | row_end () |
| Returns the past-the-end const_iterator. More... | |
| const_row_iterator | row_begin () const |
Returns a const row iterator pointing to the first row, if *this is not empty; otherwise, returns the past-the-end const_iterator. More... | |
| const_row_iterator | row_end () const |
| Returns the past-the-end const row iterator. More... | |
| element_iterator | element_begin () |
Returns an iterator pointing to the first element, if *this is not empty; otherwise, returns the past-the-end const_iterator. More... | |
| element_iterator | element_end () |
| Returns the past-the-end const_iterator. More... | |
| const_element_iterator | element_begin () const |
Returns a const element iterator pointing to the first element, if *this is not empty; otherwise, returns the past-the-end const_iterator. More... | |
| const_element_iterator | element_end () const |
| Returns the past-the-end const element iterator. More... | |
| void | clear () |
| Clears the matrix deallocating all its rows. 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... | |
| bool | OK () const |
| Checks if all the invariants are satisfied. More... | |
Subscript operators. | |
| row_reference_type | operator[] (dimension_type k) |
Returns a reference to the k-th row of the matrix. More... | |
| const_row_reference_type | operator[] (dimension_type k) const |
Returns a constant reference to the k-th row of the matrix. More... | |
Static Public Member Functions | |
| static dimension_type | max_num_rows () |
| Returns the maximum number of rows of a OR_Matrix. More... | |
| static dimension_type | row_size (dimension_type k) |
Returns the size of the row of index k. More... | |
Private Member Functions | |
| OR_Matrix () | |
| Private and not implemented: default construction is not allowed. More... | |
Static Private Member Functions | |
| static dimension_type | row_first_element_index (dimension_type k) |
Returns the index into vec of the first element of the row of index k. More... | |
Private Attributes | |
| DB_Row< T > | vec |
| Contains the rows of the matrix. More... | |
| dimension_type | space_dim |
| Contains the dimension of the space of the matrix. More... | |
| dimension_type | vec_capacity |
Contains the capacity of vec. More... | |
Friends | |
| template<typename U > | |
| class | OR_Matrix |
| bool | operator== (const OR_Matrix< T > &x, const OR_Matrix< T > &y) |
Related Functions | |
(Note that these are not member functions.) | |
| template<typename T > | |
| bool | operator== (const OR_Matrix< T > &x, const OR_Matrix< T > &y) |
Returns true if and only if x and y are identical. More... | |
| template<typename T > | |
| std::ostream & | operator<< (std::ostream &s, const OR_Matrix< T > &m) |
| Output operator. More... | |
| template<typename T > | |
| void | swap (OR_Matrix< T > &x, OR_Matrix< T > &y) |
Swaps x with y. More... | |
| template<typename T > | |
| bool | operator!= (const OR_Matrix< T > &x, const OR_Matrix< T > &y) |
Returns true if and only if x and y are different. More... | |
| template<typename Temp , typename To , typename T > | |
| bool | rectilinear_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const OR_Matrix< T > &x, const OR_Matrix< T > &y, Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2) |
Computes the rectilinear (or Manhattan) distance between x and y. More... | |
| template<typename Temp , typename To , typename T > | |
| bool | euclidean_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const OR_Matrix< T > &x, const OR_Matrix< T > &y, Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2) |
Computes the euclidean distance between x and y. More... | |
| template<typename Temp , typename To , typename T > | |
| bool | l_infinity_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const OR_Matrix< T > &x, const OR_Matrix< T > &y, Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2) |
Computes the distance between x and y. More... | |
| template<typename T > | |
| bool | operator== (const OR_Matrix< T > &x, const OR_Matrix< T > &y) |
| template<typename T > | |
| bool | operator!= (const OR_Matrix< T > &x, const OR_Matrix< T > &y) |
| template<typename Specialization , typename Temp , typename To , typename T > | |
| bool | l_m_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const OR_Matrix< T > &x, const OR_Matrix< T > &y, const Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2) |
| template<typename Temp , typename To , typename T > | |
| bool | rectilinear_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const OR_Matrix< T > &x, const OR_Matrix< T > &y, const Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2) |
| template<typename Temp , typename To , typename T > | |
| bool | euclidean_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const OR_Matrix< T > &x, const OR_Matrix< T > &y, const Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2) |
| template<typename Temp , typename To , typename T > | |
| bool | l_infinity_distance_assign (Checked_Number< To, Extended_Number_Policy > &r, const OR_Matrix< T > &x, const OR_Matrix< T > &y, const Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2) |
| template<typename T > | |
| void | swap (OR_Matrix< T > &x, OR_Matrix< T > &y) |
| template<typename T > | |
| std::ostream & | operator<< (std::ostream &s, const OR_Matrix< T > &m) |
A matrix representing octagonal constraints.
An OR_Matrix object is a DB_Row object that allows the representation of a pseudo-triangular matrix, like the following:
_ _
0 |_|_|
1 |_|_|_ _
2 |_|_|_|_|
3 |_|_|_|_|_ _
4 |_|_|_|_|_|_|
5 |_|_|_|_|_|_|
. . .
_ _ _ _ _ _ _
2n-2 |_|_|_|_|_|_| ... |_|
2n-1 |_|_|_|_|_|_| ... |_|
0 1 2 3 4 5 ... 2n-1It is characterized by parameter n that defines the structure, and such that there are 2*n rows (and 2*n columns). It provides row_iterators for the access to the rows and element_iterators for the access to the elements.
Definition at line 105 of file OR_Matrix_defs.hh.
| typedef DB_Row<T>::const_iterator Parma_Polyhedra_Library::OR_Matrix< T >::const_element_iterator |
A const element iterator.
Definition at line 341 of file OR_Matrix_defs.hh.
| typedef any_row_iterator<const T> Parma_Polyhedra_Library::OR_Matrix< T >::const_row_iterator |
A const row iterator.
Definition at line 335 of file OR_Matrix_defs.hh.
| typedef Pseudo_Row<const T> Parma_Polyhedra_Library::OR_Matrix< T >::const_row_reference_type |
A const reference to a matrix's row.
Definition at line 193 of file OR_Matrix_defs.hh.
| typedef DB_Row<T>::iterator Parma_Polyhedra_Library::OR_Matrix< T >::element_iterator |
A (non const) element iterator.
Definition at line 338 of file OR_Matrix_defs.hh.
| typedef any_row_iterator<T> Parma_Polyhedra_Library::OR_Matrix< T >::row_iterator |
A (non const) row iterator.
Definition at line 332 of file OR_Matrix_defs.hh.
| typedef Pseudo_Row<T> Parma_Polyhedra_Library::OR_Matrix< T >::row_reference_type |
A (non const) reference to a matrix's row.
Definition at line 190 of file OR_Matrix_defs.hh.
|
inline |
Builds a matrix with specified dimensions.
| num_dimensions | The space dimension of the matrix that will be created. |
This constructor creates a matrix with 2*num_dimensions rows. Each element is initialized to plus infinity.
Definition at line 483 of file OR_Matrix_inlines.hh.
|
inline |
Copy constructor.
Definition at line 552 of file OR_Matrix_inlines.hh.
|
inlineexplicit |
Constructs a conservative approximation of y.
Definition at line 562 of file OR_Matrix_inlines.hh.
References Parma_Polyhedra_Library::OR_Matrix< T >::OK(), Parma_Polyhedra_Library::OR_Matrix< T >::vec, and Parma_Polyhedra_Library::OR_Matrix< T >::vec_capacity.
|
inline |
|
private |
Private and not implemented: default construction is not allowed.
| void Parma_Polyhedra_Library::OR_Matrix< T >::ascii_dump | ( | ) | const |
Writes to std::cerr an ASCII representation of *this.
| void Parma_Polyhedra_Library::OR_Matrix< T >::ascii_dump | ( | std::ostream & | s | ) | const |
Writes to s an ASCII representation of *this.
Definition at line 66 of file OR_Matrix_templates.hh.
References Parma_Polyhedra_Library::OR_Matrix< T >::row_begin(), Parma_Polyhedra_Library::OR_Matrix< T >::row_end(), Parma_Polyhedra_Library::Implementation::BD_Shapes::separator, and Parma_Polyhedra_Library::OR_Matrix< T >::space_dimension().
| bool Parma_Polyhedra_Library::OR_Matrix< T >::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 87 of file OR_Matrix_templates.hh.
References Parma_Polyhedra_Library::is_minus_infinity(), Parma_Polyhedra_Library::result_relation(), Parma_Polyhedra_Library::ROUND_CHECK, and Parma_Polyhedra_Library::VR_EQ.
|
inline |
Clears the matrix deallocating all its rows.
Definition at line 528 of file OR_Matrix_inlines.hh.
|
inline |
Returns an iterator pointing to the first element, if *this is not empty; otherwise, returns the past-the-end const_iterator.
Definition at line 417 of file OR_Matrix_inlines.hh.
References Parma_Polyhedra_Library::OR_Matrix< T >::vec.
Referenced by Parma_Polyhedra_Library::OR_Matrix< T >::grow(), and Parma_Polyhedra_Library::OR_Matrix< T >::l_m_distance_assign().
|
inline |
Returns a const element iterator pointing to the first element, if *this is not empty; otherwise, returns the past-the-end const_iterator.
Definition at line 429 of file OR_Matrix_inlines.hh.
References Parma_Polyhedra_Library::OR_Matrix< T >::vec.
|
inline |
Returns the past-the-end const_iterator.
Definition at line 423 of file OR_Matrix_inlines.hh.
References Parma_Polyhedra_Library::OR_Matrix< T >::vec.
Referenced by Parma_Polyhedra_Library::OR_Matrix< T >::l_m_distance_assign().
|
inline |
Returns the past-the-end const element iterator.
Definition at line 435 of file OR_Matrix_inlines.hh.
References Parma_Polyhedra_Library::OR_Matrix< T >::vec.
| memory_size_type Parma_Polyhedra_Library::OR_Matrix< T >::external_memory_in_bytes | ( | ) | const |
Returns the size in bytes of the memory managed by *this.
Definition at line 33 of file OR_Matrix_templates.hh.
Referenced by Parma_Polyhedra_Library::OR_Matrix< T >::total_memory_in_bytes().
|
inline |
Makes the matrix grow by adding more space dimensions.
| new_dim | The new dimension of the resized matrix. |
Adds new rows of right dimension to the end if there is enough capacity; otherwise, creates a new matrix, with the specified dimension, copying the old elements in the upper part of the new matrix, which is then assigned to *this. Each new element is initialized to plus infinity.
Definition at line 582 of file OR_Matrix_inlines.hh.
References Parma_Polyhedra_Library::assign_or_swap(), and Parma_Polyhedra_Library::OR_Matrix< T >::element_begin().
|
inline |
Swaps *this with y.
Definition at line 441 of file OR_Matrix_inlines.hh.
References Parma_Polyhedra_Library::OR_Matrix< T >::space_dim, Parma_Polyhedra_Library::OR_Matrix< T >::swap(), Parma_Polyhedra_Library::swap(), Parma_Polyhedra_Library::OR_Matrix< T >::vec, and Parma_Polyhedra_Library::OR_Matrix< T >::vec_capacity.
Referenced by Parma_Polyhedra_Library::OR_Matrix< T >::swap().
|
inlinestatic |
Returns the maximum number of rows of a OR_Matrix.
Definition at line 468 of file OR_Matrix_inlines.hh.
References Parma_Polyhedra_Library::isqrt().
Referenced by Parma_Polyhedra_Library::Octagonal_Shape< T >::max_space_dimension().
|
inline |
Returns the number of rows in the matrix.
Definition at line 522 of file OR_Matrix_inlines.hh.
Referenced by Parma_Polyhedra_Library::OR_Matrix< T >::l_m_distance_assign(), Parma_Polyhedra_Library::OR_Matrix< T >::row_begin(), and Parma_Polyhedra_Library::OR_Matrix< T >::row_end().
| bool Parma_Polyhedra_Library::OR_Matrix< T >::OK | ( | ) | const |
Checks if all the invariants are satisfied.
Definition at line 39 of file OR_Matrix_templates.hh.
Referenced by Parma_Polyhedra_Library::OR_Matrix< T >::OR_Matrix().
|
inline |
Assignment operator.
Definition at line 573 of file OR_Matrix_inlines.hh.
References Parma_Polyhedra_Library::compute_capacity(), Parma_Polyhedra_Library::DB_Row< T >::max_size(), Parma_Polyhedra_Library::OR_Matrix< T >::space_dim, and Parma_Polyhedra_Library::OR_Matrix< T >::vec.
|
inline |
Returns a reference to the k-th row of the matrix.
Definition at line 496 of file OR_Matrix_inlines.hh.
References PPL_OR_MATRIX_EXTRA_DEBUG.
|
inline |
Returns a constant reference to the k-th row of the matrix.
Definition at line 506 of file OR_Matrix_inlines.hh.
References PPL_OR_MATRIX_EXTRA_DEBUG.
| void Parma_Polyhedra_Library::OR_Matrix< T >::print | ( | ) | const |
Prints *this to std::cerr using operator<<.
|
inline |
Resizes the matrix without worrying about the old contents.
| new_dim | The new dimension of the resized matrix. |
If the new dimension is greater than the old one, it adds new rows of right dimension to the end if there is enough capacity; otherwise, it creates a new matrix, with the specified dimension, which is then assigned to *this. If the new dimension is less than the old one, it erase from the matrix the rows having index greater than 2*new_dim-1
Definition at line 615 of file OR_Matrix_inlines.hh.
|
inline |
Returns an iterator pointing to the first row, if *this is not empty; otherwise, returns the past-the-end const_iterator.
Definition at line 393 of file OR_Matrix_inlines.hh.
References Parma_Polyhedra_Library::OR_Matrix< T >::num_rows(), and Parma_Polyhedra_Library::OR_Matrix< T >::vec.
Referenced by Parma_Polyhedra_Library::OR_Matrix< T >::ascii_dump(), Parma_Polyhedra_Library::Octagonal_Shape< T >::get_limiting_octagon(), and Parma_Polyhedra_Library::Octagonal_Shape< T >::map_space_dimensions().
|
inline |
Returns a const row iterator pointing to the first row, if *this is not empty; otherwise, returns the past-the-end const_iterator.
Definition at line 405 of file OR_Matrix_inlines.hh.
References Parma_Polyhedra_Library::OR_Matrix< T >::num_rows(), and Parma_Polyhedra_Library::OR_Matrix< T >::vec.
|
inline |
Returns the past-the-end const_iterator.
Definition at line 399 of file OR_Matrix_inlines.hh.
References Parma_Polyhedra_Library::OR_Matrix< T >::num_rows().
Referenced by Parma_Polyhedra_Library::OR_Matrix< T >::ascii_dump().
|
inline |
Returns the past-the-end const row iterator.
Definition at line 411 of file OR_Matrix_inlines.hh.
References Parma_Polyhedra_Library::OR_Matrix< T >::num_rows().
|
inlinestaticprivate |
Returns the index into vec of the first element of the row of index k.
Definition at line 39 of file OR_Matrix_inlines.hh.
|
inlinestatic |
Returns the size of the row of index k.
Definition at line 45 of file OR_Matrix_inlines.hh.
Referenced by Parma_Polyhedra_Library::OR_Matrix< T >::any_row_iterator< U >::any_row_iterator(), Parma_Polyhedra_Library::Octagonal_Shape< T >::integer_upper_bound_assign_if_exact(), Parma_Polyhedra_Library::OR_Matrix< T >::any_row_iterator< U >::row_size(), and Parma_Polyhedra_Library::Octagonal_Shape< T >::upper_bound_assign_if_exact().
|
inline |
Makes the matrix shrink by removing the last space dimensions.
| new_dim | The new dimension of the resized matrix. |
Erases from matrix to the end the rows with index greater than 2*new_dim-1.
Definition at line 606 of file OR_Matrix_inlines.hh.
|
inline |
Returns the space-dimension of the matrix.
Definition at line 516 of file OR_Matrix_inlines.hh.
Referenced by Parma_Polyhedra_Library::OR_Matrix< T >::ascii_dump().
|
inline |
Returns the total size in bytes of the memory occupied by *this.
Definition at line 477 of file OR_Matrix_inlines.hh.
References Parma_Polyhedra_Library::OR_Matrix< T >::external_memory_in_bytes().
|
related |
Computes the euclidean distance between x and y.
If the Euclidean distance between x and y is defined, stores an approximation of it into to r and returns true; returns false otherwise.
The direction of the approximation is specified by dir.
All computations are performed using the temporary variables tmp0, tmp1 and tmp2.
|
related |
Definition at line 714 of file OR_Matrix_inlines.hh.
|
related |
Computes the
distance between x and y.
If the
distance between x and y is defined, stores an approximation of it into to r and returns true; returns false otherwise.
The direction of the approximation is specified by dir.
All computations are performed using the temporary variables tmp0, tmp1 and tmp2.
|
related |
Definition at line 734 of file OR_Matrix_inlines.hh.
|
related |
Definition at line 639 of file OR_Matrix_inlines.hh.
References Parma_Polyhedra_Library::assign_r(), Parma_Polyhedra_Library::combine(), Parma_Polyhedra_Library::OR_Matrix< T >::element_begin(), Parma_Polyhedra_Library::OR_Matrix< T >::element_end(), Parma_Polyhedra_Library::finalize(), Parma_Polyhedra_Library::inverse(), Parma_Polyhedra_Library::is_plus_infinity(), Parma_Polyhedra_Library::maybe_assign(), Parma_Polyhedra_Library::OR_Matrix< T >::num_rows(), Parma_Polyhedra_Library::PLUS_INFINITY, Parma_Polyhedra_Library::ROUND_NOT_NEEDED, and Parma_Polyhedra_Library::Boundary_NS::sgn().
|
related |
Returns true if and only if x and y are different.
|
related |
Definition at line 546 of file OR_Matrix_inlines.hh.
|
related |
Output operator.
|
related |
Definition at line 113 of file OR_Matrix_templates.hh.
|
related |
Returns true if and only if x and y are identical.
|
related |
Definition at line 537 of file OR_Matrix_inlines.hh.
References Parma_Polyhedra_Library::OR_Matrix< T >::space_dim, and Parma_Polyhedra_Library::OR_Matrix< T >::vec.
Definition at line 371 of file OR_Matrix_defs.hh.
|
related |
Computes the rectilinear (or Manhattan) distance between x and y.
If the rectilinear distance between x and y is defined, stores an approximation of it into to r and returns true; returns false otherwise.
The direction of the approximation is specified by dir.
All computations are performed using the temporary variables tmp0, tmp1 and tmp2.
|
related |
Definition at line 694 of file OR_Matrix_inlines.hh.
Swaps x with y.
Referenced by Parma_Polyhedra_Library::OR_Matrix< T >::m_swap().
Definition at line 752 of file OR_Matrix_inlines.hh.
References Parma_Polyhedra_Library::OR_Matrix< T >::m_swap().
|
private |
Contains the dimension of the space of the matrix.
Definition at line 384 of file OR_Matrix_defs.hh.
Referenced by Parma_Polyhedra_Library::OR_Matrix< T >::m_swap(), Parma_Polyhedra_Library::OR_Matrix< T >::operator=(), and Parma_Polyhedra_Library::OR_Matrix< T >::operator==().
|
private |
Contains the rows of the matrix.
A DB_Row which contains the rows of the OR_Matrix inserting each successive row to the end of the vec. To contain all the elements of OR_Matrix the size of the DB_Row is 2*n*(n+1), where the n is the characteristic parameter of OR_Matrix.
Definition at line 381 of file OR_Matrix_defs.hh.
Referenced by Parma_Polyhedra_Library::OR_Matrix< T >::element_begin(), Parma_Polyhedra_Library::OR_Matrix< T >::element_end(), Parma_Polyhedra_Library::OR_Matrix< T >::m_swap(), Parma_Polyhedra_Library::OR_Matrix< T >::operator=(), Parma_Polyhedra_Library::OR_Matrix< T >::operator==(), Parma_Polyhedra_Library::OR_Matrix< T >::OR_Matrix(), and Parma_Polyhedra_Library::OR_Matrix< T >::row_begin().
|
private |
Contains the capacity of vec.
Definition at line 387 of file OR_Matrix_defs.hh.
Referenced by Parma_Polyhedra_Library::OR_Matrix< T >::m_swap(), and Parma_Polyhedra_Library::OR_Matrix< T >::OR_Matrix().