tridiagonal#
- class brainunit.lax.tridiagonal(a, lower=True)#
Reduce a symmetric/Hermitian matrix to tridiagonal form.
Currently implemented on CPU and GPU only.
- Parameters:
- Return type:
tuple[saiunit.Quantity |Array, saiunit.Quantity |Array, saiunit.Quantity |Array,Array]- Returns:
a_out (jax.Array or Quantity) – The matrix with the tridiagonal representation stored in its diagonal and first sub/super-diagonal; remaining elements hold the Householder reflectors. If
ahas a unit,a_outpreserves that unit.d (jax.Array or Quantity) – The diagonal of the tridiagonal matrix. Preserves the unit of
aif present.e (jax.Array or Quantity) – The first sub-diagonal (
lower=True) or super-diagonal (lower=False). Preserves the unit ofaif present.taus (jax.Array) – Scalar factors of the elementary Householder reflectors (unitless).
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 >>> a_out, d, e, taus = sulax.tridiagonal(A) >>> u.get_unit(d) == u.second True