flag to delete the source matrix.
'LD' or 'UD' matrix computed by ldlDecomp.
details of the interchanges and the block structure of D as determined by ldlDecomp.
the right hand side matrix.
specifies whether the details of the factorization are stored as an upper or lower triangular matrix: 'U': Upper triangular, form is \A = U * D * U**T; 'L': Lower triangular, form is \A = L * D * L**T.
The solution matrix.
import mir.ndslice; auto A = [ 2.07, 3.87, 4.20, -1.15, 3.87, -0.21, 1.87, 0.63, 4.20, 1.87, 1.15, 2.06, -1.15, 0.63, 2.06, -1.81 ] .sliced(4, 4) .as!double.slice .canonical; import mir.random.variable; import mir.random.algorithm; auto B = randomSlice(uniformVar(-100, 100), 4, 100); auto LDL = ldlDecomp('L', A); auto X = LDL.solve(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), B));
Solves a system of linear equations \A * X = B with symmetric matrix 'A' using the factorization \A = U * D * U**T, or \A = L * D * L**T computed by ldlDecomp.