import { lax, numpy as np } from "@jax-js/jax";
const x = np.array([[2., 1.], [1., 2.]]);
// Lower Cholesky factorization (default):
const L = lax.linalg.cholesky(x);
// L ≈ [[1.4142135, 0], [0.70710677, 1.2247449]]
// Upper Cholesky factorization:
const U = lax.linalg.cholesky(x, { upper: true });
// U ≈ [[1.4142135, 0.70710677], [0, 1.2247449]]
Compute the Cholesky decomposition of a symmetric positive-definite matrix.
The Cholesky decomposition of a matrix
Ais:where
Lis a lower-triangular matrix andUis an upper-triangular matrix. The input matrix must be symmetric and positive-definite.