torch.linalg.eigvals
- torch.linalg.eigvals(A, *, out=None) → Tensor
Computes the eigenvalues of a square matrix.
Letting be or , the of a square matrix are defined as the roots (counted with multiplicity) of the polynomial of degree given by
Computes the eigenvalues of a square matrix.
Letting be or , the of a square matrix are defined as the roots (counted with multiplicity) of the polynomial of degree given by
where is the n-dimensional identity matrix.
Supports input of float, double, cfloat and cdouble dtypes.
Also supports batches of matrices, and if A is a batch of matrices then
the output has the same batch dimensions.
The returned eigenvalues are not guaranteed to be in any specific order.
Examples:
>>> A = torch.randn(2, 2, dtype=torch.complex128)
>>> L = torch.linalg.eigvals(A)
>>> L
tensor([ 1.1226+0.5738j, -0.7537-0.1286j], dtype=torch.complex128)
>>> torch.dist(L, torch.linalg.eig(A).eigenvalues)
tensor(2.4576e-07)