#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. | |
typedef SparseMatrixMap::const_iterator | const_iterator |
Const iterator to move through the matrix. | |
typedef SparseMatrixMap::const_reverse_iterator | const_reverse_iterator |
Const reverse iterator to move through the matrix. | |
Public Member Functions | |
CSparseMatrixTemplate () | |
Basic constructor with no data. | |
CSparseMatrixTemplate (size_t nR, size_t nC) | |
Constructor with default size. | |
T | operator() (size_t r, size_t c) const |
Element access operator. | |
T & | operator() (size_t r, size_t c) |
Reference access operator. | |
size_t | getRowCount () const |
Returns the amount of rows in this matrix. | |
size_t | getColumnCount () const |
Returns the amount of columns in this matrix. | |
void | getRow (size_t nRow, std::vector< T > &vec) const |
Extracts a full row from the matrix. | |
void | getColumn (size_t nCol, std::vector< T > &vec) const |
Extracts a full column from the matrix. | |
void | insert (size_t row, size_t column, const T &obj) |
Inserts an element into the matrix. | |
const_iterator | begin () const |
Returns an iterator which points to the starting point of the matrix. | |
const_iterator | end () const |
Returns an iterator which points to the end of the matrix. | |
const_reverse_iterator | rbegin () const |
Returns an iterator which points to the end of the matrix, and can be used to move backwards. | |
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. | |
void | setRow (size_t nRow, const std::vector< T > &vec, const T &nullObject=T()) |
Inserts a full row into the matrix. | |
void | setColumn (size_t nCol, const std::vector< T > &vec, const T &nullObject=T()) |
Inserts a full column into the matrix. | |
void | resize (size_t nRows, size_t nCols) |
Changes the size of the matrix. | |
CSparseMatrixTemplate< T > | operator() (size_t firstRow, size_t lastRow, size_t firstColumn, size_t lastColumn) const |
Extracts a submatrix form the matrix. | |
void | getAsVector (std::vector< T > &vec) const |
Gets a vector containing all the elements of the matrix, ignoring their position. | |
size_t | getNonNullElements () const |
Gets the amount of non-null elements inside the matrix. | |
size_t | getNullElements () const |
Gets the amount of null elements inside the matrix. | |
bool | isNull (size_t nRow, size_t nCol) const |
Checks whether an element of the matrix is the default object. | |
bool | isNotNull (size_t nRow, size_t nCol) const |
Checks whether an element of the matrix is not the default object. | |
void | clear () |
Completely removes all elements, although maintaining the matrix's size. | |
void | purge (T nullObject=T()) |
Checks each non-null elements against the basic objects, erasing unnecesary references to it. | |
Protected Attributes | |
size_t | mRows |
Size of the matrix. | |
size_t | mColumns |
SparseMatrixMap | objectList |
Actual matrix. |
Definition at line 40 of file CSparseMatrixTemplate.h.
typedef SparseMatrixMap::const_iterator mrpt::math::CSparseMatrixTemplate< T >::const_iterator |
typedef SparseMatrixMap::const_reverse_iterator mrpt::math::CSparseMatrixTemplate< T >::const_reverse_iterator |
Const reverse iterator to move through the matrix.
Definition at line 56 of file CSparseMatrixTemplate.h.
typedef std::map<std::pair<size_t,size_t>,T> mrpt::math::CSparseMatrixTemplate< T >::SparseMatrixMap |
Internal map type, used to store the actual matrix.
Definition at line 46 of file CSparseMatrixTemplate.h.
mrpt::math::CSparseMatrixTemplate< T >::CSparseMatrixTemplate | ( | ) | [inline] |
Basic constructor with no data.
Size is set to (0,0).
Definition at line 70 of file CSparseMatrixTemplate.h.
mrpt::math::CSparseMatrixTemplate< T >::CSparseMatrixTemplate | ( | size_t | nR, | |
size_t | nC | |||
) | [inline] |
const_iterator mrpt::math::CSparseMatrixTemplate< T >::begin | ( | ) | const [inline] |
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 157 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::objectList.
Referenced by mrpt::math::CSparseMatrixTemplate< T >::operator()(), and mrpt::math::CSparseMatrixTemplate< T >::purge().
void mrpt::math::CSparseMatrixTemplate< T >::clear | ( | void | ) | [inline] |
Completely removes all elements, although maintaining the matrix's size.
Definition at line 285 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::objectList.
Referenced by mrpt::math::intersect().
const_iterator mrpt::math::CSparseMatrixTemplate< T >::end | ( | ) | const [inline] |
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 164 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::objectList.
Referenced by mrpt::math::CSparseSymmetricalMatrix< T >::operator()(), mrpt::math::CSparseMatrixTemplate< T >::operator()(), and mrpt::math::CSparseMatrixTemplate< T >::purge().
void mrpt::math::CSparseMatrixTemplate< T >::getAsVector | ( | std::vector< T > & | vec | ) | const [inline] |
Gets a vector containing all the elements of the matrix, ignoring their position.
Definition at line 245 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::objectList.
void mrpt::math::CSparseMatrixTemplate< T >::getColumn | ( | size_t | nCol, | |
std::vector< T > & | vec | |||
) | const [inline] |
Extracts a full column from the matrix.
std::logic_error | on out of range. |
Definition at line 131 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::mColumns, mrpt::math::CSparseMatrixTemplate< T >::mRows, and mrpt::math::CSparseMatrixTemplate< T >::objectList.
size_t mrpt::math::CSparseMatrixTemplate< T >::getColumnCount | ( | ) | const [inline] |
Returns the amount of columns in this matrix.
Definition at line 101 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::mColumns.
size_t mrpt::math::CSparseMatrixTemplate< T >::getNonNullElements | ( | ) | const [inline] |
Gets the amount of non-null elements inside the matrix.
Definition at line 255 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::objectList.
Referenced by mrpt::math::CSparseMatrixTemplate< T >::getNullElements(), and mrpt::math::intersect().
size_t mrpt::math::CSparseMatrixTemplate< T >::getNullElements | ( | ) | const [inline] |
Gets the amount of null elements inside the matrix.
Definition at line 262 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::getNonNullElements(), mrpt::math::CSparseMatrixTemplate< T >::mColumns, and mrpt::math::CSparseMatrixTemplate< T >::mRows.
void mrpt::math::CSparseMatrixTemplate< T >::getRow | ( | size_t | nRow, | |
std::vector< T > & | vec | |||
) | const [inline] |
Extracts a full row from the matrix.
std::logic_error | on out of range. |
Definition at line 109 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::mColumns, mrpt::math::CSparseMatrixTemplate< T >::mRows, and mrpt::math::CSparseMatrixTemplate< T >::objectList.
size_t mrpt::math::CSparseMatrixTemplate< T >::getRowCount | ( | ) | const [inline] |
Returns the amount of rows in this matrix.
Definition at line 94 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::mRows.
void mrpt::math::CSparseMatrixTemplate< T >::insert | ( | size_t | row, | |
size_t | column, | |||
const T & | obj | |||
) | [inline] |
Inserts an element into the matrix.
Definition at line 149 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::operator()().
bool mrpt::math::CSparseMatrixTemplate< T >::isNotNull | ( | size_t | nRow, | |
size_t | nCol | |||
) | const [inline] |
Checks whether an element of the matrix is not the default object.
Definition at line 278 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::mColumns, mrpt::math::CSparseMatrixTemplate< T >::mRows, and mrpt::math::CSparseMatrixTemplate< T >::objectList.
bool mrpt::math::CSparseMatrixTemplate< T >::isNull | ( | size_t | nRow, | |
size_t | nCol | |||
) | const [inline] |
Checks whether an element of the matrix is the default object.
std::logic_error | on out of range |
Definition at line 270 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::mColumns, mrpt::math::CSparseMatrixTemplate< T >::mRows, and mrpt::math::CSparseMatrixTemplate< T >::objectList.
CSparseMatrixTemplate<T> mrpt::math::CSparseMatrixTemplate< T >::operator() | ( | size_t | firstRow, | |
size_t | lastRow, | |||
size_t | firstColumn, | |||
size_t | lastColumn | |||
) | const [inline] |
Extracts a submatrix form the matrix.
std::logic_error | on invalid bounds. |
Definition at line 232 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.
T& mrpt::math::CSparseMatrixTemplate< T >::operator() | ( | size_t | r, | |
size_t | c | |||
) | [inline] |
Reference access operator.
Checks for bounds.
Reimplemented in mrpt::math::CSparseSymmetricalMatrix< T >.
Definition at line 86 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::mColumns, mrpt::math::CSparseMatrixTemplate< T >::mRows, and mrpt::math::CSparseMatrixTemplate< T >::objectList.
T mrpt::math::CSparseMatrixTemplate< T >::operator() | ( | size_t | r, | |
size_t | c | |||
) | const [inline] |
Element access operator.
Doesn't check bounds.
Reimplemented in mrpt::math::CSparseSymmetricalMatrix< T >.
Definition at line 78 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::objectList.
Referenced by mrpt::math::CSparseMatrixTemplate< T >::insert().
void mrpt::math::CSparseMatrixTemplate< T >::purge | ( | T | nullObject = T() |
) | [inline] |
Checks each non-null elements against the basic objects, erasing unnecesary references to it.
Definition at line 291 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::begin(), mrpt::math::CSparseMatrixTemplate< T >::end(), and mrpt::math::CSparseMatrixTemplate< T >::objectList.
const_reverse_iterator mrpt::math::CSparseMatrixTemplate< T >::rbegin | ( | ) | const [inline] |
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 171 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::objectList.
const_reverse_iterator mrpt::math::CSparseMatrixTemplate< T >::rend | ( | ) | const [inline] |
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 178 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::objectList.
void mrpt::math::CSparseMatrixTemplate< T >::resize | ( | size_t | nRows, | |
size_t | nCols | |||
) | [inline] |
Changes the size of the matrix.
Definition at line 216 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().
void mrpt::math::CSparseMatrixTemplate< T >::setColumn | ( | size_t | nCol, | |
const std::vector< T > & | vec, | |||
const T & | nullObject = T() | |||
) | [inline] |
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 202 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::mColumns, mrpt::math::CSparseMatrixTemplate< T >::mRows, and mrpt::math::CSparseMatrixTemplate< T >::objectList.
void mrpt::math::CSparseMatrixTemplate< T >::setRow | ( | size_t | nRow, | |
const std::vector< T > & | vec, | |||
const T & | nullObject = T() | |||
) | [inline] |
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 186 of file CSparseMatrixTemplate.h.
References mrpt::math::CSparseMatrixTemplate< T >::mColumns, mrpt::math::CSparseMatrixTemplate< T >::mRows, and mrpt::math::CSparseMatrixTemplate< T >::objectList.
size_t mrpt::math::CSparseMatrixTemplate< T >::mColumns [protected] |
Definition at line 61 of file CSparseMatrixTemplate.h.
Referenced by mrpt::math::CSparseMatrixTemplate< T >::getColumn(), mrpt::math::CSparseMatrixTemplate< T >::getColumnCount(), 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().
size_t mrpt::math::CSparseMatrixTemplate< T >::mRows [protected] |
Size of the matrix.
Definition at line 61 of file CSparseMatrixTemplate.h.
Referenced by 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().
SparseMatrixMap mrpt::math::CSparseMatrixTemplate< T >::objectList [protected] |
Actual matrix.
Definition at line 65 of file CSparseMatrixTemplate.h.
Referenced by mrpt::math::CSparseMatrixTemplate< T >::begin(), mrpt::math::CSparseMatrixTemplate< T >::clear(), mrpt::math::CSparseMatrixTemplate< T >::end(), 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.5.7.1 for MRPT 0.7.1 SVN: at Mon Aug 17 22:58:25 EDT 2009 |