Skip to main content

eigh

Function eigh 

Source
pub fn eigh<B: Backend, T: LinalgScalar>(
    x: &Array<B, T>,
    lower: bool,
    symmetrize_input: bool,
    sort_eigenvalues: bool,
    subset_by_index: Option<(usize, usize)>,
    implementation: Option<EighImplementation>,
) -> (Array<B, T>, Array<B, T::Real>)
Expand description

The eigendecomposition of each symmetric (Hermitian) matrix, as lax.linalg.eigh: the eigenvectors v (one per column) and the real eigenvalues w in ascending order, with x = v diag(w) v^H.

With symmetrize_input, x is replaced by (x + x^H) / 2 first; otherwise only the triangle given by lower is read (and the real part of the diagonal). The eigenvalues are always sorted (sort_eigenvalues = false allows any order). The sign (phase) of each eigenvector is chosen so that its component of largest magnitude is real and positive (LAPACK leaves it to its algorithm).

With subset_by_index (start, end), only the eigenvalues of indices start..end (in ascending order) and their eigenvectors are returned (computed from the whole decomposition; JAX supports it on TPU only), and they are not differentiable. implementation chooses the algorithm as JAX’s (None for the platform’s default; natively, Jacobi rotations for EighImplementation::Jacobi, the QR algorithm otherwise).

§Panics

Panics if x is not a batch of square matrices, or the range is out of bounds.