MRPT logo
Classes | Functions

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  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<typename T , size_t NROWS, size_t NCOLS>
void fixedToDynMatrix (const CMatrixFixedNumeric< T, NROWS, NCOLS > &SRC, CMatrixTemplateNumeric< T > &DST)
 Auxiliary function used in the constructor of dyn.
template<typename T , size_t NROWS, size_t NCOLS>
void insertMatrixFixTransposeIntoDyn (CMatrixTemplate< T > &M, const size_t nRow, const size_t nCol, const CMatrixFixedNumeric< T, NROWS, NCOLS > &in)
 Auxiliary function used in CMatrixTemplate.
template<typename T , size_t NROWS, size_t NCOLS>
void insertMatrixFixIntoDyn (CMatrixTemplate< T > &M, const size_t nRow, const size_t nCol, const CMatrixFixedNumeric< T, NROWS, NCOLS > &in)
 Auxiliary function used in CMatrixTemplate.
template<typename T , size_t NROWS, size_t NCOLS>
void extractFixMatrixFromDynMatrix (const CMatrixTemplate< T > &M, const size_t nRow, const size_t nCol, CMatrixFixedNumeric< T, NROWS, NCOLS > &outMat)
 Used from CMatrixTemplate::extractMatrix.
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 &)
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 >
T pythag (const T a, const T b)
template<class T >
T SIGN (T a, T b)

Function Documentation

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

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 131 of file ops_matrices.h.

References mrpt::utils::square().

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 889 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 894 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  ) 

Definition at line 901 of file ops_matrices.h.

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

eigenVectorsMatrix

Parameters:
eVecs if set to NULL, only compute eigenvalues

Definition at line 56 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 
)

Definition at line 142 of file ops_matrices_eigen.h.

template<typename T , size_t NROWS, size_t NCOLS>
void mrpt::math::detail::extractFixMatrixFromDynMatrix ( const CMatrixTemplate< T > &  M,
const size_t  nRow,
const size_t  nCol,
CMatrixFixedNumeric< T, NROWS, NCOLS > &  outMat 
)
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 1424 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 1431 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 
)
template<typename T , size_t NROWS, size_t NCOLS>
void mrpt::math::detail::insertMatrixFixIntoDyn ( CMatrixTemplate< T > &  M,
const size_t  nRow,
const size_t  nCol,
const CMatrixFixedNumeric< T, NROWS, NCOLS > &  in 
)
template<typename T , size_t NROWS, size_t NCOLS>
void mrpt::math::detail::insertMatrixFixTransposeIntoDyn ( CMatrixTemplate< T > &  M,
const size_t  nRow,
const size_t  nCol,
const CMatrixFixedNumeric< T, NROWS, NCOLS > &  in 
)
template<class MATRIXIN , class MATRIXOUT >
void mrpt::math::detail::invMatrix ( const MATRIXIN &  M,
MATRIXOUT &  out_inv 
) [inline]

Definition at line 823 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 775 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 791 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 442 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 1408 of file ops_matrices.h.

References fastLeftDivideSquare(), and MAT_TYPE_SAMESIZE_OF.

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

Matrix pivoting - used for detMatrix, etc.

Definition at line 962 of file ops_matrices.h.

template<class MATRIX1 , class MATRIX2 >
void mrpt::math::detail::multiply_AAt ( const MATRIX1 &  m1,
MATRIX2 &  RESULT 
)

RESULT = A * A^t.

Definition at line 264 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 
)
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.

Definition at line 360 of file ops_matrices.h.

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

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.

Definition at line 232 of file ops_matrices.h.

References ASSERT_, 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 
)

RES = A*B*C.

See also:
multiply_ABCt

Definition at line 577 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 
)

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

See also:
multiply_ABC

Definition at line 599 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 
)

Definition at line 620 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 
)

RESULT = A^t * A.

Definition at line 311 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 
)

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

Definition at line 248 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 
)

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

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

Definition at line 469 of file ops_matrices.h.

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

Referenced by 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 
)

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

Definition at line 496 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 
)

Definition at line 669 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 
)

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

OUT = B * A

Definition at line 547 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,
T  noncentrality,
T  arg,
T  eps 
)
template<class T >
void mrpt::math::detail::noncentralChi2OneIteration ( T  arg,
T &  lans,
T &  dans,
T &  pans,
unsigned int &  j 
)

Definition at line 213 of file distributions.h.

Referenced by noncentralChi2CDF_exact().

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

Definition at line 191 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 
)
template<class MATRIX >
mrpt::math::detail::RET_ELEMENT_ASSERT_MRPTCONTAINER ( MATRIX   )  const
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 1416 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 
)

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 171 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::system::MRPT_getVersion(), 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 ( T  a,
T  b 
) [inline]

Definition at line 198 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 
)

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

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

Definition at line 220 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 
)

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 208 of file ops_matrices_eigen.h.

Referenced by eigenVectorsMatrix().




Page generated by Doxygen 1.7.1 for MRPT 0.8.1 SVN:exported at Sun Sep 19 14:53:45 UTC 2010