![]() |
CMR
1.3.0
|
Sparse matrix with entries of type V.
More...
#include <matrix.hpp>
Classes | |
| struct | Data |
| Matrix data, row-wise or column-wise. More... | |
| struct | NonzeroIterator |
| Iterator for row- or column-wise iteration over the entries. More... | |
Public Types | |
| typedef Matrix< V >::Value | Value |
| typedef Matrix< V >::Index | Index |
| typedef Matrix< V >::Nonzero | Nonzero |
| typedef detail::Range< NonzeroIterator< true > > | NonzeroRowRange |
| typedef detail::Range< NonzeroIterator< false > > | NonzeroColumnRange |
Public Types inherited from tu::Matrix< V > | |
| typedef V | Value |
| typedef std::size_t | Index |
| Type of entries. More... | |
Public Member Functions | |
| SparseMatrix () | |
| Constructs a 0x0 matrix. More... | |
| SparseMatrix (SparseMatrix &&other) | |
| Move constructor. More... | |
| SparseMatrix & | operator= (SparseMatrix &&other) |
| Move assignment operator. More... | |
| SparseMatrix (bool majorRow, Index numMajor, Index numMinor, Index numEntries, Index *first, Index *beyond, Index *entryMinors, Value *entryValues, bool mayContainZeros=true, bool isSorted=false) | |
| Constructs a matrix. More... | |
| SparseMatrix (bool majorRow, const Data &data, Index numMinor, bool majorIsSorted=false) | |
| Constructs a matrix. More... | |
| SparseMatrix (bool majorRow, Data &&data, Index numMinor) | |
| Constructs a matrix. More... | |
| SparseMatrix (const Data &rowData, const Data &columnData) | |
| Constructs a matrix. More... | |
| SparseMatrix (Data &&rowData, Data &&columnData) | |
| Constructs a matrix. More... | |
| void | set (bool majorRow, Index numMajor, Index numMinor, Index numEntries, const Index *first, const Index *beyond, const Index *entryMinors, const Value *entryValues, bool mayContainZeros=true, bool isSorted=false) |
| Sets the contents of the matrix. More... | |
| void | set (bool majorRow, const Data &data, Index numMinor) |
| Sets the contents of the matrix. More... | |
| void | set (bool majorRow, Data &&data, Index numMinor) |
| Sets the contents of the matrix. More... | |
| void | set (const Data &rowData, const Data &columnData) |
| Sets the contents of the matrix. More... | |
| void | set (Data &&rowData, Data &&columnData) |
| Sets the contents of the matrix. More... | |
| ~SparseMatrix ()=default | |
| Destructor. More... | |
| std::size_t | numRows () const |
| Returns the number of rows. More... | |
| std::size_t | numColumns () const |
| Returns the number of columns. More... | |
| bool | hasSortedRows () const |
| Indicates if the row data is sorted by column. More... | |
| bool | hasSortedColumns () const |
| Indicates if the column data is sorted by row. More... | |
| const Value & | get (Index row, Index column) const |
Returns entry at row, column. More... | |
| std::size_t | numNonzeros () const |
| Returns the number of nonzeros. More... | |
| std::size_t | countRowNonzeros (Index row) const |
Returns the number of nonzeros in row. More... | |
| std::size_t | countColumnNonzeros (Index column) const |
Returns the number of nonzeros in column. More... | |
| NonzeroRowRange | iterateRowNonzeros (Index row) const |
Returns a range for iterating over the nonzeros of row. More... | |
| NonzeroColumnRange | iterateColumnNonzeros (Index column) const |
Returns a range for iterating over the nonzeros of column. More... | |
| SparseMatrix | transposed () const |
| Returns a copy of the matrix' transpose. More... | |
| void | ensureConsistency () const |
| Checks for consistency, raising a std::runtime_error if inconsistent. More... | |
| void | transpose () |
| Transposes the matrix. More... | |
| void | sortRows () |
| Sort row data (by column). More... | |
| void | sortColumns () |
| Sort column data (by row). More... | |
| void | sort () |
| Sort row and column data (by column and row, respectively). More... | |
Sparse matrix with entries of type V.
| typedef Matrix<V>::Index tu::SparseMatrix< V >::Index |
| typedef Matrix<V>::Nonzero tu::SparseMatrix< V >::Nonzero |
| typedef detail::Range<NonzeroIterator<false> > tu::SparseMatrix< V >::NonzeroColumnRange |
| typedef detail::Range<NonzeroIterator<true> > tu::SparseMatrix< V >::NonzeroRowRange |
| typedef Matrix<V>::Value tu::SparseMatrix< V >::Value |
|
inline |
Constructs a 0x0 matrix.
|
inline |
Move constructor.
|
inline |
Constructs a matrix.
Constructs a matrix. Given entries may contain zeros, but they are filtered.
| majorRow | Indicates if data is row-wise. |
| numMajor | Number of rows (resp. columns) of the matrix. |
| numMinor | Number of columns (resp. rows) of the matrix. |
| numEntries | Number of provided entries. |
| first | Array of size numMajor with first index of each row (resp. column). |
| beyond | Array of size numMajor with beyond index of each row (resp. column). May be NULL in which case the first-entry of the next major is considered, i.e., the rows (resp. columns) need to be given in an ordered way. |
| entryMinors | Array of size numEntries with column (resp. row) of each entry. |
| entryValues | Array of size numEntries with value of each entry. |
| mayContainZeros | Whether we have to check for zero entries. |
| isSorted | Whether the entries of each row (resp. column) are already sorted. |
|
inline |
Constructs a matrix.
Constructs a matrix from a prepared data structure.
| majorRow | Indicates if data is row-wise. |
| majorIsSorted | Whether the data of each major is sorted by minor. |
| data | Matrix data. |
|
inline |
Constructs a matrix.
Constructs a matrix from a prepared data structure.
| majorRow | Indicates if data is row-wise. |
| data | Matrix data. |
|
inline |
|
inline |
|
default |
Destructor.
|
inline |
Returns the number of nonzeros in column.
|
inline |
Returns the number of nonzeros in row.
|
inline |
Checks for consistency, raising a std::runtime_error if inconsistent.
Checks for consistency of row- and column-data, which includes that all entries must be nonzeros and that entries are sorted and free of duplicates (if stated so).
|
inline |
Returns entry at row, column.
Returns entry at row, column. If the row or column data is sorted (resp. not sorted) then the time is logarithmic (resp. linear) in the number of nonzeros of the row or column.
|
inline |
Indicates if the column data is sorted by row.
|
inline |
Indicates if the row data is sorted by column.
|
inline |
Returns a range for iterating over the nonzeros of column.
|
inline |
Returns a range for iterating over the nonzeros of row.
|
inline |
Returns the number of columns.
|
inline |
Returns the number of nonzeros.
|
inline |
Returns the number of rows.
|
inline |
Move assignment operator.
|
inline |
Sets the contents of the matrix.
Sets the contents of the matrix from a prepared data structure.
| majorRow | Indicates if data is row-wise. |
| data | Matrix data. |
| numMinor | Number of columns (resp. rows). |
|
inline |
Sets the contents of the matrix.
Sets the contents of the matrix from a prepared data structure.
| majorRow | Indicates if data is row-wise. |
| data | Matrix data. |
| numMinor | Number of columns (resp. rows). |
|
inline |
Sets the contents of the matrix.
Sets the contents of the matrix. Given entries may contain zeros, but they are filtered.
| majorRow | Indicates if data is row-wise. |
| numMajor | Number of rows (resp. columns) of the matrix. |
| numMinor | Number of columns (resp. rows) of the matrix. |
| numEntries | Number of provided entries. |
| first | Array of size numMajor with first index of each row (resp. column). |
| beyond | Array of size numMajor with beyond index of each row (resp. column). May be nullptr in which case the first-entry of the next major is considered, i.e., the rows (resp. columns) need to be ordered. |
| entryMinors | Array of size numEntries with column (resp. row) of each entry. |
| entryValues | Array of size numEntries with value of each entry. |
| mayContainZeros | Whether zero entries shall be skipped. |
| isSorted | Whether the entries of each major are sorted by minor. |
|
inline |
|
inline |
|
inline |
Sort row and column data (by column and row, respectively).
|
inline |
Sort column data (by row).
|
inline |
Sort row data (by column).
|
inline |
Transposes the matrix.
Transposes the matrix in constant time.
|
inline |
Returns a copy of the matrix' transpose.