Skip to content

Utils

Utility functions for the linear algebra module.

add_jitter

add_jitter(
    matrix: Array, jitter: float | Array = 1e-06
) -> Array

Add jitter to the diagonal of a matrix for numerical stability.

cholesky_factor

cholesky_factor(
    op: AbstractLinearOperator,
) -> lx.AbstractLinearOperator

Cholesky factor of a PSD operator. Returns lower-triangular L s.t. A = L L^T.

logdet_from_factor

logdet_from_factor(
    factor: AbstractLinearOperator,
) -> jax.Array

Log-determinant of A = L Lα΅€ given its lower Cholesky factor L.

Use this whenever the factor is already in hand, to avoid the redundant re-factorisation that :func:logdet would perform.

The generic implementation materialises the factor, mirroring :func:cholesky_factor's own fallback. Structured operators are handled by the registered implementations below, which never densify.

logdet

logdet(op: AbstractLinearOperator) -> jax.Array

Log-determinant of a PSD operator via its Cholesky factor.