flag to delete the source matrix.
the triangular factor 'U' or 'L' from the Cholesky factorization
the right hand side matrix.
'U': Upper triangle of A is stored; 'L': Lower triangle of A is stored.
The solution matrix X.
import mir.ndslice.slice: sliced; import mir.ndslice.topology: as; import std.typecons: Flag, Yes; auto A = [ 1.0, 1, 3, 1 , 5, 5, 3 , 5, 19 ].sliced(3, 3); auto B = [ 10.0, 157, 80 ].sliced; auto C_ = B.dup.sliced(3, 1); auto C = choleskyDecomp('U', A); auto X = choleskySolve!(Yes.allowDestroy)(C.uplo, C.matrix, B); import mir.math.common: approxEqual; import mir.algorithm.iteration: equal; alias appr = equal!((a, b) => approxEqual(a, b, 1e-5, 1e-5)); assert(appr(mtimes(A, X), C_));
Solves a system of linear equations A * X = B with a symmetric matrix A using the Cholesky factorization: \A = U**T * U or \A = L * L**T computed by choleskyDecomp.