# Linear algebra (numpy.linalg)¶

The NumPy linear algebra functions rely on BLAS and LAPACK to provide efficient low level implementations of standard linear algebra algorithms. Those libraries may be provided by NumPy itself using C versions of a subset of their reference implementations but, when possible, highly optimized libraries that take advantage of specialized processor functionality are preferred. Examples of such libraries are OpenBLAS, MKL (TM), and ATLAS. Because those libraries are multithreaded and processor dependent, environmental variables and external packages such as threadpoolctl may be needed to control the number of threads or specify the processor architecture.

## Matrix and vector products¶

 dot(a, b[, out]) Dot product of two arrays. vdot(a, b) Return the dot product of two vectors. inner(a, b) Inner product of two arrays. outer(a, b) Compute the outer product of two vectors. tensordot(a, b[, axes]) Compute tensor dot product along specified axes for arrays >= 1-D. einsum(subscripts, *operands[, out, optimize]) Evaluates the Einstein summation convention on the operands. linalg.multi_dot(arrays, *[, out]) Compute the dot product of two or more arrays in a single function call, while automatically selecting the fastest evaluation order. matmul(a, b[, out]) Matrix product of two arrays. Raise a square matrix to the (integer) power n. kron(a, b) Kronecker product of two arrays.

## Decompositions¶

 Singular Value Decomposition. linalg.cholesky(a[, upper]) Cholesky decomposition. linalg.qr(a[, mode]) Compute the qr factorization of a matrix a.

## Matrix eigenvalues¶

 Compute the eigenvalues and right eigenvectors of a square array. linalg.eigh(a[, upper]) Return the eigenvalues and eigenvectors real symmetric matrix. Compute the eigenvalues of a general matrix. linalg.eigvalsh(a[, upper]) Compute the eigenvalues real symmetric matrix.

## Norms and other numbers¶

 linalg.norm(x[, ord, axis, keepdims]) Matrix or vector norm. trace(a[, offset, axis1, axis2, out]) Return the sum along diagonals of the array. linalg.cond(x[, p]) Compute the condition number of a matrix. Compute the determinant of an array. linalg.matrix_rank(M[, rtol, hermitian]) Return matrix rank of array using SVD method Compute the sign and (natural) logarithm of the determinant of an array.

## Solving equations and inverting matrices¶

 linalg.solve(a, b) Solve a linear matrix equation, or system of linear scalar equations. linalg.tensorsolve(a, b[, axes]) Solve the tensor equation a x = b for x. linalg.lstsq(a, b[, rcond]) Return the least-squares solution to a linear matrix equation. Compute the (multiplicative) inverse of a matrix. linalg.pinv(a[, rtol, hermitian]) Compute the (Moore-Penrose) pseudo-inverse of a matrix. linalg.tensorinv(a[, ind]) Compute the ‘inverse’ of an N-dimensional array.