PPL
1.2
|
A matrix of bits. More...
#include <Bit_Matrix_defs.hh>
Classes | |
struct | Bit_Row_Less_Than |
Ordering predicate (used when implementing the sort algorithm). More... | |
Public Member Functions | |
Bit_Matrix () | |
Default constructor. More... | |
Bit_Matrix (dimension_type n_rows, dimension_type n_columns) | |
Construct a bit matrix with n_rows rows and n_columns columns. More... | |
Bit_Matrix (const Bit_Matrix &y) | |
Copy constructor. More... | |
~Bit_Matrix () | |
Destructor. More... | |
Bit_Matrix & | operator= (const Bit_Matrix &y) |
Assignment operator. More... | |
void | m_swap (Bit_Matrix &y) |
Swaps *this with y . More... | |
Bit_Row & | operator[] (dimension_type k) |
Subscript operator. More... | |
const Bit_Row & | operator[] (dimension_type k) const |
Constant subscript operator. More... | |
void | clear () |
Clears the matrix deallocating all its rows. More... | |
void | transpose () |
Transposes the matrix. More... | |
void | transpose_assign (const Bit_Matrix &y) |
Makes *this a transposed copy of y . More... | |
dimension_type | num_columns () const |
Returns the number of columns of *this . More... | |
dimension_type | num_rows () const |
Returns the number of rows of *this . More... | |
void | sort_rows () |
Sorts the rows and removes duplicates. More... | |
bool | sorted_contains (const Bit_Row &row) const |
Looks for row in *this , which is assumed to be sorted. More... | |
void | add_recycled_row (Bit_Row &row) |
Adds row to *this . More... | |
void | remove_trailing_rows (dimension_type n) |
Removes the last n rows. More... | |
void | remove_trailing_columns (dimension_type n) |
Removes the last n columns. More... | |
void | resize (dimension_type new_n_rows, dimension_type new_n_columns) |
Resizes the matrix copying the old contents. 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... | |
bool | check_sorted () const |
Checks whether *this is sorted. It does NOT check for duplicates. More... | |
Static Public Member Functions | |
static dimension_type | max_num_rows () |
Returns the maximum number of rows of a Bit_Matrix. More... | |
Private Attributes | |
std::vector< Bit_Row > | rows |
Contains the rows of the matrix. More... | |
dimension_type | row_size |
Size of the initialized part of each row. More... | |
Friends | |
template<typename Row > | |
class | Parma_Polyhedra_Library::Linear_System |
Related Functions | |
(Note that these are not member functions.) | |
bool | operator== (const Bit_Matrix &x, const Bit_Matrix &y) |
void | swap (Bit_Matrix &x, Bit_Matrix &y) |
Swaps x with y . More... | |
bool | operator== (const Bit_Matrix &x, const Bit_Matrix &y) |
Returns true if and only if x and y are equal. More... | |
bool | operator!= (const Bit_Matrix &x, const Bit_Matrix &y) |
Returns true if and only if x and y are not equal. More... | |
bool | operator!= (const Bit_Matrix &x, const Bit_Matrix &y) |
void | swap (Bit_Matrix &x, Bit_Matrix &y) |
A matrix of bits.
Definition at line 47 of file Bit_Matrix_defs.hh.
|
inline |
Default constructor.
Definition at line 33 of file Bit_Matrix_inlines.hh.
|
inline |
Construct a bit matrix with n_rows
rows and n_columns
columns.
Definition at line 44 of file Bit_Matrix_inlines.hh.
|
inline |
Copy constructor.
Definition at line 51 of file Bit_Matrix_inlines.hh.
|
inline |
void Parma_Polyhedra_Library::Bit_Matrix::add_recycled_row | ( | Bit_Row & | row | ) |
Adds row
to *this
.
row | The row whose implementation will be recycled. |
The only thing that can be done with row
upon return is destruction.
Definition at line 74 of file Bit_Matrix.cc.
References Parma_Polyhedra_Library::compute_capacity(), and Parma_Polyhedra_Library::swap().
Referenced by Parma_Polyhedra_Library::Polyhedron::conversion().
void Parma_Polyhedra_Library::Bit_Matrix::ascii_dump | ( | ) | const |
Writes to std::cerr
an ASCII representation of *this
.
void Parma_Polyhedra_Library::Bit_Matrix::ascii_dump | ( | std::ostream & | s | ) | const |
Writes to s
an ASCII representation of *this
.
Definition at line 173 of file Bit_Matrix.cc.
References Parma_Polyhedra_Library::Implementation::BD_Shapes::separator.
bool Parma_Polyhedra_Library::Bit_Matrix::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 189 of file Bit_Matrix.cc.
References clear().
bool Parma_Polyhedra_Library::Bit_Matrix::check_sorted | ( | ) | const |
Checks whether *this
is sorted. It does NOT check for duplicates.
Definition at line 263 of file Bit_Matrix.cc.
References Parma_Polyhedra_Library::compare().
Referenced by sorted_contains().
|
inline |
Clears the matrix deallocating all its rows.
Definition at line 109 of file Bit_Matrix_inlines.hh.
References row_size, rows, and Parma_Polyhedra_Library::swap().
Referenced by ascii_load(), Parma_Polyhedra_Library::BD_Shape< T >::shortest_path_reduction_assign(), Parma_Polyhedra_Library::Polyhedron::update_sat_c(), and Parma_Polyhedra_Library::Polyhedron::update_sat_g().
PPL::memory_size_type Parma_Polyhedra_Library::Bit_Matrix::external_memory_in_bytes | ( | ) | const |
Returns the size in bytes of the memory managed by *this
.
Definition at line 225 of file Bit_Matrix.cc.
Referenced by total_memory_in_bytes().
|
inline |
Swaps *this
with y
.
Definition at line 81 of file Bit_Matrix_inlines.hh.
References row_size, rows, and Parma_Polyhedra_Library::swap().
Referenced by resize(), and swap().
|
inlinestatic |
Returns the maximum number of rows of a Bit_Matrix.
Definition at line 39 of file Bit_Matrix_inlines.hh.
|
inline |
Returns the number of columns of *this
.
Definition at line 99 of file Bit_Matrix_inlines.hh.
References row_size.
Referenced by Parma_Polyhedra_Library::Polyhedron::add_space_dimensions(), Parma_Polyhedra_Library::Polyhedron::conversion(), operator==(), Parma_Polyhedra_Library::Polyhedron::simplify(), and transpose_assign().
|
inline |
Returns the number of rows of *this
.
Definition at line 104 of file Bit_Matrix_inlines.hh.
References rows.
Referenced by Parma_Polyhedra_Library::Polyhedron::add_space_dimensions(), Parma_Polyhedra_Library::Polyhedron::conversion(), operator==(), Parma_Polyhedra_Library::Linear_System< Row >::sort_and_remove_with_sat(), and transpose_assign().
bool Parma_Polyhedra_Library::Bit_Matrix::OK | ( | ) | const |
Checks if all the invariants are satisfied.
Definition at line 234 of file Bit_Matrix.cc.
References Parma_Polyhedra_Library::Bit_Row::last(), and Parma_Polyhedra_Library::Bit_Row::OK().
Referenced by operator=(), remove_trailing_columns(), and remove_trailing_rows().
PPL::Bit_Matrix & Parma_Polyhedra_Library::Bit_Matrix::operator= | ( | const Bit_Matrix & | y | ) |
Assignment operator.
Definition at line 36 of file Bit_Matrix.cc.
References OK(), row_size, and rows.
|
inline |
Subscript operator.
Definition at line 87 of file Bit_Matrix_inlines.hh.
References rows.
|
inline |
Constant subscript operator.
Definition at line 93 of file Bit_Matrix_inlines.hh.
References rows.
void Parma_Polyhedra_Library::Bit_Matrix::print | ( | ) | const |
Prints *this
to std::cerr
using operator<<
.
|
inline |
Removes the last n
columns.
The last n
columns of the matrix are all made of zeros. If such an assumption is not met, the behavior is undefined.
Definition at line 72 of file Bit_Matrix_inlines.hh.
References OK(), and row_size.
Referenced by Parma_Polyhedra_Library::Polyhedron::conversion().
|
inline |
Removes the last n
rows.
Definition at line 61 of file Bit_Matrix_inlines.hh.
Referenced by Parma_Polyhedra_Library::Polyhedron::conversion(), Parma_Polyhedra_Library::Polyhedron::select_H79_constraints(), Parma_Polyhedra_Library::Polyhedron::simplify(), and Parma_Polyhedra_Library::Linear_System< Row >::sort_and_remove_with_sat().
void Parma_Polyhedra_Library::Bit_Matrix::resize | ( | dimension_type | new_n_rows, |
dimension_type | new_n_columns | ||
) |
Resizes the matrix copying the old contents.
Definition at line 132 of file Bit_Matrix.cc.
References Parma_Polyhedra_Library::compute_capacity(), m_swap(), and Parma_Polyhedra_Library::swap().
Referenced by Parma_Polyhedra_Library::Polyhedron::add_and_minimize(), Parma_Polyhedra_Library::Polyhedron::add_space_dimensions(), Parma_Polyhedra_Library::Polyhedron::update_sat_c(), and Parma_Polyhedra_Library::Polyhedron::update_sat_g().
void Parma_Polyhedra_Library::Bit_Matrix::sort_rows | ( | ) |
Sorts the rows and removes duplicates.
Definition at line 44 of file Bit_Matrix.cc.
References Parma_Polyhedra_Library::Implementation::indirect_sort_and_unique().
Referenced by Parma_Polyhedra_Library::Polyhedron::select_H79_constraints().
|
inline |
Looks for row
in *this
, which is assumed to be sorted.
true
if row
belongs to *this
, false otherwise.row | The row that will be searched for in the matrix. |
Given a sorted bit matrix (this ensures better efficiency), tells whether it contains the given row.
Definition at line 128 of file Bit_Matrix_inlines.hh.
References check_sorted(), and rows.
Referenced by Parma_Polyhedra_Library::Polyhedron::select_H79_constraints().
|
inline |
Returns the total size in bytes of the memory occupied by *this
.
Definition at line 117 of file Bit_Matrix_inlines.hh.
References external_memory_in_bytes().
void Parma_Polyhedra_Library::Bit_Matrix::transpose | ( | ) |
Transposes the matrix.
Definition at line 101 of file Bit_Matrix.cc.
void Parma_Polyhedra_Library::Bit_Matrix::transpose_assign | ( | const Bit_Matrix & | y | ) |
Makes *this
a transposed copy of y
.
Definition at line 117 of file Bit_Matrix.cc.
References num_columns(), and num_rows().
Referenced by Parma_Polyhedra_Library::Polyhedron::add_space_dimensions(), Parma_Polyhedra_Library::Polyhedron::minimize(), Parma_Polyhedra_Library::Polyhedron::obtain_sorted_constraints(), Parma_Polyhedra_Library::Polyhedron::obtain_sorted_constraints_with_sat_c(), Parma_Polyhedra_Library::Polyhedron::obtain_sorted_generators(), Parma_Polyhedra_Library::Polyhedron::obtain_sorted_generators_with_sat_g(), Parma_Polyhedra_Library::Polyhedron::process_pending_constraints(), Parma_Polyhedra_Library::Polyhedron::process_pending_generators(), Parma_Polyhedra_Library::Polyhedron::strongly_minimize_constraints(), and Parma_Polyhedra_Library::Polyhedron::strongly_minimize_generators().
|
related |
Definition at line 136 of file Bit_Matrix_inlines.hh.
|
related |
Returns true
if and only if x
and y
are not equal.
|
related |
Returns true
if and only if x
and y
are equal.
|
related |
Definition at line 276 of file Bit_Matrix.cc.
References num_columns(), and num_rows().
|
friend |
Definition at line 166 of file Bit_Matrix_defs.hh.
|
related |
Swaps x
with y
.
|
related |
Definition at line 142 of file Bit_Matrix_inlines.hh.
References m_swap().
|
private |
Size of the initialized part of each row.
Definition at line 157 of file Bit_Matrix_defs.hh.
Referenced by clear(), m_swap(), num_columns(), operator=(), and remove_trailing_columns().
|
private |
Contains the rows of the matrix.
Definition at line 154 of file Bit_Matrix_defs.hh.
Referenced by clear(), m_swap(), num_rows(), operator=(), operator[](), remove_trailing_rows(), and sorted_contains().