#include <mi32/stddefns.h>
Go to the source code of this file.
Classes | |
| struct | _MATRIX |
Defines | |
| #define | MATFLAG_NoDiagonal 0x00000002 |
| #define | MATFLAG_Symmetric 0x00000001 |
| #define | MatGetValue(m, i, j) ((m)->matrix[i][j]) |
| #define | MatIsSymmetric(m) ((m)->flags&MATFLAG_Symmetric) |
| #define | MatSetValue(m, i, j, v) ((m)->matrix[i][j]=(v)) |
Typedefs | |
| typedef DEPRECATED struct _MATRIX * | MATRIX |
Functions | |
| int | MatAddMatrix (MATRIX outmatrix, MATRIX matrixA, MATRIX matrixB) |
| int | MatCopy (MATRIX *outmatrix, MATRIX inmatrix) |
| int | MatCreate (MATRIX *matrix, UINT16 rows, UINT16 cols, UINT32 flags) |
| void | MatDestroy (MATRIX matrix) |
| int | MatDeterminant (MATRIX matrix, double *detvalue) |
| int | MatEigenvectors (MATRIX matrix, MATRIX *vectors, MATRIX *values) |
| double | MatGetValueTest (MATRIX matrix, UINT16 row, UINT16 col) |
| int | MatInverse (MATRIX outmatrix, MATRIX inmatrix, int maxiterations, double maxerror) |
| int | MatMultMatrix (MATRIX outmatrix, MATRIX matrixA, MATRIX matrixB) |
| void | MatMultScalar (MATRIX matrix, double value) |
| int | MatPseudoInverse (MATRIX inverse, MATRIX input, double tolerance) |
| void | MatSetScalar (MATRIX matrix, double value) |
| int | MatSubMatrix (MATRIX outmatrix, MATRIX matrixA, MATRIX matrixB) |
| int | MatSVD (MATRIX A, MATRIX *U, MATRIX *W, MATRIX *V) |
| int | MatSVDSolve (MATRIX A, MATRIX B, MATRIX X, double tolerance) |
| int | MatSVDSolveAutoTolerance (MATRIX A, MATRIX B, MATRIX X) |
| int | MatSVDSolveAutoToleranceFast (MATRIX A, MATRIX U, MATRIX W, MATRIX V, MATRIX B, MATRIX X) |
| double | MatTrace (MATRIX matrix) |
| int | MatTranspose (MATRIX outmatrix, MATRIX inmatrix) |
Definitions for matrix manipulation functions
| #define MATFLAG_NoDiagonal 0x00000002 |
Don't allocate space for diagonal (symmetric only).
| #define MATFLAG_Symmetric 0x00000001 |
Matrix is symmetric.
| #define MatGetValue | ( | m, | |||
| i, | |||||
| j | ) | ((m)->matrix[i][j]) |
Retrieve value from matrix.
| #define MatIsSymmetric | ( | m | ) | ((m)->flags&MATFLAG_Symmetric) |
Determine if "symmetric" flag set for a matrix.
| #define MatSetValue | ( | m, | |||
| i, | |||||
| j, | |||||
| v | ) | ((m)->matrix[i][j]=(v)) |
Set single matrix entry to a specified value.
Add one matrix to another of the same size.
| outmatrix | Output matrix, may be the same as either input matrix | |
| matrixA | First input matrix | |
| matrixB | Second input matrix, if NULL will use outmatrix |
Copy one matrix to another.
The output matrix will be resized if it exists and is not the same size as the input matrix.
| outmatrix | Matrix to copy to, will be created if NULL | |
| inmatrix | Matrix to copy from |
Create a new matrix.
Flags: MATFLAG_Symmetric Matrix is symmetric, don't allocate space for elements above diagonal MATFLAG_NoDiagonal Don't allocate space for diagonal elements (symmetric only)
All matrix elements will be initialized to 0.
| matrix | Matrix returned | |
| rows | Number of rows in matrix | |
| cols | Number of columns in matrix | |
| flags | Flags |
| void MatDestroy | ( | MATRIX | matrix | ) |
Destroy a matrix.
| matrix | Matrix to be destroyed |
| int MatDeterminant | ( | MATRIX | matrix, | |
| double * | detvalue | |||
| ) |
Compute determinate of a square matrix.
| matrix | Matrix to compute determinant for | |
| detvalue | Determinant returned |
Compute eigenvectors and eigenvalues of the SYMMETRIC matrix.
WARNING: This function computes eigen-stuff for SYMMETRIC matrices ONLY. Example: correlation /covariation matrix. NO CHECKING IS PERFORMED ON INPUT TO MAKE SURE IT'S SYMMETRIC.
| matrix | Matrix to use | |
| vectors | Matrix returned, that contain eigenvectors as columns | |
| values | Matrix returned (vector), that contains eigenvalues |
Retrieve value from matrix with range check.
| matrix | Matrix to retrieve value from | |
| row | Row in matrix (0 - numrows-1) | |
| col | Column in matrix (0 - numcols-1) |
Compute inverse of a square matrix.
| outmatrix | Inverse matrix computed | |
| inmatrix | Matrix to compute inverse of | |
| maxiterations | Maximum iterations for convergence (0 for default) | |
| maxerror | Maximum error, (0.0 for default) |
Multiply one matrix by another.
| outmatrix | Output matrix, may be the same as either input matrix | |
| matrixA | Left matrix, will use outmatrix if NULL | |
| matrixB | Right matrix, will use outmatrix if NULL |
| void MatMultScalar | ( | MATRIX | matrix, | |
| double | value | |||
| ) |
Multiply a matrix by a scalar.
| matrix | Matrix to use | |
| value | Value to multiply all matrix elements by |
Compute pseudoinverse of the matrix using SVD.
If Input matrix is not singular pseudoinverse is equal to normal inverse of the matrix. EXPLANATION: Pseudoinverse is such matrix X that satisfy the following condition: A * X * A = A, if matrix A is singular X still exists.
| inverse | Output pseudoinverse | |
| input | Input matrix | |
| tolerance | Tolerance to use, if in doubt pass 0.0 and function will use built-in defaults |
| void MatSetScalar | ( | MATRIX | matrix, | |
| double | value | |||
| ) |
Set all entries in a matrix to a specified scalar value.
| matrix | Matrix to use | |
| value | Value to set all matrix elements to |
Subtract one matrix from another.
| outmatrix | Output matrix, may be the same as either input matrix | |
| matrixA | Matrix to subtract FROM | |
| matrixB | Second to subtract, if NULL will subtract matrixA from outmatrix |
Compute Singular Value Decomposition (SVD).
This function computes SVD as A = U * W * V ; Output matrix U has the same dimension as input matrix A. The diagonal matrix of singular values W is output as a vector. The matrix V (not transpose of V) is output as a matrix.
| A | Input matrix | |
| U | Returned | |
| W | Returned | |
| V | Returned |
Stable Solution of system of linear equation using SVD algorithm.
A * X = B where A(M x N) matrix and X (N) vector. B(M) is also a vector. X is the output solution vector. Matrix A is decomposed into U(M x N), W(N) and V(N x N) matrices using SVD operation.
| A | Input matrix of equations | |
| B | Input vector that contains right side of equations NOTE: you can pass ANY type of vector: numrows = 1 or numcols = 1 | |
| X | Solution returned | |
| tolerance | Tolerance to use, if in doubt pass 0.0 for defaults |
| X | Size of A->cols x 1 |
| double MatTrace | ( | MATRIX | matrix | ) |
Compute trace of the matrix: sum of it's diagonal elements.
| matrix | Matrix to use |
1.6.1