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 :m:`a x = 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.
kron(a, b) Kronecker product of a and b.
hankel(c[, r]) Construct a Hankel 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.

Eigenvalues and Decompositions

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 hermetian band matrix eigenvalue problem.
eigvals_banded(a_band[, lower, ...]) Solve real symmetric or complex hermitian band matrix eigenvalue problem.
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(clow, b) Solve a previously factored symmetric system of equations.
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.

Iterative linear systems solutions

These functions are deprecated - use scipy.sparse.linalg instead

cg(*args, **kwds) scipy.linalg.cg is deprecated, use scipy.sparse.linalg.cg instead!
cgs(*args, **kwds) scipy.linalg.cgs is deprecated, use scipy.sparse.linalg.cgs instead!
qmr(*args, **kwds) scipy.linalg.qmr is deprecated, use scipy.sparse.linalg.qmr instead!
gmres(*args, **kwds) scipy.linalg.gmres is deprecated, use scipy.sparse.linalg.gmres instead!
bicg(*args, **kwds) scipy.linalg.bicg is deprecated, use scipy.sparse.linalg.bicg instead!
bicgstab(*args, **kwds) scipy.linalg.bicgstab is deprecated, use scipy.sparse.linalg.bicgstab instead!

Table Of Contents

Previous topic

scipy.io.netcdf.netcdf_variable.typecode

Next topic

scipy.linalg.inv

This Page