Linear algebra (scipy.linalg
)¶
Linear algebra functions.
See also
numpy.linalg
for more linear algebra functions. Note that
although scipy.linalg
imports most of them, identically named
functions from scipy.linalg
may offer more or slightly differing
functionality.
Basics¶
|
Compute the inverse of a matrix. |
|
Solves the linear equation set |
|
Solve the equation a x = b for x, assuming a is banded matrix. |
|
Solve equation a x = b. |
|
Solve C x = b for x, where C is a circulant matrix. |
|
Solve the equation a x = b for x, assuming a is a triangular matrix. |
|
Solve a Toeplitz system using Levinson Recursion |
|
Compute the determinant of a matrix |
|
Matrix or vector norm. |
|
Compute least-squares solution to equation Ax = b. |
|
Compute the (Moore-Penrose) pseudo-inverse of a matrix. |
|
Compute the (Moore-Penrose) pseudo-inverse of a matrix. |
|
Compute the (Moore-Penrose) pseudo-inverse of a Hermitian matrix. |
|
Kronecker product. |
|
Khatri-rao product |
|
Make a copy of a matrix with elements above the kth diagonal zeroed. |
|
Make a copy of a matrix with elements below the kth diagonal zeroed. |
|
Compute the matrix solution of the orthogonal Procrustes problem. |
|
Compute a diagonal similarity transformation for row/column balancing. |
|
Compute the subspace angles between two matrices. |
Generic Python-exception-derived object raised by linalg functions. |
|
The warning emitted when a linear algebra related operation is close to fail conditions of the algorithm or loss of accuracy is expected. |
Eigenvalue Problems¶
|
Solve an ordinary or generalized eigenvalue problem of a square matrix. |
|
Compute eigenvalues from an ordinary or generalized eigenvalue problem. |
|
Solve a standard or generalized eigenvalue problem for a complex Hermitian or real symmetric matrix. |
|
Solves a standard or generalized eigenvalue problem for a complex Hermitian or real symmetric matrix. |
|
Solve real symmetric or complex Hermitian band matrix eigenvalue problem. |
|
Solve real symmetric or complex Hermitian band matrix eigenvalue problem. |
|
Solve eigenvalue problem for a real symmetric tridiagonal matrix. |
|
Solve eigenvalue problem for a real symmetric tridiagonal matrix. |
Decompositions¶
|
Compute pivoted LU decomposition of a matrix. |
|
Compute pivoted LU decomposition of a matrix. |
|
Solve an equation system, a x = b, given the LU factorization of a |
|
Singular Value Decomposition. |
|
Compute singular values of a matrix. |
|
Construct the sigma matrix in SVD from singular values and size M, N. |
|
Construct an orthonormal basis for the range of A using SVD |
|
Construct an orthonormal basis for the null space of A using SVD |
|
Computes the LDLt or Bunch-Kaufman factorization of a symmetric/ hermitian matrix. |
|
Compute the Cholesky decomposition of a matrix. |
|
Cholesky decompose a banded Hermitian positive-definite matrix |
|
Compute the Cholesky decomposition of a matrix, to use in cho_solve |
|
Solve the linear equations A x = b, given the Cholesky factorization of A. |
|
Solve the linear equations |
|
Compute the polar decomposition. |
|
Compute QR decomposition of a matrix. |
|
Calculate the QR decomposition and multiply Q with a matrix. |
|
Rank-k QR update |
|
QR downdate on row or column deletions |
|
QR update on row or column insertions |
|
Compute RQ decomposition of a matrix. |
|
QZ decomposition for generalized eigenvalues of a pair of matrices. |
|
QZ decomposition for a pair of matrices with reordering. |
|
Compute Schur decomposition of a matrix. |
|
Convert real Schur form to complex Schur form. |
|
Compute Hessenberg form of a matrix. |
|
Converts complex eigenvalues |
|
Compute the cosine-sine (CS) decomposition of an orthogonal/unitary matrix. |
See also
scipy.linalg.interpolative
– Interpolative matrix decompositions
Matrix Functions¶
|
Compute the matrix exponential using Pade approximation. |
|
Compute matrix logarithm. |
|
Compute the matrix cosine. |
|
Compute the matrix sine. |
|
Compute the matrix tangent. |
|
Compute the hyperbolic matrix cosine. |
|
Compute the hyperbolic matrix sine. |
|
Compute the hyperbolic matrix tangent. |
|
Matrix sign function. |
|
Matrix square root. |
|
Evaluate a matrix function specified by a callable. |
|
Frechet derivative of the matrix exponential of A in the direction E. |
|
Relative condition number of the matrix exponential in the Frobenius norm. |
|
Compute the fractional power of a matrix. |
Matrix Equation Solvers¶
|
Computes a solution (X) to the Sylvester equation \(AX + XB = Q\). |
|
Solves the continuous-time algebraic Riccati equation (CARE). |
|
Solves the discrete-time algebraic Riccati equation (DARE). |
Solves the continuous Lyapunov equation \(AX + XA^H = Q\). |
|
|
Solves the discrete Lyapunov equation \(AXA^H - X + Q = 0\). |
Sketches and Random Projections¶
|
” |
Special Matrices¶
|
Create a block diagonal matrix from provided arrays. |
|
Construct a circulant matrix. |
|
Create a companion matrix. |
|
Construct a convolution matrix. |
|
Discrete Fourier transform matrix. |
|
Returns a symmetric Fiedler matrix |
Returns a Fiedler companion matrix |
|
|
Construct an Hadamard matrix. |
|
Construct a Hankel matrix. |
|
Create an Helmert matrix of order n. |
|
Create a Hilbert matrix of order n. |
|
Compute the inverse of the Hilbert matrix of order n. |
|
Create a Leslie matrix. |
|
Returns the n x n Pascal matrix. |
|
Returns the inverse of the n x n Pascal matrix. |
|
Construct a Toeplitz matrix. |
|
Construct (N, M) matrix filled with ones at and below the kth diagonal. |
Low-level routines¶
|
Return available BLAS function objects from names. |
|
Return available LAPACK function objects from names. |
|
Find best-matching BLAS/LAPACK type. |
See also
scipy.linalg.blas
– Low-level BLAS functions
scipy.linalg.lapack
– Low-level LAPACK functions
scipy.linalg.cython_blas
– Low-level BLAS functions for Cython
scipy.linalg.cython_lapack
– Low-level LAPACK functions for Cython