Inherits pm::IncidenceMatrix_base< symmetric >, and pm::GenericIncidenceMatrix< pm::IncidenceMatrix< symmetric > >.
Public Member Functions | |
| IncidenceMatrix () | |
| Create an empty IncidenceMatrix. | |
| IncidenceMatrix (int r, int c) | |
| Create an empty IncidenceMatrix with r rows and c columns initialized with zeroes. | |
| template<typename Iterator> | |
| IncidenceMatrix (int r, int c, Iterator src) | |
| Create an IncidenceMatrix IncidenceMatrix with r rows and c columns and initialize it from a data sequence. | |
| template<typename Container> | |
| IncidenceMatrix (const Container &src, typename enable_if< nothing *, isomorphic_to_container_of< Container, Set< int > >::value &&!symmetric::value >::type=0) | |
| number of columns not known in advance | |
| template<typename Container> | |
| IncidenceMatrix (const Container &src, typename enable_if< int, isomorphic_to_container_of< Container, Set< int > >::value &&!symmetric::value >::type c) | |
| number of columns given explicitly | |
| IncidenceMatrix & | operator= (const IncidenceMatrix &M) |
| Assignement operator. | |
| void | swap (IncidenceMatrix &M) |
| Swap the contents with that of another matrix in an efficient way. | |
| void | resize (int m, int n) |
Extend or truncate to new dimensions (m rows, n columns). Surviving elements keep their values, new elements are implicitly false. | |
| void | clear () |
| Clear contents. | |
| void | clear (int r, int c) |
| Clear contents. | |
| reference | operator() (int i, int j) |
| Entry at row i column j. | |
| const_reference | operator() (int i, int j) const |
| Entry at row i column j (const). | |
| bool | exists (int i, int j) const |
| Returns the entry at position (i,j). | |
| void | squeeze () |
| Delete empty rows and columns, renumber the rest and reduce the dimensions. | |
| void | squeeze_rows () |
| Delete empty rows, renumber the rest and reduce the dimensions. | |
| void | squeeze_cols () |
| Delete empty columns, renumber the rest and reduce the dimensions. | |
| template<typename Iterator> | |
| void | permute_rows (Iterator perm) |
| Permute the rows according to the given permutation. | |
| template<typename Iterator> | |
| void | permute_cols (Iterator perm) |
| Permute the columns according to the given permutation. | |
| template<typename Iterator> | |
| void | permute_inv_rows (Iterator inv_perm) |
| Permute the rows according to the inverse of the given permutation. | |
| template<typename Iterator> | |
| void | permute_inv_cols (Iterator inv_perm) |
| Permute the columns according to the inverse of the given permutation. | |
Protected Member Functions | |
| template<typename Iterator> | |
| void | _init (Iterator src, True) |
| initialize from a dense boolean sequence in row order | |
| template<typename Iterator> | |
| void | _init (Iterator src, False) |
| initialize rowwise from a sequence of sets | |
The only persistent class from the incidence matrix family. The implementation is based on a two-dimensional grid of balanced binary search (AVL) trees, the same as for
{reference counting}.
| pm::IncidenceMatrix< symmetric >::IncidenceMatrix | ( | int | r, | |
| int | c, | |||
| Iterator | src | |||
| ) | [inline] |
Create an IncidenceMatrix IncidenceMatrix with r rows and c columns and initialize it from a data sequence.
src should iterate either over r c boolean values, corresponding to the elements in the row order (the column index changes first,) or over r sets with integer elements (or convertible to integer), which are assigned to the matrix rows.
In the symmetric case the redundant elements must be present in the input sequence; their values are ignored.
| r | the number of rows | |
| c | the number of columns | |
| src | an iterator |
| void pm::IncidenceMatrix< symmetric >::resize | ( | int | m, | |
| int | n | |||
| ) | [inline] |
Extend or truncate to new dimensions (m rows, n columns). Surviving elements keep their values, new elements are implicitly false.
IncidenceMatrix deploys an adaptive reallocation strategy similar to std::vector, reserving additional stock memory by every reallocation. If you repeatedly increase the matrix dimensions by one, the amortized reallocation costs will be proportional to the logarithm of the final dimension.
A special case, looking at the first glance like a "no operation": { M.resize(M.rows(), M.cols()) }, gets rid of this extra allocated storage.