@Test public void testlmul() { Matrix M=Matrix.square(20); M.randomize(0); M.toLower(); DataBlock B0=new DataBlock(M.getColumnsCount()); B0.randomize(1); DataBlock B1=B0.deepClone(); LowerTriangularMatrix.lmul(M, B0); LowerTriangularMatrix.lmul2(M, B1); assertTrue(B0.distance(B1)<1e-9); }
public static void lmul(final Matrix L, final DataBlock left) { int n = L.nrows_; double[] data = L.data_; double[] x = left.getData(); int xinc = left.getIncrement(); int xbeg = left.getStartPosition(); int xend = left.getEndPosition(); if (xinc == 1) { for (int xi = xbeg, idx = 0; xi < xend; ++xi, idx += n + 1) { double t = 0.0; for (int xj = xi, idx2 = idx; xj < xend; ++xj, ++idx2) { t += data[idx2] * x[xj]; } x[xi] = t; } } else { for (int xi = xbeg, idx = 0; xi != xend; xi += xinc, idx += n + 1) { double t = 0.0; for (int xj = xi, idx2 = idx; xj != xend; xj += xinc, ++idx2) { t += data[idx2] * x[xj]; } x[xi] = t; } } }
LowerTriangularMatrix { public static void lmul(final Matrix L, final DataBlock left) { int n = L.nrows_; double[] data = L.data_; double[] x = left.getData(); int xinc = left.getIncrement(); int xbeg = left.getStartPosition(); int xend = left.getEndPosition(); if (xinc == 1) { for (int xi = xbeg, idx = 0; xi < xend; ++xi, idx += n + 1) { double t = 0.0; for (int xj = xi, idx2 = idx; xj < xend; ++xj, ++idx2) { t += data[idx2] * x[xj]; } x[xi] = t; } } else { for (int xi = xbeg, idx = 0; xi != xend; xi += xinc, idx += n + 1) { double t = 0.0; for (int xj = xi, idx2 = idx; xj != xend; xj += xinc, ++idx2) { t += data[idx2] * x[xj]; } x[xi] = t; } } } }
LowerTriangularMatrix { public static void lmul(final Matrix L, final DataBlock left) { int n = L.nrows_; double[] data = L.data_; double[] x = left.getData(); int xinc = left.getIncrement(); int xbeg = left.getStartPosition(); int xend = left.getEndPosition(); if (xinc == 1) { for (int xi = xbeg, idx = 0; xi < xend; ++xi, idx += n + 1) { double t = 0.0; for (int xj = xi, idx2 = idx; xj < xend; ++xj, ++idx2) { t += data[idx2] * x[xj]; } x[xi] = t; } } else { for (int xi = xbeg, idx = 0; xi != xend; xi += xinc, idx += n + 1) { double t = 0.0; for (int xj = xi, idx2 = idx; xj != xend; xj += xinc, ++idx2) { t += data[idx2] * x[xj]; } x[xi] = t; } } } private  LowerTriangularMatrix(); }
LowerTriangularMatrix { public static void lmul(final Matrix L, final DataBlock left) { int n = L.nrows_; double[] data = L.data_; double[] x = left.getData(); int xinc = left.getIncrement(); int xbeg = left.getStartPosition(); int xend = left.getEndPosition(); if (xinc == 1) { for (int xi = xbeg, idx = 0; xi < xend; ++xi, idx += n + 1) { double t = 0.0; for (int xj = xi, idx2 = idx; xj < xend; ++xj, ++idx2) { t += data[idx2] * x[xj]; } x[xi] = t; } } else { for (int xi = xbeg, idx = 0; xi != xend; xi += xinc, idx += n + 1) { double t = 0.0; for (int xj = xi, idx2 = idx; xj != xend; xj += xinc, ++idx2) { t += data[idx2] * x[xj]; } x[xi] = t; } } } 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); }
LowerTriangularMatrix { public static void lmul(final Matrix L, final DataBlock left) { int n = L.nrows_; double[] data = L.data_; double[] x = left.getData(); int xinc = left.getIncrement(); int xbeg = left.getStartPosition(); int xend = left.getEndPosition(); if (xinc == 1) { for (int xi = xbeg, idx = 0; xi < xend; ++xi, idx += n + 1) { double t = 0.0; for (int xj = xi, idx2 = idx; xj < xend; ++xj, ++idx2) { t += data[idx2] * x[xj]; } x[xi] = t; } } else { for (int xi = xbeg, idx = 0; xi != xend; xi += xinc, idx += n + 1) { double t = 0.0; for (int xj = xi, idx2 = idx; xj != xend; xj += xinc, ++idx2) { t += data[idx2] * x[xj]; } x[xi] = t; } } } 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);  }