eigh#
- class saiunit.lax.eigh(x, lower=True, symmetrize_input=True, sort_eigenvalues=True, subset_by_index=None)#
Eigendecomposition of a Hermitian matrix.
Compute the eigenvectors and eigenvalues of a complex Hermitian or real symmetric square matrix.
- Parameters:
x (saiunit.Quantity |
Array|ndarray|bool|number|bool|int|float|complex) – A batch of square Hermitian (or real symmetric) matrices with shape[..., n, n].lower (
bool) – Whensymmetrize_inputisFalse, selects which triangle of the input to use. Default isTrue.symmetrize_input (
bool) – IfTrue, the matrix is symmetrized before the eigendecomposition by computing \(\frac{1}{2}(x + x^H)\). Default isTrue.sort_eigenvalues (
bool) – IfTrue, eigenvalues are sorted in ascending order. Default isTrue.subset_by_index (
tuple[int,int] |None) – A(start, end)pair selecting a range of eigenvalue indices to compute.Nonemeans all eigenvalues. Default isNone.
- Return type:
tuple[saiunit.Quantity |Array,Array]- Returns:
v (jax.Array) – Eigenvectors (unitless).
v[..., :, i]is the normalised eigenvector for eigenvaluew[..., i].w (jax.Array or Quantity) – Eigenvalues in ascending order. If
xhas a unit,wpreserves that unit.
Examples
>>> import jax.numpy as jnp >>> import saiunit as u >>> import saiunit.lax as sulax >>> A = jnp.array([[2.0, 1.0], [1.0, 3.0]]) * u.second >>> v, w = sulax.eigh(A) >>> u.get_unit(w) == u.second True