eigh

Contents

eigh#

class saiunit.linalg.eigh(a, UPLO=None, symmetrize_input=True, **kwargs)#

Compute eigenvalues and eigenvectors of a Hermitian matrix.

SaiUnit implementation of numpy.linalg.eigh().

Eigenvalues carry the same unit as a; eigenvectors are dimensionless.

Parameters:
  • a (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – Hermitian (or symmetric) input of shape (..., M, M).

  • UPLO (str | None) – Use the lower ('L', default) or upper ('U') triangle.

  • symmetrize_input (bool) – If True (default), symmetrise the input for better autodiff behaviour.

Return type:

tuple[Array | saiunit.Quantity, Array | saiunit.Quantity]

Returns:

  • eigenvalues (ndarray or Quantity) – Shape (..., M), sorted ascending. Same unit as a.

  • eigenvectors (ndarray) – Shape (..., M, M). Column v[:, i] is the eigenvector for eigenvalues[i].

Examples

>>> import saiunit as u
>>> import jax.numpy as jnp
>>> a = jnp.array([[1, -2j],
...                [2j, 1]]) * u.meter
>>> w, v = u.linalg.eigh(a)
>>> w
Array([-1.,  3.], dtype=float32)