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
Square 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.+0.j), (3.+0.j)], dtype=lucid.complex64)