def Mat.cholesky
import bend-blas-lapack@0.0.0.1/mat.bend as Matimport Base
import bend-blas-lapack@0.0.0.1/lapack.bend as L
254# the lower Cholesky factor L of a symmetric positive definite A
255def Mat.cholesky(+n: Nat, a: Mat<n, n>) -> IO(Result<&1, &1, U32 & String, Mat<n, n>>):
256 MatA{x} = a
257 IO.bind(Result<&1, &1, U32 & String, Array<F32>>, Result<&1, &1, U32 & String, Mat<n, n>>, L.Lapack.spotrf(U32.from_nat(n), x), r => Mat.wrap(n, n, r))