LowerTriangularMatrix { public static void rmul(final Matrix L, final DataBlock r) { int nb = r.getLength(); int nr = L.nrows_; double[] data = L.data_; double[] x = r.getData(); int xinc = r.getIncrement(); int xend = r.getEndPosition(); if (xinc == 1) { for (int li = nr * nb - 1, xi = xend - 1; li >= 0; li -= nr + 1, --xi) { double z = x[xi]; if (z != 0) { x[xi] = data[li] * z; for (int xj = xi + 1, idx = li + 1; xj < xend; ++xj, ++idx) { x[xj] += data[idx] * z; } } } } else { for (int li = nr * nb - 1, xi = xend - xinc; li >= 0; li -= nr + 1, xi -= xinc) { double z = x[xi]; if (z != 0) { x[xi] = data[li] * z; for (int xj = xi + xinc, idx = li + 1; xj != xend; xj += xinc, ++idx) { x[xj] += data[idx] * z; } } } } } private  LowerTriangularMatrix(); static Matrix inverse(final Matrix L); static void lmul(final Matrix L, final DataBlock left); @Deprecated static void lmul2(final Matrix L, final DataBlock left); @Deprecated static void lmul(final Matrix L, final double[] left); static void lmul(final Matrix L, final SubMatrix left); static void lsolve(final Matrix L, final DataBlock b); @Deprecated static void lsolve2(final Matrix L, final DataBlock b); static void lsolve(final Matrix L, final DataBlock b, double zero); @Deprecated static void lsolve2(final Matrix L, final DataBlock b, double zero); static void lsolve(final Matrix L, final double[] b); static void lsolve(final Matrix L, final SubMatrix B, double zero); static void lsolve(final Matrix L, final SubMatrix B); @Deprecated static void rmul2(final Matrix L, final DataBlock r); static void rmul(final Matrix L, final DataBlock r); static void rmul(final Matrix L, final double[] r); static void rmul(final Matrix L, final SubMatrix R); static void rsolve2(final Matrix L, final DataBlock b, double zero); static void rsolve(final Matrix L, final DataBlock b); static void rsolve2(final Matrix L, final DataBlock b); static void rsolve(final Matrix L, final DataBlock b, double zero); static void rsolve(final Matrix lower, final double[] b); static void rsolve(final Matrix L, final SubMatrix B); static void rsolve(final Matrix L, final SubMatrix B, final double zero); static void addXaXt(Matrix S, double a, DataBlock x);  }
@Test public void testrmul() { Matrix M=Matrix.square(20); M.randomize(0); M.toLower(); DataBlock B0=new DataBlock(M.getColumnsCount()); B0.randomize(1); DataBlock B1=B0.deepClone(); LowerTriangularMatrix.rmul(M, B0); LowerTriangularMatrix.rmul2(M, B1); assertTrue(B0.distance(B1)<1e-9); }