Skip to content
fn

eigh_op

→std::vector<TensorImplPtr>
int eigh_op(const int & a, const int & uplo)

Python wrappers

Public Python APIs implemented by this engine symbol.

Compute eigenvalues and eigenvectors of a real symmetric square matrix.

Math

A=Vdiag(w)V⊤A = V \mathrm{diag}(w) V^\top with V⊤V=IV^\top V = I and w1≤⋯≤wnw_1 \le \cdots \le w_n.

Shape

  • Input a : (..., n, n), symmetric
  • Output w : (..., n), real, ascending
  • Output V : (..., n, n), orthonormal columns

See Also

[[eig_op]] : General non-symmetric eigendecomposition (use only when the symmetric structure cannot be exploited).

Parameters

aconst TensorImplPtr&
Square float tensor of shape (..., n, n), interpreted as symmetric. Only the lower triangle is read; the strict upper triangle is ignored. Leading dimensions are independent batch axes. Must be at least 2-D and floating-point.

Returns

std::vector<TensorImplPtr>

Two-element vector {w, V} where: - w has shape (..., n) — real eigenvalues in ascending order. - V has shape (..., n, n) — columns are the orthonormal eigenvectors corresponding to w.

Raises

LinAlgError
When a is not at least 2-D, not square, or not float-typed. Also when LAPACK *syevd / *heevd fails to converge (reported via info > 0).

Notes

Outputs are leaf nodes — autograd is not wired. See header-level Notes for the closed-form backward and its caveats around sign ambiguity / spectral degeneracy.

Examples

In Python (via [[lucid.linalg.eigh]]):
>>> A = lucid.tensor([[2.0, 1.0], [1.0, 2.0]])
>>> w, V = lucid.linalg.eigh(A)
>>> w
Tensor([1., 3.])