Public Member Functions
rtc::SMat< T, M > Class Template Reference

#include <rtcSMat.h>

Inheritance diagram for rtc::SMat< T, M >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

int choleskyDecomp ()
int choleskyDecomp (SMat< T, M > &r)
void choleskySolve (Vec< T, M > &b)
det () const
Vec< T, M > getDiag ()
int invert ()
SMat< T, M > inverted () const
SMat< T, M > & leftMultiply (const SMat< T, M > &m)
int luDecomp (Vec< int, M > &indx, T *d=NULL)
void luSolve (const Vec< int, M > &indx, Vec< T, M > &b)
SMat< T, M-1 > minorMat (const int ip, const int jp) const
void setDiag (const T a)
void setDiag (const Vec< T, M > &diagVec)
void setIdentity ()
 SMat ()
 SMat (const T *d)
 SMat (const T diagVal)
 SMat (const Vec< T, M > &diagVec)
 SMat (const Mat< T, M, M > &m)
template<class U >
 SMat (const Mat< U, M, M > &m)
trace () const
void transpose ()

Detailed Description

template<class T, int M>
class rtc::SMat< T, M >

A square matrix. A specialization of a general matrix that provides operations only possible on square matrices like guassian elimination and Cholesky decomposition.

Definition at line 42 of file rtcSMat.h.


Constructor & Destructor Documentation

template<class T , int M>
rtc::SMat< T, M >::SMat ( ) [inline]

Ctor that doesn't initialize anything.

Definition at line 92 of file rtcSMat.h.

template<class T, int M>
rtc::SMat< T, M >::SMat ( const T *  d) [inline]

Ctor that initializes from an array.

Parameters:
dthe (row major) data array of length M*M

Definition at line 98 of file rtcSMat.h.

template<class T, int M>
rtc::SMat< T, M >::SMat ( const T  diagVal) [inline]

Ctor that makes a multiple of the identity matrix.

Parameters:
diagValthe value to which all diagonal entries will be set

Definition at line 104 of file rtcSMat.h.

template<class T, int M>
rtc::SMat< T, M >::SMat ( const Vec< T, M > &  diagVec) [inline]

Ctor that makes a (mostly) zero matrix with diagonal entries from vec.

Parameters:
diagVecthe vector of values that should appear on the diagonal

Definition at line 113 of file rtcSMat.h.

template<class T, int M>
rtc::SMat< T, M >::SMat ( const Mat< T, M, M > &  m) [inline]

Ctor that initializes from a Mat<T,M,M>

Definition at line 121 of file rtcSMat.h.

template<class T , int M>
template<class U >
rtc::SMat< T, M >::SMat ( const Mat< U, M, M > &  m) [inline]

Casting Ctor that initializes from a Mat<U,M,M>

Definition at line 128 of file rtcSMat.h.


Member Function Documentation

template<class T , int M>
int rtc::SMat< T, M >::choleskyDecomp ( ) [inline]

Perform the Cholesky Decomposition in place. Only the upper triangle (including the diagonal) is used as source data. The result is stored in the lower triangle (including the diagonal).

Returns:
1 on failure (matrix not positive definite), 0 on success

Definition at line 361 of file rtcSMat.h.

template<class T, int M>
int rtc::SMat< T, M >::choleskyDecomp ( SMat< T, M > &  r) [inline]

Perform the Cholesky Decomposition and stores the result in r.

Returns:
1 on failure (matrix not positive definite), 0 on success

Definition at line 379 of file rtcSMat.h.

template<class T, int M>
void rtc::SMat< T, M >::choleskySolve ( Vec< T, M > &  b) [inline]

Perform a Cholesky Decomposition backsolve with given RHS. Precondtion: choleskyDecomp() has already been called

Parameters:
bthe RHS vector in the equation A*x = b
Returns:
b is also the solution, overwriting the passed RHS

Definition at line 396 of file rtcSMat.h.

template<class T , int M>
T rtc::SMat< T, M >::det ( ) const [inline]

Return the determinant of this matrix. This uses the LU decomposition. Matrices of size 3 and under have specialized implementations.

Reimplemented in rtc::SMat3< T >, and rtc::SMat2< T >.

Definition at line 227 of file rtcSMat.h.

template<class T , int M>
Vec< T, M > rtc::SMat< T, M >::getDiag ( ) [inline]

Get the diagonal entries of the matrix.

Returns:
vector of the diagonal entries.

Definition at line 174 of file rtcSMat.h.

template<class T , int M>
int rtc::SMat< T, M >::invert ( ) [inline]

Return the inverse of this matrix This uses the LU decomposition

Reimplemented in rtc::SMat3< T >, and rtc::SMat2< T >.

Definition at line 258 of file rtcSMat.h.

template<class T , int M>
SMat< T, M > rtc::SMat< T, M >::inverted ( ) const [inline]

Return the inverse of this matrix This uses the LU decomposition

Reimplemented in rtc::Transform2D< T >, rtc::Transform< T >, rtc::Transform< float >, rtc::SMat3< T >, and rtc::SMat2< T >.

Definition at line 238 of file rtcSMat.h.

template<class T, int M>
SMat< T, M > & rtc::SMat< T, M >::leftMultiply ( const SMat< T, M > &  m) [inline]

Matrix-Matrix multiplication from the left.

Definition at line 163 of file rtcSMat.h.

template<class T, int M>
int rtc::SMat< T, M >::luDecomp ( Vec< int, M > &  indx,
T *  d = NULL 
) [inline]

Perform the LU Decomposition in place

Returns:
indx output vector that records the row permutation effected by the partial pivoting
d (optional) is +/- 1 depending on if there were an even (+) or odd (-) number of row-interchanges (used to compute determinant).
1 on failure (matrix singular), 0 on success

Definition at line 283 of file rtcSMat.h.

template<class T, int M>
void rtc::SMat< T, M >::luSolve ( const Vec< int, M > &  indx,
Vec< T, M > &  b 
) [inline]

Perform a LU Decomposition backsolve with given RHS. Precondtion: luDecomp(indx,d) has already been called

Parameters:
indxthe row-swap vector returned from luDecomp()
bthe RHS vector in the equation A*x = b
Returns:
b is also the solution, overwriting the passed RHS

Definition at line 338 of file rtcSMat.h.

template<class T , int M>
SMat< T, M-1 > rtc::SMat< T, M >::minorMat ( const int  ip,
const int  jp 
) const [inline]

Return the minor of this matrix about element (ip,jp)

Definition at line 201 of file rtcSMat.h.

template<class T, int M>
void rtc::SMat< T, M >::setDiag ( const T  diagVal) [inline]

Sets matrix to a multiple of the identity matrix.

Parameters:
diagValthe value to which all diagonal entries will be set

Definition at line 145 of file rtcSMat.h.

template<class T, int M>
void rtc::SMat< T, M >::setDiag ( const Vec< T, M > &  diagVec) [inline]

Sets the diagonal entries of matrix from a vector. without changing other entries.

Parameters:
diagVecthe vector of values that should appear on the diagonal

Definition at line 155 of file rtcSMat.h.

template<class T , int M>
void rtc::SMat< T, M >::setIdentity ( ) [inline]

Sets matrix to an identiy matrix, where the diagonal elements are equal to 1 and every other element equals 0.

Definition at line 136 of file rtcSMat.h.

template<class T , int M>
T rtc::SMat< T, M >::trace ( ) const [inline]

Return the trace of the matrix

Definition at line 185 of file rtcSMat.h.

template<class T , int M>
void rtc::SMat< T, M >::transpose ( ) [inline]

Transposes this matrix in place, overwriting old data

Definition at line 194 of file rtcSMat.h.


The documentation for this class was generated from the following file:


rtc
Author(s): Benjamin Pitzer
autogenerated on Thu Jan 2 2014 11:04:54