class SubMatrix implements Cloneable {

    public void product(final SubMatrix m, final SubMatrix n) {
        if (m.getColumnsCount() < PROD_THRESHOLD * (m.getRowsCount())) {
            DataBlockIterator cols = columns();
            DataBlockIterator rcols = n.columns();
            DataBlockIterator lcols = m.columns();

            DataBlock col = cols.getData(), rcol = rcols.getData(), lcol = lcols.getData();
            do {
                lcols.begin();
                int k = 0;
                col.setAY(rcol.get(k++), lcol);
                while (lcols.next()) {
                    col.addAY(rcol.get(k++), lcol);
                }
            } while (cols.next() && rcols.next());
        } else {
            DataBlockIterator iter = columns(), riter = m.rows(), citer = n.columns();

            DataBlock cur = iter.getData(), col = citer.getData(), row = riter.getData();
            do {
                int pos = 0;
                riter.begin();
                do {
                    cur.set(pos++, row.dot(col));
                } while (riter.next());
            } while (iter.next() && citer.next());
        }
    }

    public  SubMatrix(final double[] data, final int nrows, final int ncols);
    public  SubMatrix(final double[] data, final int start, final int nrows,
            final int ncols, final int rowinc, final int colinc);
    public  SubMatrix(final SubMatrix m);

}