PPL
1.2
|
The base class for the square matrices. More...
#include <DB_Matrix_defs.hh>
Classes | |
class | const_iterator |
A read-only iterator over the rows of the matrix. More... | |
Public Member Functions | |
DB_Matrix () | |
Builds an empty matrix. More... | |
DB_Matrix (dimension_type n_rows) | |
Builds a square matrix having the specified dimension. More... | |
DB_Matrix (const DB_Matrix &y) | |
Copy constructor. More... | |
template<typename U > | |
DB_Matrix (const DB_Matrix< U > &y) | |
Constructs a conservative approximation of y . More... | |
~DB_Matrix () | |
Destructor. More... | |
DB_Matrix & | operator= (const DB_Matrix &y) |
Assignment operator. More... | |
const_iterator | begin () const |
Returns the const_iterator pointing to the first row, 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... | |
void | m_swap (DB_Matrix &y) |
Swaps *this with y . More... | |
void | grow (dimension_type new_n_rows) |
Makes the matrix grow by adding more rows and more columns. More... | |
void | resize_no_copy (dimension_type new_n_rows) |
Resizes the matrix without worrying about the old contents. More... | |
dimension_type | num_rows () const |
Returns the number of rows in the matrix. 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. | |
DB_Row< T > & | operator[] (dimension_type k) |
Returns a reference to the k-th row of the matrix. More... | |
const DB_Row< T > & | 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 a DB_Matrix can handle. More... | |
static dimension_type | max_num_columns () |
Returns the maximum number of columns a DB_Matrix can handle. More... | |
Private Attributes | |
std::vector< DB_Row< T > > | rows |
The rows of the matrix. More... | |
dimension_type | row_size |
Size of the initialized part of each row. More... | |
dimension_type | row_capacity |
Capacity allocated for each row, i.e., number of long objects that each row can contain. More... | |
Friends | |
template<typename U > | |
class | DB_Matrix |
Related Functions | |
(Note that these are not member functions.) | |
template<typename T > | |
std::ostream & | operator<< (std::ostream &s, const DB_Matrix< T > &c) |
Output operator. More... | |
template<typename T > | |
void | swap (DB_Matrix< T > &x, DB_Matrix< T > &y) |
Swaps x with y . More... | |
template<typename T > | |
bool | operator== (const DB_Matrix< T > &x, const DB_Matrix< T > &y) |
Returns true if and only if x and y are identical. More... | |
template<typename T > | |
bool | operator!= (const DB_Matrix< T > &x, const DB_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 DB_Matrix< T > &x, const DB_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 DB_Matrix< T > &x, const DB_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 DB_Matrix< T > &x, const DB_Matrix< T > &y, Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2) |
Computes the ![]() x and y . More... | |
template<typename T > | |
bool | operator!= (const DB_Matrix< T > &x, const DB_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 DB_Matrix< T > &x, const DB_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 DB_Matrix< T > &x, const DB_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 DB_Matrix< T > &x, const DB_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 DB_Matrix< T > &x, const DB_Matrix< T > &y, const Rounding_Dir dir, Temp &tmp0, Temp &tmp1, Temp &tmp2) |
template<typename T > | |
void | swap (DB_Matrix< T > &x, DB_Matrix< T > &y) |
template<typename T > | |
bool | operator== (const DB_Matrix< T > &x, const DB_Matrix< T > &y) |
template<typename T > | |
std::ostream & | operator<< (std::ostream &s, const DB_Matrix< T > &c) |
The base class for the square matrices.
The template class DB_Matrix<T> allows for the representation of a square matrix of T objects. Each DB_Matrix<T> object can be viewed as a multiset of DB_Row<T>.
Definition at line 62 of file DB_Matrix_defs.hh.
|
inline |
Builds an empty matrix.
DB_Rows' size and capacity are initialized to .
Definition at line 138 of file DB_Matrix_inlines.hh.
|
explicit |
Builds a square matrix having the specified dimension.
Definition at line 30 of file DB_Matrix_templates.hh.
References Parma_Polyhedra_Library::DB_Matrix< T >::OK(), Parma_Polyhedra_Library::DB_Matrix< T >::row_capacity, and Parma_Polyhedra_Library::DB_Matrix< T >::rows.
|
inline |
Copy constructor.
Definition at line 180 of file DB_Matrix_inlines.hh.
|
explicit |
Constructs a conservative approximation of y
.
Definition at line 43 of file DB_Matrix_templates.hh.
References Parma_Polyhedra_Library::DB_Matrix< T >::OK(), Parma_Polyhedra_Library::DB_Matrix< T >::row_capacity, and Parma_Polyhedra_Library::DB_Matrix< T >::rows.
|
inline |
void Parma_Polyhedra_Library::DB_Matrix< T >::ascii_dump | ( | ) | const |
Writes to std::cerr
an ASCII representation of *this
.
void Parma_Polyhedra_Library::DB_Matrix< T >::ascii_dump | ( | std::ostream & | s | ) | const |
Writes to s
an ASCII representation of *this
.
Definition at line 226 of file DB_Matrix_templates.hh.
References Parma_Polyhedra_Library::DB_Matrix< T >::num_rows(), and Parma_Polyhedra_Library::Implementation::BD_Shapes::separator.
bool Parma_Polyhedra_Library::DB_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 244 of file DB_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 |
Returns the const_iterator pointing to the first row, if *this
is not empty; otherwise, returns the past-the-end const_iterator.
Definition at line 126 of file DB_Matrix_inlines.hh.
References Parma_Polyhedra_Library::DB_Matrix< T >::rows.
|
inline |
Returns the past-the-end const_iterator.
Definition at line 132 of file DB_Matrix_inlines.hh.
References Parma_Polyhedra_Library::DB_Matrix< T >::rows.
memory_size_type Parma_Polyhedra_Library::DB_Matrix< T >::external_memory_in_bytes | ( | ) | const |
Returns the size in bytes of the memory managed by *this
.
Definition at line 285 of file DB_Matrix_templates.hh.
void Parma_Polyhedra_Library::DB_Matrix< T >::grow | ( | dimension_type | new_n_rows | ) |
Makes the matrix grow by adding more rows and more columns.
new_n_rows | The number of rows and columns of the resized matrix. |
A new matrix, with the specified dimension, is created. The contents of the old matrix are copied in the upper, left-hand corner of the new matrix, which is then assigned to *this
.
Definition at line 56 of file DB_Matrix_templates.hh.
References Parma_Polyhedra_Library::compute_capacity(), Parma_Polyhedra_Library::DB_Matrix< T >::row_capacity, Parma_Polyhedra_Library::DB_Matrix< T >::row_size, Parma_Polyhedra_Library::DB_Matrix< T >::rows, and Parma_Polyhedra_Library::swap().
|
inline |
Swaps *this
with y
.
Definition at line 37 of file DB_Matrix_inlines.hh.
References Parma_Polyhedra_Library::DB_Matrix< T >::row_capacity, Parma_Polyhedra_Library::DB_Matrix< T >::row_size, Parma_Polyhedra_Library::DB_Matrix< T >::rows, and Parma_Polyhedra_Library::swap().
Referenced by Parma_Polyhedra_Library::DB_Matrix< T >::swap().
|
inlinestatic |
Returns the maximum number of columns a DB_Matrix can handle.
Definition at line 52 of file DB_Matrix_inlines.hh.
References Parma_Polyhedra_Library::DB_Row< T >::max_size().
|
inlinestatic |
Returns the maximum number of rows a DB_Matrix can handle.
Definition at line 46 of file DB_Matrix_inlines.hh.
|
inline |
Returns the number of rows in the matrix.
Definition at line 165 of file DB_Matrix_inlines.hh.
Referenced by Parma_Polyhedra_Library::DB_Matrix< T >::ascii_dump(), Parma_Polyhedra_Library::DB_Matrix< T >::l_m_distance_assign(), Parma_Polyhedra_Library::DB_Matrix< T >::OK(), and Parma_Polyhedra_Library::DB_Matrix< T >::operator==().
bool Parma_Polyhedra_Library::DB_Matrix< T >::OK | ( | ) | const |
Checks if all the invariants are satisfied.
Definition at line 295 of file DB_Matrix_templates.hh.
References Parma_Polyhedra_Library::DB_Matrix< T >::num_rows().
Referenced by Parma_Polyhedra_Library::DB_Matrix< T >::DB_Matrix().
|
inline |
Assignment operator.
Definition at line 188 of file DB_Matrix_inlines.hh.
References Parma_Polyhedra_Library::compute_capacity(), Parma_Polyhedra_Library::DB_Matrix< T >::row_size, and Parma_Polyhedra_Library::DB_Matrix< T >::rows.
|
inline |
Returns a reference to the k-th
row of the matrix.
Definition at line 151 of file DB_Matrix_inlines.hh.
|
inline |
Returns a constant reference to the k-th
row of the matrix.
Definition at line 158 of file DB_Matrix_inlines.hh.
void Parma_Polyhedra_Library::DB_Matrix< T >::print | ( | ) | const |
Prints *this
to std::cerr
using operator<<
.
void Parma_Polyhedra_Library::DB_Matrix< T >::resize_no_copy | ( | dimension_type | new_n_rows | ) |
Resizes the matrix without worrying about the old contents.
new_n_rows | The number of rows and columns of the resized matrix. |
A new matrix, with the specified dimension, is created without copying the content of the old matrix and assigned to *this
.
Definition at line 146 of file DB_Matrix_templates.hh.
References Parma_Polyhedra_Library::compute_capacity(), and Parma_Polyhedra_Library::swap().
|
inline |
Returns the total size in bytes of the memory occupied by *this
.
Definition at line 58 of file DB_Matrix_inlines.hh.
References Parma_Polyhedra_Library::external_memory_in_bytes().
Definition at line 161 of file DB_Matrix_defs.hh.
|
related |
Definition at line 286 of file DB_Matrix_inlines.hh.
|
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 306 of file DB_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 209 of file DB_Matrix_inlines.hh.
References Parma_Polyhedra_Library::assign_r(), Parma_Polyhedra_Library::combine(), Parma_Polyhedra_Library::finalize(), Parma_Polyhedra_Library::inverse(), Parma_Polyhedra_Library::is_plus_infinity(), Parma_Polyhedra_Library::maybe_assign(), Parma_Polyhedra_Library::DB_Matrix< T >::num_rows(), Parma_Polyhedra_Library::PLUS_INFINITY, Parma_Polyhedra_Library::ROUND_NOT_NEEDED, and Parma_Polyhedra_Library::Boundary_NS::sgn().
|
related |
Definition at line 174 of file DB_Matrix_inlines.hh.
|
related |
Returns true
if and only if x
and y
are different.
|
related |
Output operator.
|
related |
Definition at line 329 of file DB_Matrix_templates.hh.
References c.
|
related |
Returns true
if and only if x
and y
are identical.
Referenced by Parma_Polyhedra_Library::DB_Matrix< T >::const_iterator::operator!=().
|
related |
Definition at line 270 of file DB_Matrix_templates.hh.
References Parma_Polyhedra_Library::DB_Matrix< T >::num_rows().
|
related |
Definition at line 265 of file DB_Matrix_inlines.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
.
Definition at line 326 of file DB_Matrix_inlines.hh.
References Parma_Polyhedra_Library::DB_Matrix< T >::m_swap().
|
private |
Capacity allocated for each row, i.e., number of long
objects that each row can contain.
Definition at line 173 of file DB_Matrix_defs.hh.
Referenced by Parma_Polyhedra_Library::DB_Matrix< T >::DB_Matrix(), Parma_Polyhedra_Library::DB_Matrix< T >::grow(), and Parma_Polyhedra_Library::DB_Matrix< T >::m_swap().
|
private |
Size of the initialized part of each row.
Definition at line 167 of file DB_Matrix_defs.hh.
Referenced by Parma_Polyhedra_Library::DB_Matrix< T >::grow(), Parma_Polyhedra_Library::DB_Matrix< T >::m_swap(), and Parma_Polyhedra_Library::DB_Matrix< T >::operator=().
|
private |
The rows of the matrix.
Definition at line 164 of file DB_Matrix_defs.hh.
Referenced by Parma_Polyhedra_Library::DB_Matrix< T >::begin(), Parma_Polyhedra_Library::DB_Matrix< T >::DB_Matrix(), Parma_Polyhedra_Library::DB_Matrix< T >::end(), Parma_Polyhedra_Library::DB_Matrix< T >::grow(), Parma_Polyhedra_Library::DB_Matrix< T >::m_swap(), and Parma_Polyhedra_Library::DB_Matrix< T >::operator=().