eigvalsh

Contents

eigvalsh#

class brainunit.linalg.eigvalsh(a, UPLO='L', *, symmetrize_input=True, **kwargs)#

Compute the eigenvalues of a Hermitian matrix.

SaiUnit implementation of numpy.linalg.eigvalsh().

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

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

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

Returns:

out – Eigenvalues of shape (..., M), sorted ascending. Same unit as a.

Return type:

Array | saiunit.Quantity

Examples

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