LinearAlgebra
Class for linear algebra for Matrix
class.
- These methods can be used in the
Matrix
method chain. - This class cannot be called directly.
Static Method Summary
Static Public Methods | ||
public static |
cond(mat: KMatrixInputData, p: KMatrixInputData): number Condition number of the matrix |
|
public static |
det(mat: KMatrixInputData): Matrix Determinant. |
|
public static |
eig(mat: KMatrixInputData): {V: Matrix, D: Matrix} Eigendecomposition of symmetric matrix. |
|
public static |
inner(A: KMatrixInputData, B: KMatrixInputData, dimension: KMatrixInputData): Matrix Inner product/Dot product. |
|
public static |
inv(mat: KMatrixInputData): Matrix Inverse matrix of this matrix. |
|
public static |
linsolve(mat: KMatrixInputData, number: KMatrixInputData): Matrix Solving a system of linear equations to be Ax = B |
|
public static |
lu(mat: KMatrixInputData): {L: Matrix, U: Matrix} LU decomposition. |
|
public static |
lup(mat: KMatrixInputData): {P: Matrix, L: Matrix, U: Matrix} LUP decomposition. |
|
public static |
norm(mat: KMatrixInputData, p: KMatrixInputData): number p-norm. |
|
public static |
pinv(mat: KMatrixInputData): Matrix Pseudo-inverse matrix. |
|
public static |
qr(mat: KMatrixInputData): {Q: Matrix, R: Matrix} QR decomposition. |
|
public static |
rank(mat: KMatrixInputData, tolerance: KMatrixInputData): number Rank. |
|
public static |
rcond(mat: KMatrixInputData): number Inverse condition number. |
|
public static |
svd(mat: KMatrixInputData): {U: Matrix, S: Matrix, V: Matrix} Singular Value Decomposition (SVD). |
|
public static |
trace(mat: KMatrixInputData): Complex Trace of a matrix. |
|
public static |
tridiagonalize(mat: KMatrixInputData): {P: Matrix, H: Matrix} Tridiagonalization of symmetric matrix. |
Static Public Methods
public static cond(mat: KMatrixInputData, p: KMatrixInputData): number source
Condition number of the matrix
Params:
Name | Type | Attribute | Description |
mat | KMatrixInputData | ||
p | KMatrixInputData |
|
public static det(mat: KMatrixInputData): Matrix source
Determinant.
Params:
Name | Type | Attribute | Description |
mat | KMatrixInputData |
public static eig(mat: KMatrixInputData): {V: Matrix, D: Matrix} source
Eigendecomposition of symmetric matrix.
- Don't support complex numbers.
- VDV'=A.
- V is orthonormal matrix. and columns of V are the right eigenvectors.
- D is a matrix containing the eigenvalues on the diagonal component.
Params:
Name | Type | Attribute | Description |
mat | KMatrixInputData | A |
TODO:
- 対称行列しか対応できていないので、対称行列ではないものはQR分解を用いた手法に切り替える予定。
public static inner(A: KMatrixInputData, B: KMatrixInputData, dimension: KMatrixInputData): Matrix source
Inner product/Dot product.
Params:
Name | Type | Attribute | Description |
A | KMatrixInputData | ||
B | KMatrixInputData | ||
dimension | KMatrixInputData |
|
Dimension of matrix used for calculation. (1 or 2) |
public static inv(mat: KMatrixInputData): Matrix source
Inverse matrix of this matrix.
Params:
Name | Type | Attribute | Description |
mat | KMatrixInputData | A |
public static linsolve(mat: KMatrixInputData, number: KMatrixInputData): Matrix source
Solving a system of linear equations to be Ax = B
Params:
Name | Type | Attribute | Description |
mat | KMatrixInputData | A |
|
number | KMatrixInputData | B |
TODO:
- 安定化のためQR分解を用いた手法に切り替える。あるいはlup分解を使用した関数に作り替える。
public static lu(mat: KMatrixInputData): {L: Matrix, U: Matrix} source
LU decomposition.
- L*U=A
- L is lower triangular matrix.
- U is upper triangular matrix.
Params:
Name | Type | Attribute | Description |
mat | KMatrixInputData | A |
public static lup(mat: KMatrixInputData): {P: Matrix, L: Matrix, U: Matrix} source
LUP decomposition.
- P'LU=A
- P is permutation matrix.
- L is lower triangular matrix.
- U is upper triangular matrix.
Params:
Name | Type | Attribute | Description |
mat | KMatrixInputData | A |
public static norm(mat: KMatrixInputData, p: KMatrixInputData): number source
p-norm.
Params:
Name | Type | Attribute | Description |
mat | KMatrixInputData | ||
p | KMatrixInputData |
|
public static pinv(mat: KMatrixInputData): Matrix source
Pseudo-inverse matrix.
Params:
Name | Type | Attribute | Description |
mat | KMatrixInputData | A |
public static qr(mat: KMatrixInputData): {Q: Matrix, R: Matrix} source
QR decomposition.
- Q*R=A
- Q is orthonormal matrix.
- R is upper triangular matrix.
Params:
Name | Type | Attribute | Description |
mat | KMatrixInputData | A |
public static rank(mat: KMatrixInputData, tolerance: KMatrixInputData): number source
Rank.
Params:
Name | Type | Attribute | Description |
mat | KMatrixInputData | ||
tolerance | KMatrixInputData |
|
Calculation tolerance of calculation. |
public static rcond(mat: KMatrixInputData): number source
Inverse condition number.
Params:
Name | Type | Attribute | Description |
mat | KMatrixInputData |
public static svd(mat: KMatrixInputData): {U: Matrix, S: Matrix, V: Matrix} source
Singular Value Decomposition (SVD).
- USV'=A
- U and V are orthonormal matrices.
- S is a matrix with singular values in the diagonal.
Params:
Name | Type | Attribute | Description |
mat | KMatrixInputData | A |
public static trace(mat: KMatrixInputData): Complex source
Trace of a matrix. Sum of diagonal elements.
Params:
Name | Type | Attribute | Description |
mat | KMatrixInputData |
public static tridiagonalize(mat: KMatrixInputData): {P: Matrix, H: Matrix} source
Tridiagonalization of symmetric matrix.
- Don't support complex numbers.
- PHP'=A
- P is orthonormal matrix.
- H is tridiagonal matrix.
- The eigenvalues of H match the eigenvalues of A.
Params:
Name | Type | Attribute | Description |
mat | KMatrixInputData | A |