class 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();

        // by column
        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();

}