Public Functions
int | matrixf_print( |
int | matrixf_add( |
int | matrixf_sub( |
int | matrixf_pmul( |
int | matrixf_pdiv( |
int | matrixf_mul( |
int | matrixf_div( |
float | matrixf_det( |
int | matrixf_trans( |
int | matrixf_hermitian( |
int | matrixf_mul_transpose( |
int | matrixf_transpose_mul( |
int | matrixf_mul_hermitian( |
int | matrixf_hermitian_mul( |
int | matrixf_aug( |
int | matrixf_inv( |
int | matrixf_eye( |
int | matrixf_ones( |
int | matrixf_zeros( |
int | matrixf_gjelim( |
int | matrixf_pivot( |
int | matrixf_swaprows( |
int | matrixf_linsolve( |
int | matrixf_cgsolve( |
int | matrixf_ludecomp_crout( |
int | matrixf_ludecomp_doolittle( |
int | matrixf_gramschmidt( |
int | matrixf_qrdecomp_gramschmidt( |
int | matrixf_chol( |
Interfaces
int matrixf_print(
Print array as matrix to stdout
- _x : input matrix, shape: (_r, _c)
- _r : rows in matrix
- _c : columns in matrix
int matrixf_add(
Perform point-wise addition between two matrices \(\vec{X}\) and \(\vec{Y}\), saving the result in the output matrix \(\vec{Z}\). That is, \(\vec{Z}_{i,j}=\vec{X}_{i,j}+\vec{Y}_{i,j} \), \( \forall_{i \in r} \) and \( \forall_{j \in c} \)
- _x : input matrix, shape: (_r, _c)
- _y : input matrix, shape: (_r, _c)
- _z : output matrix, shape: (_r, _c)
- _r : number of rows in each matrix
- _c : number of columns in each matrix
int matrixf_sub(
Perform point-wise subtraction between two matrices \(\vec{X}\) and \(\vec{Y}\), saving the result in the output matrix \(\vec{Z}\) That is, \(\vec{Z}_{i,j}=\vec{X}_{i,j}-\vec{Y}_{i,j} \), \( \forall_{i \in r} \) and \( \forall_{j \in c} \)
- _x : input matrix, shape: (_r, _c)
- _y : input matrix, shape: (_r, _c)
- _z : output matrix, shape: (_r, _c)
- _r : number of rows in each matrix
- _c : number of columns in each matrix
int matrixf_pmul(
Perform point-wise multiplication between two matrices \(\vec{X}\) and \(\vec{Y}\), saving the result in the output matrix \(\vec{Z}\) That is, \(\vec{Z}_{i,j}=\vec{X}_{i,j} \vec{Y}_{i,j} \), \( \forall_{i \in r} \) and \( \forall_{j \in c} \)
- _x : input matrix, shape: (_r, _c)
- _y : input matrix, shape: (_r, _c)
- _z : output matrix, shape: (_r, _c)
- _r : number of rows in each matrix
- _c : number of columns in each matrix
int matrixf_pdiv(
Perform point-wise division between two matrices \(\vec{X}\) and \(\vec{Y}\), saving the result in the output matrix \(\vec{Z}\) That is, \(\vec{Z}_{i,j}=\vec{X}_{i,j}/\vec{Y}_{i,j} \), \( \forall_{i \in r} \) and \( \forall_{j \in c} \)
- _x : input matrix, shape: (_r, _c)
- _y : input matrix, shape: (_r, _c)
- _z : output matrix, shape: (_r, _c)
- _r : number of rows in each matrix
- _c : number of columns in each matrix
int matrixf_mul(
Multiply two matrices \(\vec{X}\) and \(\vec{Y}\), storing the result in \(\vec{Z}\). NOTE: _rz = _rx, _cz = _cy, and _cx = _ry
- _x : input matrix, shape: (_rx, _cx)
- _rx : number of rows in _x
- _cx : number of columns in _x
- _y : input matrix, shape: (_ry, _cy)
- _ry : number of rows in _y
- _cy : number of columns in _y
- _z : output matrix, shape: (_rz, _cz)
- _rz : number of rows in _z
- _cz : number of columns in _z
int matrixf_div(
Solve \(\vec{X} = \vec{Y} \vec{Z}\) for \(\vec{Z}\) for square matrices of size \(n\)
- _x : input matrix, shape: (_n, _n)
- _y : input matrix, shape: (_n, _n)
- _z : output matrix, shape: (_n, _n)
- _n : number of rows and columns in each matrix
float matrixf_det(
Compute the determinant of a square matrix \(\vec{X}\)
- _x : input matrix, shape: (_r, _c)
- _r : rows
- _c : columns
int matrixf_trans(
Compute the in-place transpose of the matrix \(\vec{X}\)
- _x : input matrix, shape: (_r, _c)
- _r : rows
- _c : columns
int matrixf_hermitian(
Compute the in-place Hermitian transpose of the matrix \(\vec{X}\)
- _x : input matrix, shape: (_r, _c)
- _r : rows
- _c : columns
int matrixf_mul_transpose(
Compute \(\vec{X}\vec{X}^T\) on a \(m \times n\) matrix. The result is a \(m \times m\) matrix.
- _x : input matrix, shape: (_m, _n)
- _m : input rows
- _n : input columns
- _xxT : output matrix, shape: (_m, _m)
int matrixf_transpose_mul(
Compute \(\vec{X}^T\vec{X}\) on a \(m \times n\) matrix. The result is a \(n \times n\) matrix.
- _x : input matrix, shape: (_m, _n)
- _m : input rows
- _n : input columns
- _xTx : output matrix, shape: (_n, _n)
int matrixf_mul_hermitian(
Compute \(\vec{X}\vec{X}^H\) on a \(m \times n\) matrix. The result is a \(m \times m\) matrix.
- _x : input matrix, shape: (_m, _n)
- _m : input rows
- _n : input columns
- _xxH : output matrix, shape: (_m, _m)
int matrixf_hermitian_mul(
Compute \(\vec{X}^H\vec{X}\) on a \(m \times n\) matrix. The result is a \(n \times n\) matrix.
- _x : input matrix, shape: (_m, _n)
- _m : input rows
- _n : input columns
- _xHx : output matrix, shape: (_n, _n)
int matrixf_aug(
Augment two matrices \(\vec{X}\) and \(\vec{Y}\), storing the result in \(\vec{Z}\) NOTE: _rz = _rx = _ry, _rx = _ry, and _cz = _cx + _cy
- _x : input matrix, shape: (_rx, _cx)
- _rx : number of rows in _x
- _cx : number of columns in _x
- _y : input matrix, shape: (_ry, _cy)
- _ry : number of rows in _y
- _cy : number of columns in _y
- _z : output matrix, shape: (_rz, _cz)
- _rz : number of rows in _z
- _cz : number of columns in _z
int matrixf_inv(
Compute the inverse of a square matrix \(\vec{X}\)
- _x : input/output matrix, shape: (_r, _c)
- _r : rows
- _c : columns
int matrixf_eye(
Generate the identity square matrix of size \(n\)
- _x : output matrix, shape: (_n, _n)
- _n : dimensions of _x
int matrixf_ones(
Generate the all-ones matrix of size \(n\)
- _x : output matrix, shape: (_r, _c)
- _r : rows
- _c : columns
int matrixf_zeros(
Generate the all-zeros matrix of size \(n\)
- _x : output matrix, shape: (_r, _c)
- _r : rows
- _c : columns
int matrixf_gjelim(
Perform Gauss-Jordan elimination on matrix \(\vec{X}\)
- _x : input/output matrix, shape: (_r, _c)
- _r : rows
- _c : columns
int matrixf_pivot(
Pivot on element \(\vec{X}_{i,j}\)
- _x : output matrix, shape: (_r, _c)
- _r : rows of _x
- _c : columns of _x
- _i : pivot row
- _j : pivot column
int matrixf_swaprows(
Swap rows _r1 and _r2 of matrix \(\vec{X}\)
- _x : input/output matrix, shape: (_r, _c)
- _r : rows of _x
- _c : columns of _x
- _r1 : first row to swap
- _r2 : second row to swap
int matrixf_linsolve(
Solve linear system of \(n\) equations: \(\vec{A}\vec{x} = \vec{b}\)
- _A : system matrix, shape: (_n, _n)
- _n : system size
- _b : equality vector, shape: (_n, 1)
- _x : solution vector, shape: (_n, 1)
- _opts : options (ignored for now)
int matrixf_cgsolve(
Solve linear system of equations using conjugate gradient method.
- _A : symmetric positive definite square matrix
- _n : system dimension
- _b : equality, shape: (_n, 1)
- _x : solution estimate, shape: (_n, 1)
- _opts : options (ignored for now)
int matrixf_ludecomp_crout(
Perform L/U/P decomposition using Crout's method
- _x : input/output matrix, shape: (_rx, _cx)
- _rx : rows of _x
- _cx : columns of _x
- _l : first row to swap
- _u : first row to swap
- _p : first row to swap
int matrixf_ludecomp_doolittle(
Perform L/U/P decomposition, Doolittle's method
- _x : input/output matrix, shape: (_rx, _cx)
- _rx : rows of _x
- _cx : columns of _x
- _l : first row to swap
- _u : first row to swap
- _p : first row to swap
int matrixf_gramschmidt(
Perform orthnormalization using the Gram-Schmidt algorithm
- _A : input matrix, shape: (_r, _c)
- _r : rows
- _c : columns
- _v : output matrix
int matrixf_qrdecomp_gramschmidt(
Perform Q/R decomposition using the Gram-Schmidt algorithm such that \( \vec{A} = \vec{Q} \vec{R} \) and \( \vec{Q}^T \vec{Q} = \vec{I}_n \) and \(\vec{R\}\) is a diagonal \(m \times m\) matrix NOTE: all matrices are square
- _a : input matrix, shape: (_m, _m)
- _m : rows
- _n : columns (same as cols)
- _q : output matrix, shape: (_m, _m)
- _r : output matrix, shape: (_m, _m)
int matrixf_chol(
Compute Cholesky decomposition of a symmetric/Hermitian positive-definite matrix as \( \vec{A} = \vec{L}\vec{L}^T \)
- _a : input square matrix, shape: (_n, _n)
- _n : input matrix dimension
- _l : output lower-triangular matrix