matrixcf

Variants: matrix, matrixc, matrixcf, matrixf

Public Functions

int matrixcf_print(float complex * _x, unsigned int _r, unsigned int _c)
int matrixcf_add(float complex * _x, float complex * _y, float complex * _z, unsigned int _r, unsigned int _c)
int matrixcf_sub(float complex * _x, float complex * _y, float complex * _z, unsigned int _r, unsigned int _c)
int matrixcf_pmul(float complex * _x, float complex * _y, float complex * _z, unsigned int _r, unsigned int _c)
int matrixcf_pdiv(float complex * _x, float complex * _y, float complex * _z, unsigned int _r, unsigned int _c)
int matrixcf_mul(float complex * _x, unsigned int _rx, unsigned int _cx, float complex * _y, unsigned int _ry, unsigned int _cy, float complex * _z, unsigned int _rz, unsigned int _cz)
int matrixcf_div(float complex * _x, float complex * _y, float complex * _z, unsigned int _n)
float complex matrixcf_det(float complex * _x, unsigned int _r, unsigned int _c)
int matrixcf_trans(float complex * _x, unsigned int _r, unsigned int _c)
int matrixcf_hermitian(float complex * _x, unsigned int _r, unsigned int _c)
int matrixcf_mul_transpose(float complex * _x, unsigned int _m, unsigned int _n, float complex * _xxT)
int matrixcf_transpose_mul(float complex * _x, unsigned int _m, unsigned int _n, float complex * _xTx)
int matrixcf_mul_hermitian(float complex * _x, unsigned int _m, unsigned int _n, float complex * _xxH)
int matrixcf_hermitian_mul(float complex * _x, unsigned int _m, unsigned int _n, float complex * _xHx)
int matrixcf_aug(float complex * _x, unsigned int _rx, unsigned int _cx, float complex * _y, unsigned int _ry, unsigned int _cy, float complex * _z, unsigned int _rz, unsigned int _cz)
int matrixcf_inv(float complex * _x, unsigned int _r, unsigned int _c)
int matrixcf_eye(float complex * _x, unsigned int _n)
int matrixcf_ones(float complex * _x, unsigned int _r, unsigned int _c)
int matrixcf_zeros(float complex * _x, unsigned int _r, unsigned int _c)
int matrixcf_gjelim(float complex * _x, unsigned int _r, unsigned int _c)
int matrixcf_pivot(float complex * _x, unsigned int _r, unsigned int _c, unsigned int _i, unsigned int _j)
int matrixcf_swaprows(float complex * _x, unsigned int _r, unsigned int _c, unsigned int _r1, unsigned int _r2)
int matrixcf_linsolve(float complex * _A, unsigned int _n, float complex * _b, float complex * _x, void * _opts)
int matrixcf_cgsolve(float complex * _A, unsigned int _n, float complex * _b, float complex * _x, void * _opts)
int matrixcf_ludecomp_crout(float complex * _x, unsigned int _rx, unsigned int _cx, float complex * _l, float complex * _u, float complex * _p)
int matrixcf_ludecomp_doolittle(float complex * _x, unsigned int _rx, unsigned int _cx, float complex * _l, float complex * _u, float complex * _p)
int matrixcf_gramschmidt(float complex * _A, unsigned int _r, unsigned int _c, float complex * _v)
int matrixcf_qrdecomp_gramschmidt(float complex * _a, unsigned int _m, unsigned int _n, float complex * _q, float complex * _r)
int matrixcf_chol(float complex * _a, unsigned int _n, float complex * _l)

Interfaces

int matrixcf_print(float complex * _x, unsigned int _r, unsigned int _c)

Print array as matrix to stdout

  • _x : input matrix, shape: (_r, _c)
  • _r : rows in matrix
  • _c : columns in matrix

int matrixcf_add(float complex * _x, float complex * _y, float complex * _z, unsigned int _r, unsigned int _c)

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 matrixcf_sub(float complex * _x, float complex * _y, float complex * _z, unsigned int _r, unsigned int _c)

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 matrixcf_pmul(float complex * _x, float complex * _y, float complex * _z, unsigned int _r, unsigned int _c)

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 matrixcf_pdiv(float complex * _x, float complex * _y, float complex * _z, unsigned int _r, unsigned int _c)

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 matrixcf_mul(float complex * _x, unsigned int _rx, unsigned int _cx, float complex * _y, unsigned int _ry, unsigned int _cy, float complex * _z, unsigned int _rz, unsigned int _cz)

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 matrixcf_div(float complex * _x, float complex * _y, float complex * _z, unsigned int _n)

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 complex matrixcf_det(float complex * _x, unsigned int _r, unsigned int _c)

Compute the determinant of a square matrix \(\vec{X}\)

  • _x : input matrix, shape: (_r, _c)
  • _r : rows
  • _c : columns

int matrixcf_trans(float complex * _x, unsigned int _r, unsigned int _c)

Compute the in-place transpose of the matrix \(\vec{X}\)

  • _x : input matrix, shape: (_r, _c)
  • _r : rows
  • _c : columns

int matrixcf_hermitian(float complex * _x, unsigned int _r, unsigned int _c)

Compute the in-place Hermitian transpose of the matrix \(\vec{X}\)

  • _x : input matrix, shape: (_r, _c)
  • _r : rows
  • _c : columns

int matrixcf_mul_transpose(float complex * _x, unsigned int _m, unsigned int _n, float complex * _xxT)

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 matrixcf_transpose_mul(float complex * _x, unsigned int _m, unsigned int _n, float complex * _xTx)

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 matrixcf_mul_hermitian(float complex * _x, unsigned int _m, unsigned int _n, float complex * _xxH)

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 matrixcf_hermitian_mul(float complex * _x, unsigned int _m, unsigned int _n, float complex * _xHx)

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 matrixcf_aug(float complex * _x, unsigned int _rx, unsigned int _cx, float complex * _y, unsigned int _ry, unsigned int _cy, float complex * _z, unsigned int _rz, unsigned int _cz)

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 matrixcf_inv(float complex * _x, unsigned int _r, unsigned int _c)

Compute the inverse of a square matrix \(\vec{X}\)

  • _x : input/output matrix, shape: (_r, _c)
  • _r : rows
  • _c : columns

int matrixcf_eye(float complex * _x, unsigned int _n)

Generate the identity square matrix of size \(n\)

  • _x : output matrix, shape: (_n, _n)
  • _n : dimensions of _x

int matrixcf_ones(float complex * _x, unsigned int _r, unsigned int _c)

Generate the all-ones matrix of size \(n\)

  • _x : output matrix, shape: (_r, _c)
  • _r : rows
  • _c : columns

int matrixcf_zeros(float complex * _x, unsigned int _r, unsigned int _c)

Generate the all-zeros matrix of size \(n\)

  • _x : output matrix, shape: (_r, _c)
  • _r : rows
  • _c : columns

int matrixcf_gjelim(float complex * _x, unsigned int _r, unsigned int _c)

Perform Gauss-Jordan elimination on matrix \(\vec{X}\)

  • _x : input/output matrix, shape: (_r, _c)
  • _r : rows
  • _c : columns

int matrixcf_pivot(float complex * _x, unsigned int _r, unsigned int _c, unsigned int _i, unsigned int _j)

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 matrixcf_swaprows(float complex * _x, unsigned int _r, unsigned int _c, unsigned int _r1, unsigned int _r2)

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 matrixcf_linsolve(float complex * _A, unsigned int _n, float complex * _b, float complex * _x, void * _opts)

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 matrixcf_cgsolve(float complex * _A, unsigned int _n, float complex * _b, float complex * _x, void * _opts)

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 matrixcf_ludecomp_crout(float complex * _x, unsigned int _rx, unsigned int _cx, float complex * _l, float complex * _u, float complex * _p)

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 matrixcf_ludecomp_doolittle(float complex * _x, unsigned int _rx, unsigned int _cx, float complex * _l, float complex * _u, float complex * _p)

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 matrixcf_gramschmidt(float complex * _A, unsigned int _r, unsigned int _c, float complex * _v)

Perform orthnormalization using the Gram-Schmidt algorithm

  • _A : input matrix, shape: (_r, _c)
  • _r : rows
  • _c : columns
  • _v : output matrix

int matrixcf_qrdecomp_gramschmidt(float complex * _a, unsigned int _m, unsigned int _n, float complex * _q, float complex * _r)

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 matrixcf_chol(float complex * _a, unsigned int _n, float complex * _l)

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