#include <mrpt/config.h>#include <mrpt/base/link_pragmas.h>#include <mrpt/utils/types.h>#include <cmath>#include <cstdlib>#include <algorithm>

Go to the source code of this file.
Namespaces | |
| namespace | mrpt |
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries. | |
| namespace | mrpt::utils |
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL. | |
| namespace | mrpt::poses |
Classes for 2D/3D geometry representation, both of single values and probability density distributions (PDFs) in many forms. | |
| namespace | mrpt::math |
This base provides a set of functions for maths stuff. | |
| namespace | mrpt::math::detail |
Defines | |
| #define | DECLARE_COMMON_CONTAINERS_MEMBERS(NUMTYPE) |
| #define | DECLARE_COMMON_MATRIX_MEMBERS(NUMTYPE) |
Enumerations | |
| enum | mrpt::math::TMatrixTextFileFormat { mrpt::math::MATRIX_FORMAT_ENG = 0, mrpt::math::MATRIX_FORMAT_FIXED = 1, mrpt::math::MATRIX_FORMAT_INT = 2 } |
| enum | mrpt::math::TConstructorFlags_Matrices { mrpt::math::UNINITIALIZED_MATRIX = 0 } |
For usage in one of the constructors of CMatrixFixedNumeric or CMatrixTemplate (and derived classes), if it's not required to fill it with zeros at the constructor to save time. More... | |
Functions | |
| template<class T > | |
| T | mrpt::utils::square (const T x) |
| Inline function for the square of a number. | |
| 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 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 MATRIX2 , class MATRIXRES > | |
| void | mrpt::math::detail::multiply_AB (const MATRIX1 &m1, const MATRIX2 &m2, MATRIXRES &RESULT) |
| Multiply 2 matrices: RESULT = A * B. | |
| 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<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 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<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<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_AtB (const MAT_A &A, const MAT_B &B, MAT_OUT &out) |
| template<class MAT_A , class MAT_OUT > | |
| void | mrpt::math::detail::multiply_AAt (const MAT_A &A, 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<typename MAT_IN , typename MAT_OUT > | |
| void | mrpt::math::detail::multiply_AAt_scalar (const MAT_IN &in, typename MAT_IN::value_type scalar, MAT_OUT &out) |
| OUT=IN * IN^t * scalar. | |
| template<typename MAT_IN , typename MAT_OUT > | |
| void | mrpt::math::detail::multiply_AtA_scalar (const MAT_IN &in, typename MAT_IN::value_type scalar, MAT_OUT &out) |
| OUT=IN^t * IN * scalar. | |
| template<typename MatrixType > | |
| size_t | mrpt::math::detail::rank (const MatrixType &m, typename MatrixType::value_type eps=1e-7) |
| template<> | |
| void | mrpt::math::detail::eigenVectorsMatrix< CMatrixFixedNumeric< float, 2, 2 >, CMatrixFixedNumeric< float, 2, 2 >, CArrayNumeric< float, 2 > > (const CMatrixFixedNumeric< float, 2, 2 > &M, CMatrixFixedNumeric< float, 2, 2 > *eVecs, CArrayNumeric< float, 2 > &eVals) |
| template<> | |
| void | mrpt::math::detail::eigenVectorsMatrix< CMatrixFixedNumeric< double, 2, 2 >, CMatrixFixedNumeric< double, 2, 2 >, CArrayNumeric< double, 2 > > (const CMatrixFixedNumeric< double, 2, 2 > &M, CMatrixFixedNumeric< double, 2, 2 > *eVecs, CArrayNumeric< double, 2 > &eVals) |
| 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<typename T , size_t NROWS, size_t NCOLS> | |
| void | mrpt::math::detail::fixedToDynMatrix (const CMatrixFixedNumeric< T, NROWS, NCOLS > &SRC, CMatrixTemplateNumeric< T > &DST) |
| 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 MAT1 , class MAT2 > | |
| void | mrpt::math::detail::insertMatrixTransposeInto (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 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 MATRIX > | |
| int | mrpt::math::detail::matrix_pivot (MATRIX &M, const size_t row) |
| Matrix pivoting - used for detMatrix, etc. | |
| 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) |
| template<class MATRIX > | |
| bool | mrpt::math::detail::isMatrixTypeResizable (const MATRIX &) |
| template<class CONTAINER > | |
| void | mrpt::math::detail::loadFromTextFileAsVector (CONTAINER &M, const std::string &file) |
| template<class CONTAINER > | |
| void | mrpt::math::detail::saveToTextFileAsVector (const CONTAINER &M, const std::string &file, mrpt::math::TMatrixTextFileFormat fileFormat, bool asColumnVector) |
| TPoint2D BASE_IMPEXP | mrpt::math::detail::lightFromPose (const mrpt::poses::CPoint2D &p) |
| Convert a pose into a light-weight structure (functional form, needed for forward declarations). | |
| TPoint3D BASE_IMPEXP | mrpt::math::detail::lightFromPose (const mrpt::poses::CPoint3D &p) |
| Convert a pose into a light-weight structure (functional form, needed for forward declarations). | |
| TPose2D BASE_IMPEXP | mrpt::math::detail::lightFromPose (const mrpt::poses::CPose2D &p) |
| Convert a pose into a light-weight structure (functional form, needed for forward declarations). | |
| TPose3D BASE_IMPEXP | mrpt::math::detail::lightFromPose (const mrpt::poses::CPose3D &p) |
| Convert a pose into a light-weight structure (functional form, needed for forward declarations). | |
| TPose3DQuat BASE_IMPEXP | mrpt::math::detail::lightFromPose (const mrpt::poses::CPose3DQuat &p) |
| Convert a pose into a light-weight structure (functional form, needed for forward declarations). | |
| template<class CONTAINER > | |
| size_t | mrpt::math::countNonZero (const CONTAINER &a) |
| template<class CONTAINER > | |
| CONTAINER::value_type | mrpt::math::maximum (const CONTAINER &v, size_t *maxIndex=NULL) |
| template<class CONTAINER > | |
| CONTAINER::value_type | mrpt::math::minimum (const CONTAINER &v, size_t *minIndex=NULL) |
| template<class CONTAINER > | |
| void | mrpt::math::minimum_maximum (const CONTAINER &v, typename CONTAINER::mrpt_autotype::value_type &out_min, typename CONTAINER::mrpt_autotype::value_type &out_max, size_t *minIndex=static_cast< size_t * >(NULL), size_t *maxIndex=static_cast< size_t * >(NULL)) |
| template<class CONTAINER > | |
| CONTAINER::value_type | mrpt::math::norm_inf (const CONTAINER &v, size_t *maxIndex=NULL) |
| template<class CONTAINER > | |
| CONTAINER::value_type | mrpt::math::squareNorm (const CONTAINER &v) |
| template<class CONTAINER > | |
| CONTAINER::value_type | mrpt::math::norm (const CONTAINER &v) |
| template<class CONTAINER > | |
| double | mrpt::math::mean (const CONTAINER &v) |
| template<class CONTAINER > | |
| CONTAINER::value_type | mrpt::math::sum (const CONTAINER &v) |
| template<class CONTAINER , typename RET > | |
| RET | mrpt::math::sumRetType (const CONTAINER &v) |
| template<class CONTAINER > | |
| void | mrpt::math::adjustRange (CONTAINER &m, const typename CONTAINER::value_type minVal, const typename CONTAINER::value_type maxVal) |
| template<class CONTAINER1 , class CONTAINER2 > | |
| void | mrpt::math::cumsum (const CONTAINER1 &in_data, CONTAINER2 &out_cumsum) |
| template<class CONTAINER1 , class CONTAINER2 > | |
| size_t | mrpt::math::countCommonElements (const CONTAINER1 &a, const CONTAINER2 &b) |
| template<class CONTAINER > | |
| std::vector< double > | mrpt::math::histogram (const CONTAINER &v, double limit_min, double limit_max, size_t number_bins, bool do_normalization=false, std::vector< double > *out_bin_centers=NULL) |
| template<class VECTORLIKE > | |
| double | mrpt::math::stddev (const VECTORLIKE &v, bool unbiased=true) |
| template<class VECTORLIKE > | |
| void | mrpt::math::meanAndStd (const VECTORLIKE &v, double &out_mean, double &out_std, bool unbiased=true) |
| template<class CONTAINER > | |
| CONTAINER & | mrpt::math::containerFromPoseOrPoint (CONTAINER &C, const TPoint2D &p) |
| Conversion of poses to MRPT containers (vector/matrix). | |
| template<class CONTAINER > | |
| CONTAINER & | mrpt::math::containerFromPoseOrPoint (CONTAINER &C, const TPoint3D &p) |
| template<class CONTAINER > | |
| CONTAINER & | mrpt::math::containerFromPoseOrPoint (CONTAINER &C, const TPose2D &p) |
| template<class CONTAINER > | |
| CONTAINER & | mrpt::math::containerFromPoseOrPoint (CONTAINER &C, const TPose3D &p) |
| template<class CONTAINER > | |
| CONTAINER & | mrpt::math::containerFromPoseOrPoint (CONTAINER &C, const TPose3DQuat &p) |
| template<class CONTAINER > | |
| CONTAINER & | mrpt::math::containerFromPoseOrPoint (CONTAINER &C, const mrpt::poses::CPoint2D &p) |
| template<class CONTAINER > | |
| CONTAINER & | mrpt::math::containerFromPoseOrPoint (CONTAINER &C, const mrpt::poses::CPoint3D &p) |
| template<class CONTAINER > | |
| CONTAINER & | mrpt::math::containerFromPoseOrPoint (CONTAINER &C, const mrpt::poses::CPose2D &p) |
| template<class CONTAINER > | |
| CONTAINER & | mrpt::math::containerFromPoseOrPoint (CONTAINER &C, const mrpt::poses::CPose3D &p) |
| template<class CONTAINER > | |
| CONTAINER & | mrpt::math::containerFromPoseOrPoint (CONTAINER &C, const mrpt::poses::CPose3DQuat &p) |
| template<class T > | |
| T | mrpt::math::wrapTo2Pi (T a) |
| Modifies the given angle to translate it into the [0,2pi[ range. | |
Matrix inverses - Implementation | |
| 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) |
| 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) |
Matrix determinants - implementation | |
| template<class MATRIX > | |
| mrpt::math::detail::RET_ELEMENT_ASSERT_MRPTCONTAINER (MATRIX) detMatrix(const MATRIX &M) | |
| 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) |
Matrix eigenvectors | |
| template<class MATRIX1 , class MATRIX2 , class VECTOR1 > | |
| void | mrpt::math::detail::eigenVectorsMatrix (const MATRIX1 &M, MATRIX2 *eVecs, VECTOR1 &eVals) |
| eigenVectorsMatrix | |
| template<class MATRIX1 , class MATRIX2 , class VECTOR1 > | |
| void | mrpt::math::detail::eigenVectorsMatrix_special_2x2 (const MATRIX1 &M, MATRIX2 *eVecs, VECTOR1 &eVals) |
Variables | |
| class BASE_IMPEXP | mrpt::utils::CStream |
| class BASE_IMPEXP | mrpt::math::CMatrixTemplateNumeric |
| class BASE_IMPEXP | mrpt::math::CMatrix |
| class BASE_IMPEXP | mrpt::math::CMatrixD |
Forward declarations of all mrpt::math classes related to vectors, arrays and matrices. Many of the function implementations are in ops_matrices.h, others in ops_containers.h
Definition in file math_frwds.h.
| #define DECLARE_COMMON_CONTAINERS_MEMBERS | ( | NUMTYPE | ) |
Definition at line 103 of file math_frwds.h.
| #define DECLARE_COMMON_MATRIX_MEMBERS | ( | NUMTYPE | ) |
Definition at line 161 of file math_frwds.h.
| Page generated by Doxygen 1.7.1 for MRPT 0.9.1 SVN:exported at Fri Aug 6 10:31:35 UTC 2010 |