flag to delete the source matrix.
detalis of the QR factorization of the original matrix as returned by qrDecomp.
details of the orhtogonal matrix Q.
right hand side matrix.
solution matrix.
import mir.ndslice; auto A = [ 3, 1, -1, 2, -5, 1, 3, -4, 2, 0, 1, -1, 1, -5, 3, -3 ] .sliced(4, 4) .as!double.slice; import mir.random.variable; import mir.random.algorithm; auto B = randomSlice(uniformVar(-100, 100), 4, 100); auto C = qrDecomp(A); auto X = C.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));
Solve the least squares problem: \min ||A * X - B|| Using the QR factorization: \A = Q * R computed by qrDecomp.