This file implements miscelaneous matrix and matrix/vector operations, plus internal functions in mrpt::math::detail. More...
#include <mrpt/math/math_frwds.h>#include <mrpt/math/CMatrix.h>#include <mrpt/math/CMatrixD.h>#include <mrpt/utils/CStream.h>#include <mrpt/math/CMatrixTemplateNumeric.h>#include <mrpt/math/CMatrixFixedNumeric.h>#include <mrpt/math/CVectorTemplate.h>#include <mrpt/math/ops_containers.h>#include <mrpt/math/ops_matrices_eigen.h>#include <mrpt/math/matrices_metaprogramming.h>

Go to the source code of this file.
Classes | |
| class | mrpt::math::detail::VicinityTraits< CMatrixTemplate< T > > |
| Vicinity traits class specialization for matrices. More... | |
| class | mrpt::math::detail::VicinityTraits< std::vector< T > > |
| Vicinity traits class specialization for vectors. More... | |
| struct | mrpt::math::detail::getVicinity< MatrixType, T, ReturnType, 4 > |
| Template specialization for getVicinity. More... | |
| struct | mrpt::math::detail::getVicinity< MatrixType, T, ReturnType, 5 > |
| Template specialization for getVicinity. More... | |
| struct | mrpt::math::detail::getVicinity< MatrixType, T, ReturnType, 8 > |
| Template specialization for getVicinity. More... | |
| struct | mrpt::math::detail::getVicinity< MatrixType, T, ReturnType, 9 > |
| Template specialization for getVicinity. More... | |
| struct | mrpt::math::detail::getVicinity< MatrixType, T, ReturnType, 12 > |
| Template specialization for getVicinity. More... | |
| struct | mrpt::math::detail::getVicinity< MatrixType, T, ReturnType, 13 > |
| Template specialization for getVicinity. More... | |
| struct | mrpt::math::detail::getVicinity< MatrixType, T, ReturnType, 20 > |
| Template specialization for getVicinity. More... | |
| struct | mrpt::math::detail::getVicinity< MatrixType, T, ReturnType, 21 > |
| Template specialization for getVicinity. More... | |
| struct | mrpt::math::detail::getVicinity< MatrixType, T, ReturnType, 24 > |
| Template specialization for getVicinity. More... | |
| struct | mrpt::math::detail::getVicinity< MatrixType, T, ReturnType, 25 > |
| Template specialization for getVicinity. More... | |
Namespaces | |
| namespace | mrpt |
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries. | |
| namespace | mrpt::math |
This base provides a set of functions for maths stuff. | |
| namespace | mrpt::math::detail |
Defines | |
| #define | SAVE_MATRIX(M) M.saveToTextFile(mrpt::format("%s.txt",#M)); |
| A useful macro for saving matrixes to a file while debugging. | |
Functions | |
| template<size_t NROWS, size_t NCOLS> | |
| mrpt::utils::CStream & | mrpt::math::operator>> (mrpt::utils::CStream &in, CMatrixFixedNumeric< float, NROWS, NCOLS > &M) |
| Read operator from a CStream. | |
| template<size_t NROWS, size_t NCOLS> | |
| mrpt::utils::CStream & | mrpt::math::operator>> (mrpt::utils::CStream &in, CMatrixFixedNumeric< double, NROWS, NCOLS > &M) |
| Read operator from a CStream. | |
| template<size_t NROWS, size_t NCOLS> | |
| mrpt::utils::CStream & | mrpt::math::operator<< (mrpt::utils::CStream &out, const CMatrixFixedNumeric< float, NROWS, NCOLS > &M) |
| Write operator for writing into a CStream. | |
| template<size_t NROWS, size_t NCOLS> | |
| mrpt::utils::CStream & | mrpt::math::operator<< (mrpt::utils::CStream &out, const CMatrixFixedNumeric< double, NROWS, NCOLS > &M) |
| Write operator for writing into a CStream. | |
| template<class T , size_t NROWS, size_t NCOLS> | |
| bool | mrpt::math::operator== (const CMatrixFixedNumeric< T, NROWS, NCOLS > &M1, const CMatrixFixedNumeric< T, NROWS, NCOLS > &M2) |
| Equal comparison (==). | |
| template<class MATRIX > | |
| mrpt::math::RET_TYPE_ASSERT_MRPTMATRIX (MATRIX, std::ostream)&operator<< (std | |
| Textual output stream function. | |
| template<class MATRIX1 , class MATRIX2 > | |
| bool | mrpt::math::detail::chol (const MATRIX1 &in, MATRIX2 &out) |
| Cholesky factorization: in = out' · out (Upper triangular version: M=U'*U ) Given a positive-definite symmetric matrix, this routine constructs its Cholesky decomposition. | |
| template<class MAT > | |
| void | mrpt::math::detail::saveMatrixToTextFile (const MAT &theMatrix, const std::string &file, TMatrixTextFileFormat fileFormat, bool appendMRPTHeader, const std::string &userHeader) |
| Save matrix to a text file, compatible with MATLAB text format (see also the methods of matrix classes themselves). | |
| template<class MATRIX > | |
| std::string | mrpt::math::detail::matrix_inMatlabFormat (const MATRIX &m, const size_t decimal_digits) |
| Dump matrix in matlab format. | |
| template<class MATRIX1 > | |
| MATRIX1::value_type | mrpt::math::detail::trace (const MATRIX1 &m) |
| The trace of a matrix (the sum of its diagonal). | |
| template<class MATRIX1 , class OTHERVECTOR1 , class OTHERVECTOR2 > | |
| void | mrpt::math::detail::multiply_Ab (const MATRIX1 &m, const OTHERVECTOR1 &vIn, OTHERVECTOR2 &vOut, bool accumToOutput) |
| Computes the vector v = A * a, where "a" is a column vector of the appropriate length. | |
| template<class MATRIX1 , class OTHERVECTOR1 , class OTHERVECTOR2 > | |
| void | mrpt::math::detail::multiply_Atb (const MATRIX1 &m, const OTHERVECTOR1 &vIn, OTHERVECTOR2 &vOut, bool accumToOutput) |
| Computes the vector v = AT * a, where "a" is a column vector of the appropriate length. | |
| template<class MATRIX1 , class MATRIX2 > | |
| void | mrpt::math::detail::multiply_AAt (const MATRIX1 &m1, MATRIX2 &RESULT) |
| RESULT = A * A^t. | |
| template<class MATRIX1 , class MATRIX2 > | |
| void | mrpt::math::detail::multiply_AtA (const MATRIX1 &m1, MATRIX2 &RESULT) |
| RESULT = A^t * A. | |
| template<class MATRIX1 , class MATRIX2 , class MATRIXRES > | |
| void | mrpt::math::detail::multiply_AB (const MATRIX1 &m1, const MATRIX2 &m2, MATRIXRES &RESULT) |
| Multiply 2 matrices: RESULT = A * B. | |
| template<typename MAT_H , typename MAT_C , typename MAT_R > | |
| void | mrpt::math::detail::multiply_HCHt (const MAT_H &H, const MAT_C &C, MAT_R &R, bool accumResultInOutput, bool allow_submatrix_mult) |
| R = H * C * H^t (with C symmetric). | |
| template<typename VECTOR_H , typename MAT_C > | |
| MAT_C::value_type | mrpt::math::detail::multiply_HCHt_scalar (const VECTOR_H &H, const MAT_C &C) |
| r (a scalar) = H * C * H^t (with a vector H and a symmetric matrix C) | |
| template<typename MAT_H , typename MAT_C , typename MAT_R > | |
| void | mrpt::math::detail::multiply_HtCH (const MAT_H &H, const MAT_C &C, MAT_R &R, bool accumResultInOutput, bool allow_submatrix_mult) |
| R = H^t * C * H (with C symmetric). | |
| template<class MAT_X , class MAT_A , class MAT_OUT > | |
| void | mrpt::math::detail::multiply_subMatrix (const MAT_X &X, const MAT_A &A, MAT_OUT &outResult, const size_t A_cols_offset, const size_t A_rows_offset, const size_t A_col_count) |
| Matrix multiplication of this matrix with a submatrix of 'A', saving the result in a third matrix. | |
| template<class MAT_A , class MAT_B , class MAT_C , class MAT_OUT > | |
| void | mrpt::math::detail::multiply_ABC (const MAT_A &A, const MAT_B &B, const MAT_C &C, MAT_OUT &RES) |
| RES = A*B*C. | |
| template<class MAT_A , class MAT_B , class MAT_C , class MAT_OUT > | |
| void | mrpt::math::detail::multiply_ABCt (const MAT_A &A, const MAT_B &B, const MAT_C &C, MAT_OUT &RES) |
| RES = A*B*(C^t). | |
| template<class MAT_A , class MAT_B , class MAT_OUT > | |
| void | mrpt::math::detail::multiply_ABt (const MAT_A &A, const MAT_B &B, MAT_OUT &out) |
| template<class MAT_A , class MAT_B , class MAT_OUT > | |
| void | mrpt::math::detail::multiply_result_is_symmetric (const MAT_A &A, const MAT_B &B, MAT_OUT &out) |
| template<class MAT1 , class MAT2 > | |
| void | mrpt::math::detail::insertMatrixTransposeInto (MAT1 &M, const size_t nRow, const size_t nCol, const MAT2 &in) |
| template<class MAT1 , class MAT2 > | |
| void | mrpt::math::detail::insertMatrixInto (MAT1 &M, const size_t nRow, const size_t nCol, const MAT2 &in) |
| template<class MATORG , class MATDEST > | |
| void | mrpt::math::detail::extractMatrix (const MATORG &M, const size_t first_row, const size_t first_col, MATDEST &outMat) |
| Extract a submatrix - The output matrix must be set to the required size before call. | |
| template<class MATRIX > | |
| int | mrpt::math::detail::matrix_pivot (MATRIX &M, const size_t row) |
| Matrix pivoting - used for detMatrix, etc. | |
| template<class MAT , class VEC > | |
| void | mrpt::math::detail::extractRowFromMatrix (const MAT &m, size_t nRow, VEC &out, const size_t startingCol) |
| template<class MAT , class VEC > | |
| void | mrpt::math::detail::extractColFromMatrix (const MAT &m, size_t nCol, VEC &out, const size_t startingRow) |
| template<class MAT , class VEC > | |
| void | mrpt::math::detail::insertRowToMatrix (MAT &m, size_t nRow, const VEC &in, const size_t startingCol) |
| template<class MAT , class VEC > | |
| void | mrpt::math::detail::insertColToMatrix (MAT &m, size_t nCol, const VEC &in, const size_t startingRow) |
| template<class MAT1 , class MAT2 > | |
| MAT1::value_type | mrpt::math::multiply_HCHt_scalar (const MAT1 &H, const MAT2 &C) |
| Just like s=H.multiply_HCHt_scalar(C), but defined in mrpt::math for backward compatibility. | |
| template<class T > | |
| CMatrixTemplateNumeric< T > | mrpt::math::operator/ (const CMatrixTemplateNumeric< T > &m1, const CMatrixTemplateNumeric< T > &m2) |
| Binary matrix division operator A/B = A*inv(B). | |
| template<class T > | |
| CMatrixTemplateNumeric< T > | mrpt::math::operator^ (const CMatrixTemplateNumeric< T > &m, const unsigned int pow) |
| binary power operator | |
| template<class MAT > | |
| mrpt::math::MAT_TYPE_TRANSPOSE_OF (MAT) operator~(const MAT &m) | |
| unary transpose operator ~ | |
| template<class MATRIX > | |
| mrpt::math::RET_MAT_ASSERT_MRPTMATRIX (MATRIX) operator!(const MATRIX &m) | |
| Unary inversion operator. | |
| template<class MAT1 , class MAT2 > | |
| mrpt::math::MAT_TYPE_PRODUCT_OF (MAT1, MAT2) operator*(const MAT1 &A | |
Matrix multiplication operator: A * B -> RES The meaning of the lengthy macros in the declaration is:
| |
| class MAT_OUT void | mrpt::math::meanAndCov (const MAT_IN &v, vector_double &out_mean, MAT_OUT &out_cov) |
| template<class MATRIX > | |
| mrpt::math::MAT_TYPE_COVARIANCE_OF (MATRIX) cov(const MATRIX &v) | |
| Computes the covariance matrix from a list of samples in an NxM matrix, where each row is a sample, so the covariance is MxM. | |
| template<typename MatrixType > | |
| size_t | mrpt::math::detail::rank (const MatrixType &m, typename MatrixType::value_type eps=1e-7) |
| template<typename JA > | |
| void | mrpt::math::detail::pivotUntilIdentity (JointAccessor< JA > &joint) |
| template<typename MAT1 , typename MAT2 , typename MAT3 > | |
| void | mrpt::math::detail::leftDivideSquare (const MAT1 &C, const MAT2 &A, MAT3 &RES) |
| template<typename MAT1 , typename MAT2 , typename MAT3 > | |
| void | mrpt::math::detail::rightDivideSquare (const MAT1 &C, const MAT2 &B, MAT3 &RES) |
| template<typename MAT1 , typename MAT2 > | |
| void | mrpt::math::detail::fastLeftDivideSquare (MAT1 &inout_CB, MAT2 &willBeDestroyed_A) |
| template<typename MAT1 , typename MAT2 > | |
| void | mrpt::math::detail::fastRightDivideSquare (MAT1 &inout_CA, MAT2 &willBeDestroyed_B) |
Matrix inverses - Implementation | |
| template<class MATRIXIN , class MATRIXOUT > | |
| void | mrpt::math::detail::invMatrix_special_2x2 (const MATRIXIN &M, MATRIXOUT &out_inv) |
| template<class MATRIXIN , class MATRIXOUT > | |
| void | mrpt::math::detail::invMatrix_special_3x3 (const MATRIXIN &M, MATRIXOUT &out_inv) |
| template<> | |
| void | mrpt::math::detail::invMatrix< CMatrixFixedNumeric< float, 2, 2 >, CMatrixFixedNumeric< float, 2, 2 > > (const CMatrixFixedNumeric< float, 2, 2 > &M, CMatrixFixedNumeric< float, 2, 2 > &out_inv) |
| template<> | |
| void | mrpt::math::detail::invMatrix_destroySrc< CMatrixFixedNumeric< float, 2, 2 >, CMatrixFixedNumeric< float, 2, 2 > > (CMatrixFixedNumeric< float, 2, 2 > &M, CMatrixFixedNumeric< float, 2, 2 > &out_inv) |
| template<> | |
| void | mrpt::math::detail::invMatrix< CMatrixFixedNumeric< double, 2, 2 >, CMatrixFixedNumeric< double, 2, 2 > > (const CMatrixFixedNumeric< double, 2, 2 > &M, CMatrixFixedNumeric< double, 2, 2 > &out_inv) |
| template<> | |
| void | mrpt::math::detail::invMatrix_destroySrc< CMatrixFixedNumeric< double, 2, 2 >, CMatrixFixedNumeric< double, 2, 2 > > (CMatrixFixedNumeric< double, 2, 2 > &M, CMatrixFixedNumeric< double, 2, 2 > &out_inv) |
| template<> | |
| void | mrpt::math::detail::invMatrix< CMatrixFixedNumeric< float, 3, 3 >, CMatrixFixedNumeric< float, 3, 3 > > (const CMatrixFixedNumeric< float, 3, 3 > &M, CMatrixFixedNumeric< float, 3, 3 > &out_inv) |
| template<> | |
| void | mrpt::math::detail::invMatrix_destroySrc< CMatrixFixedNumeric< float, 3, 3 >, CMatrixFixedNumeric< float, 3, 3 > > (CMatrixFixedNumeric< float, 3, 3 > &M, CMatrixFixedNumeric< float, 3, 3 > &out_inv) |
| template<> | |
| void | mrpt::math::detail::invMatrix< CMatrixFixedNumeric< double, 3, 3 >, CMatrixFixedNumeric< double, 3, 3 > > (const CMatrixFixedNumeric< double, 3, 3 > &M, CMatrixFixedNumeric< double, 3, 3 > &out_inv) |
| template<> | |
| void | mrpt::math::detail::invMatrix_destroySrc< CMatrixFixedNumeric< double, 3, 3 >, CMatrixFixedNumeric< double, 3, 3 > > (CMatrixFixedNumeric< double, 3, 3 > &M, CMatrixFixedNumeric< double, 3, 3 > &out_inv) |
| template<class MATRIXIN , class MATRIXOUT > | |
| void | mrpt::math::detail::invMatrix (const MATRIXIN &M, MATRIXOUT &out_inv) |
| template<class MATRIXIN , class MATRIXOUT > | |
| void | mrpt::math::detail::invMatrix_destroySrc (MATRIXIN &M, MATRIXOUT &out_inv) |
Matrix determinants - implementation | |
| template<class MATRIX > | |
| MATRIX::value_type | mrpt::math::detail::detMatrix_special_2x2 (const MATRIX &M) |
| template<class MATRIX > | |
| MATRIX::value_type | mrpt::math::detail::detMatrix_special_3x3 (const MATRIX &M) |
| template<class MATRIX > | |
| MATRIX::value_type | mrpt::math::detail::detMatrix_special_4x4 (const MATRIX &M) |
| template<> | |
| float | mrpt::math::detail::detMatrix< CMatrixFixedNumeric< float, 2, 2 > > (const CMatrixFixedNumeric< float, 2, 2 > &M) |
| template<> | |
| double | mrpt::math::detail::detMatrix< CMatrixFixedNumeric< double, 2, 2 > > (const CMatrixFixedNumeric< double, 2, 2 > &M) |
| template<> | |
| float | mrpt::math::detail::detMatrix< CMatrixFixedNumeric< float, 3, 3 > > (const CMatrixFixedNumeric< float, 3, 3 > &M) |
| template<> | |
| double | mrpt::math::detail::detMatrix< CMatrixFixedNumeric< double, 3, 3 > > (const CMatrixFixedNumeric< double, 3, 3 > &M) |
| template<> | |
| float | mrpt::math::detail::detMatrix< CMatrixFixedNumeric< float, 4, 4 > > (const CMatrixFixedNumeric< float, 4, 4 > &M) |
| template<> | |
| double | mrpt::math::detail::detMatrix< CMatrixFixedNumeric< double, 4, 4 > > (const CMatrixFixedNumeric< double, 4, 4 > &M) |
| template<class MATRIX > | |
| mrpt::math::detail::RET_ELEMENT_ASSERT_MRPTCONTAINER (MATRIX) detMatrix(const MATRIX &M) | |
This file implements miscelaneous matrix and matrix/vector operations, plus internal functions in mrpt::math::detail.
Definition in file ops_matrices.h.
| #define SAVE_MATRIX | ( | M | ) | M.saveToTextFile(mrpt::format("%s.txt",#M)); |
A useful macro for saving matrixes to a file while debugging.
Definition at line 1174 of file ops_matrices.h.
| Page generated by Doxygen 1.6.1 for MRPT 0.9.0 SVN: at Mon Jun 7 06:47:58 UTC 2010 |