Skip to content
fn

eigvalsh

→Tensor
eigvalsh(input: Tensor, UPLO: str = 'L')

Eigenvalues of a Hermitian / symmetric matrix.

Returns only the real eigenvalues λ1≤⋯≤λn\lambda_1 \le \cdots \le \lambda_n of a symmetric (real) or Hermitian (complex) matrix without forming the eigenvectors. Equivalent to eigh(A)[0] but skips eigenvector assembly when no gradients are requested.

Parameters

inputTensor
Symmetric / Hermitian matrix of shape (*, n, n).
UPLOstr= 'L'
"L" reads the lower triangle (default), "U" the upper; case does not matter.

Returns

Tensor

Eigenvalues in ascending order, shape (*, n).

Notes

When input.requires_grad is true the call routes through eigh so that backward via the Loewner formula remains available. Otherwise the engine kernel is invoked directly.

Examples

>>> import lucid
>>> from lucid.linalg import eigvalsh
>>> eigvalsh(lucid.tensor([[2.0, 1.0], [1.0, 3.0]]))
tensor([1.382, 3.618])