MRPT logo
Classes | Public Types

mrpt::math::CMatrixTemplateNumeric< T > Class Template Reference

This template class extends the class "CMatrixTemplate" with many common operations with numerical matrixes. More...

#include <mrpt/math/CMatrixTemplateNumeric.h>

Inheritance diagram for mrpt::math::CMatrixTemplateNumeric< T >:
Inheritance graph
[legend]
Collaboration diagram for mrpt::math::CMatrixTemplateNumeric< T >:
Collaboration graph
[legend]

List of all members.

Classes

struct  mrpt_container

Public Types

enum  dummy_enum { mrpt_matrix_type_ncols = -1, mrpt_matrix_type_nrows = -1 }
typedef CMatrixTemplate< T > BASE
typedef CMatrixTemplateNumeric< T > mrpt_autotype

Public Member Functions

Methods common to all containers

size_t countNonZero () const
void fill (const T &val)
T maximum (size_t *maxIndex=NULL) const
T minimum (size_t *minIndex=NULL) const
void minimum_maximum (T &out_min, T &out_max, size_t *minIndex=NULL, size_t *maxIndex=NULL) const
T norm_inf (size_t *maxIndex=NULL) const
T sumAll () const
template<class CONTAINEROUT >
void cumsum (CONTAINEROUT &out) const
template<class CONTAINEROUT >
CONTAINEROUT cumsum () const
template<class CONTAINER2 >
size_t countCommonElements (const CONTAINER2 &b) const
 Counts the number of elements that appear in both containers (comparison through the == operator).
std::vector< double > histogram (double limit_min, double limit_max, size_t number_bins, bool do_normalization=false) const
 Computes the normalized or normal histogram of a sequence of numbers given the number of bins and the limits.
template<class F >
mrpt_autotype & applyToAllElements (T(*function)(T))
mrpt_autotype & Sqrt ()
mrpt_autotype & Abs ()
mrpt_autotype & Square ()
mrpt_autotype & Exp ()
mrpt_autotype & Log ()
T squareNorm () const
T norm () const
T mean () const
void adjustRange (const T min_val, const T max_val)
void normalize (const T min_val=0, const T max_val=1)
double std (bool unbiased=true) const
void meanAndStd (double &out_mean, double &out_std, bool unbiased=true)
Methods common to all matrices

mrpt_autotype operator+ ()
mrpt_autotype operator- () const
mrpt_autotype & operator+= (const T n)
mrpt_autotype & operator-= (const T n)
mrpt_autotype & operator*= (const T n)
mrpt_autotype & operator/= (const T n)
template<typename OTHERMATRIX >
OTHERMATRIX::template
mrpt_matrix_tag_templ< void >
::void_type 
operator*= (const OTHERMATRIX &m)
template<typename OTHERMATRIX >
mrpt_autotype & add_At (const OTHERMATRIX &m)
template<typename OTHERMATRIX >
mrpt_autotype & add_Ac (const OTHERMATRIX &m, const T c)
template<typename OTHERMATRIX >
mrpt_autotype & substract_At (const OTHERMATRIX &m)
template<typename OTHERMATRIX >
mrpt_autotype & substract_An (const OTHERMATRIX &m, const size_t n)
template<typename OTHERMATRIX >
mrpt_autotype & substract_Ac (const OTHERMATRIX &m, const T c)
template<typename OTHERMATRIX >
mrpt_autotype & add_AAt (const OTHERMATRIX &m)
template<typename OTHERMATRIX >
mrpt_autotype & substract_AAt (const OTHERMATRIX &m)
bool empty () const
template<class MATRIX1 , class MATRIX2 >
void multiply (const MATRIX1 &A, const MATRIX2 &B)
template<typename OTHERVECTOR1 , typename OTHERVECTOR2 >
void multiply_Ab (const OTHERVECTOR1 &vIn, OTHERVECTOR2 &vOut, bool accumToOutput=false) const
template<typename OTHERVECTOR1 , typename OTHERVECTOR2 >
void multiply_Atb (const OTHERVECTOR1 &vIn, OTHERVECTOR2 &vOut, bool accumToOutput=false) const
template<typename MAT_C , typename MAT_R >
void multiply_HCHt (const MAT_C &C, MAT_R &R, bool accumResultInOutput=false, bool allow_submatrix_mult=false) const
template<typename MAT_C >
T multiply_HCHt_scalar (const MAT_C &C) const
template<typename MAT_C >
T multiply_HtCH_scalar (const MAT_C &C) const
template<typename MAT_C , typename MAT_R >
void multiply_HtCH (const MAT_C &C, MAT_R &R, bool accumResultInOutput=false, bool allow_submatrix_mult=false) const
template<class MAT_A , class MAT_OUT >
void multiply_subMatrix (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) const
template<class MAT_A , class MAT_B , class MAT_C >
void multiply_ABC (const MAT_A &A, const MAT_B &B, const MAT_C &C)
template<class MAT_A , class MAT_B , class MAT_C >
void multiply_ABCt (const MAT_A &A, const MAT_B &B, const MAT_C &C)
template<class MAT_A , class MAT_B >
void multiply_ABt (const MAT_A &A, const MAT_B &B)
template<class MAT_A >
void multiply_AAt (const MAT_A &A)
template<class MAT_A >
void multiply_AtA (const MAT_A &A)
template<class MAT_A , class MAT_B >
void multiply_result_is_symmetric (const MAT_A &A, const MAT_B &B)
T _E (const size_t row, const size_t col) const
T & _E (const size_t row, const size_t col)
bool IsSquare () const
bool isSquare () const
bool isSingular (const T epsilon=0) const
T trace () const
template<class MAT_OUT >
void pseudoInverse (MAT_OUT &out) const
template<class MAT_OUT >
MAT_OUT pseudoInverse () const
T det () const
template<class MATRIXOUT >
void inv (MATRIXOUT &out) const
mrpt_autotype inv () const
template<class MATRIXOUT >
void inv_fast (MATRIXOUT &out)
template<class MAT2 , class MAT3 >
void leftDivideSquare (const MAT2 &A, MAT3 &RES) const
template<class MAT2 , class MAT3 >
void rightDivideSquare (const MAT2 &B, MAT3 &RES) const
template<typename MAT2 >
void fastLeftDivideSquare (MAT2 &A)
template<typename MAT2 >
void fastRightDivideSquare (MAT2 &B)
void saveToTextFile (const std::string &file, mrpt::math::TMatrixTextFileFormat fileFormat=MATRIX_FORMAT_ENG, bool appendMRPTHeader=false, const std::string &userHeader=std::string("")) const
int pivot (const size_t row)
template<class MATRIXOUT >
bool chol (MATRIXOUT &out) const
template<class MATRIX1 , class MATRIX2 >
MATRIX1::template
mrpt_matrix_tag_templ
< typename
MATRIX2::mrpt_matrix_tag >
::void_type 
eigenVectors (MATRIX1 &eVecs, MATRIX2 &eVals) const
template<class MATRIX1 , class VECTOR1 >
void eigenVectorsVec (MATRIX1 &eVecs, VECTOR1 &eVals) const
template<class VECTOR1 >
void eigenValues (VECTOR1 &eVals) const
void setIdentity ()
void setIdentity (size_t N)
template<typename OTHERMATRIX >
mrpt_autotype & assignMatrix (const OTHERMATRIX &m)
size_t rank (T eps=1e-7) const
template<class R >
 CMatrixTemplateNumeric (const CMatrixTemplate< R > &m)
 Copy constructor from a matrix of any type.
 CMatrixTemplateNumeric ()
 Default constructor, builds a 1x1 matrix.
 CMatrixTemplateNumeric (bool, bool, bool)
 Default constructor, builds a 0x0 matrix, with a signature identical to that of the fixed matrix constructor for uninitialized matrix constructor.
 CMatrixTemplateNumeric (size_t row, size_t col)
 Constructor.
 CMatrixTemplateNumeric (const CMatrixTemplate< T > &m, const size_t cropRowCount, const size_t cropColCount)
 Copy & crop constructor, which copies the given matrix but only up to the given size.
template<typename V , size_t N>
 CMatrixTemplateNumeric (size_t row, size_t col, V(&theArray)[N])
 Constructor from a given size and a C array.
template<typename V >
 CMatrixTemplateNumeric (size_t row, size_t col, const V &theVector)
 Constructor from a given size and a STL container (std::vector, std::list,...) with the initial values.
virtual ~CMatrixTemplateNumeric ()
 Destructor.
 CMatrixTemplateNumeric (const mrpt::poses::CPose2D &p)
 Constructor from a mrpt::poses::CPose2D, which generates a 3x1 matrix $ [x y \phi]^T $.
 CMatrixTemplateNumeric (const mrpt::poses::CPose3D &p)
 Constructor from a mrpt::poses::CPose6D, which generates a 6x1 matrix $ [x y z yaw pitch roll]^T $.
 CMatrixTemplateNumeric (const mrpt::poses::CPoint2D &p)
 Constructor from a mrpt::poses::CPoint2D, which generates a 2x1 matrix $ [x y]^T $.
 CMatrixTemplateNumeric (const mrpt::poses::CPoint3D &p)
 Constructor from a mrpt::poses::CPoint3D, which generates a 3x1 matrix $ [x y z]^T $.
template<size_t NROWS, size_t NCOLS>
 CMatrixTemplateNumeric (const CMatrixFixedNumeric< T, NROWS, NCOLS > &M)
 Copy constructor from a fixed-size matrix.
template<size_t NROWS, size_t NCOLS>
CMatrixTemplateNumeric & operator= (const CMatrixFixedNumeric< T, NROWS, NCOLS > &M)
 Copy operator from a fixed-size matrix.
template<class R >
CMatrixTemplateNumeric< T > & operator= (const CMatrixTemplateNumeric< R > &m)
 Assignment operator of other types.
template<typename V , size_t N>
CMatrixTemplateNumeric & operator= (V(&theArray)[N])
 Assignment operator for initializing from a C array (The matrix must be set to the correct size before invoking this asignament).
CMatrixTemplateNumeric< T > & operator= (const CMatrixTemplateNumeric< T > &m)
 Assignment operator for the same type.
void setSize (size_t row, size_t col)
 Changes the size of matrix, maintaining its previous content as possible and padding with zeros where applicable.
void resize (size_t row, size_t col)
 Changes the size of matrix, maintaining its previous content as possible and padding with zeros where applicable.
void resize (const CMatrixTemplateSize &siz)
 This method just checks has no effects in this class, but raises an exception if the expected size does not match.
void laplacian (CMatrixTemplateNumeric< T > &ret) const
 Computes the laplacian of the matrix, useful for graph matrixes.
void svd (CMatrixTemplateNumeric< T > &U, std::vector< T > &W, CMatrixTemplateNumeric< T > &V) const
 Computes the SVD (Singular Value Decomposition) of the matrix.
CMatrixTemplateNumeric< T > largestEigenvector (T resolution=0.01f, size_t maxIterations=6, int *out_Iterations=NULL, float *out_estimatedResolution=NULL) const
 Efficiently computes only the biggest eigenvector of the matrix using the Power Method, and returns it as a column vector.
CMatrixTemplateNumeric< T > & operator^= (const unsigned int &pow)
 combined power and assignment operator
void scalarPow (T s)
 Scalar power of all elements to a given power, this is diferent of ^ operator.
void zeros (const size_t row, const size_t col)
 Set all elements to zero.
void zeros ()
 Set all elements to zero.
void ones (const size_t row, const size_t col)
 Set all elements to one.
void ones ()
 Set all elements to one.
void unit (const size_t row)
 Build an unit matrix.
void unit ()
 Build an unit matrix.
CMatrixTemplateNumeric< T > solve (const CMatrixTemplateNumeric< T > &v) const
 Solve the matrix as linear equations system.
CMatrixTemplateNumeric< T > adj () const
 Computes the adjunt of matrix.
T cofact (size_t row, size_t col) const
 Computes the rank of the matrix using a slight variation of Gauss method.
T cond ()
 Computes the cond.
bool isDiagonal () const
 Checks for matrix type.
bool isScalar () const
 Checks for matrix type.
bool isUnit () const
 Checks for matrix type.
bool isNull () const
 Checks for matrix type.
bool isSymmetric () const
 Checks for matrix type.
bool isSkewSymmetric () const
 Checks for matrix type.
bool isUpperTriangular () const
 Checks for matrix type.
bool isLowerTriangular () const
 Checks for matrix type.
void matrix_floor ()
 Round towards minus infinity modifying the matrix (by AJOGD @ JAN-2007).
void matrix_floor (CMatrixTemplateNumeric< T > &out)
 Round towards minus infinity (by AJOGD @ JAN-2007).
void matrix_ceil ()
 Round towards plus infinity (by AJOGD @ JAN-2007).
void find_index_max_value (size_t &umax, size_t &vmax, T &max_val) const
 Finds the maximum value in the matrix, and returns its position.
T maximumDiagonal () const
 Finds the maximum value in the diagonal of the matrix.
void find_index_min_value (size_t &umin, size_t &vmin, T &min_val) const
 Finds the minimum value in the matrix, and returns its position.
void force_symmetry ()
 Force symmetry in the matrix (by AJOGD @ JAN-2007).
void mean (std::vector< T > &outMeanVector) const
 Computes a row with the mean values of each column in the matrix.
void meanAndStd (std::vector< T > &outMeanVector, std::vector< T > &outStdVector) const
 Computes a row with the mean values of each column in the matrix and the associated vector with the standard deviation of each column.
void meanAndStdAll (T &outMean, T &outStd) const
 Computes the mean and standard deviation of all the elements in the matrix as a whole.
void asCol (CMatrixTemplateNumeric< T > &aux) const
void asRow (CMatrixTemplateNumeric< T > &aux) const
void findElementsPassingMahalanobisThreshold (double stdTimes, std::vector< size_t > &rowIndexes, std::vector< size_t > &colIndexes, bool below=false) const
 Finds elements whose values are a given number of times above (or below) the mean, in 1D Mahalanobis distance.
T sum (size_t firstRow=0, size_t firstCol=0, size_t lastRow=std::numeric_limits< size_t >::max(), size_t lastCol=std::numeric_limits< size_t >::max()) const
 Returns the sum of a given part of the matrix.
void multiplyByMatrixAndByTransposeNonSymmetric (const CMatrixTemplateNumeric< T > &C, CMatrixTemplateNumeric< T > &R, bool accumOnOutput=false, bool substractInsteadOfSum=false) const
 Computes: R = H * C * H^t , where H is this matrix.

Detailed Description

template<class T>
class mrpt::math::CMatrixTemplateNumeric< T >

This template class extends the class "CMatrixTemplate" with many common operations with numerical matrixes.

The template can be instanced for data types: float, double, long double

The following operators have been implemented:

Implemented Operators
Meaning
x=M(i,j)
M(i,j)=x
This () operator is used to access/change the element at i'th row, j'th column. First index is 0.
!M The matrix inverse M-1
~M The matrix transpose MT
(M^n) Power of a matrix: (M*M*M*...M) n times. Use parenthesis with this operator. Use "scalarPow" for the power of individual elements in the matrix.
M1 = M2 Assignment operator: Copy matrix M2 to M1
M1 == M2
M1 != M2
Logical comparison: Returns true or false if all elements are identical.
x * M Scalar multiplication
M1 * M2 Matrix multiplication, with the usual mathematical meaning
M1 + M2
M1 – M2
Matrixes addition and substraction.
M / x Scalar division
M1 / M2 Equivalent to (M1 * M2-1)
stream << M; Write to a binary CStream, since this class is CSerializable
stream >> M; Read from a binary CStream, since this class is CSerializable

See also this useful methods:

Definition at line 110 of file CMatrixTemplateNumeric.h.


Member Typedef Documentation

template<class T>
typedef CMatrixTemplate<T> mrpt::math::CMatrixTemplateNumeric< T >::BASE

Definition at line 113 of file CMatrixTemplateNumeric.h.

Definition at line 114 of file CMatrixTemplateNumeric.h.


Member Enumeration Documentation

Enumerator:
mrpt_matrix_type_ncols 
mrpt_matrix_type_nrows 

Definition at line 116 of file CMatrixTemplateNumeric.h.


Constructor & Destructor Documentation

template<class T>
template<class R >
mrpt::math::CMatrixTemplateNumeric< T >::CMatrixTemplateNumeric ( const CMatrixTemplate< R > &  m  )  [inline]

Copy constructor from a matrix of any type.

Definition at line 123 of file CMatrixTemplateNumeric.h.

Default constructor, builds a 1x1 matrix.

template<class T>
mrpt::math::CMatrixTemplateNumeric< T >::CMatrixTemplateNumeric ( bool  ,
bool  ,
bool   
) [inline]

Default constructor, builds a 0x0 matrix, with a signature identical to that of the fixed matrix constructor for uninitialized matrix constructor.

Definition at line 136 of file CMatrixTemplateNumeric.h.

template<class T>
mrpt::math::CMatrixTemplateNumeric< T >::CMatrixTemplateNumeric ( size_t  row,
size_t  col 
)

Constructor.

template<class T>
mrpt::math::CMatrixTemplateNumeric< T >::CMatrixTemplateNumeric ( const CMatrixTemplate< T > &  m,
const size_t  cropRowCount,
const size_t  cropColCount 
) [inline]

Copy & crop constructor, which copies the given matrix but only up to the given size.

Definition at line 144 of file CMatrixTemplateNumeric.h.

template<class T>
template<typename V , size_t N>
mrpt::math::CMatrixTemplateNumeric< T >::CMatrixTemplateNumeric ( size_t  row,
size_t  col,
V(&)  theArray[N] 
) [inline]

Constructor from a given size and a C array.

The array length must match cols x row.

  const double numbers[] = {
    1,2,3,
    4,5,6 };
         CMatrixDouble   M(3,2, numbers);

Definition at line 156 of file CMatrixTemplateNumeric.h.

template<class T>
template<typename V >
mrpt::math::CMatrixTemplateNumeric< T >::CMatrixTemplateNumeric ( size_t  row,
size_t  col,
const V &  theVector 
) [inline]

Constructor from a given size and a STL container (std::vector, std::list,...) with the initial values.

The vector length must match cols x row.

Definition at line 162 of file CMatrixTemplateNumeric.h.

template<class T>
virtual mrpt::math::CMatrixTemplateNumeric< T >::~CMatrixTemplateNumeric (  )  [inline, virtual]

Destructor.

Definition at line 167 of file CMatrixTemplateNumeric.h.

template<class T>
mrpt::math::CMatrixTemplateNumeric< T >::CMatrixTemplateNumeric ( const mrpt::poses::CPose2D &  p  )  [explicit]

Constructor from a mrpt::poses::CPose2D, which generates a 3x1 matrix $ [x y \phi]^T $.

template<class T>
mrpt::math::CMatrixTemplateNumeric< T >::CMatrixTemplateNumeric ( const mrpt::poses::CPose3D &  p  )  [explicit]

Constructor from a mrpt::poses::CPose6D, which generates a 6x1 matrix $ [x y z yaw pitch roll]^T $.

template<class T>
mrpt::math::CMatrixTemplateNumeric< T >::CMatrixTemplateNumeric ( const mrpt::poses::CPoint2D &  p  )  [explicit]

Constructor from a mrpt::poses::CPoint2D, which generates a 2x1 matrix $ [x y]^T $.

template<class T>
mrpt::math::CMatrixTemplateNumeric< T >::CMatrixTemplateNumeric ( const mrpt::poses::CPoint3D &  p  )  [explicit]

Constructor from a mrpt::poses::CPoint3D, which generates a 3x1 matrix $ [x y z]^T $.

template<class T>
template<size_t NROWS, size_t NCOLS>
mrpt::math::CMatrixTemplateNumeric< T >::CMatrixTemplateNumeric ( const CMatrixFixedNumeric< T, NROWS, NCOLS > &  M  )  [inline, explicit]

Copy constructor from a fixed-size matrix.

Note:
Method implemented in CMatrixFixedNumeric.h

Definition at line 190 of file CMatrixTemplateNumeric.h.


Member Function Documentation

template<class T>
T mrpt::math::CMatrixTemplateNumeric< T >::_E ( const size_t  row,
const size_t  col 
) const [inline]

Alternative access to element (i,j) with first index being (1,1) instead of (0,0)

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
T& mrpt::math::CMatrixTemplateNumeric< T >::_E ( const size_t  row,
const size_t  col 
) [inline]

Alternative access to element (i,j) with first index being (1,1) instead of (0,0)

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
mrpt_autotype& mrpt::math::CMatrixTemplateNumeric< T >::Abs (  )  [inline]

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<typename OTHERMATRIX >
mrpt_autotype& mrpt::math::CMatrixTemplateNumeric< T >::add_AAt ( const OTHERMATRIX &  m  )  [inline]

this += A + AT

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<typename OTHERMATRIX >
mrpt_autotype& mrpt::math::CMatrixTemplateNumeric< T >::add_Ac ( const OTHERMATRIX &  m,
const T  c 
) [inline]

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<typename OTHERMATRIX >
mrpt_autotype& mrpt::math::CMatrixTemplateNumeric< T >::add_At ( const OTHERMATRIX &  m  )  [inline]

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
CMatrixTemplateNumeric<T> mrpt::math::CMatrixTemplateNumeric< T >::adj (  )  const

Computes the adjunt of matrix.

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::adjustRange ( const T  min_val,
const T  max_val 
) [inline]
Parameters:
max_val Normalize all the elements such as they are in the given range

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<class F >
mrpt_autotype& mrpt::math::CMatrixTemplateNumeric< T >::applyToAllElements ( T(*)(T)  function  )  [inline]

Applies a generic operation "T func(T val)" to all the elements.

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::asCol ( CMatrixTemplateNumeric< T > &  aux  )  const
template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::asRow ( CMatrixTemplateNumeric< T > &  aux  )  const
template<class T>
template<typename OTHERMATRIX >
mrpt_autotype& mrpt::math::CMatrixTemplateNumeric< T >::assignMatrix ( const OTHERMATRIX &  m  )  [inline]

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<class MATRIXOUT >
bool mrpt::math::CMatrixTemplateNumeric< T >::chol ( MATRIXOUT &  out  )  const [inline]

Cholesky factorization: in = out' * out

Returns:
True on success, false on singular matrix
See also:
mrpt::math::chol

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
T mrpt::math::CMatrixTemplateNumeric< T >::cofact ( size_t  row,
size_t  col 
) const

Computes the rank of the matrix using a slight variation of Gauss method.

Computes the cofact.

template<class T>
T mrpt::math::CMatrixTemplateNumeric< T >::cond (  ) 

Computes the cond.

template<class T>
template<class CONTAINER2 >
size_t mrpt::math::CMatrixTemplateNumeric< T >::countCommonElements ( const CONTAINER2 &  b  )  const [inline]

Counts the number of elements that appear in both containers (comparison through the == operator).

It is assumed that no repeated elements appear within each of the containers.

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
size_t mrpt::math::CMatrixTemplateNumeric< T >::countNonZero (  )  const [inline]

Count how many elements in a container are non-zero.

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<class CONTAINEROUT >
CONTAINEROUT mrpt::math::CMatrixTemplateNumeric< T >::cumsum (  )  const [inline]

Cumsum of all the elements, returning a container of the given type, for example: CMatrixDouble m = mat.cumsum<CMatrixDouble>();

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<class CONTAINEROUT >
void mrpt::math::CMatrixTemplateNumeric< T >::cumsum ( CONTAINEROUT &  out  )  const [inline]

Cumsum of all the elements, saving in an output container

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
T mrpt::math::CMatrixTemplateNumeric< T >::det (  )  const [inline]

< Returns the determinant of the matrix

Definition at line 118 of file CMatrixTemplateNumeric.h.

Referenced by mrpt::math::normalPDF(), and mrpt::math::productIntegralTwoGaussians().

template<class T>
template<class VECTOR1 >
void mrpt::math::CMatrixTemplateNumeric< T >::eigenValues ( VECTOR1 &  eVals  )  const [inline]

Return the eigenvalues of the matrix in an ordered vector.

See also:
eigenVectors

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<class MATRIX1 , class MATRIX2 >
MATRIX1 ::template mrpt_matrix_tag_templ<typename MATRIX2 ::mrpt_matrix_tag>::void_type mrpt::math::CMatrixTemplateNumeric< T >::eigenVectors ( MATRIX1 &  eVecs,
MATRIX2 &  eVals 
) const [inline]

Eigenvalues and eigenvector of symmetric matrix: M = eVecs * eVals * eVecsT, with eigenvectors in columns in eVecs, eigenvalues in ascending order in diagonal of eVals

See also:
eigenVectorsVec, eigenValues

Definition at line 118 of file CMatrixTemplateNumeric.h.

Referenced by mrpt::utils::CEnhancedMetaFile::ellipseGaussian(), and mrpt::utils::CCanvas::ellipseGaussian().

template<class T>
template<class MATRIX1 , class VECTOR1 >
void mrpt::math::CMatrixTemplateNumeric< T >::eigenVectorsVec ( MATRIX1 &  eVecs,
VECTOR1 &  eVals 
) const [inline]

Like eigenVectors, but eigenvalues are returned in a vector instead of a matrix's diagonal.

See also:
eigenVectors,eigenValues

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
bool mrpt::math::CMatrixTemplateNumeric< T >::empty (  )  const [inline]

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
mrpt_autotype& mrpt::math::CMatrixTemplateNumeric< T >::Exp (  )  [inline]

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<typename MAT2 >
void mrpt::math::CMatrixTemplateNumeric< T >::fastLeftDivideSquare ( MAT2 &  A  )  [inline]

Matrix left divide: this = A-1 &#183; this (A must be a square matrix, and will be modified on return).

See also:
leftDivideSquare,fastRightDivideSquare

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<typename MAT2 >
void mrpt::math::CMatrixTemplateNumeric< T >::fastRightDivideSquare ( MAT2 &  B  )  [inline]

Matrix right divide: this = this &#183; B-1 (B must be a square matrix, and will be modified on return).

See also:
leftDivideSquare,fastRightDivideSquare

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::fill ( const T &  val  )  [inline]

Fill all the elements with a given value

Definition at line 118 of file CMatrixTemplateNumeric.h.

Referenced by mrpt::math::detail::VicinityTraits< CMatrixTemplateNumeric< T > >::initialize().

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::find_index_max_value ( size_t &  umax,
size_t &  vmax,
T &  max_val 
) const

Finds the maximum value in the matrix, and returns its position.

(by AJOGD @ JAN-2007)

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::find_index_min_value ( size_t &  umin,
size_t &  vmin,
T &  min_val 
) const

Finds the minimum value in the matrix, and returns its position.

(by AJOGD @ JAN-2007)

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::findElementsPassingMahalanobisThreshold ( double  stdTimes,
std::vector< size_t > &  rowIndexes,
std::vector< size_t > &  colIndexes,
bool  below = false 
) const

Finds elements whose values are a given number of times above (or below) the mean, in 1D Mahalanobis distance.

This returns two lists with the "row" and "column" indexes (i,j) of those elements m[i][j] such as: m[i][j] > mean(matrix) + stdTimes·std(matrix) The elements below the threshold mean(matrix) - stdTimes·std(matrix) can also be obtained setting "below" to "true".

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::force_symmetry (  ) 

Force symmetry in the matrix (by AJOGD @ JAN-2007).

template<class T>
std::vector<double> mrpt::math::CMatrixTemplateNumeric< T >::histogram ( double  limit_min,
double  limit_max,
size_t  number_bins,
bool  do_normalization = false 
) const [inline]

Computes the normalized or normal histogram of a sequence of numbers given the number of bins and the limits.

In any case this is a "linear" histogram, i.e. for matrices, all the elements are taken as if they were a plain sequence, not taking into account they were in columns or rows.

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
mrpt_autotype mrpt::math::CMatrixTemplateNumeric< T >::inv (  )  const [inline]

< mrpt_autotype out = inv(this)

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<class MATRIXOUT >
void mrpt::math::CMatrixTemplateNumeric< T >::inv ( MATRIXOUT &  out  )  const [inline]
template<class T>
template<class MATRIXOUT >
void mrpt::math::CMatrixTemplateNumeric< T >::inv_fast ( MATRIXOUT &  out  )  [inline]
Parameters:
out out = inv(this), overwriting contents of this

Definition at line 118 of file CMatrixTemplateNumeric.h.

Referenced by mrpt::math::leastSquareLinearFit(), and mrpt::math::productIntegralTwoGaussians().

template<class T>
bool mrpt::math::CMatrixTemplateNumeric< T >::isDiagonal (  )  const

Checks for matrix type.

template<class T>
bool mrpt::math::CMatrixTemplateNumeric< T >::isLowerTriangular (  )  const

Checks for matrix type.

template<class T>
bool mrpt::math::CMatrixTemplateNumeric< T >::isNull (  )  const

Checks for matrix type.

template<class T>
bool mrpt::math::CMatrixTemplateNumeric< T >::isScalar (  )  const

Checks for matrix type.

template<class T>
bool mrpt::math::CMatrixTemplateNumeric< T >::isSingular ( const T  epsilon = 0  )  const [inline]

Checks for the absolute value of the determinant of the matrix being equal or below a given threshold (by default, exactly zero).

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
bool mrpt::math::CMatrixTemplateNumeric< T >::isSkewSymmetric (  )  const

Checks for matrix type.

template<class T>
bool mrpt::math::CMatrixTemplateNumeric< T >::isSquare (  )  const [inline]

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
bool mrpt::math::CMatrixTemplateNumeric< T >::IsSquare (  )  const [inline]

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
bool mrpt::math::CMatrixTemplateNumeric< T >::isSymmetric (  )  const

Checks for matrix type.

template<class T>
bool mrpt::math::CMatrixTemplateNumeric< T >::isUnit (  )  const

Checks for matrix type.

template<class T>
bool mrpt::math::CMatrixTemplateNumeric< T >::isUpperTriangular (  )  const

Checks for matrix type.

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::laplacian ( CMatrixTemplateNumeric< T > &  ret  )  const

Computes the laplacian of the matrix, useful for graph matrixes.

template<class T>
CMatrixTemplateNumeric<T> mrpt::math::CMatrixTemplateNumeric< T >::largestEigenvector ( T  resolution = 0.01f,
size_t  maxIterations = 6,
int *  out_Iterations = NULL,
float *  out_estimatedResolution = NULL 
) const

Efficiently computes only the biggest eigenvector of the matrix using the Power Method, and returns it as a column vector.

The computation time for this method, in a Pentium 4 1.4Ghz is:
T = 7.0867e-008*n2 + 1.9191e-005*n + 0.0017494 seconds
where N is the matrix size.

template<class T>
template<class MAT2 , class MAT3 >
void mrpt::math::CMatrixTemplateNumeric< T >::leftDivideSquare ( const MAT2 &  A,
MAT3 &  RES 
) const [inline]

Matrix left divide: RES = A-1 &#183; this (A must be a square matrix).

See also:
rightDivideSquare,fastLeftDivideSquare

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
mrpt_autotype& mrpt::math::CMatrixTemplateNumeric< T >::Log (  )  [inline]

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::matrix_ceil (  ) 

Round towards plus infinity (by AJOGD @ JAN-2007).

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::matrix_floor (  ) 

Round towards minus infinity modifying the matrix (by AJOGD @ JAN-2007).

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::matrix_floor ( CMatrixTemplateNumeric< T > &  out  ) 

Round towards minus infinity (by AJOGD @ JAN-2007).

template<class T>
T mrpt::math::CMatrixTemplateNumeric< T >::maximum ( size_t *  maxIndex = NULL  )  const [inline]

Finds the maximum value (and the corresponding zero-based index).

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
T mrpt::math::CMatrixTemplateNumeric< T >::maximumDiagonal (  )  const

Finds the maximum value in the diagonal of the matrix.

template<class T>
T mrpt::math::CMatrixTemplateNumeric< T >::mean (  )  const [inline]

Return the mean of the container (for matrices, as if it were a vector with all its elements).

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::mean ( std::vector< T > &  outMeanVector  )  const

Computes a row with the mean values of each column in the matrix.

See also:
meanAndStdAll
template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::meanAndStd ( double &  out_mean,
double &  out_std,
bool  unbiased = true 
) [inline]

Return the mean and standard deviation of all the elements in the container.

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::meanAndStd ( std::vector< T > &  outMeanVector,
std::vector< T > &  outStdVector 
) const

Computes a row with the mean values of each column in the matrix and the associated vector with the standard deviation of each column.

See also:
mean,meanAndStdAll
template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::meanAndStdAll ( T &  outMean,
T &  outStd 
) const

Computes the mean and standard deviation of all the elements in the matrix as a whole.

See also:
mean,meanAndStd
template<class T>
T mrpt::math::CMatrixTemplateNumeric< T >::minimum ( size_t *  minIndex = NULL  )  const [inline]

Finds the minimum value (and the corresponding zero-based index).

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::minimum_maximum ( T &  out_min,
T &  out_max,
size_t *  minIndex = NULL,
size_t *  maxIndex = NULL 
) const [inline]

Minimum and maximum of a vector at once

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<class MATRIX1 , class MATRIX2 >
void mrpt::math::CMatrixTemplateNumeric< T >::multiply ( const MATRIX1 &  A,
const MATRIX2 &  B 
) [inline]
template<class T>
template<class MAT_A >
void mrpt::math::CMatrixTemplateNumeric< T >::multiply_AAt ( const MAT_A &  A  )  [inline]
Parameters:
A this = A * AT

Definition at line 118 of file CMatrixTemplateNumeric.h.

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

template<class T>
template<typename OTHERVECTOR1 , typename OTHERVECTOR2 >
void mrpt::math::CMatrixTemplateNumeric< T >::multiply_Ab ( const OTHERVECTOR1 &  vIn,
OTHERVECTOR2 &  vOut,
bool  accumToOutput = false 
) const [inline]

Computes the vector vOut = this * vIn, where "vIn" is a column vector of the appropriate length.

Definition at line 118 of file CMatrixTemplateNumeric.h.

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

template<class T>
template<class MAT_A , class MAT_B , class MAT_C >
void mrpt::math::CMatrixTemplateNumeric< T >::multiply_ABC ( const MAT_A &  A,
const MAT_B &  B,
const MAT_C &  C 
) [inline]
Parameters:
C this = A*B*C

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<class MAT_A , class MAT_B , class MAT_C >
void mrpt::math::CMatrixTemplateNumeric< T >::multiply_ABCt ( const MAT_A &  A,
const MAT_B &  B,
const MAT_C &  C 
) [inline]
Parameters:
C this = A*B*(CT)

Definition at line 118 of file CMatrixTemplateNumeric.h.

Referenced by mrpt::bayes::CKalmanFilterCapable< 6, 3, 3, 6 >::runOneKalmanIteration().

template<class T>
template<class MAT_A , class MAT_B >
void mrpt::math::CMatrixTemplateNumeric< T >::multiply_ABt ( const MAT_A &  A,
const MAT_B &  B 
) [inline]
Parameters:
B this = A * BT

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<class MAT_A >
void mrpt::math::CMatrixTemplateNumeric< T >::multiply_AtA ( const MAT_A &  A  )  [inline]
Parameters:
A this = AT * A

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<typename OTHERVECTOR1 , typename OTHERVECTOR2 >
void mrpt::math::CMatrixTemplateNumeric< T >::multiply_Atb ( const OTHERVECTOR1 &  vIn,
OTHERVECTOR2 &  vOut,
bool  accumToOutput = false 
) const [inline]

Computes the vector vOut = thisT * vIn, where "vIn" is a column vector of the appropriate length.

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<typename MAT_C , typename MAT_R >
void mrpt::math::CMatrixTemplateNumeric< T >::multiply_HCHt ( const MAT_C &  C,
MAT_R &  R,
bool  accumResultInOutput = false,
bool  allow_submatrix_mult = false 
) const [inline]

< R = this * C * thisT

See also:
detail::multiply_HCHt

Definition at line 118 of file CMatrixTemplateNumeric.h.

Referenced by mrpt::bayes::CKalmanFilterCapable< 6, 3, 3, 6 >::runOneKalmanIteration().

template<class T>
template<typename MAT_C >
T mrpt::math::CMatrixTemplateNumeric< T >::multiply_HCHt_scalar ( const MAT_C &  C  )  const [inline]

R = H * C * HT (with a vector H and a symmetric matrix C) In fact when H is a vector, multiply_HCHt_scalar and multiply_HtCH_scalar are exactly equivalent

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<typename MAT_C , typename MAT_R >
void mrpt::math::CMatrixTemplateNumeric< T >::multiply_HtCH ( const MAT_C &  C,
MAT_R &  R,
bool  accumResultInOutput = false,
bool  allow_submatrix_mult = false 
) const [inline]

R = HT * C * H (with a symmetric matrix C)

< R = thisT * C * this

See also:
detail::multiply_HtCH

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<typename MAT_C >
T mrpt::math::CMatrixTemplateNumeric< T >::multiply_HtCH_scalar ( const MAT_C &  C  )  const [inline]

R = HT * C * H (with a vector H and a symmetric matrix C) In fact when H is a vector, multiply_HCHt_scalar and multiply_HtCH_scalar are exactly equivalent

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<class MAT_A , class MAT_B >
void mrpt::math::CMatrixTemplateNumeric< T >::multiply_result_is_symmetric ( const MAT_A &  A,
const MAT_B &  B 
) [inline]
Parameters:
B this = A * B (result is symmetric)

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<class MAT_A , class MAT_OUT >
void mrpt::math::CMatrixTemplateNumeric< T >::multiply_subMatrix ( 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 
) const [inline]

< outResult = this * A

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::multiplyByMatrixAndByTransposeNonSymmetric ( const CMatrixTemplateNumeric< T > &  C,
CMatrixTemplateNumeric< T > &  R,
bool  accumOnOutput = false,
bool  substractInsteadOfSum = false 
) const

Computes: R = H * C * H^t , where H is this matrix.

Referenced by mrpt::bayes::CKalmanFilterCapable< 6, 3, 3, 6 >::runOneKalmanIteration().

template<class T>
T mrpt::math::CMatrixTemplateNumeric< T >::norm (  )  const [inline]

Return the norm of the container (for matrices, as if it were a vector with all its elements).

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
T mrpt::math::CMatrixTemplateNumeric< T >::norm_inf ( size_t *  maxIndex = NULL  )  const [inline]

Compute the norm-infinite of a vector ($f[ ||{v}||_ $f]), ie the maximum absolute value of the elements.

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::normalize ( const T  min_val = 0,
const T  max_val = 1 
) [inline]
Parameters:
max_val Normalize all the elements such as they are in the given range

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::ones ( const size_t  row,
const size_t  col 
)

Set all elements to one.

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::ones (  ) 

Set all elements to one.

template<class T>
mrpt_autotype& mrpt::math::CMatrixTemplateNumeric< T >::operator*= ( const T  n  )  [inline]
Parameters:
n Multiply by scalar

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<typename OTHERMATRIX >
OTHERMATRIX ::template mrpt_matrix_tag_templ<void>::void_type mrpt::math::CMatrixTemplateNumeric< T >::operator*= ( const OTHERMATRIX &  m  )  [inline]

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
mrpt_autotype mrpt::math::CMatrixTemplateNumeric< T >::operator+ (  )  [inline]

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
mrpt_autotype& mrpt::math::CMatrixTemplateNumeric< T >::operator+= ( const T  n  )  [inline]
Parameters:
n Sum a scalar

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
mrpt_autotype mrpt::math::CMatrixTemplateNumeric< T >::operator- (  )  const [inline]

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
mrpt_autotype& mrpt::math::CMatrixTemplateNumeric< T >::operator-= ( const T  n  )  [inline]
Parameters:
n Substract a scalar

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
mrpt_autotype& mrpt::math::CMatrixTemplateNumeric< T >::operator/= ( const T  n  )  [inline]
Parameters:
n Divide by scalar

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
CMatrixTemplateNumeric<T>& mrpt::math::CMatrixTemplateNumeric< T >::operator= ( const CMatrixTemplateNumeric< T > &  m  ) 

Assignment operator for the same type.

Reimplemented in mrpt::math::CMatrixD.

template<class T>
template<typename V , size_t N>
CMatrixTemplateNumeric& mrpt::math::CMatrixTemplateNumeric< T >::operator= ( V(&)  theArray[N]  )  [inline]

Assignment operator for initializing from a C array (The matrix must be set to the correct size before invoking this asignament).

         CMatrixDouble   M(3,2);
  const double numbers[] = {
    1,2,3,
    4,5,6 };
  M = numbers;

Refer also to the constructor with initialization data CMatrixTemplate::CMatrixTemplate

Reimplemented from mrpt::math::CMatrixTemplate< T >.

Definition at line 227 of file CMatrixTemplateNumeric.h.

template<class T>
template<class R >
CMatrixTemplateNumeric<T>& mrpt::math::CMatrixTemplateNumeric< T >::operator= ( const CMatrixTemplateNumeric< R > &  m  )  [inline]

Assignment operator of other types.

Definition at line 206 of file CMatrixTemplateNumeric.h.

template<class T>
template<size_t NROWS, size_t NCOLS>
CMatrixTemplateNumeric& mrpt::math::CMatrixTemplateNumeric< T >::operator= ( const CMatrixFixedNumeric< T, NROWS, NCOLS > &  M  )  [inline]

Copy operator from a fixed-size matrix.

Note:
Method implemented in CMatrixFixedNumeric.h

Definition at line 198 of file CMatrixTemplateNumeric.h.

Referenced by mrpt::math::CMatrixD::operator=(), and mrpt::math::CMatrix::operator=().

template<class T>
CMatrixTemplateNumeric<T>& mrpt::math::CMatrixTemplateNumeric< T >::operator^= ( const unsigned int &  pow  ) 

combined power and assignment operator

template<class T>
int mrpt::math::CMatrixTemplateNumeric< T >::pivot ( const size_t  row  )  [inline]

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<class MAT_OUT >
void mrpt::math::CMatrixTemplateNumeric< T >::pseudoInverse ( MAT_OUT &  out  )  const [inline]

< Pseudo inverse of this matrix M: out = (MT * M)^-1 * MT

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<class MAT_OUT >
MAT_OUT mrpt::math::CMatrixTemplateNumeric< T >::pseudoInverse (  )  const [inline]

< Pseudo inverse of this matrix M: return (MT * M)^-1 * MT. Invoke with template argument for desired return matrix type: m.pseudoInverse<CMatrixDouble>()

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
size_t mrpt::math::CMatrixTemplateNumeric< T >::rank ( T  eps = 1e-7  )  const [inline]

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::resize ( size_t  row,
size_t  col 
)

Changes the size of matrix, maintaining its previous content as possible and padding with zeros where applicable.

setSize and resize are exactly equivalent methods.

Referenced by mrpt::math::covariancesAndMean(), and mrpt::math::detail::fixedToDynMatrix().

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::resize ( const CMatrixTemplateSize &  siz  )  [inline]

This method just checks has no effects in this class, but raises an exception if the expected size does not match.

Definition at line 248 of file CMatrixTemplateNumeric.h.

template<class T>
template<class MAT2 , class MAT3 >
void mrpt::math::CMatrixTemplateNumeric< T >::rightDivideSquare ( const MAT2 &  B,
MAT3 &  RES 
) const [inline]

Matrix right divide: RES = this &#183; B-1 (B must be a square matrix).

See also:
leftDivideSquare,fastRightDivideSquare

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::saveToTextFile ( const std::string &  file,
mrpt::math::TMatrixTextFileFormat  fileFormat = MATRIX_FORMAT_ENG,
bool  appendMRPTHeader = false,
const std::string &  userHeader = std::string("") 
) const [inline]

Save matrix to a text file, compatible with MATLAB text format.

Reimplemented from mrpt::math::CMatrixTemplate< T >.

Definition at line 118 of file CMatrixTemplateNumeric.h.

Referenced by mrpt::math::CVectorTemplate< KFTYPE >::saveToTextFile().

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::scalarPow ( T  s  ) 

Scalar power of all elements to a given power, this is diferent of ^ operator.

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::setIdentity (  )  [inline]

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::setIdentity ( size_t  N  )  [inline]

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::setSize ( size_t  row,
size_t  col 
)

Changes the size of matrix, maintaining its previous content as possible and padding with zeros where applicable.

setSize and resize are exactly equivalent methods.

Referenced by mrpt::math::CLevenbergMarquardtTempl< VECTORTYPE, USERPARAM >::execute(), mrpt::math::detail::VicinityTraits< CMatrixTemplateNumeric< T > >::initialize(), mrpt::math::CVectorTemplate< KFTYPE >::likeMatrix(), and mrpt::bayes::CKalmanFilterCapable< 6, 3, 3, 6 >::runOneKalmanIteration().

template<class T>
CMatrixTemplateNumeric<T> mrpt::math::CMatrixTemplateNumeric< T >::solve ( const CMatrixTemplateNumeric< T > &  v  )  const

Solve the matrix as linear equations system.

template<class T>
mrpt_autotype& mrpt::math::CMatrixTemplateNumeric< T >::Sqrt (  )  [inline]
template<class T>
mrpt_autotype& mrpt::math::CMatrixTemplateNumeric< T >::Square (  )  [inline]

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
T mrpt::math::CMatrixTemplateNumeric< T >::squareNorm (  )  const [inline]

Return the square norm of the container (for matrices, as if it were a vector with all its elements).

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
double mrpt::math::CMatrixTemplateNumeric< T >::std ( bool  unbiased = true  )  const [inline]

Return the standard deviation of all the elements in the container.

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<typename OTHERMATRIX >
mrpt_autotype& mrpt::math::CMatrixTemplateNumeric< T >::substract_AAt ( const OTHERMATRIX &  m  )  [inline]

this -= A + AT

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<typename OTHERMATRIX >
mrpt_autotype& mrpt::math::CMatrixTemplateNumeric< T >::substract_Ac ( const OTHERMATRIX &  m,
const T  c 
) [inline]

Substract c (scalar) times A to this matrix: this -= A * c

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<typename OTHERMATRIX >
mrpt_autotype& mrpt::math::CMatrixTemplateNumeric< T >::substract_An ( const OTHERMATRIX &  m,
const size_t  n 
) [inline]

Substract n (integer) times A to this matrix: this -= A * n

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
template<typename OTHERMATRIX >
mrpt_autotype& mrpt::math::CMatrixTemplateNumeric< T >::substract_At ( const OTHERMATRIX &  m  )  [inline]

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
T mrpt::math::CMatrixTemplateNumeric< T >::sum ( size_t  firstRow = 0,
size_t  firstCol = 0,
size_t  lastRow = std::numeric_limits< size_t >::max(),
size_t  lastCol = std::numeric_limits< size_t >::max() 
) const

Returns the sum of a given part of the matrix.

The default value (std::numeric_limits<size_t>::max()) for the last column/row means to sum up to the last column/row.

See also:
sumAll
template<class T>
T mrpt::math::CMatrixTemplateNumeric< T >::sumAll (  )  const [inline]

Sum all the elements

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::svd ( CMatrixTemplateNumeric< T > &  U,
std::vector< T > &  W,
CMatrixTemplateNumeric< T > &  V 
) const

Computes the SVD (Singular Value Decomposition) of the matrix.

If "this" matrix is named A with dimensions M x N, this method computes:
A = U * W * V'

, where U is a M x N column orthogonal matrix, W is a diagonal matrix containing the singular values, and V is a NxN matrix.
This method returns the U matrix, the N elements in the diagonal of W as a vector, and the matrix V, NOT TRANSPOSED.

template<class T>
T mrpt::math::CMatrixTemplateNumeric< T >::trace (  )  const [inline]

The trace of this square matrix

Definition at line 118 of file CMatrixTemplateNumeric.h.

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::unit (  ) 

Build an unit matrix.

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::unit ( const size_t  row  ) 

Build an unit matrix.

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::zeros ( const size_t  row,
const size_t  col 
)

Set all elements to zero.

template<class T>
void mrpt::math::CMatrixTemplateNumeric< T >::zeros (  ) 

Set all elements to zero.




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