Skip to content
fn

eig_op

→std::vector<TensorImplPtr>
int eig_op(const int & a)

Python wrappers

Public Python APIs implemented by this engine symbol.

Compute eigenvalues and right eigenvectors of a square float matrix.

Math

Returns (w,V)(w, V) such that AV=Vdiag(w)A V = V \mathrm{diag}(w), equivalently Avi=wiviA v_i = w_i v_i for each column viv_i of VV.

Shape

  • Input a : (..., n, n)
  • Output w : (..., n)
  • Output V : (..., n, n)

See Also

[[eigh_op]] : Symmetric / Hermitian specialisation (preferred when applicable — faster, real outputs, autograd-friendly).

Parameters

aconst TensorImplPtr&
Square float tensor of shape (..., n, n). Leading dimensions are treated as independent batch axes — one decomposition per batch element. Must be at least 2-D and floating-point.

Returns

std::vector<TensorImplPtr>

Two-element vector {w, V} where: - w has shape (..., n) — one eigenvalue per column of AA (real part only; see Notes on complex spectra). - V has shape (..., n, n) — columns are the right eigenvectors, normalised to unit Euclidean length.

Raises

LinAlgError
When a is not at least 2-D, not square, or not float-typed. Also if LAPACK fails to converge (rare; reported via info > 0).

Notes

Outputs are leaf nodes — autograd is not wired. See header-level Notes for the deferred backward formula and its caveats.

Examples

In Python (via [[lucid.linalg.eig]]):
>>> A = lucid.tensor([[2.0, 0.0], [0.0, 3.0]])
>>> w, V = lucid.linalg.eig(A)
>>> w
Tensor([2., 3.])