linalg namespace. Access them as np.linalg.eig(...), np.linalg.svd(...), etc.
linalg.eig
Compute the eigenvalues and right eigenvectors of a square matrix. For each eigenvaluew[i], the corresponding eigenvector is the column v[:, i].
Returns:
{ w, v } — Object where w has shape [..., n] (eigenvalues) and v has shape [..., n, n] (eigenvectors). The column v[:, i] is the eigenvector corresponding to w[i].
linalg.eigh
Compute eigenvalues and eigenvectors of a symmetric (Hermitian) matrix. The eigenvalues are returned in ascending order. This is faster thaneig for symmetric matrices and guarantees real eigenvalues.
Returns:
{ w, v } — Object where w has shape [..., n] containing eigenvalues in ascending order and v has shape [..., n, n] containing orthonormal eigenvectors.
linalg.eigvals
Compute the eigenvalues of a square matrix. This is equivalent tolinalg.eig but only returns eigenvalues, which can be more efficient when eigenvectors are not needed.
Returns:
NDArray — Array of eigenvalues with shape [..., n] (may be complex-valued).
linalg.eigvalsh
Compute the eigenvalues of a symmetric (Hermitian) matrix. Returns eigenvalues only, sorted in ascending order.
Returns:
NDArray — Array of real eigenvalues with shape [..., n] in ascending order.
linalg.svd
Compute the singular value decomposition (SVD) of a matrix. Factors the matrixa as U @ diag(S) @ Vh.
Returns:
{ u, s, vt } when compute_uv is true, where u contains left singular vectors, s contains singular values (descending), and vt contains right singular vectors (conjugate-transposed). Returns NDArray of singular values when compute_uv is false.
linalg.svdvals
Compute the singular values of a matrix. This is equivalent tolinalg.svd but only returns the singular values, which can be more efficient.
Returns:
NDArray — 1-D array of singular values in descending order.
linalg.qr
Compute the QR decomposition of a matrix. Factors the matrixa as Q @ R, where Q is orthogonal and R is upper triangular.
Returns:
{ q, r } for 'reduced'/'complete', NDArray for 'r', and { h, tau } for 'raw'.
linalg.cholesky
Compute the Cholesky decomposition of a positive-definite symmetric matrix. Returns the lower-triangular matrixL such that a = L @ L.T.
Returns:
NDArray of shape [..., n, n] — Lower-triangular Cholesky factor L.
Throws: Error if the matrix is not positive definite.