Linear algebra (scipy.linalg)

Basics

inv(a[, overwrite_a]) Compute the inverse of a matrix.
solve(a, b[, sym_pos, lower, overwrite_a, ...]) Solve the equation a x = b for x
solve_banded(l, ab, b[, overwrite_ab, ...]) Solve the equation a x = b for x, assuming a is banded matrix.
solveh_banded(ab, b[, overwrite_ab, ...]) Solve equation a x = b.
det(a[, overwrite_a]) Compute the determinant of a matrix
norm(a[, ord]) Matrix or vector norm.
lstsq(a, b[, cond, overwrite_a, overwrite_b]) Compute least-squares solution to equation Ax = b.
pinv(a[, cond, rcond]) Compute the (Moore-Penrose) pseudo-inverse of a matrix.
pinv2(a[, cond, rcond]) Compute the (Moore-Penrose) pseudo-inverse of a matrix.

Eigenvalue Problem

eig(a[, b, left, right, overwrite_a, ...]) Solve an ordinary or generalized eigenvalue problem of a square matrix.
eigvals(a[, b, overwrite_a]) Compute eigenvalues from an ordinary or generalized eigenvalue problem.
eigh(a[, b, lower, eigvals_only, ...]) Solve an ordinary or generalized eigenvalue problem for a complex
eigvalsh(a[, b, lower, overwrite_a, ...]) Solve an ordinary or generalized eigenvalue problem for a complex
eig_banded(a_band[, lower, eigvals_only, ...]) Solve real symmetric or complex hermitian band matrix eigenvalue problem.
eigvals_banded(a_band[, lower, ...]) Solve real symmetric or complex hermitian band matrix eigenvalue problem.

Decompositions

lu(a[, permute_l, overwrite_a]) Compute pivoted LU decompostion of a matrix.
lu_factor(a[, overwrite_a]) Compute pivoted LU decomposition of a matrix.
lu_solve(lu, b[, trans, overwrite_b]) Solve an equation system, a x = b, given the LU factorization of a
svd(a[, full_matrices, compute_uv, overwrite_a]) Singular Value Decomposition.
svdvals(a[, overwrite_a]) Compute singular values of a matrix.
diagsvd(s, M, N) Construct the sigma matrix in SVD from singular values and size M,N.
orth(A) Construct an orthonormal basis for the range of A using SVD
cholesky(a[, lower, overwrite_a]) Compute the Cholesky decomposition of a matrix.
cholesky_banded(ab[, overwrite_ab, lower]) Cholesky decompose a banded Hermitian positive-definite matrix
cho_factor(a[, lower, overwrite_a]) Compute the Cholesky decomposition of a matrix, to use in cho_solve
cho_solve(c, b[, overwrite_b]) Solve the linear equations A x = b, given the Cholesky factorization of A.
cho_solve_banded(cb, b[, overwrite_b]) Solve the linear equations A x = b, given the Cholesky factorization of A.
qr(a[, overwrite_a, lwork, econ, mode]) Compute QR decomposition of a matrix.
schur(a[, output, lwork, overwrite_a]) Compute Schur decomposition of a matrix.
rsf2csf(T, Z) Convert real Schur form to complex Schur form.
hessenberg(a[, calc_q, overwrite_a]) Compute Hessenberg form of a matrix.

Matrix Functions

expm(A[, q]) Compute the matrix exponential using Pade approximation.
expm2(A) Compute the matrix exponential using eigenvalue decomposition.
expm3(A[, q]) Compute the matrix exponential using Taylor series.
logm(A[, disp]) Compute matrix logarithm.
cosm(A) Compute the matrix cosine.
sinm(A) Compute the matrix sine.
tanm(A) Compute the matrix tangent.
coshm(A) Compute the hyperbolic matrix cosine.
sinhm(A) Compute the hyperbolic matrix sine.
tanhm(A) Compute the hyperbolic matrix tangent.
signm(a[, disp]) Matrix sign function.
sqrtm(A[, disp]) Matrix square root.
funm(A, func[, disp]) Evaluate a matrix function specified by a callable.

Special Matrices

block_diag(*arrs) Create a block diagonal matrix from the provided arrays.
circulant(c) Construct a circulant matrix.
companion(a) Create a companion matrix.
hadamard(n[, dtype]) Construct a Hadamard matrix.
hankel(c[, r]) Construct a Hankel matrix.
kron(a, b) Kronecker product of a and b.
leslie(f, s) Create a Leslie matrix.
toeplitz(c[, r]) Construct a Toeplitz matrix.
tri(N[, M, k, dtype]) Construct (N, M) matrix filled with ones at and below the k-th diagonal.
tril(m[, k]) Construct a copy of a matrix with elements above the k-th diagonal zeroed.
triu(m[, k]) Construct a copy of a matrix with elements below the k-th diagonal zeroed.

Table Of Contents

Next topic

scipy.linalg.inv

This Page