torch.linalg¶
Common linear algebra operations.
Matrix Properties¶
norm |
Computes a vector or matrix norm. |
vector_norm |
Computes a vector norm. |
matrix_norm |
Computes a matrix norm. |
diagonal |
Alias for |
det |
Computes the determinant of a square matrix. |
slogdet |
Computes the sign and natural logarithm of the absolute value of the determinant of a square matrix. |
cond |
Computes the condition number of a matrix with respect to a matrix norm. |
matrix_rank |
Computes the numerical rank of a matrix. |
Decompositions¶
cholesky |
Computes the Cholesky decomposition of a complex Hermitian or real symmetric positive-definite matrix. |
qr |
Computes the QR decomposition of a matrix. |
lu |
Computes the LU decomposition with partial pivoting of a matrix. |
lu_factor |
Computes a compact representation of the LU factorization with partial pivoting of a matrix. |
eig |
Computes the eigenvalue decomposition of a square matrix if it exists. |
eigvals |
Computes the eigenvalues of a square matrix. |
eigh |
Computes the eigenvalue decomposition of a complex Hermitian or real symmetric matrix. |
eigvalsh |
Computes the eigenvalues of a complex Hermitian or real symmetric matrix. |
svd |
Computes the singular value decomposition (SVD) of a matrix. |
svdvals |
Computes the singular values of a matrix. |
Solvers¶
solve |
Computes the solution of a square system of linear equations with a unique solution. |
solve_triangular |
Computes the solution of a triangular system of linear equations with a unique solution. |
lu_solve |
Computes the solution of a square system of linear equations with a unique solution given an LU decomposition. |
lstsq |
Computes a solution to the least squares problem of a system of linear equations. |
Inverses¶
inv |
Computes the inverse of a square matrix if it exists. |
pinv |
Computes the pseudoinverse (Moore-Penrose inverse) of a matrix. |
Matrix Functions¶
matrix_exp |
Computes the matrix exponential of a square matrix. |
matrix_power |
Computes the n-th power of a square matrix for an integer n. |
Matrix Products¶
cross |
Computes the cross product of two 3-dimensional vectors. |
matmul |
Alias for |
vecdot |
Computes the dot product of two batches of vectors along a dimension. |
multi_dot |
Efficiently multiplies two or more matrices by reordering the multiplications so that the fewest arithmetic operations are performed. |
householder_product |
Computes the first n columns of a product of Householder matrices. |
Tensor Operations¶
tensorinv |
Computes the multiplicative inverse of |
tensorsolve |
Computes the solution X to the system torch.tensordot(A, X) = B. |
Misc¶
vander |
Generates a Vandermonde matrix. |
Experimental Functions¶
cholesky_ex |
Computes the Cholesky decomposition of a complex Hermitian or real symmetric positive-definite matrix. |
inv_ex |
Computes the inverse of a square matrix if it is invertible. |
solve_ex |
A version of |
lu_factor_ex |
This is a version of |
ldl_factor |
Computes a compact representation of the LDL factorization of a Hermitian or symmetric (possibly indefinite) matrix. |
ldl_factor_ex |
This is a version of |
ldl_solve |
Computes the solution of a system of linear equations using the LDL factorization. |