rtc::SMat< T, M > Class Template Reference
#include <rtcSMat.h>
List of all members.
Public Member Functions |
int | choleskyDecomp (SMat< T, M > &r) |
int | choleskyDecomp () |
void | choleskySolve (Vec< T, M > &b) |
T | 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 Vec< T, M > &diagVec) |
void | setDiag (const T a) |
void | setIdentity () |
template<class U > |
| SMat (const Mat< U, M, M > &m) |
| SMat (const Mat< T, M, M > &m) |
| SMat (const Vec< T, M > &diagVec) |
| SMat (const T diagVal) |
| SMat (const T *d) |
| SMat () |
T | 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>
Ctor that doesn't initialize anything.
Definition at line 92 of file rtcSMat.h.
Ctor that initializes from an array.
- Parameters:
-
| d | the (row major) data array of length M*M |
Definition at line 98 of file rtcSMat.h.
Ctor that makes a multiple of the identity matrix.
- Parameters:
-
| diagVal | the value to which all diagonal entries will be set |
Definition at line 104 of file rtcSMat.h.
Ctor that makes a (mostly) zero matrix with diagonal entries from vec.
- Parameters:
-
| diagVec | the vector of values that should appear on the diagonal |
Definition at line 113 of file rtcSMat.h.
template<class T , int M>
template<class U >
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 |
( |
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>
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>
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:
-
| b | the 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>
Return the determinant of this matrix. This uses the LU decomposition. Matrices of size 3 and under have specialized implementations.
Reimplemented in rtc::SMat2< T >, and rtc::SMat3< T >.
Definition at line 227 of file rtcSMat.h.
template<class T , int M>
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>
template<class T , int M>
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:
-
| indx | the row-swap vector returned from luDecomp() |
| b | the 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 Vec< T, M > & |
diagVec |
) |
[inline] |
Sets the diagonal entries of matrix from a vector. without changing other entries.
- Parameters:
-
| diagVec | the 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 >::setDiag |
( |
const T |
diagVal |
) |
[inline] |
Sets matrix to a multiple of the identity matrix.
- Parameters:
-
| diagVal | the 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 >::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: