Linear Algebra
The following table shows linear algebra routines provided by NLCPy.
Matrix and Vector Products
Computes a dot product of two arrays. |
|
Computes an inner product of two arrays. |
|
Computes an outer product of two vectors. |
|
Matrix product of two arrays. |
Decompositions
Singular Value Decomposition. |
|
Cholesky decomposition. |
|
Computes the qr factorization of a matrix. |
Matrix Eigenvalues
Computes the eigenvalues and right eigenvectors of a square array. |
|
Computes the eigenvalues and eigenvectors of a complex Hermitian or a real symmetric matrix. |
|
Computes the eigenvalues of a general matrix. |
|
Computes the eigenvalues of a complex Hermitian or real symmetric matrix. |
Norms and Other Numbers
Returns matrix or vector norm. |
Solving Equations and Inverting Matrices
Solves a linear matrix equation, or system of linear scalar equations. |
|
Returns the least-squares solution to a linear matrix equation. |
|
Computes the (multiplicative) inverse of a matrix. |
Exceptions
Generic Python-exception-derived object raised by linalg functions. |
Linear Algebra on Several Matrices at Once
Several of the linear algebra routines listed above are able to compute results for several matrices at once, if they are stacked into the same array.
This is indicated in the documentation via input parameter specifications such as a : (..., M, M) array_like
.
This means that if for instance given an input array a.shape == (N, M, M)
, it is interpreted as a “stack” of N matrices, each of size M-by-M.
Similar specification applies to return values, for instance the inverse has ainv : (..., M, M)
and will in this case return an array of shape inv(a).shape == (N,M,M)
.
This generalizes to linear algebra operations on higher-dimensional arrays: the last 1 or 2 dimensions of a multidimensional array are interpreted as vectors or matrices, as appropriate for each operation.