Main MRPT website > C++ reference
MRPT logo

mrpt::math::detail Namespace Reference

Classes

class  MatrixWrapper< U, true >
class  MatrixWrapper< U, false >
class  VicinityTraits< CMatrixFixedNumeric< T, D, D > >
 Vicinity traits class specialization for fixed size matrices. More...
class  VicinityTraits< CMatrixTemplateNumeric< T > >
 Vicinity traits class specialization for fixed size matrices. More...
class  AccessorIterator
 Template class for matrix accessor's iterators. More...
class  ReverseAccessorIterator
 Template class for matrix accessor's iterators. More...
struct  TMatrixProductType
 TMatrixProductType: Metaprogramming helper to determine the type of the product of two matrices, in compile time. More...
struct  TMatrixProductType< T, size_t(-1), size_t(-1), size_t(-1), size_t(-1)>
struct  TMatrixProductType< T, NR1, NC1, size_t(-1), size_t(-1)>
struct  TMatrixProductType< T, size_t(-1), size_t(-1), NR2, NC2 >
struct  TMatrixTransposeType
 TMatrixTransposeType: Metaprogramming helper to determine the type of the transpose of a matrix in compile time. More...
struct  TMatrixTransposeType< T, size_t(-1), size_t(-1)>
struct  TMatrixCovarianceType
 TMatrixCovarianceType: Metaprogramming helper to determine the type of the MxM covariance matrix of an NxM matrix with samples in each row, in compile time. More...
struct  TMatrixCovarianceType< T, size_t(-1), size_t(-1)>
struct  TMatrixJacobianType
 TMatrixJacobianType: Metaprogramming helper to determine the type of the MxN matrix from the types of two vector-like objects VECX (length N) and VECY (length M). More...
struct  TMatrixJacobianType< T, N1, size_t(-1)>
struct  TMatrixJacobianType< T, size_t(-1), N2 >
struct  TMatrixJacobianType< T, size_t(-1), size_t(-1)>
struct  TMatrixSameSizeOfType
 TMatrixSameSizeOfType: Metaprogramming helper to create a matrix of the same size that another type, in compile time. More...
struct  TMatrixSameSizeOfType< T, size_t(-1), size_t(-1)>
struct  TArrayOrVectorRowCountOfType
 TArrayOrVectorRowCountOfType: Metaprogramming helper to create a CArray or a std::vector<> with its size to the number of rows of a matrix, in compile time. More...
struct  TArrayOrVectorRowCountOfType< T, size_t(-1)>
struct  CGenericMatrixIterator
 A random-access iterator for trasversing all the elements of a matrix, left to right, top to bottom. More...
struct  CGenericMatrixConstIterator
 A random-access const iterator for trasversing all the elements of a matrix, left to right, top to bottom. More...
class  VicinityTraits< CMatrixTemplate< T > >
 Vicinity traits class specialization for matrices. More...
class  VicinityTraits< std::vector< T > >
 Vicinity traits class specialization for vectors. More...
struct  getVicinity< MatrixType, T, ReturnType, 4 >
 Template specialization for getVicinity. More...
struct  getVicinity< MatrixType, T, ReturnType, 5 >
 Template specialization for getVicinity. More...
struct  getVicinity< MatrixType, T, ReturnType, 8 >
 Template specialization for getVicinity. More...
struct  getVicinity< MatrixType, T, ReturnType, 9 >
 Template specialization for getVicinity. More...
struct  getVicinity< MatrixType, T, ReturnType, 12 >
 Template specialization for getVicinity. More...
struct  getVicinity< MatrixType, T, ReturnType, 13 >
 Template specialization for getVicinity. More...
struct  getVicinity< MatrixType, T, ReturnType, 20 >
 Template specialization for getVicinity. More...
struct  getVicinity< MatrixType, T, ReturnType, 21 >
 Template specialization for getVicinity. More...
struct  getVicinity< MatrixType, T, ReturnType, 24 >
 Template specialization for getVicinity. More...
struct  getVicinity< MatrixType, T, ReturnType, 25 >
 Template specialization for getVicinity. More...

Functions

template<typename T , typename U , bool UIsObject, typename FunctionType >
void applyFunction (CBinaryRelation< T, U, UIsObject > &o, FunctionType fun, size_t e1, size_t e2, const T &T1, const T &T2)
template<typename T , typename U , bool UIsObject>
void applyFunction (CBinaryRelation< T, U, UIsObject > &o, typename CBinaryRelation< T, U, UIsObject >::FunctionByReferencePass fun, size_t e1, size_t e2, const T &T1, const T &T2)
 Template specialization by reference type.
template<>
bool isMatrixTypeResizable< CMatrixFloat > (const CMatrixFloat &)
template<>
bool isMatrixTypeResizable< CMatrixDouble > (const CMatrixDouble &)
template<>
bool isMatrixTypeResizable< CMatrixLongDouble > (const CMatrixLongDouble &)
template<class T >
void noncentralChi2OneIteration (T arg, T &lans, T &dans, T &pans, unsigned int &j)
template<class T >
std::pair< double, double > noncentralChi2CDF_exact (unsigned int degreesOfFreedom, T noncentrality, T arg, T eps)
template<class MATRIX1 , class MATRIX2 >
bool 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 trace (const MATRIX1 &m)
 The trace of a matrix (the sum of its diagonal).
template<class MATRIX1 , class MATRIX2 , class MATRIXRES >
void multiply_AB (const MATRIX1 &m1, const MATRIX2 &m2, MATRIXRES &RESULT)
 Multiply 2 matrices: RESULT = A * B.
template<class MATRIX1 , class OTHERVECTOR1 , class OTHERVECTOR2 >
void 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 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 multiply_AAt (const MATRIX1 &m1, MATRIX2 &RESULT)
 RESULT = A * A^t.
template<class MATRIX1 , class MATRIX2 >
void multiply_AtA (const MATRIX1 &m1, MATRIX2 &RESULT)
 RESULT = A^t * A.
template<typename MAT_H , typename MAT_C , typename MAT_R >
void 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 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 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 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 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 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 multiply_ABt (const MAT_A &A, const MAT_B &B, MAT_OUT &out)
template<class MAT_A , class MAT_OUT >
void multiply_AAt (const MAT_A &A, MAT_OUT &out)
template<class MAT_A , class MAT_B , class MAT_OUT >
void multiply_result_is_symmetric (const MAT_A &A, const MAT_B &B, MAT_OUT &out)
template<typename MatrixType >
size_t rank (const MatrixType &m, typename MatrixType::value_type eps=1e-7)
template<>
void 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 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 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 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 fixedToDynMatrix (const CMatrixFixedNumeric< T, NROWS, NCOLS > &SRC, CMatrixTemplateNumeric< T > &DST)
template<class MAT1 , class MAT2 >
void insertMatrixInto (MAT1 &M, const size_t nRow, const size_t nCol, const MAT2 &in)
template<class MAT1 , class MAT2 >
void insertMatrixTransposeInto (MAT1 &M, const size_t nRow, const size_t nCol, const MAT2 &in)
template<class MATORG , class MATDEST >
void 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 extractRowFromMatrix (const MAT &m, size_t nRow, VEC &out, const size_t startingCol)
template<class MAT , class VEC >
void extractColFromMatrix (const MAT &m, size_t nCol, VEC &out, const size_t startingRow)
template<class MAT , class VEC >
void insertRowToMatrix (MAT &m, size_t nRow, const VEC &in, const size_t startingCol)
template<class MAT , class VEC >
void insertColToMatrix (MAT &m, size_t nCol, const VEC &in, const size_t startingRow)
template<class MATRIX >
int matrix_pivot (MATRIX &M, const size_t row)
 Matrix pivoting - used for detMatrix, etc.
template<typename MAT1 , typename MAT2 , typename MAT3 >
void leftDivideSquare (const MAT1 &C, const MAT2 &A, MAT3 &RES)
template<typename MAT1 , typename MAT2 , typename MAT3 >
void rightDivideSquare (const MAT1 &C, const MAT2 &B, MAT3 &RES)
template<typename MAT1 , typename MAT2 >
void fastLeftDivideSquare (MAT1 &inout_CB, MAT2 &willBeDestroyed_A)
template<typename MAT1 , typename MAT2 >
void fastRightDivideSquare (MAT1 &inout_CA, MAT2 &willBeDestroyed_B)
template<class MATRIX >
bool isMatrixTypeResizable (const MATRIX &)
TPoint2D BASE_IMPEXP lightFromPose (const mrpt::poses::CPoint2D &p)
 Convert a pose into a light-weight structure (functional form, needed for forward declarations).
TPoint3D BASE_IMPEXP lightFromPose (const mrpt::poses::CPoint3D &p)
 Convert a pose into a light-weight structure (functional form, needed for forward declarations).
TPose2D BASE_IMPEXP lightFromPose (const mrpt::poses::CPose2D &p)
 Convert a pose into a light-weight structure (functional form, needed for forward declarations).
TPose3D BASE_IMPEXP lightFromPose (const mrpt::poses::CPose3D &p)
 Convert a pose into a light-weight structure (functional form, needed for forward declarations).
TPose3DQuat BASE_IMPEXP lightFromPose (const mrpt::poses::CPose3DQuat &p)
 Convert a pose into a light-weight structure (functional form, needed for forward declarations).
template<typename JA >
void pivotUntilIdentity (JointAccessor< JA > &joint)
Matrix inverses - Implementation



template<class MATRIXIN , class MATRIXOUT >
void invMatrix (const MATRIXIN &M, MATRIXOUT &out_inv)
template<class MATRIXIN , class MATRIXOUT >
void invMatrix_destroySrc (MATRIXIN &M, MATRIXOUT &out_inv)
template<class MATRIXIN , class MATRIXOUT >
void invMatrix_special_2x2 (const MATRIXIN &M, MATRIXOUT &out_inv)
template<class MATRIXIN , class MATRIXOUT >
void invMatrix_special_3x3 (const MATRIXIN &M, MATRIXOUT &out_inv)
template<>
void invMatrix< CMatrixFixedNumeric< float, 2, 2 >, CMatrixFixedNumeric< float, 2, 2 > > (const CMatrixFixedNumeric< float, 2, 2 > &M, CMatrixFixedNumeric< float, 2, 2 > &out_inv)
template<>
void invMatrix_destroySrc< CMatrixFixedNumeric< float, 2, 2 >, CMatrixFixedNumeric< float, 2, 2 > > (CMatrixFixedNumeric< float, 2, 2 > &M, CMatrixFixedNumeric< float, 2, 2 > &out_inv)
template<>
void invMatrix< CMatrixFixedNumeric< double, 2, 2 >, CMatrixFixedNumeric< double, 2, 2 > > (const CMatrixFixedNumeric< double, 2, 2 > &M, CMatrixFixedNumeric< double, 2, 2 > &out_inv)
template<>
void invMatrix_destroySrc< CMatrixFixedNumeric< double, 2, 2 >, CMatrixFixedNumeric< double, 2, 2 > > (CMatrixFixedNumeric< double, 2, 2 > &M, CMatrixFixedNumeric< double, 2, 2 > &out_inv)
template<>
void invMatrix< CMatrixFixedNumeric< float, 3, 3 >, CMatrixFixedNumeric< float, 3, 3 > > (const CMatrixFixedNumeric< float, 3, 3 > &M, CMatrixFixedNumeric< float, 3, 3 > &out_inv)
template<>
void invMatrix_destroySrc< CMatrixFixedNumeric< float, 3, 3 >, CMatrixFixedNumeric< float, 3, 3 > > (CMatrixFixedNumeric< float, 3, 3 > &M, CMatrixFixedNumeric< float, 3, 3 > &out_inv)
template<>
void invMatrix< CMatrixFixedNumeric< double, 3, 3 >, CMatrixFixedNumeric< double, 3, 3 > > (const CMatrixFixedNumeric< double, 3, 3 > &M, CMatrixFixedNumeric< double, 3, 3 > &out_inv)
template<>
void invMatrix_destroySrc< CMatrixFixedNumeric< double, 3, 3 >, CMatrixFixedNumeric< double, 3, 3 > > (CMatrixFixedNumeric< double, 3, 3 > &M, CMatrixFixedNumeric< double, 3, 3 > &out_inv)
Matrix determinants - implementation



template<class MATRIX >
 RET_ELEMENT_ASSERT_MRPTCONTAINER (MATRIX) detMatrix(const MATRIX &M)
template<class MATRIX >
MATRIX::value_type detMatrix_special_2x2 (const MATRIX &M)
template<class MATRIX >
MATRIX::value_type detMatrix_special_3x3 (const MATRIX &M)
template<class MATRIX >
MATRIX::value_type detMatrix_special_4x4 (const MATRIX &M)
template<>
float detMatrix< CMatrixFixedNumeric< float, 2, 2 > > (const CMatrixFixedNumeric< float, 2, 2 > &M)
template<>
double detMatrix< CMatrixFixedNumeric< double, 2, 2 > > (const CMatrixFixedNumeric< double, 2, 2 > &M)
template<>
float detMatrix< CMatrixFixedNumeric< float, 3, 3 > > (const CMatrixFixedNumeric< float, 3, 3 > &M)
template<>
double detMatrix< CMatrixFixedNumeric< double, 3, 3 > > (const CMatrixFixedNumeric< double, 3, 3 > &M)
template<>
float detMatrix< CMatrixFixedNumeric< float, 4, 4 > > (const CMatrixFixedNumeric< float, 4, 4 > &M)
template<>
double detMatrix< CMatrixFixedNumeric< double, 4, 4 > > (const CMatrixFixedNumeric< double, 4, 4 > &M)
Matrix eigenvectors



template<class MATRIX1 , class MATRIX2 , class VECTOR1 >
void eigenVectorsMatrix (const MATRIX1 &M, MATRIX2 *eVecs, VECTOR1 &eVals)
 eigenVectorsMatrix
template<class MATRIX1 , class MATRIX2 , class VECTOR1 >
void eigenVectorsMatrix_special_2x2 (const MATRIX1 &M, MATRIX2 *eVecs, VECTOR1 &eVals)
template<class MAT , class ARR >
void tred2 (MAT &a, const size_t n, ARR &d, ARR &e)
 Householder reduction of a real, symmetric matrix a[1..n][1..n].
template<class MAT , class ARR >
void tqli (ARR &d, ARR &e, const size_t n, MAT &z)
 QL algorithm with implicit shifts, to determine the eigenvalues and eigenvectors of a real, symmetric, tridiagonal matrix, or of a real, symmetric matrix previously reduced by tred2 x11.2.
template<class T >
pythag (const T a, const T b)
template<class T >
SIGN (T a, T b)

Function Documentation

template<typename T , typename U , bool UIsObject>
void mrpt::math::detail::applyFunction ( CBinaryRelation< T, U, UIsObject > &  o,
typename CBinaryRelation< T, U, UIsObject >::FunctionByReferencePass  fun,
size_t  e1,
size_t  e2,
const T &  T1,
const T &  T2 
) [inline]

Template specialization by reference type.

Definition at line 462 of file CBinaryRelation.h.

References mrpt::math::CBinaryRelation< T, U, UIsObject >::getRelationValue().

template<typename T , typename U , bool UIsObject, typename FunctionType >
void mrpt::math::detail::applyFunction ( CBinaryRelation< T, U, UIsObject > &  o,
FunctionType  fun,
size_t  e1,
size_t  e2,
const T &  T1,
const T &  T2 
) [inline]
template<class MATRIX1 , class MATRIX2 >
bool mrpt::math::detail::chol ( const MATRIX1 &  in,
MATRIX2 &  out 
) [inline]

Cholesky factorization: in = out' · out (Upper triangular version: M=U'*U ) Given a positive-definite symmetric matrix, this routine constructs its Cholesky decomposition.

On input, only the upper triangle of "IN" need be given; it is not modified. The Cholesky factorization is returned in "out" in the upper triangle. (by AJOGD @ JAN-2007) Redone for efficiency (Pablo Moreno, Jan 2010).

Returns:
True on success, false on singular (i.e. det=0) or not positive semidefinite matrix
Exceptions:
logic_error On non-square matrix.
Note:
Complexity O(N^3)

Definition at line 134 of file ops_matrices.h.

References mrpt::utils::square(), and mrpt::math::sum().

template<>
double mrpt::math::detail::detMatrix< CMatrixFixedNumeric< double, 2, 2 > > ( const CMatrixFixedNumeric< double, 2, 2 > &  M  )  [inline]
template<>
double mrpt::math::detail::detMatrix< CMatrixFixedNumeric< double, 3, 3 > > ( const CMatrixFixedNumeric< double, 3, 3 > &  M  )  [inline]
template<>
double mrpt::math::detail::detMatrix< CMatrixFixedNumeric< double, 4, 4 > > ( const CMatrixFixedNumeric< double, 4, 4 > &  M  )  [inline]
template<>
float mrpt::math::detail::detMatrix< CMatrixFixedNumeric< float, 2, 2 > > ( const CMatrixFixedNumeric< float, 2, 2 > &  M  )  [inline]
template<>
float mrpt::math::detail::detMatrix< CMatrixFixedNumeric< float, 3, 3 > > ( const CMatrixFixedNumeric< float, 3, 3 > &  M  )  [inline]
template<>
float mrpt::math::detail::detMatrix< CMatrixFixedNumeric< float, 4, 4 > > ( const CMatrixFixedNumeric< float, 4, 4 > &  M  )  [inline]
template<class MATRIX >
MATRIX::value_type mrpt::math::detail::detMatrix_special_2x2 ( const MATRIX &  M  )  [inline]

Definition at line 897 of file ops_matrices.h.

Referenced by RET_ELEMENT_ASSERT_MRPTCONTAINER().

template<class MATRIX >
MATRIX::value_type mrpt::math::detail::detMatrix_special_3x3 ( const MATRIX &  M  )  [inline]

Definition at line 902 of file ops_matrices.h.

Referenced by RET_ELEMENT_ASSERT_MRPTCONTAINER().

template<class MATRIX >
MATRIX::value_type mrpt::math::detail::detMatrix_special_4x4 ( const MATRIX &  M  )  [inline]

Definition at line 909 of file ops_matrices.h.

template<class MATRIX1 , class MATRIX2 , class VECTOR1 >
void mrpt::math::detail::eigenVectorsMatrix ( const MATRIX1 &  M,
MATRIX2 *  eVecs,
VECTOR1 &  eVals 
) [inline]

eigenVectorsMatrix

Parameters:
eVecs if set to NULL, only compute eigenvalues

Definition at line 55 of file ops_matrices_eigen.h.

References ARRAY_TYPE_SAMESIZE_ROWS_OF, ASSERT_, ASSERTMSG_, mrpt::format(), MAT_TYPE_SAMESIZE_OF, MRPT_END_WITH_CLEAN_UP, MRPT_START, THROW_EXCEPTION, tqli(), and tred2().

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 
) [inline]
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 
) [inline]
template<class MATRIX1 , class MATRIX2 , class VECTOR1 >
void mrpt::math::detail::eigenVectorsMatrix_special_2x2 ( const MATRIX1 &  M,
MATRIX2 *  eVecs,
VECTOR1 &  eVals 
) [inline]

Definition at line 141 of file ops_matrices_eigen.h.

template<class MAT , class VEC >
void mrpt::math::detail::extractColFromMatrix ( const MAT &  m,
size_t  nCol,
VEC &  out,
const size_t  startingRow = 0 
) [inline]

Definition at line 1005 of file ops_matrices.h.

References mrpt::math::size(), and THROW_EXCEPTION.

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 
) [inline]

Extract a submatrix - The output matrix must be set to the required size before call.

Definition at line 764 of file ops_matrices.h.

References ASSERTMSG_.

template<class MAT , class VEC >
void mrpt::math::detail::extractRowFromMatrix ( const MAT &  m,
size_t  nRow,
VEC &  out,
const size_t  startingCol = 0 
) [inline]

Definition at line 992 of file ops_matrices.h.

References mrpt::math::size(), and THROW_EXCEPTION.

template<typename MAT1 , typename MAT2 >
void mrpt::math::detail::fastLeftDivideSquare ( MAT1 &  inout_CB,
MAT2 &  willBeDestroyed_A 
) [inline]

Matrix left divide: B=A-1·C. A must be a square matrix, which is destroyed. C is also destroyed, and assigned to the looked for quotient.

Definition at line 1483 of file ops_matrices.h.

References pivotUntilIdentity().

Referenced by invMatrix_destroySrc(), and leftDivideSquare().

template<typename MAT1 , typename MAT2 >
void mrpt::math::detail::fastRightDivideSquare ( MAT1 &  inout_CA,
MAT2 &  willBeDestroyed_B 
) [inline]

Matrix left divide: A=C·B-1. B must be a square matrix, which is destroyed. C is also destroyed, and assigned to the looked for quotient.

Definition at line 1490 of file ops_matrices.h.

References pivotUntilIdentity().

Referenced by rightDivideSquare().

template<typename T , size_t NROWS, size_t NCOLS>
void mrpt::math::detail::fixedToDynMatrix ( const CMatrixFixedNumeric< T, NROWS, NCOLS > &  SRC,
CMatrixTemplateNumeric< T > &  DST 
) [inline]
template<class MAT , class VEC >
void mrpt::math::detail::insertColToMatrix ( MAT &  m,
size_t  nCol,
const VEC &  in,
const size_t  startingRow = 0 
) [inline]

Definition at line 1031 of file ops_matrices.h.

References ASSERT_, mrpt::math::size(), and THROW_EXCEPTION.

template<class MAT1 , class MAT2 >
void mrpt::math::detail::insertMatrixInto ( MAT1 &  M,
const size_t  nRow,
const size_t  nCol,
const MAT2 &  in 
) [inline]

Definition at line 754 of file ops_matrices.h.

References ASSERTMSG_, and mrpt::math::size().

template<class MAT1 , class MAT2 >
void mrpt::math::detail::insertMatrixTransposeInto ( MAT1 &  M,
const size_t  nRow,
const size_t  nCol,
const MAT2 &  in 
) [inline]

Definition at line 744 of file ops_matrices.h.

References ASSERTMSG_, and mrpt::math::size().

template<class MAT , class VEC >
void mrpt::math::detail::insertRowToMatrix ( MAT &  m,
size_t  nRow,
const VEC &  in,
const size_t  startingCol = 0 
) [inline]

Definition at line 1018 of file ops_matrices.h.

References ASSERT_, mrpt::math::size(), and THROW_EXCEPTION.

template<class MATRIXIN , class MATRIXOUT >
void mrpt::math::detail::invMatrix ( const MATRIXIN &  M,
MATRIXOUT &  out_inv 
) [inline]

Definition at line 831 of file ops_matrices.h.

References invMatrix_destroySrc(), and MAT_TYPE_SAMESIZE_OF.

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 
) [inline]
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 
) [inline]
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 
) [inline]
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 
) [inline]
template<class MATRIXIN , class MATRIXOUT >
void mrpt::math::detail::invMatrix_destroySrc ( MATRIXIN &  M,
MATRIXOUT &  out_inv 
) [inline]
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 
) [inline]
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 
) [inline]
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 
) [inline]
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 
) [inline]
template<class MATRIXIN , class MATRIXOUT >
void mrpt::math::detail::invMatrix_special_2x2 ( const MATRIXIN &  M,
MATRIXOUT &  out_inv 
) [inline]

Definition at line 783 of file ops_matrices.h.

References ASSERTMSG_.

Referenced by invMatrix_destroySrc().

template<class MATRIXIN , class MATRIXOUT >
void mrpt::math::detail::invMatrix_special_3x3 ( const MATRIXIN &  M,
MATRIXOUT &  out_inv 
) [inline]

Definition at line 799 of file ops_matrices.h.

References ASSERTMSG_.

Referenced by invMatrix_destroySrc().

template<class MATRIX >
bool mrpt::math::detail::isMatrixTypeResizable ( const MATRIX &   )  [inline]

An auxiliary function, which return true only for CMatrixTemplate-derived classes

Definition at line 501 of file math_frwds.h.

template<>
bool mrpt::math::detail::isMatrixTypeResizable< CMatrixDouble > ( const CMatrixDouble &   )  [inline]
template<>
bool mrpt::math::detail::isMatrixTypeResizable< CMatrixFloat > ( const CMatrixFloat &   )  [inline]
template<>
bool mrpt::math::detail::isMatrixTypeResizable< CMatrixLongDouble > ( const CMatrixLongDouble &   )  [inline]
template<typename MAT1 , typename MAT2 , typename MAT3 >
void mrpt::math::detail::leftDivideSquare ( const MAT1 &  C,
const MAT2 &  A,
MAT3 &  RES 
) [inline]

Matrix left divide: RES = A-1 · C (A must be a square matrix).

See also:
rightDivideSquare,fastLeftDivideSquare

Definition at line 1467 of file ops_matrices.h.

References fastLeftDivideSquare(), and MAT_TYPE_SAMESIZE_OF.

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).

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).

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).

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).

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).

Referenced by mrpt::math::containerFromPoseOrPoint().

template<class MATRIX >
std::string mrpt::math::detail::matrix_inMatlabFormat ( const MATRIX &  m,
const size_t  decimal_digits 
) [inline]

Dump matrix in matlab format.

This template method can be instantiated for matrices of the types: int, long, unsinged int, unsigned long, float, double, long double

Definition at line 223 of file ops_matrices.h.

template<class MATRIX >
int mrpt::math::detail::matrix_pivot ( MATRIX &  M,
const size_t  row 
) [inline]

Matrix pivoting - used for detMatrix, etc.

Definition at line 970 of file ops_matrices.h.

template<class MAT_A , class MAT_OUT >
void mrpt::math::detail::multiply_AAt ( const MAT_A &  A,
MAT_OUT &  out 
) [inline]
template<class MATRIX1 , class MATRIX2 >
void mrpt::math::detail::multiply_AAt ( const MATRIX1 &  m1,
MATRIX2 &  RESULT 
) [inline]

RESULT = A * A^t.

Definition at line 286 of file ops_matrices.h.

template<class MATRIX1 , class OTHERVECTOR1 , class OTHERVECTOR2 >
void mrpt::math::detail::multiply_Ab ( const MATRIX1 &  m,
const OTHERVECTOR1 &  vIn,
OTHERVECTOR2 &  vOut,
bool  accumToOutput 
) [inline]

Computes the vector v = A * a, where "a" is a column vector of the appropriate length.

Definition at line 254 of file ops_matrices.h.

References ASSERT_, MRPT_END, and MRPT_START.

template<class MATRIX1 , class MATRIX2 , class MATRIXRES >
void mrpt::math::detail::multiply_AB ( const MATRIX1 &  m1,
const MATRIX2 &  m2,
MATRIXRES &  RESULT 
) [inline]

Multiply 2 matrices: RESULT = A * B.

Definition at line 382 of file ops_matrices.h.

References ASSERTMSG_, mrpt::format(), MRPT_END, and MRPT_START.

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 
) [inline]

RES = A*B*C.

See also:
multiply_ABCt

Definition at line 599 of file ops_matrices.h.

References ASSERT_.

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 
) [inline]

RES = A*B*(C^t).

See also:
multiply_ABC

Definition at line 621 of file ops_matrices.h.

References ASSERT_.

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 
) [inline]

Definition at line 642 of file ops_matrices.h.

References ASSERTMSG_, MRPT_END, and MRPT_START.

template<class MATRIX1 , class MATRIX2 >
void mrpt::math::detail::multiply_AtA ( const MATRIX1 &  m1,
MATRIX2 &  RESULT 
) [inline]

RESULT = A^t * A.

Definition at line 333 of file ops_matrices.h.

template<class MATRIX1 , class OTHERVECTOR1 , class OTHERVECTOR2 >
void mrpt::math::detail::multiply_Atb ( const MATRIX1 &  m,
const OTHERVECTOR1 &  vIn,
OTHERVECTOR2 &  vOut,
bool  accumToOutput 
) [inline]

Computes the vector v = AT * a, where "a" is a column vector of the appropriate length.

Definition at line 270 of file ops_matrices.h.

References ASSERT_, MRPT_END, and MRPT_START.

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 = false,
bool  allow_submatrix_mult = false 
) [inline]

R = H * C * H^t (with C symmetric).

This executes the operation $ \mathbf{R} = \mathbf{H} \mathbf{C} \mathbf{H}^t $, where 'this' matrix is $ \mathbf{H} $ and $ \mathbf{C} $ is symmetric, in an efficient and numerically stable way. If 'this' matrix is $ N \times M $, then $ \mathbf{C} $ must be $ M \times M $, and the result matrix $ R $ will be $ N \times N $. The result from this method is assured to be symmetric (if $ \mathbf{C} $ is symmetric), whereas executing:

                                 R = H * C * (~H);

may lead to non-symmetric matrixes due to numerical rounding errors. In addition, this method is more efficient that the code above (see the MRPT's code examples on matrixes). If accumResultInOutput=true, the contents of the output matrix will not be cleared, but added to the result of the operations. In this case it must have the correct size before calling or an exception will be raised.

See also:
multiply_HCHt_scalar

Definition at line 439 of file ops_matrices.h.

References ASSERT_, ASSERTMSG_, mrpt::math::MAT_TYPE_PRODUCT_OF(), MRPT_END, and MRPT_START.

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 
) [inline]

r (a scalar) = H * C * H^t (with a vector H and a symmetric matrix C)

Definition at line 491 of file ops_matrices.h.

References ASSERT_, MRPT_END, MRPT_START, and mrpt::math::size().

Referenced by mrpt::math::mahalanobisDistance2(), and mrpt::math::multiply_HCHt_scalar().

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 = false,
bool  allow_submatrix_mult = false 
) [inline]

R = H^t * C * H (with C symmetric).

Definition at line 518 of file ops_matrices.h.

References ASSERT_, ASSERTMSG_, MRPT_END, and MRPT_START.

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 
) [inline]

Definition at line 691 of file ops_matrices.h.

References ASSERTMSG_, MRPT_END, and MRPT_START.

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 
) [inline]

Matrix multiplication of this matrix with a submatrix of 'A', saving the result in a third matrix.

OUT = B * A

Definition at line 569 of file ops_matrices.h.

References ASSERT_, MRPT_END, and MRPT_START.

template<class T >
std::pair<double, double> mrpt::math::detail::noncentralChi2CDF_exact ( unsigned int  degreesOfFreedom,
noncentrality,
arg,
eps 
) [inline]
template<class T >
void mrpt::math::detail::noncentralChi2OneIteration ( arg,
T &  lans,
T &  dans,
T &  pans,
unsigned int &  j 
) [inline]

Definition at line 189 of file distributions.h.

Referenced by noncentralChi2CDF_exact().

template<typename JA >
void mrpt::math::detail::pivotUntilIdentity ( JointAccessor< JA > &  joint  )  [inline]
template<class T >
T mrpt::math::detail::pythag ( const T  a,
const T  b 
) [inline]

Definition at line 190 of file ops_matrices_eigen.h.

Referenced by tqli().

template<typename MatrixType >
size_t mrpt::math::detail::rank ( const MatrixType &  m,
typename MatrixType::value_type  eps = 1e-7 
) [inline]
template<class MATRIX >
mrpt::math::detail::RET_ELEMENT_ASSERT_MRPTCONTAINER ( MATRIX   )  const [inline]
template<typename MAT1 , typename MAT2 , typename MAT3 >
void mrpt::math::detail::rightDivideSquare ( const MAT1 &  C,
const MAT2 &  B,
MAT3 &  RES 
) [inline]

Matrix right divide: RES = C · B-1 (B must be a square matrix).

See also:
leftDivideSquare,fastRightDivideSquare

Definition at line 1475 of file ops_matrices.h.

References fastRightDivideSquare(), and MAT_TYPE_SAMESIZE_OF.

template<class MAT >
void mrpt::math::detail::saveMatrixToTextFile ( const MAT &  theMatrix,
const std::string &  file,
TMatrixTextFileFormat  fileFormat,
bool  appendMRPTHeader,
const std::string &  userHeader 
) [inline]

Save matrix to a text file, compatible with MATLAB text format (see also the methods of matrix classes themselves).

Parameters:
theMatrix It can be a CMatrixTemplate or a CMatrixFixedNumeric.
file The target filename.
fileFormat See TMatrixTextFileFormat. The format of the numbers in the text file.
appendMRPTHeader Insert this header to the file "% File generated by MRPT. Load with MATLAB with: VAR=load(FILENAME);"
userHeader Additional text to be written at the head of the file. Typically MALAB comments "% This file blah blah". Final end-of-line is not needed.
See also:
loadFromTextFile, CMatrixTemplate::inMatlabFormat, SAVE_MATRIX

Definition at line 174 of file ops_matrices.h.

References mrpt::system::dateTimeLocalToString(), mrpt::system::os::fclose(), mrpt::system::os::fopen(), mrpt::system::os::fprintf(), mrpt::math::MATRIX_FORMAT_ENG, mrpt::math::MATRIX_FORMAT_FIXED, mrpt::math::MATRIX_FORMAT_INT, MRPT_END, mrpt::system::MRPT_getVersion(), MRPT_START, mrpt::system::now(), THROW_EXCEPTION, and THROW_EXCEPTION_CUSTOM_MSG1.

Referenced by mrpt::math::CMatrixTemplate< TPoint3D >::saveToTextFile().

template<class T >
T mrpt::math::detail::SIGN ( a,
b 
) [inline]

Definition at line 197 of file ops_matrices_eigen.h.

Referenced by tqli().

template<class MAT , class ARR >
void mrpt::math::detail::tqli ( ARR &  d,
ARR &  e,
const size_t  n,
MAT &  z 
) [inline]

QL algorithm with implicit shifts, to determine the eigenvalues and eigenvectors of a real, symmetric, tridiagonal matrix, or of a real, symmetric matrix previously reduced by tred2 x11.2.

On input, d[1..n] contains the diagonal elements of the tridiagonal matrix. On output, it returns the eigenvalues. The vector e[1..n] inputs the subdiagonal elements of the tridiagonal matrix, with e[1] arbitrary. On output e is destroyed. When finding only the eigenvalues, several lines may be omitted, as noted in the comments. If the eigenvectors of a tridiagonal matrix are desired, the matrix z[1..n][1..n] is input as the identity matrix. If the eigenvectors of a matrix that has been reduced by tred2 are required, then z is input as the matrix output by tred2. In either case, the kth column of z returns the normalized eigenvector corresponding to d[k].

Definition at line 294 of file ops_matrices_eigen.h.

References pythag(), SIGN(), and THROW_EXCEPTION.

Referenced by eigenVectorsMatrix().

template<class MATRIX1 >
MATRIX1::value_type mrpt::math::detail::trace ( const MATRIX1 &  m  )  [inline]

The trace of a matrix (the sum of its diagonal).

Definition at line 242 of file ops_matrices.h.

References mrpt::math::size().

template<class MAT , class ARR >
void mrpt::math::detail::tred2 ( MAT &  a,
const size_t  n,
ARR &  d,
ARR &  e 
) [inline]

Householder reduction of a real, symmetric matrix a[1..n][1..n].

On output, a is replaced by the orthogonal matrix Q reflecting the transformation. d[1..n] returns the diagonal elements of the tridiagonal matrix, and e[1..n] the off-diagonal elements, with e[1]=0. Several statements, as noted in comments, can be omitted if only eigenvalues are to be found, in which case a contains no useful information on output. Otherwise they are to be included.

Definition at line 207 of file ops_matrices_eigen.h.

Referenced by eigenVectorsMatrix().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines



Page generated by Doxygen 1.6.1 for MRPT 0.9.0 SVN: at Mon Jun 7 06:47:58 UTC 2010