#include <otMatrix.h>
Public Types | |
enum | InitZero { InitMatWithZero, NoInitMatZero } |
Public Member Functions | |
otMatrix () | |
otMatrix (const S16 _i16row, const S16 _i16col, InitZero _init=InitMatWithZero) | |
otMatrix (const S16 _i16row, const S16 _i16col, F32 *initData) | |
void | create (const S16 _i16row, const S16 _i16col, InitZero _init=InitMatWithZero) |
void | create (const S16 _i16row, const S16 _i16col, F32 *initData) |
void | close () |
bool | isValid () |
bool | isSquare () |
S16 | getRow () |
S16 | getCol () |
bool | operator== (otMatrix _compare) |
otMatrix | operator+ (otMatrix _matAdd) |
otMatrix | operator- (otMatrix _matSub) |
otMatrix | operator- (void) |
otMatrix | operator * (otMatrix _matMul) |
otMatrix | operator= (otMatrix _mat) |
void | vSetHomogen (const F32 _val) |
void | vRoundingElementToZero (const S16 _i, const S16 _j) |
otMatrix | RoundingMatrixToZero () |
void | vSetToZero () |
void | vSetRandom (const S32 _maxRand, const S32 _minRand) |
void | vSetDiag (const F32 _val) |
void | vSetIdentity () |
void | Copy (otMatrix &_outp) |
otMatrix | InsertVector (otMatrix _Vector, const S16 _posColumn) |
otMatrix | InsertSubMatrix (otMatrix _subMatrix, const S16 _posRow, const S16 _posColumn) |
otMatrix | InsertSubMatrix (otMatrix _subMatrix, const S16 _posRow, const S16 _posColumn, const S16 _lenRow, const S16 _lenColumn) |
otMatrix | InsertSubMatrix (otMatrix _subMatrix, const S16 _posRow, const S16 _posColumn, const S16 _posRowSub, const S16 _posColumnSub, const S16 _lenRow, const S16 _lenColumn) |
otMatrix | Transpose () |
bool | bNormVector () |
otMatrix | Invers () |
bool | bMatrixIsPositiveDefinite (bool checkPosSemidefinite=false) |
otMatrix | GetDiagonalEntries (void) |
otMatrix | CholeskyDec () |
otMatrix | HouseholderTransformQR (const S16 _rowTransform, const S16 _columnTransform) |
bool | QRDec (otMatrix &Qt, otMatrix &R) |
otMatrix | BackSubtitution (otMatrix &A, otMatrix &B) |
otMatrix | ForwardSubtitution (otMatrix &A, otMatrix &B) |
Static Public Member Functions | |
static void | garbageClean (U32 start=0) |
|
|
|
Create the class |
|
Create and init the matrix
|
|
Create and init the matrix
|
|
Do the back-subtitution operation for upper triangular matrix A & column matrix B to solve x: x = BackSubtitution(A, B);
|
|
Use elemtary row operation to reduce the matrix into upper triangular form (like in the first phase of gauss-jordan algorithm). Useful if we want to check the matrix as positive definite or not (can be used before calling CholeskyDec function).
|
|
Normalize the vector
|
|
Do the Cholesky Decomposition using Cholesky-Crout algorithm. A = L * L' ; A = real, positive definite, and symmetry MxM matrix L = A.CholeskyDec();
|
|
Free all allocated memory and set the matrix as invalid. Use this function only for dynamic allocation when the matrix is greather then 6x6 |
|
Copy this matrix content to a destination matrix. Matrix size must be the same.
|
|
Create and init the matrix
|
|
Create and init the matrix
|
|
Perform forward-substitution operations on triangular matrix A & matrix column B. To save computation, matrix A is not done triangular checking (assumed to be lower-triangular).
|
|
C++ overloading produces several intermediate classes that are allocated in memory but not reachable. This is the only way to free the memory of all these unreachable objects. Run this function at the end of matrix process. Use this function only for dynamic allocation when the matrix is greather then 6x6 |
|
Read number of matrix columns
|
|
For square matrix 'this' with size MxM, return vector Mx1 with entries corresponding with diagonal entries of 'this'. * Example: this = [a11 a12 a13] * [a21 a22 a23] * [a31 a32 a33] * * out = this.GetDiagonalEntries() = [a11] * [a22] * [a33] *
|
|
Read number of matrix rows
|
|
Do the Householder Transformation for QR Decomposition operation.
|
|
Insert the _lenRow & _lenColumn submatrix, start from _posRowSub & _posColumnSub submatrix; into matrix at the matrix's _posRow and _posColumn position. * Example: A = Matrix 4x4, B = Matrix 2x3 * * C = A.InsertSubMatrix(B, 1, 1, 0, 1, 1, 2); * * A = [A00 A01 A02 A03] B = [B00 B01 B02] * [A10 A11 A12 A13] [B10 B11 B12] * [A20 A21 A22 A23] * [A30 A31 A32 A33] * * * C = [A00 A01 A02 A03] * [A10 B01 B02 A13] * [A20 A21 A22 A23] * [A30 A31 A32 A33] *
|
|
Insert the first _lenRow-th and first _lenColumn-th submatrix into matrix; at the matrix's _posRow and _posColumn position. * Example: A = Matrix 4x4, B = Matrix 2x3 * C = A.InsertSubMatrix(B, 1, 1, 2, 2); * * A = [A00 A01 A02 A03] B = [B00 B01 B02] * [A10 A11 A12 A13] [B10 B11 B12] * [A20 A21 A22 A23] * [A30 A31 A32 A33] * * * C = [A00 A01 A02 A03] * [A10 B00 B01 A13] * [A20 B10 B11 A23] * [A30 A31 A32 A33] *
|
|
Insert submatrix into matrix at _posRow & _posColumn position * Example: A = Matrix 4x4, B = Matrix 2x3 * * C = A.InsertSubMatrix(B, 1, 1); * * A = [A00 A01 A02 A03] B = [B00 B01 B02] * [A10 A11 A12 A13] [B10 B11 B12] * [A20 A21 A22 A23] * [A30 A31 A32 A33] * * * C = [A00 A01 A02 A03] * [A10 B00 B01 B02] * [A20 B10 B11 B12] * [A30 A31 A32 A33] *
|
|
Insert vector into matrix at _posColumn position * Example: A = Matrix 3x3, B = Vector 3x1 * * C = A.InsertVector(B, 1); * * A = [A00 A01 A02] B = [B00] * [A10 A11 A12] [B10] * [A20 A21 A22] [B20] * * C = [A00 B00 A02] * [A10 B10 A12] * [A20 B20 A22] *
|
|
Invers operation using Gauss-Jordan algorithm.
|
|
Check if the matrix is square
|
|
Check if the matrix is valid or not
|
|
C++ overloading for matrix multiply |
|
C++ overloading for matrix add |
|
C++ overloading for matrix unary operation |
|
C++ overloading for matrix subtract |
|
C++ overloading for matrix assign |
|
C++ overloading for matrix compare |
|
Do the QR Decomposition for matrix using Householder Transformation. WARNING! The matrix calculated by this function return Q' and R (Q transpose and R). Because QR Decomposition usually used to calculate solution for least-squares equation (that need Q'), we don't do the transpose of Q inside this routine to lower the computation cost). * Example of using QRDec to solve least-squares: * Ax = b * (QR)x = b * Rx = Q'b --> Afterward use back-subtitution to solve x *
|
|
Round all matrix to 0 |
|
Return the transpose of the matrix. Reverse rows with columns.
|
|
Round to 0 specified matrix location |
|
Set diagonal matrix at specified value and clear the rest
|
|
Set initial value for all matrix contents |
|
Set as unitary matrix. Same as vSetHomogen(1.0) |
|
Set all matrix to random value
|
|
Set all matrix to 0. Same as vSetHomogen(0.0) |