#include <mrpt/math/CMatrixTemplate.h>
Public Member Functions | ||||
void | extractCol (size_t nCol, std::vector< T > &out, int startingRow=0) | |||
Returns a given column to a vector (without modifying the matrix)
| ||||
void | extractCol (size_t nCol, CMatrixTemplate< T > &out, int startingRow=0) | |||
Gets a given column to a vector (without modifying the matrix)
| ||||
template<class F > | ||||
void | extractRow (size_t nRow, std::vector< F > &out, size_t startingCol=0) | |||
Gets a given row to a vector (without modifying the matrix)
| ||||
template<class F > | ||||
void | extractRow (size_t nRow, CMatrixTemplate< F > &out, size_t startingCol=0) | |||
Gets a given row to a vector (without modifying the matrix)
| ||||
CMatrixTemplate (const CMatrixTemplate &m) | ||||
Constructors. | ||||
CMatrixTemplate (size_t row=3, size_t col=3) | ||||
template<typename V , size_t N> | ||||
CMatrixTemplate (size_t row, size_t col, V(&theArray)[N]) | ||||
Constructor from a given size and a C array. | ||||
virtual | ~CMatrixTemplate () | |||
Destructor. | ||||
CMatrixTemplate & | operator= (const CMatrixTemplate &m) | |||
Assignment operator from another matrix. | ||||
template<typename V , size_t N> | ||||
CMatrixTemplate & | operator= (V(&theArray)[N]) | |||
Assignment operator for initializing from a C array (The matrix must be set to the correct size before invoking this asignament). | ||||
size_t | getRowCount () const | |||
Number of rows in the matrix. | ||||
size_t | getColCount () const | |||
Number of columns in the matrix. | ||||
size_t | nr () const | |||
Number of rows in the matrix. | ||||
size_t | nc () const | |||
Number of columns in the matrix. | ||||
void | setSize (size_t row, size_t col) | |||
Changes the size of matrix, maintaining the previous contents. | ||||
bool | IsSquare () | |||
Check for type of matrix. | ||||
T & | operator() (size_t row, size_t col) | |||
Subscript operator to get/set individual elements. | ||||
T | operator() (size_t row, size_t col) const | |||
Subscript operator to get/set individual elements. | ||||
T & | operator() (size_t ith) | |||
Subscript operator to get/set an individual element from a row or column matrix. | ||||
T | operator() (size_t ith) const | |||
Subscript operator to get/set an individual element from a row or column matrix. | ||||
void | set_unsafe (size_t row, size_t col, const T &v) | |||
Fast but unsafe method to write a value in the matrix. | ||||
T | get_unsafe (size_t row, size_t col) const | |||
Fast but unsafe method to read a value from the matrix. | ||||
T * | get_unsafe_row (size_t row) const | |||
Fast but unsafe method to obtain a pointer to a given row of the matrix (Use only in time critical applications). | ||||
void | insertRow (size_t nRow, const std::vector< T > &in) | |||
Inserts a row from a vector, replacing the current contents of that row. | ||||
void | appendRow (const std::vector< T > &in) | |||
Appends a new row to the MxN matrix from a 1xN vector. | ||||
void | insertCol (size_t nCol, const std::vector< T > &in) | |||
Inserts a column from a vector, replacing the current contents of that column. | ||||
template<class R > | ||||
void | insertMatrix (size_t nRow, size_t nCol, const CMatrixTemplate< R > &in) | |||
Inserts a matrix into this matrix Notice that the matrix must "fit" into the existing size of this matrix. | ||||
void | insertMatrixTranspose (size_t nRow, size_t nCol, const CMatrixTemplate< T > &in) | |||
Inserts the transpose of a given matrix into this matrix Notice that the matrix must "fit" into the existing size of this matrix. | ||||
void | insertMatrix (size_t nRow, size_t nCol, const std::vector< T > &in) | |||
Inserts a matrix line (vector) into this matrix Notice that the matrix must "fit" into the existing size of this matrix. | ||||
void | joinMatrix (const CMatrixTemplate< T > &left_up, const CMatrixTemplate< T > &right_up, const CMatrixTemplate< T > &left_down, const CMatrixTemplate< T > &right_down) | |||
Inserts 4 matrixes corresponding to the "four corners" into this matrix. | ||||
void | fill (const T &val) | |||
Fill the matrix with a given value:. | ||||
Protected Member Functions | ||||
void | realloc (size_t row, size_t col, bool newElementsToZero=false) | |||
Internal use only: It realloc the memory for the 2D matrix, maintaining the previous contents if posible. | ||||
Protected Attributes | ||||
T ** | m_Val | |||
size_t | m_Rows | |||
size_t | m_Cols |
NOTES:
Definition at line 53 of file CMatrixTemplate.h.
mrpt::math::CMatrixTemplate< T >::CMatrixTemplate | ( | const CMatrixTemplate< T > & | m | ) | [inline] |
mrpt::math::CMatrixTemplate< T >::CMatrixTemplate | ( | size_t | row = 3 , |
|
size_t | col = 3 | |||
) | [inline] |
Definition at line 190 of file CMatrixTemplate.h.
mrpt::math::CMatrixTemplate< T >::CMatrixTemplate | ( | size_t | row, | |
size_t | col, | |||
V(&) | theArray[N] | |||
) | [inline] |
Constructor from a given size and a C array.
The array length must match cols x row.
const double numbers[] = { 1,2,3, 4,5,6 }; CMatrixDouble M(3,2, numbers);
Definition at line 204 of file CMatrixTemplate.h.
virtual mrpt::math::CMatrixTemplate< T >::~CMatrixTemplate | ( | ) | [inline, virtual] |
void mrpt::math::CMatrixTemplate< T >::appendRow | ( | const std::vector< T > & | in | ) | [inline] |
Appends a new row to the MxN matrix from a 1xN vector.
std::exception | On incorrect vector length. |
Definition at line 433 of file CMatrixTemplate.h.
void mrpt::math::CMatrixTemplate< T >::extractCol | ( | size_t | nCol, | |
CMatrixTemplate< T > & | out, | |||
int | startingRow = 0 | |||
) | [inline] |
Gets a given column to a vector (without modifying the matrix)
std::exception | On index out of bounds. |
Definition at line 132 of file CMatrixTemplate.h.
void mrpt::math::CMatrixTemplate< T >::extractCol | ( | size_t | nCol, | |
std::vector< T > & | out, | |||
int | startingRow = 0 | |||
) | [inline] |
Returns a given column to a vector (without modifying the matrix)
std::exception | On index out of bounds. |
Definition at line 114 of file CMatrixTemplate.h.
void mrpt::math::CMatrixTemplate< T >::extractRow | ( | size_t | nRow, | |
CMatrixTemplate< F > & | out, | |||
size_t | startingCol = 0 | |||
) | [inline] |
Gets a given row to a vector (without modifying the matrix)
std::exception | On index out of bounds. |
Definition at line 169 of file CMatrixTemplate.h.
void mrpt::math::CMatrixTemplate< T >::extractRow | ( | size_t | nRow, | |
std::vector< F > & | out, | |||
size_t | startingCol = 0 | |||
) | [inline] |
Gets a given row to a vector (without modifying the matrix)
std::exception | On index out of bounds. |
Definition at line 151 of file CMatrixTemplate.h.
void mrpt::math::CMatrixTemplate< T >::fill | ( | const T & | val | ) | [inline] |
T mrpt::math::CMatrixTemplate< T >::get_unsafe | ( | size_t | row, | |
size_t | col | |||
) | const [inline] |
Fast but unsafe method to read a value from the matrix.
Definition at line 402 of file CMatrixTemplate.h.
Referenced by mrpt::math::CMatrixTemplateNumeric< KFTYPE >::CMatrixTemplateNumeric(), mrpt::math::CMatrixTemplate< bool >::insertMatrix(), mrpt::math::CMatrixTemplate< bool >::insertMatrixTranspose(), and mrpt::math::CMatrix::operator=().
T* mrpt::math::CMatrixTemplate< T >::get_unsafe_row | ( | size_t | row | ) | const [inline] |
Fast but unsafe method to obtain a pointer to a given row of the matrix (Use only in time critical applications).
Definition at line 409 of file CMatrixTemplate.h.
size_t mrpt::math::CMatrixTemplate< T >::getColCount | ( | ) | const [inline] |
Number of columns in the matrix.
Definition at line 279 of file CMatrixTemplate.h.
Referenced by mrpt::math::CMatrixTemplateNumeric< KFTYPE >::CMatrixTemplateNumeric(), mrpt::math::CMatrixTemplate< bool >::joinMatrix(), mrpt::math::CMatrixTemplateObjects< T >::operator=(), mrpt::math::CMatrixD::operator=(), mrpt::math::CMatrix::operator=(), and mrpt::math::size().
size_t mrpt::math::CMatrixTemplate< T >::getRowCount | ( | ) | const [inline] |
Number of rows in the matrix.
Definition at line 271 of file CMatrixTemplate.h.
Referenced by mrpt::math::CMatrixTemplateNumeric< KFTYPE >::CMatrixTemplateNumeric(), mrpt::math::CMatrixTemplate< bool >::joinMatrix(), mrpt::math::CMatrixTemplateObjects< T >::operator=(), mrpt::math::CMatrixD::operator=(), mrpt::math::CMatrix::operator=(), and mrpt::math::size().
void mrpt::math::CMatrixTemplate< T >::insertCol | ( | size_t | nCol, | |
const std::vector< T > & | in | |||
) | [inline] |
Inserts a column from a vector, replacing the current contents of that column.
std::exception | On index out of bounds |
Definition at line 451 of file CMatrixTemplate.h.
void mrpt::math::CMatrixTemplate< T >::insertMatrix | ( | size_t | nRow, | |
size_t | nCol, | |||
const std::vector< T > & | in | |||
) | [inline] |
Inserts a matrix line (vector) into this matrix Notice that the matrix must "fit" into the existing size of this matrix.
std::exception | On index out of bounds |
Definition at line 514 of file CMatrixTemplate.h.
void mrpt::math::CMatrixTemplate< T >::insertMatrix | ( | size_t | nRow, | |
size_t | nCol, | |||
const CMatrixTemplate< R > & | in | |||
) | [inline] |
Inserts a matrix into this matrix Notice that the matrix must "fit" into the existing size of this matrix.
in | The submatrix to insert into 'this' matrix. | |
nRow | The row in 'this' matrix where the submatrix will be inserted (0:first). | |
nCol | The column in 'this' matrix where the submatrix will be inserted (0:first). |
std::exception | On index out of bounds |
Definition at line 471 of file CMatrixTemplate.h.
Referenced by mrpt::math::CMatrixTemplate< bool >::joinMatrix().
void mrpt::math::CMatrixTemplate< T >::insertMatrixTranspose | ( | size_t | nRow, | |
size_t | nCol, | |||
const CMatrixTemplate< T > & | in | |||
) | [inline] |
Inserts the transpose of a given matrix into this matrix Notice that the matrix must "fit" into the existing size of this matrix.
in | The submatrix to insert into 'this' matrix. | |
nRow | The row in 'this' matrix where the submatrix will be inserted (0:first). | |
nCol | The column in 'this' matrix where the submatrix will be inserted (0:first). |
std::exception | On index out of bounds |
Definition at line 493 of file CMatrixTemplate.h.
void mrpt::math::CMatrixTemplate< T >::insertRow | ( | size_t | nRow, | |
const std::vector< T > & | in | |||
) | [inline] |
Inserts a row from a vector, replacing the current contents of that row.
std::exception | On index out of bounds |
Definition at line 418 of file CMatrixTemplate.h.
bool mrpt::math::CMatrixTemplate< T >::IsSquare | ( | ) | [inline] |
void mrpt::math::CMatrixTemplate< T >::joinMatrix | ( | const CMatrixTemplate< T > & | left_up, | |
const CMatrixTemplate< T > & | right_up, | |||
const CMatrixTemplate< T > & | left_down, | |||
const CMatrixTemplate< T > & | right_down | |||
) | [inline] |
Inserts 4 matrixes corresponding to the "four corners" into this matrix.
std::exception | On index out of bounds |
Definition at line 530 of file CMatrixTemplate.h.
size_t mrpt::math::CMatrixTemplate< T >::nc | ( | ) | const [inline] |
Number of columns in the matrix.
Definition at line 295 of file CMatrixTemplate.h.
size_t mrpt::math::CMatrixTemplate< T >::nr | ( | ) | const [inline] |
Number of rows in the matrix.
Definition at line 287 of file CMatrixTemplate.h.
T mrpt::math::CMatrixTemplate< T >::operator() | ( | size_t | ith | ) | const [inline] |
Subscript operator to get/set an individual element from a row or column matrix.
std::exception | If the object is not a column or row matrix. |
Definition at line 368 of file CMatrixTemplate.h.
T& mrpt::math::CMatrixTemplate< T >::operator() | ( | size_t | ith | ) | [inline] |
Subscript operator to get/set an individual element from a row or column matrix.
std::exception | If the object is not a column or row matrix. |
Definition at line 340 of file CMatrixTemplate.h.
T mrpt::math::CMatrixTemplate< T >::operator() | ( | size_t | row, | |
size_t | col | |||
) | const [inline] |
Subscript operator to get/set individual elements.
Definition at line 328 of file CMatrixTemplate.h.
T& mrpt::math::CMatrixTemplate< T >::operator() | ( | size_t | row, | |
size_t | col | |||
) | [inline] |
Subscript operator to get/set individual elements.
Definition at line 317 of file CMatrixTemplate.h.
CMatrixTemplate& mrpt::math::CMatrixTemplate< T >::operator= | ( | V(&) | theArray[N] | ) | [inline] |
Assignment operator for initializing from a C array (The matrix must be set to the correct size before invoking this asignament).
CMatrixDouble M(3,2); const double numbers[] = { 1,2,3, 4,5,6 }; M = numbers;
Reimplemented in mrpt::math::CMatrixTemplateNumeric< T >, mrpt::math::CMatrixTemplateNumeric< double >, mrpt::math::CMatrixTemplateNumeric< float >, and mrpt::math::CMatrixTemplateNumeric< KFTYPE >.
Definition at line 251 of file CMatrixTemplate.h.
CMatrixTemplate& mrpt::math::CMatrixTemplate< T >::operator= | ( | const CMatrixTemplate< T > & | m | ) | [inline] |
void mrpt::math::CMatrixTemplate< T >::realloc | ( | size_t | row, | |
size_t | col, | |||
bool | newElementsToZero = false | |||
) | [inline, protected] |
Internal use only: It realloc the memory for the 2D matrix, maintaining the previous contents if posible.
Definition at line 61 of file CMatrixTemplate.h.
Referenced by mrpt::math::CMatrixTemplate< bool >::appendRow(), mrpt::math::CMatrixTemplate< bool >::CMatrixTemplate(), mrpt::math::CMatrixTemplate< bool >::operator=(), mrpt::math::CMatrixTemplate< bool >::realloc(), mrpt::math::CMatrixTemplate< bool >::setSize(), and mrpt::math::CMatrixTemplate< bool >::~CMatrixTemplate().
void mrpt::math::CMatrixTemplate< T >::set_unsafe | ( | size_t | row, | |
size_t | col, | |||
const T & | v | |||
) | [inline] |
Fast but unsafe method to write a value in the matrix.
Definition at line 395 of file CMatrixTemplate.h.
Referenced by mrpt::math::CMatrixTemplate< bool >::insertMatrix(), and mrpt::math::CMatrixTemplate< bool >::insertMatrixTranspose().
void mrpt::math::CMatrixTemplate< T >::setSize | ( | size_t | row, | |
size_t | col | |||
) | [inline] |
Changes the size of matrix, maintaining the previous contents.
Reimplemented in mrpt::math::CMatrixTemplateNumeric< T >, mrpt::math::CMatrixTemplateObjects< T >, mrpt::math::CMatrixTemplateNumeric< double >, mrpt::math::CMatrixTemplateNumeric< float >, and mrpt::math::CMatrixTemplateNumeric< KFTYPE >.
Definition at line 303 of file CMatrixTemplate.h.
Referenced by mrpt::math::CMatrixTemplate< bool >::extractCol(), mrpt::math::CMatrixTemplate< bool >::extractRow(), mrpt::poses::CPose2DGridTemplate< double >::getAsMatrix(), and mrpt::math::CMatrixTemplate< bool >::joinMatrix().
size_t mrpt::math::CMatrixTemplate< T >::m_Cols [protected] |
Definition at line 57 of file CMatrixTemplate.h.
Referenced by mrpt::math::CMatrixTemplate< bool >::appendRow(), mrpt::math::CMatrixTemplate< bool >::CMatrixTemplate(), mrpt::math::CMatrixTemplate< bool >::extractCol(), mrpt::math::CMatrixTemplate< bool >::extractRow(), mrpt::math::CMatrixTemplate< bool >::fill(), mrpt::math::CMatrixTemplate< bool >::getColCount(), mrpt::math::CMatrixTemplate< bool >::insertCol(), mrpt::math::CMatrixTemplate< bool >::insertMatrix(), mrpt::math::CMatrixTemplate< bool >::insertMatrixTranspose(), mrpt::math::CMatrixTemplate< bool >::insertRow(), mrpt::math::CMatrixTemplate< bool >::IsSquare(), mrpt::math::CMatrixTemplate< bool >::nc(), mrpt::math::CMatrixTemplate< bool >::operator()(), mrpt::math::CMatrixTemplate< bool >::operator=(), and mrpt::math::CMatrixTemplate< bool >::realloc().
size_t mrpt::math::CMatrixTemplate< T >::m_Rows [protected] |
Definition at line 57 of file CMatrixTemplate.h.
Referenced by mrpt::math::CMatrixTemplate< bool >::appendRow(), mrpt::math::CMatrixTemplate< bool >::CMatrixTemplate(), mrpt::math::CMatrixTemplate< bool >::extractCol(), mrpt::math::CMatrixTemplate< bool >::extractRow(), mrpt::math::CMatrixTemplate< bool >::fill(), mrpt::math::CMatrixTemplate< bool >::getRowCount(), mrpt::math::CMatrixTemplate< bool >::insertCol(), mrpt::math::CMatrixTemplate< bool >::insertMatrix(), mrpt::math::CMatrixTemplate< bool >::insertMatrixTranspose(), mrpt::math::CMatrixTemplate< bool >::insertRow(), mrpt::math::CMatrixTemplate< bool >::IsSquare(), mrpt::math::CMatrixTemplate< bool >::nr(), mrpt::math::CMatrixTemplate< bool >::operator()(), mrpt::math::CMatrixTemplate< bool >::operator=(), and mrpt::math::CMatrixTemplate< bool >::realloc().
T** mrpt::math::CMatrixTemplate< T >::m_Val [protected] |
Definition at line 56 of file CMatrixTemplate.h.
Referenced by mrpt::math::CMatrixTemplate< bool >::appendRow(), mrpt::math::CMatrixTemplate< bool >::CMatrixTemplate(), mrpt::math::CMatrixTemplate< bool >::extractCol(), mrpt::math::CMatrixTemplate< bool >::extractRow(), mrpt::math::CMatrixTemplate< bool >::fill(), mrpt::math::CMatrixTemplate< bool >::get_unsafe(), mrpt::math::CMatrixTemplate< bool >::get_unsafe_row(), mrpt::math::CMatrixTemplate< bool >::insertCol(), mrpt::math::CMatrixTemplate< bool >::insertRow(), mrpt::math::CMatrixTemplate< bool >::operator()(), mrpt::math::CMatrixTemplateObjects< T >::operator=(), mrpt::math::CMatrixTemplate< bool >::operator=(), mrpt::math::CMatrixTemplate< bool >::realloc(), and mrpt::math::CMatrixTemplate< bool >::set_unsafe().
Page generated by Doxygen 1.5.8 for MRPT 0.6.5 SVN:exported at Mon Jan 12 13:00:16 UTC 2009 |