fn
eigvals
→Tensoreigvals(x: Tensor)Compute only the eigenvalues of a general square matrix.
Returns the roots of the
characteristic polynomial without
computing the eigenvectors. Equivalent to eig(A)[0] but skips
the eigenvector assembly.
Parameters
xTensorSquare matrix of shape
(*, n, n).Returns
TensorEigenvalues of shape (*, n).
Notes
Cost is and dominated by the Hessenberg reduction.
No autograd support — use eigvalsh for symmetric / Hermitian
matrices when gradients are required.
Examples
>>> import lucid
>>> from lucid.linalg import eigvals
>>> eigvals(lucid.tensor([[2.0, 0.0], [0.0, 3.0]]))
Tensor([2.0000, 3.0000])