PPL
1.2
|
The base class for systems of constraints and generators. More...
#include <Linear_System_defs.hh>
Classes | |
struct | Row_Less_Than |
Ordering predicate (used when implementing the sort algorithm). More... | |
struct | Unique_Compare |
Comparison predicate (used when implementing the unique algorithm). More... | |
struct | With_Pending |
A tag class. More... | |
Public Types | |
typedef Swapping_Vector< Row >::const_iterator | iterator |
typedef Swapping_Vector< Row >::const_iterator | const_iterator |
Public Member Functions | |
Linear_System (Topology topol, Representation r) | |
Builds an empty linear system with specified topology. More... | |
Linear_System (Topology topol, dimension_type space_dim, Representation r) | |
Builds a system with specified topology and dimensions. More... | |
Linear_System (const Linear_System &y) | |
Copy constructor: pending rows are transformed into non-pending ones. More... | |
Linear_System (const Linear_System &y, Representation r) | |
Linear_System (const Linear_System &y, With_Pending) | |
Full copy constructor: pending rows are copied as pending. More... | |
Linear_System (const Linear_System &y, Representation r, With_Pending) | |
Full copy constructor: pending rows are copied as pending. More... | |
Linear_System & | operator= (const Linear_System &y) |
Assignment operator: pending rows are transformed into non-pending ones. More... | |
void | assign_with_pending (const Linear_System &y) |
Full assignment operator: pending rows are copied as pending. More... | |
void | m_swap (Linear_System &y) |
Swaps *this with y . More... | |
Representation | representation () const |
Returns the current representation of *this. More... | |
void | set_representation (Representation r) |
Converts *this to the specified representation. More... | |
dimension_type | space_dimension () const |
Returns the space dimension of the rows in the system. More... | |
void | set_space_dimension (dimension_type space_dim) |
Sets the space dimension of the rows in the system to space_dim . More... | |
void | remove_trailing_rows (dimension_type n) |
Makes the system shrink by removing its n trailing rows. More... | |
void | remove_row (dimension_type i, bool keep_sorted=false) |
Makes the system shrink by removing its i-th row. More... | |
void | remove_rows (dimension_type first, dimension_type last, bool keep_sorted=false) |
Makes the system shrink by removing the rows in [first,last). More... | |
void | remove_rows (const std::vector< dimension_type > &indexes) |
void | remove_space_dimensions (const Variables_Set &vars) |
Removes all the specified dimensions from the system. More... | |
void | shift_space_dimensions (Variable v, dimension_type n) |
void | permute_space_dimensions (const std::vector< Variable > &cycle) |
Permutes the space dimensions of the matrix. More... | |
void | swap_space_dimensions (Variable v1, Variable v2) |
Swaps the coefficients of the variables v1 and v2 . More... | |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
bool | has_no_rows () const |
dimension_type | num_rows () const |
void | strong_normalize () |
Strongly normalizes the system. More... | |
void | sign_normalize () |
Sign-normalizes the system. More... | |
bool | check_sorted () const |
Returns true if and only if *this is sorted, without checking for duplicates. More... | |
void | set_topology (Topology t) |
Sets the system topology to t . More... | |
void | set_necessarily_closed () |
Sets the system topology to NECESSARILY_CLOSED . More... | |
void | set_not_necessarily_closed () |
Sets the system topology to NOT_NECESSARILY_CLOSED . More... | |
void | mark_as_necessarily_closed () |
Marks the epsilon dimension as a standard dimension. More... | |
void | mark_as_not_necessarily_closed () |
Marks the last dimension as the epsilon dimension. More... | |
void | unset_pending_rows () |
Sets the index to indicate that the system has no pending rows. More... | |
void | set_index_first_pending_row (dimension_type i) |
Sets the index of the first pending row to i . More... | |
void | set_sorted (bool b) |
Sets the sortedness flag of the system to b . More... | |
void | add_universe_rows_and_space_dimensions (dimension_type n) |
Adds n rows and space dimensions to the system. More... | |
void | insert (const Row &r) |
Adds a copy of r to the system, automatically resizing the system or the row's copy, if needed. More... | |
void | insert_pending (const Row &r) |
Adds a copy of the given row to the pending part of the system, automatically resizing the system or the row, if needed. More... | |
void | insert (Row &r, Recycle_Input) |
Adds r to the system, stealing its contents and automatically resizing the system or the row, if needed. More... | |
void | insert_pending (Row &r, Recycle_Input) |
Adds the given row to the pending part of the system, stealing its contents and automatically resizing the system or the row, if needed. More... | |
void | insert (const Linear_System &y) |
Adds to *this a copy of the rows of y . More... | |
void | insert_pending (const Linear_System &r) |
Adds a copy of the rows of `y' to the pending part of `*this'. More... | |
void | insert (Linear_System &r, Recycle_Input) |
Adds to *this a the rows of `y', stealing them from `y'. More... | |
void | insert_pending (Linear_System &r, Recycle_Input) |
void | sort_rows () |
Sorts the non-pending rows (in growing order) and eliminates duplicated ones. More... | |
void | sort_rows (dimension_type first_row, dimension_type last_row) |
Sorts the rows (in growing order) form first_row to last_row and eliminates duplicated ones. More... | |
void | merge_rows_assign (const Linear_System &y) |
Assigns to *this the result of merging its rows with those of y , obtaining a sorted system. More... | |
void | sort_pending_and_remove_duplicates () |
Sorts the pending rows and eliminates those that also occur in the non-pending part of the system. More... | |
void | sort_and_remove_with_sat (Bit_Matrix &sat) |
Sorts the system, removing duplicates, keeping the saturation matrix consistent. More... | |
dimension_type | gauss (dimension_type n_lines_or_equalities) |
Minimizes the subsystem of equations contained in *this . More... | |
void | back_substitute (dimension_type n_lines_or_equalities) |
Back-substitutes the coefficients to reduce the complexity of the system. More... | |
void | simplify () |
Applies Gaussian elimination and back-substitution so as to simplify the linear system. More... | |
void | clear () |
Clears the system 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 | |
const Row & | operator[] (dimension_type k) const |
Returns a const reference to the k-th row of the system. More... | |
Accessors | |
Topology | topology () const |
Returns the system topology. More... | |
bool | is_sorted () const |
Returns the value of the sortedness flag. More... | |
bool | is_necessarily_closed () const |
Returns true if and only if the system topology is NECESSARILY_CLOSED . More... | |
dimension_type | num_lines_or_equalities () const |
Returns the number of rows in the system that represent either lines or equalities. More... | |
dimension_type | first_pending_row () const |
Returns the index of the first pending row. More... | |
dimension_type | num_pending_rows () const |
Returns the number of rows that are in the pending part of the system. More... | |
Static Public Member Functions | |
static dimension_type | max_space_dimension () |
Returns the maximum space dimension a Linear_System can handle. More... | |
Public Attributes | |
Swapping_Vector< Row > | rows |
The vector that contains the rows. More... | |
Private Member Functions | |
void | remove_row_no_ok (dimension_type i, bool keep_sorted=false) |
Makes the system shrink by removing its i-th row. More... | |
void | insert_pending_no_ok (Row &r, Recycle_Input) |
Adds r to the pending part of the system, stealing its contents and automatically resizing the system or the row, if needed. More... | |
void | insert_no_ok (Row &r, Recycle_Input) |
Adds r to the system, stealing its contents and automatically resizing the system or the row, if needed. More... | |
void | set_space_dimension_no_ok (dimension_type space_dim) |
Sets the space dimension of the rows in the system to space_dim . More... | |
void | swap_row_intervals (dimension_type first, dimension_type last, dimension_type offset) |
Private Attributes | |
dimension_type | space_dimension_ |
Topology | row_topology |
dimension_type | index_first_pending |
The index of the first pending row. More... | |
bool | sorted |
true if rows are sorted in the ascending order as defined by bool compare(const Row&, const Row&) . If false may not be sorted. More... | |
Representation | representation_ |
Friends | |
class | Polyhedron |
class | Generator_System |
Related Functions | |
(Note that these are not member functions.) | |
template<typename Row > | |
void | swap (Parma_Polyhedra_Library::Linear_System< Row > &x, Parma_Polyhedra_Library::Linear_System< Row > &y) |
Swaps x with y . More... | |
template<typename Row > | |
bool | operator== (const Linear_System< Row > &x, const Linear_System< Row > &y) |
Returns true if and only if x and y are identical. More... | |
template<typename Row > | |
bool | operator!= (const Linear_System< Row > &x, const Linear_System< Row > &y) |
Returns true if and only if x and y are different. More... | |
template<typename Row > | |
bool | operator!= (const Linear_System< Row > &x, const Linear_System< Row > &y) |
template<typename Row > | |
void | swap (Linear_System< Row > &x, Linear_System< Row > &y) |
template<typename Row > | |
bool | operator== (const Linear_System< Row > &x, const Linear_System< Row > &y) |
The base class for systems of constraints and generators.
An object of this class represents either a constraint system or a generator system. Each Linear_System object can be viewed as a finite sequence of strong-normalized Row objects, where each Row implements a constraint or a generator. Linear systems are characterized by the matrix of coefficients, also encoding the number, size and capacity of Row objects, as well as a few additional information, including:
true
, ensures that the non-pending prefix of the sequence of rows is sorted. Definition at line 61 of file Linear_System_defs.hh.
typedef Swapping_Vector<Row>::const_iterator Parma_Polyhedra_Library::Linear_System< Row >::const_iterator |
Definition at line 66 of file Linear_System_defs.hh.
typedef Swapping_Vector<Row>::const_iterator Parma_Polyhedra_Library::Linear_System< Row >::iterator |
Definition at line 65 of file Linear_System_defs.hh.
|
inline |
Builds an empty linear system with specified topology.
Rows size and capacity are initialized to .
Definition at line 66 of file Linear_System_inlines.hh.
References Parma_Polyhedra_Library::Linear_System< Row >::OK().
|
inline |
Builds a system with specified topology and dimensions.
topol | The topology of the system that will be created; |
space_dim | The number of space dimensions of the system that will be created. |
r | The representation for system's rows. |
Creates a n_rows
space_dim
system whose coefficients are all zero and with the given topology.
Definition at line 79 of file Linear_System_inlines.hh.
References Parma_Polyhedra_Library::Linear_System< Row >::OK(), and Parma_Polyhedra_Library::Linear_System< Row >::set_space_dimension().
|
inline |
Copy constructor: pending rows are transformed into non-pending ones.
Definition at line 121 of file Linear_System_inlines.hh.
References Parma_Polyhedra_Library::Linear_System< Row >::num_pending_rows(), Parma_Polyhedra_Library::Linear_System< Row >::OK(), Parma_Polyhedra_Library::Linear_System< Row >::sorted, and Parma_Polyhedra_Library::Linear_System< Row >::unset_pending_rows().
|
inline |
Copy constructor with specified representation. Pending rows are transformed into non-pending ones.
Definition at line 134 of file Linear_System_inlines.hh.
References Parma_Polyhedra_Library::Linear_System< Row >::num_pending_rows(), Parma_Polyhedra_Library::Linear_System< Row >::num_rows(), Parma_Polyhedra_Library::Linear_System< Row >::OK(), Parma_Polyhedra_Library::Swapping_Vector< T >::resize(), Parma_Polyhedra_Library::Linear_System< Row >::rows, Parma_Polyhedra_Library::Linear_System< Row >::sorted, Parma_Polyhedra_Library::Linear_System< Row >::swap(), and Parma_Polyhedra_Library::Linear_System< Row >::unset_pending_rows().
|
inline |
Full copy constructor: pending rows are copied as pending.
Definition at line 153 of file Linear_System_inlines.hh.
References Parma_Polyhedra_Library::Linear_System< Row >::OK().
|
inline |
Full copy constructor: pending rows are copied as pending.
Definition at line 165 of file Linear_System_inlines.hh.
References Parma_Polyhedra_Library::Linear_System< Row >::num_rows(), Parma_Polyhedra_Library::Linear_System< Row >::OK(), Parma_Polyhedra_Library::Swapping_Vector< T >::resize(), Parma_Polyhedra_Library::Linear_System< Row >::rows, and Parma_Polyhedra_Library::Linear_System< Row >::swap().
void Parma_Polyhedra_Library::Linear_System< Row >::add_universe_rows_and_space_dimensions | ( | dimension_type | n | ) |
Adds n
rows and space dimensions to the system.
n | The number of rows and space dimensions to be added: must be strictly positive. |
Turns the system into the system
such that
, where
is the specular image of the
identity matrix.
Definition at line 779 of file Linear_System_templates.hh.
References c, Parma_Polyhedra_Library::compare(), Parma_Polyhedra_Library::Boundary_NS::le(), Parma_Polyhedra_Library::NECESSARILY_CLOSED, Parma_Polyhedra_Library::NOT_NECESSARILY_CLOSED, Parma_Polyhedra_Library::Linear_Expression::set_space_dimension(), and Parma_Polyhedra_Library::swap().
void Parma_Polyhedra_Library::Linear_System< Row >::ascii_dump | ( | ) | const |
Writes to std::cerr
an ASCII representation of *this
.
void Parma_Polyhedra_Library::Linear_System< Row >::ascii_dump | ( | std::ostream & | s | ) | const |
Writes to s
an ASCII representation of *this
.
Definition at line 119 of file Linear_System_templates.hh.
References Parma_Polyhedra_Library::ascii_dump().
bool Parma_Polyhedra_Library::Linear_System< Row >::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.
Reads into a Linear_System object the information produced by the output of ascii_dump(std::ostream&) const. The specialized methods provided by Constraint_System and Generator_System take care of properly reading the contents of the system.
Definition at line 143 of file Linear_System_templates.hh.
References Parma_Polyhedra_Library::ascii_load(), Parma_Polyhedra_Library::NECESSARILY_CLOSED, and Parma_Polyhedra_Library::NOT_NECESSARILY_CLOSED.
|
inline |
Full assignment operator: pending rows are copied as pending.
Definition at line 193 of file Linear_System_inlines.hh.
References Parma_Polyhedra_Library::swap().
void Parma_Polyhedra_Library::Linear_System< Row >::back_substitute | ( | dimension_type | n_lines_or_equalities | ) |
Back-substitutes the coefficients to reduce the complexity of the system.
Takes an upper triangular system having n_lines_or_equalities
rows. For each row, starting from the one having the minimum number of coefficients different from zero, computes the expression of an element as a function of the remaining ones and then substitutes this expression in all the other rows.
Definition at line 628 of file Linear_System_templates.hh.
References Parma_Polyhedra_Library::compare(), and Parma_Polyhedra_Library::neg_assign().
|
inline |
Definition at line 286 of file Linear_System_inlines.hh.
|
inline |
Definition at line 298 of file Linear_System_inlines.hh.
bool Parma_Polyhedra_Library::Linear_System< Row >::check_sorted | ( | ) | const |
Returns true
if and only if *this
is sorted, without checking for duplicates.
Definition at line 912 of file Linear_System_templates.hh.
References Parma_Polyhedra_Library::compare().
Referenced by Parma_Polyhedra_Library::Linear_System< Row >::merge_rows_assign().
|
inline |
Clears the system deallocating all its rows.
Definition at line 214 of file Linear_System_inlines.hh.
Referenced by Parma_Polyhedra_Library::Linear_System< Row >::insert_pending().
|
inline |
Definition at line 292 of file Linear_System_inlines.hh.
|
inline |
Definition at line 304 of file Linear_System_inlines.hh.
|
inline |
Returns the size in bytes of the memory managed by *this
.
Definition at line 36 of file Linear_System_inlines.hh.
|
inline |
Returns the index of the first pending row.
Definition at line 94 of file Linear_System_inlines.hh.
Referenced by Parma_Polyhedra_Library::Linear_System< Row >::operator==().
dimension_type Parma_Polyhedra_Library::Linear_System< Row >::gauss | ( | dimension_type | n_lines_or_equalities | ) |
Minimizes the subsystem of equations contained in *this
.
This method works only on the equalities of the system: the system is required to be partially sorted, so that all the equalities are grouped at its top; it is assumed that the number of equalities is exactly n_lines_or_equalities
. The method finds a minimal system for the equalities and returns its rank, i.e., the number of linearly independent equalities. The result is an upper triangular subsystem of equalities: for each equality, the pivot is chosen starting from the right-most space dimensions.
Definition at line 567 of file Linear_System_templates.hh.
References Parma_Polyhedra_Library::swap().
|
inline |
Definition at line 310 of file Linear_System_inlines.hh.
Referenced by Parma_Polyhedra_Library::Linear_System< Row >::insert().
void Parma_Polyhedra_Library::Linear_System< Row >::insert | ( | const Row & | r | ) |
Adds a copy of r
to the system, automatically resizing the system or the row's copy, if needed.
Definition at line 214 of file Linear_System_templates.hh.
void Parma_Polyhedra_Library::Linear_System< Row >::insert | ( | Row & | r, |
Recycle_Input | |||
) |
Adds r
to the system, stealing its contents and automatically resizing the system or the row, if needed.
Definition at line 221 of file Linear_System_templates.hh.
void Parma_Polyhedra_Library::Linear_System< Row >::insert | ( | const Linear_System< Row > & | y | ) |
Adds to *this
a copy of the rows of y
.
It is assumed that *this
has no pending rows.
Definition at line 323 of file Linear_System_templates.hh.
void Parma_Polyhedra_Library::Linear_System< Row >::insert | ( | Linear_System< Row > & | r, |
Recycle_Input | |||
) |
Adds to *this
a the rows of `y', stealing them from `y'.
It is assumed that *this
has no pending rows.
Definition at line 330 of file Linear_System_templates.hh.
References Parma_Polyhedra_Library::compare(), Parma_Polyhedra_Library::Linear_System< Row >::has_no_rows(), Parma_Polyhedra_Library::Linear_System< Row >::is_sorted(), and Parma_Polyhedra_Library::Linear_System< Row >::num_pending_rows().
|
private |
Adds r
to the system, stealing its contents and automatically resizing the system or the row, if needed.
This method is for internal use, it does *not* assert OK() at the end, so it can be used for invalid systems.
Definition at line 228 of file Linear_System_templates.hh.
References Parma_Polyhedra_Library::compare().
void Parma_Polyhedra_Library::Linear_System< Row >::insert_pending | ( | const Row & | r | ) |
Adds a copy of the given row to the pending part of the system, automatically resizing the system or the row, if needed.
Definition at line 284 of file Linear_System_templates.hh.
Referenced by Parma_Polyhedra_Library::Linear_System< Row >::insert_pending().
void Parma_Polyhedra_Library::Linear_System< Row >::insert_pending | ( | Row & | r, |
Recycle_Input | |||
) |
Adds the given row to the pending part of the system, stealing its contents and automatically resizing the system or the row, if needed.
Definition at line 291 of file Linear_System_templates.hh.
void Parma_Polyhedra_Library::Linear_System< Row >::insert_pending | ( | const Linear_System< Row > & | r | ) |
Adds a copy of the rows of `y' to the pending part of `*this'.
Definition at line 298 of file Linear_System_templates.hh.
void Parma_Polyhedra_Library::Linear_System< Row >::insert_pending | ( | Linear_System< Row > & | r, |
Recycle_Input | |||
) |
Adds the rows of `y' to the pending part of `*this', stealing them from `y'.
Definition at line 305 of file Linear_System_templates.hh.
References Parma_Polyhedra_Library::Linear_System< Row >::clear(), Parma_Polyhedra_Library::Linear_System< Row >::insert_pending(), Parma_Polyhedra_Library::Linear_System< Row >::num_rows(), Parma_Polyhedra_Library::Linear_System< Row >::OK(), Parma_Polyhedra_Library::Linear_System< Row >::rows, and Parma_Polyhedra_Library::Linear_System< Row >::space_dimension().
|
private |
Adds r
to the pending part of the system, stealing its contents and automatically resizing the system or the row, if needed.
This method is for internal use, it does *not* assert OK() at the end, so it can be used for invalid systems.
Definition at line 257 of file Linear_System_templates.hh.
References Parma_Polyhedra_Library::swap().
|
inline |
Returns true
if and only if the system topology is NECESSARILY_CLOSED
.
Definition at line 274 of file Linear_System_inlines.hh.
References Parma_Polyhedra_Library::NECESSARILY_CLOSED.
|
inline |
Returns the value of the sortedness flag.
Definition at line 48 of file Linear_System_inlines.hh.
Referenced by Parma_Polyhedra_Library::Linear_System< Row >::insert().
|
inline |
Swaps *this
with y
.
Definition at line 200 of file Linear_System_inlines.hh.
References Parma_Polyhedra_Library::Linear_System< Row >::index_first_pending, Parma_Polyhedra_Library::Linear_System< Row >::OK(), Parma_Polyhedra_Library::Linear_System< Row >::representation_, Parma_Polyhedra_Library::Linear_System< Row >::row_topology, Parma_Polyhedra_Library::Linear_System< Row >::rows, Parma_Polyhedra_Library::Linear_System< Row >::sorted, Parma_Polyhedra_Library::Linear_System< Row >::space_dimension_, and Parma_Polyhedra_Library::swap().
Referenced by Parma_Polyhedra_Library::Linear_System< Row >::swap().
|
inline |
Marks the epsilon dimension as a standard dimension.
The system topology is changed to NOT_NECESSARILY_CLOSED
, and the number of space dimensions is increased by 1.
Definition at line 226 of file Linear_System_inlines.hh.
References Parma_Polyhedra_Library::NECESSARILY_CLOSED, and Parma_Polyhedra_Library::NOT_NECESSARILY_CLOSED.
|
inline |
Marks the last dimension as the epsilon dimension.
The system topology is changed to NECESSARILY_CLOSED
, and the number of space dimensions is decreased by 1.
Definition at line 237 of file Linear_System_inlines.hh.
References Parma_Polyhedra_Library::NECESSARILY_CLOSED, and Parma_Polyhedra_Library::NOT_NECESSARILY_CLOSED.
|
inlinestatic |
Returns the maximum space dimension a Linear_System can handle.
Definition at line 344 of file Linear_System_inlines.hh.
References Parma_Polyhedra_Library::max_space_dimension().
Referenced by Parma_Polyhedra_Library::Constraint_System::max_space_dimension(), Parma_Polyhedra_Library::Grid_Generator_System::max_space_dimension(), and Parma_Polyhedra_Library::Generator_System::max_space_dimension().
void Parma_Polyhedra_Library::Linear_System< Row >::merge_rows_assign | ( | const Linear_System< Row > & | y | ) |
Assigns to *this
the result of merging its rows with those of y
, obtaining a sorted system.
Duplicated rows will occur only once in the result. On entry, both systems are assumed to be sorted and have no pending rows.
Definition at line 55 of file Linear_System_templates.hh.
References Parma_Polyhedra_Library::Swapping_Vector< T >::back(), Parma_Polyhedra_Library::Linear_System< Row >::check_sorted(), Parma_Polyhedra_Library::compare(), Parma_Polyhedra_Library::compute_capacity(), Parma_Polyhedra_Library::Swapping_Vector< T >::max_num_rows(), Parma_Polyhedra_Library::Linear_System< Row >::num_pending_rows(), Parma_Polyhedra_Library::Linear_System< Row >::num_rows(), Parma_Polyhedra_Library::Swapping_Vector< T >::reserve(), Parma_Polyhedra_Library::Swapping_Vector< T >::resize(), Parma_Polyhedra_Library::Linear_System< Row >::rows, Parma_Polyhedra_Library::Swapping_Vector< T >::size(), Parma_Polyhedra_Library::Linear_System< Row >::space_dimension(), and Parma_Polyhedra_Library::swap().
dimension_type Parma_Polyhedra_Library::Linear_System< Row >::num_lines_or_equalities | ( | ) | const |
Returns the number of rows in the system that represent either lines or equalities.
Definition at line 41 of file Linear_System_templates.hh.
|
inline |
Returns the number of rows that are in the pending part of the system.
Definition at line 100 of file Linear_System_inlines.hh.
Referenced by Parma_Polyhedra_Library::Linear_System< Row >::insert(), Parma_Polyhedra_Library::Linear_System< Row >::Linear_System(), and Parma_Polyhedra_Library::Linear_System< Row >::merge_rows_assign().
|
inline |
Definition at line 316 of file Linear_System_inlines.hh.
Referenced by Parma_Polyhedra_Library::Linear_System< Row >::insert_pending(), Parma_Polyhedra_Library::Linear_System< Row >::Linear_System(), Parma_Polyhedra_Library::Linear_System< Row >::merge_rows_assign(), and Parma_Polyhedra_Library::Linear_System< Row >::operator==().
bool Parma_Polyhedra_Library::Linear_System< Row >::OK | ( | ) | const |
Checks if all the invariants are satisfied.
Definition at line 923 of file Linear_System_templates.hh.
Referenced by Parma_Polyhedra_Library::Linear_System< Row >::insert_pending(), Parma_Polyhedra_Library::Linear_System< Row >::Linear_System(), and Parma_Polyhedra_Library::Linear_System< Row >::m_swap().
|
inline |
Assignment operator: pending rows are transformed into non-pending ones.
Definition at line 184 of file Linear_System_inlines.hh.
References Parma_Polyhedra_Library::swap().
|
inline |
Returns a const reference to the k-th
row of the system.
Definition at line 280 of file Linear_System_inlines.hh.
|
inline |
Permutes the space dimensions of the matrix.
Definition at line 659 of file Linear_System_inlines.hh.
void Parma_Polyhedra_Library::Linear_System< Row >::print | ( | ) | const |
Prints *this
to std::cerr
using operator<<
.
|
inline |
Makes the system shrink by removing its i-th row.
When keep_sorted
is true
and the system is sorted, sortedness will be preserved, but this method costs O(n).
Otherwise, this method just swaps the i-th row with the last and then removes it, so it costs O(1).
Definition at line 414 of file Linear_System_inlines.hh.
|
inlineprivate |
Makes the system shrink by removing its i-th row.
When keep_sorted
is true
and the system is sorted, sortedness will be preserved, but this method costs O(n).
Otherwise, this method just swaps the i-th row with the last and then removes it, so it costs O(1).
This method is for internal use, it does *not* assert OK() at the end, so it can be used for invalid systems.
Definition at line 372 of file Linear_System_inlines.hh.
References Parma_Polyhedra_Library::swap().
|
inline |
Makes the system shrink by removing the rows in [first,last).
When keep_sorted
is true
and the system is sorted, sortedness will be preserved, but this method costs O(num_rows()).
Otherwise, this method just swaps the rows with the last ones and then removes them, so it costs O(last - first).
Definition at line 422 of file Linear_System_inlines.hh.
References Parma_Polyhedra_Library::swap().
|
inline |
Removes the specified rows. The row ordering of remaining rows is preserved.
indexes | specifies a list of row indexes. It must be sorted. |
Definition at line 560 of file Linear_System_inlines.hh.
References Parma_Polyhedra_Library::swap().
void Parma_Polyhedra_Library::Linear_System< Row >::remove_space_dimensions | ( | const Variables_Set & | vars | ) |
Removes all the specified dimensions from the system.
The space dimension of the variable with the highest space dimension in vars
must be at most the space dimension of this
.
Definition at line 365 of file Linear_System_templates.hh.
References Parma_Polyhedra_Library::Variables_Set::space_dimension().
|
inline |
Makes the system shrink by removing its n
trailing rows.
Definition at line 647 of file Linear_System_inlines.hh.
|
inline |
Returns the current representation of *this.
Definition at line 328 of file Linear_System_inlines.hh.
|
inline |
Sets the index of the first pending row to i
.
Definition at line 114 of file Linear_System_inlines.hh.
|
inline |
Sets the system topology to NECESSARILY_CLOSED
.
Definition at line 262 of file Linear_System_inlines.hh.
References Parma_Polyhedra_Library::NECESSARILY_CLOSED.
|
inline |
Sets the system topology to NOT_NECESSARILY_CLOSED
.
Definition at line 268 of file Linear_System_inlines.hh.
References Parma_Polyhedra_Library::NOT_NECESSARILY_CLOSED.
|
inline |
Converts *this to the specified representation.
Definition at line 334 of file Linear_System_inlines.hh.
|
inline |
Sets the sortedness flag of the system to b
.
Definition at line 59 of file Linear_System_inlines.hh.
|
inline |
Sets the space dimension of the rows in the system to space_dim
.
Definition at line 365 of file Linear_System_inlines.hh.
Referenced by Parma_Polyhedra_Library::Linear_System< Row >::Linear_System().
|
inlineprivate |
Sets the space dimension of the rows in the system to space_dim
.
This method is for internal use, it does *not* assert OK() at the end, so it can be used for invalid systems.
Definition at line 356 of file Linear_System_inlines.hh.
|
inline |
Sets the system topology to t
.
Definition at line 249 of file Linear_System_inlines.hh.
void Parma_Polyhedra_Library::Linear_System< Row >::shift_space_dimensions | ( | Variable | v, |
dimension_type | n | ||
) |
Shift by n
positions the coefficients of variables, starting from the coefficient of v
. This increases the space dimension by n
.
Definition at line 399 of file Linear_System_templates.hh.
References Parma_Polyhedra_Library::Variable::id().
void Parma_Polyhedra_Library::Linear_System< Row >::sign_normalize | ( | ) |
Sign-normalizes the system.
Definition at line 481 of file Linear_System_templates.hh.
void Parma_Polyhedra_Library::Linear_System< Row >::simplify | ( | ) |
Applies Gaussian elimination and back-substitution so as to simplify the linear system.
Definition at line 733 of file Linear_System_templates.hh.
References Parma_Polyhedra_Library::swap().
void Parma_Polyhedra_Library::Linear_System< Row >::sort_and_remove_with_sat | ( | Bit_Matrix & | sat | ) |
Sorts the system, removing duplicates, keeping the saturation matrix consistent.
sat | Bit matrix with rows corresponding to the rows of *this . |
Definition at line 521 of file Linear_System_templates.hh.
References Parma_Polyhedra_Library::Implementation::indirect_sort_and_unique(), Parma_Polyhedra_Library::Bit_Matrix::num_rows(), Parma_Polyhedra_Library::Bit_Matrix::remove_trailing_rows(), and Parma_Polyhedra_Library::swap().
void Parma_Polyhedra_Library::Linear_System< Row >::sort_pending_and_remove_duplicates | ( | ) |
Sorts the pending rows and eliminates those that also occur in the non-pending part of the system.
Definition at line 851 of file Linear_System_templates.hh.
References Parma_Polyhedra_Library::cmp(), Parma_Polyhedra_Library::compare(), and Parma_Polyhedra_Library::swap().
void Parma_Polyhedra_Library::Linear_System< Row >::sort_rows | ( | ) |
Sorts the non-pending rows (in growing order) and eliminates duplicated ones.
Definition at line 412 of file Linear_System_templates.hh.
void Parma_Polyhedra_Library::Linear_System< Row >::sort_rows | ( | dimension_type | first_row, |
dimension_type | last_row | ||
) |
Sorts the rows (in growing order) form first_row
to last_row
and eliminates duplicated ones.
Definition at line 421 of file Linear_System_templates.hh.
References Parma_Polyhedra_Library::Implementation::indirect_sort_and_unique().
|
inline |
Returns the space dimension of the rows in the system.
The computation of the space dimension correctly ignores the column encoding the inhomogeneous terms of constraint (resp., the divisors of generators); if the system topology is NOT_NECESSARILY_CLOSED
, also the column of the -dimension coefficients will be ignored.
Definition at line 350 of file Linear_System_inlines.hh.
Referenced by Parma_Polyhedra_Library::Linear_System< Row >::insert_pending(), Parma_Polyhedra_Library::Linear_System< Row >::merge_rows_assign(), and Parma_Polyhedra_Library::Linear_System< Row >::operator==().
void Parma_Polyhedra_Library::Linear_System< Row >::strong_normalize | ( | ) |
Strongly normalizes the system.
Definition at line 469 of file Linear_System_templates.hh.
|
inlineprivate |
Swaps the [first,last) row interval with the [first + offset, last + offset) interval.
These intervals may not be disjunct.
Sorting of these intervals is *not* preserved.
Either both intervals contain only not-pending rows, or they both contain pending rows.
Definition at line 515 of file Linear_System_inlines.hh.
References Parma_Polyhedra_Library::swap().
|
inline |
Swaps the coefficients of the variables v1
and v2
.
Definition at line 670 of file Linear_System_inlines.hh.
References Parma_Polyhedra_Library::Variable::space_dimension().
|
inline |
Returns the system topology.
Definition at line 322 of file Linear_System_inlines.hh.
|
inline |
Returns the total size in bytes of the memory occupied by *this
.
Definition at line 42 of file Linear_System_inlines.hh.
References Parma_Polyhedra_Library::external_memory_in_bytes().
|
inline |
Sets the index to indicate that the system has no pending rows.
Definition at line 107 of file Linear_System_inlines.hh.
Referenced by Parma_Polyhedra_Library::Linear_System< Row >::Linear_System().
|
friend |
Definition at line 546 of file Linear_System_defs.hh.
|
related |
Returns true
if and only if x
and y
are different.
|
related |
Definition at line 683 of file Linear_System_inlines.hh.
|
related |
Definition at line 494 of file Linear_System_templates.hh.
References Parma_Polyhedra_Library::Linear_System< Row >::first_pending_row(), Parma_Polyhedra_Library::Linear_System< Row >::num_rows(), and Parma_Polyhedra_Library::Linear_System< Row >::space_dimension().
|
related |
Returns true
if and only if x
and y
are identical.
|
friend |
Definition at line 545 of file Linear_System_defs.hh.
|
related |
Swaps x
with y
.
Referenced by Parma_Polyhedra_Library::Linear_System< Row >::Linear_System().
|
related |
Definition at line 712 of file Linear_System_inlines.hh.
References Parma_Polyhedra_Library::Linear_System< Row >::m_swap().
|
private |
The index of the first pending row.
Definition at line 518 of file Linear_System_defs.hh.
Referenced by Parma_Polyhedra_Library::Linear_System< Row >::m_swap().
|
private |
Definition at line 527 of file Linear_System_defs.hh.
Referenced by Parma_Polyhedra_Library::Linear_System< Row >::m_swap().
|
private |
The topological kind of the rows in the system. All rows must have this topology.
Definition at line 515 of file Linear_System_defs.hh.
Referenced by Parma_Polyhedra_Library::Linear_System< Row >::m_swap().
Swapping_Vector<Row> Parma_Polyhedra_Library::Linear_System< Row >::rows |
The vector that contains the rows.
Definition at line 452 of file Linear_System_defs.hh.
Referenced by Parma_Polyhedra_Library::Linear_System< Row >::insert_pending(), Parma_Polyhedra_Library::Linear_System< Row >::Linear_System(), Parma_Polyhedra_Library::Linear_System< Row >::m_swap(), and Parma_Polyhedra_Library::Linear_System< Row >::merge_rows_assign().
|
private |
true
if rows are sorted in the ascending order as defined by bool compare(const Row&, const Row&)
. If false
may not be sorted.
Definition at line 525 of file Linear_System_defs.hh.
Referenced by Parma_Polyhedra_Library::Linear_System< Row >::Linear_System(), and Parma_Polyhedra_Library::Linear_System< Row >::m_swap().
|
private |
The space dimension of each row. All rows must have this number of space dimensions.
Definition at line 511 of file Linear_System_defs.hh.
Referenced by Parma_Polyhedra_Library::Linear_System< Row >::m_swap().