Linear algebra (scipy.linalg)#
Linear algebra functions.
See also
numpy.linalgfor more linear algebra functions. Note thatalthoughscipy.linalg imports most of them, identically namedfunctions fromscipy.linalg may offer more or slightly differingfunctionality.
Basics#
| Compute the inverse of a matrix. |
| Solve the equation |
| Solve the equation |
| Solve the equation |
| Solve the equation |
| Solve the equation |
| Solve the equation |
| Efficient Toeplitz Matrix-Matrix Multiplication using FFT |
| Compute the determinant of a matrix |
| Matrix or vector norm. |
| Compute least-squares solution to the equation |
| Compute the (Moore-Penrose) pseudo-inverse of a matrix. |
| Compute the (Moore-Penrose) pseudo-inverse of a Hermitian matrix. |
| Khatri-Rao product of two matrices. |
| Compute the matrix solution of the orthogonal (or unitary) Procrustes problem. |
| Compute a diagonal similarity transformation for row/column balancing. |
| Compute the subspace angles between two matrices. |
| Return the lower and upper bandwidth of a 2D numeric array. |
| Check if a square 2D array is symmetric. |
| Check if a square 2D array is Hermitian. |
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 LU decomposition of a matrix with partial pivoting. |
| 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. |
| Complex diagonal form to real diagonal block form. |
| 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 of an array. |
| 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. |
| Compute, if exists, the 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#
| Applies a Clarkson-Woodruff Transform/sketch to the input matrix. |
Special Matrices#
| Create a block diagonal array 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 ordern. |
| Create a Hilbert matrix of ordern. |
| Compute the inverse of the Hilbert matrix of ordern. |
| 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. |
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