A sparse matrix container for square symmetrical content around the main diagonal.
This class saves half of the space with respect to CSparseMatrixTemplate since only those entries (c,r) such as c>=r are really stored, but both (c,r) and (r,c) can be retrieved or set and both redirect to the same internal cell container.
Definition at line 409 of file CSparseMatrixTemplate.h.
#include <mrpt/math/CSparseMatrixTemplate.h>
Public Types | |
typedef std::map< std::pair< size_t, size_t >, T > | SparseMatrixMap |
Internal map type, used to store the actual matrix. More... | |
typedef SparseMatrixMap::const_iterator | const_iterator |
Const iterator to move through the matrix. More... | |
typedef SparseMatrixMap::const_reverse_iterator | const_reverse_iterator |
Const reverse iterator to move through the matrix. More... | |
Public Member Functions | |
CSparseSymmetricalMatrix () | |
CSparseSymmetricalMatrix (const CSparseSymmetricalMatrix &o) | |
CSparseSymmetricalMatrix (const CSparseMatrixTemplate< T > &o) | |
virtual | ~CSparseSymmetricalMatrix () |
void | resize (size_t matrixSize) |
T | operator() (size_t r, size_t c) const |
T & | operator() (size_t r, size_t c) |
CSparseMatrixTemplate< T > | operator() (size_t firstRow, size_t lastRow, size_t firstColumn, size_t lastColumn) const |
Extracts a submatrix form the matrix. More... | |
bool | exists (size_t r, size_t c) const |
Element access operator. More... | |
size_t | getRowCount () const |
Returns the amount of rows in this matrix. More... | |
size_t | getColCount () const |
Returns the amount of columns in this matrix. More... | |
void | getRow (size_t nRow, std::vector< T > &vec) const |
Extracts a full row from the matrix. More... | |
void | getColumn (size_t nCol, std::vector< T > &vec) const |
Extracts a full column from the matrix. More... | |
void | insert (size_t row, size_t column, const T &obj) |
Inserts an element into the matrix. More... | |
template<class MATRIX_LIKE > | |
void | insertMatrix (size_t row, size_t column, const MATRIX_LIKE &mat) |
Inserts submatrix at a given location. More... | |
const_iterator | begin () const |
Returns an iterator which points to the starting point of the matrix. More... | |
const_iterator | end () const |
Returns an iterator which points to the end of the matrix. More... | |
const_reverse_iterator | rbegin () const |
Returns an iterator which points to the end of the matrix, and can be used to move backwards. More... | |
const_reverse_iterator | rend () const |
Returns an iterator which points to the starting point of the matrix, although it's the upper limit of the matrix since it's a reverse iterator. More... | |
void | setRow (size_t nRow, const std::vector< T > &vec, const T &nullObject=T()) |
Inserts a full row into the matrix. More... | |
void | setColumn (size_t nCol, const std::vector< T > &vec, const T &nullObject=T()) |
Inserts a full column into the matrix. More... | |
void | resize (size_t nRows, size_t nCols) |
Changes the size of the matrix. More... | |
void | getAsVector (std::vector< T > &vec) const |
Gets a vector containing all the elements of the matrix, ignoring their position. More... | |
size_t | getNonNullElements () const |
Gets the amount of non-null elements inside the matrix. More... | |
bool | empty () const |
Are there no elements set to !=0 ? More... | |
size_t | getNullElements () const |
Gets the amount of null elements inside the matrix. More... | |
bool | isNull (size_t nRow, size_t nCol) const |
Checks whether an element of the matrix is the default object. More... | |
bool | isNotNull (size_t nRow, size_t nCol) const |
Checks whether an element of the matrix is not the default object. More... | |
void | clear () |
Completely removes all elements, although maintaining the matrix's size. More... | |
void | purge (T nullObject=T()) |
Checks each non-null elements against the basic objects, erasing unnecesary references to it. More... | |
Protected Attributes | |
size_t | mRows |
Size of the matrix. More... | |
size_t | mColumns |
SparseMatrixMap | objectList |
Actual matrix. More... | |
|
inherited |
Const iterator to move through the matrix.
Definition at line 55 of file CSparseMatrixTemplate.h.
|
inherited |
Const reverse iterator to move through the matrix.
Definition at line 61 of file CSparseMatrixTemplate.h.
|
inherited |
Internal map type, used to store the actual matrix.
Definition at line 50 of file CSparseMatrixTemplate.h.
|
inline |
Definition at line 412 of file CSparseMatrixTemplate.h.
|
inlineexplicit |
Definition at line 413 of file CSparseMatrixTemplate.h.
|
inlineexplicit |
Definition at line 417 of file CSparseMatrixTemplate.h.
|
inlinevirtual |
Definition at line 421 of file CSparseMatrixTemplate.h.
|
inlineinherited |
Returns an iterator which points to the starting point of the matrix.
It's a const_iterator, so that the usar isn't able to modify the matrix content into an invalid state.
Definition at line 206 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::objectList.
Referenced by mrpt::math::CSparseMatrixTemplate< T >::operator()(), and mrpt::math::CSparseMatrixTemplate< T >::purge().
|
inlineinherited |
Completely removes all elements, although maintaining the matrix's size.
Definition at line 383 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::objectList.
Referenced by mrpt::math::intersect().
|
inlineinherited |
Are there no elements set to !=0 ?
Definition at line 350 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::objectList.
|
inlineinherited |
Returns an iterator which points to the end of the matrix.
It's a const_iterator, so that the usar isn't able to modify the matrix content into an invalid state.
Definition at line 213 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::objectList.
Referenced by mrpt::math::CSparseMatrixTemplate< T >::operator()(), mrpt::math::CSparseSymmetricalMatrix< T >::operator()(), and mrpt::math::CSparseMatrixTemplate< T >::purge().
|
inlineinherited |
Element access operator.
Checks bounds.
Definition at line 96 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::mColumns, mrpt::math::CSparseMatrixTemplate< T >::mRows, and mrpt::math::CSparseMatrixTemplate< T >::objectList.
|
inlineinherited |
Gets a vector containing all the elements of the matrix, ignoring their position.
Definition at line 333 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::objectList.
|
inlineinherited |
Returns the amount of columns in this matrix.
Definition at line 123 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::mColumns.
Referenced by depthFirstSearch(), and mrpt::math::intersect().
|
inlineinherited |
Extracts a full column from the matrix.
std::logic_error | on out of range. |
Definition at line 160 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::mColumns, mrpt::math::CSparseMatrixTemplate< T >::mRows, and mrpt::math::CSparseMatrixTemplate< T >::objectList.
|
inlineinherited |
Gets the amount of non-null elements inside the matrix.
Definition at line 346 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::objectList.
Referenced by mrpt::math::CSparseMatrixTemplate< T >::getNullElements(), and mrpt::math::intersect().
|
inlineinherited |
Gets the amount of null elements inside the matrix.
Definition at line 355 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::getNonNullElements(), mrpt::math::CSparseMatrixTemplate< T >::mColumns, and mrpt::math::CSparseMatrixTemplate< T >::mRows.
|
inlineinherited |
Extracts a full row from the matrix.
std::logic_error | on out of range. |
Definition at line 129 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::mColumns, mrpt::math::CSparseMatrixTemplate< T >::mRows, and mrpt::math::CSparseMatrixTemplate< T >::objectList.
|
inlineinherited |
Returns the amount of rows in this matrix.
Definition at line 118 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::mRows.
Referenced by mrpt::math::intersect().
|
inlineinherited |
Inserts an element into the matrix.
Definition at line 184 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::operator()().
|
inlineinherited |
Inserts submatrix at a given location.
Definition at line 191 of file CSparseMatrixTemplate.h.
|
inlineinherited |
Checks whether an element of the matrix is not the default object.
Definition at line 374 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::mColumns, mrpt::math::CSparseMatrixTemplate< T >::mRows, and mrpt::math::CSparseMatrixTemplate< T >::objectList.
Referenced by depthFirstSearch().
|
inlineinherited |
Checks whether an element of the matrix is the default object.
std::logic_error | on out of range |
Definition at line 364 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::mColumns, mrpt::math::CSparseMatrixTemplate< T >::mRows, and mrpt::math::CSparseMatrixTemplate< T >::objectList.
|
inlineinherited |
Extracts a submatrix form the matrix.
std::logic_error | on invalid bounds. |
Definition at line 307 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::begin(), mrpt::math::CSparseMatrixTemplate< T >::end(), mrpt::math::CSparseMatrixTemplate< T >::mColumns, and mrpt::math::CSparseMatrixTemplate< T >::mRows.
|
inline |
Definition at line 427 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::end().
|
inline |
Definition at line 437 of file CSparseMatrixTemplate.h.
|
inlineinherited |
Checks each non-null elements against the basic objects, erasing unnecesary references to it.
Definition at line 388 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::begin(), mrpt::math::CSparseMatrixTemplate< T >::end(), and mrpt::math::CSparseMatrixTemplate< T >::objectList.
|
inlineinherited |
Returns an iterator which points to the end of the matrix, and can be used to move backwards.
It's a const_reverse_iterator, so that the usar isn't able to modify the matrix content into an invalid state.
Definition at line 220 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::objectList.
|
inlineinherited |
Returns an iterator which points to the starting point of the matrix, although it's the upper limit of the matrix since it's a reverse iterator.
Also, it's a const_reverse_iterator, so that the usar isn't able to modify the matrix content into an invalid state.
Definition at line 228 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::objectList.
|
inlineinherited |
Changes the size of the matrix.
Definition at line 282 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::mColumns, mrpt::math::CSparseMatrixTemplate< T >::mRows, and mrpt::math::CSparseMatrixTemplate< T >::objectList.
Referenced by mrpt::math::intersect(), and mrpt::math::CSparseSymmetricalMatrix< T >::resize().
|
inline |
Definition at line 422 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::resize().
|
inlineinherited |
Inserts a full column into the matrix.
The third argument is used to specify a null object (which won't be inserted, since the matrix is sparse).
std::logic_error | on out of range or wrong sized vector. |
Definition at line 261 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::mColumns, mrpt::math::CSparseMatrixTemplate< T >::mRows, and mrpt::math::CSparseMatrixTemplate< T >::objectList.
|
inlineinherited |
Inserts a full row into the matrix.
The third argument is used to specify a null object (which won't be inserted, since the matrix is sparse).
std::logic_error | on out of range or wrong sized vector. |
Definition at line 236 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::mColumns, mrpt::math::CSparseMatrixTemplate< T >::mRows, and mrpt::math::CSparseMatrixTemplate< T >::objectList.
|
protectedinherited |
Definition at line 67 of file CSparseMatrixTemplate.h.
Referenced by mrpt::math::CSparseMatrixTemplate< T >::exists(), mrpt::math::CSparseMatrixTemplate< T >::getColCount(), mrpt::math::CSparseMatrixTemplate< T >::getColumn(), mrpt::math::CSparseMatrixTemplate< T >::getNullElements(), mrpt::math::CSparseMatrixTemplate< T >::getRow(), mrpt::math::CSparseMatrixTemplate< T >::isNotNull(), mrpt::math::CSparseMatrixTemplate< T >::isNull(), mrpt::math::CSparseMatrixTemplate< T >::operator()(), mrpt::math::CSparseMatrixTemplate< T >::resize(), mrpt::math::CSparseMatrixTemplate< T >::setColumn(), and mrpt::math::CSparseMatrixTemplate< T >::setRow().
|
protectedinherited |
Size of the matrix.
Definition at line 67 of file CSparseMatrixTemplate.h.
Referenced by mrpt::math::CSparseMatrixTemplate< T >::exists(), mrpt::math::CSparseMatrixTemplate< T >::getColumn(), mrpt::math::CSparseMatrixTemplate< T >::getNullElements(), mrpt::math::CSparseMatrixTemplate< T >::getRow(), mrpt::math::CSparseMatrixTemplate< T >::getRowCount(), mrpt::math::CSparseMatrixTemplate< T >::isNotNull(), mrpt::math::CSparseMatrixTemplate< T >::isNull(), mrpt::math::CSparseMatrixTemplate< T >::operator()(), mrpt::math::CSparseMatrixTemplate< T >::resize(), mrpt::math::CSparseMatrixTemplate< T >::setColumn(), and mrpt::math::CSparseMatrixTemplate< T >::setRow().
|
protectedinherited |
Actual matrix.
Definition at line 71 of file CSparseMatrixTemplate.h.
Referenced by mrpt::math::CSparseMatrixTemplate< T >::begin(), mrpt::math::CSparseMatrixTemplate< T >::clear(), mrpt::math::CSparseMatrixTemplate< T >::empty(), mrpt::math::CSparseMatrixTemplate< T >::end(), mrpt::math::CSparseMatrixTemplate< T >::exists(), mrpt::math::CSparseMatrixTemplate< T >::getAsVector(), mrpt::math::CSparseMatrixTemplate< T >::getColumn(), mrpt::math::CSparseMatrixTemplate< T >::getNonNullElements(), mrpt::math::CSparseMatrixTemplate< T >::getRow(), mrpt::math::CSparseMatrixTemplate< T >::isNotNull(), mrpt::math::CSparseMatrixTemplate< T >::isNull(), mrpt::math::CSparseMatrixTemplate< T >::operator()(), mrpt::math::CSparseMatrixTemplate< T >::purge(), mrpt::math::CSparseMatrixTemplate< T >::rbegin(), mrpt::math::CSparseMatrixTemplate< T >::rend(), mrpt::math::CSparseMatrixTemplate< T >::resize(), mrpt::math::CSparseMatrixTemplate< T >::setColumn(), and mrpt::math::CSparseMatrixTemplate< T >::setRow().
Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019 |