fn

eigvals

Tensor
eigvals(x: Tensor)
source

Compute only the eigenvalues of a general square matrix.

Returns the roots λ1,,λn\lambda_1, \ldots, \lambda_n of the characteristic polynomial det(AλI)=0\det(A - \lambda I) = 0 without computing the eigenvectors. Equivalent to eig(A)[0] but skips the eigenvector assembly.

Parameters

xTensor
Square matrix of shape (*, n, n).

Returns

Tensor

Eigenvalues of shape (*, n).

Notes

Cost is O(n3)O(n^3) 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])