cholesky

Contents

cholesky#

class saiunit.lax.cholesky(x, symmetrize_input=True)#

Cholesky decomposition.

Compute the Cholesky decomposition \(A = L \cdot L^H\) of square positive-definite matrices such that \(L\) is lower triangular. The matrices must be Hermitian (if complex) or symmetric (if real).

Parameters:
  • x (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – A batch of square positive-definite matrices with shape [..., n, n].

  • symmetrize_input (bool) – If True, the matrix is symmetrized before decomposition by computing \(\frac{1}{2}(x + x^H)\). If False, only the lower triangle of x is used. Default is True.

Returns:

L – The lower-triangular Cholesky factor with shape [..., n, n]. If x carries a unit u, the result has unit u ** 0.5. If decomposition fails, the result is filled with NaNs.

Return type:

saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex

See also

saiunit.linalg.cholesky

Higher-level Cholesky wrapper.

Examples

>>> import jax.numpy as jnp
>>> import saiunit as u
>>> import saiunit.lax as sulax
>>> A = jnp.array([[4.0, 2.0], [2.0, 3.0]]) * (u.meter ** 2)
>>> L = sulax.cholesky(A)
>>> u.get_unit(L) == u.meter
True