class SubMatrix implements Cloneable {

    public void copy(final SubMatrix m) {
        // special handling of full matrices
        if (isFull() && m.isFull()) {
            System.arraycopy(m.m_data, 0, m_data, 0, m_data.length);
            return;
        }

        int scur = m.m_start, tcur = m_start;
        for (int c = 0; c < m_ncols; ++c, scur += m.m_col_inc, tcur += m_col_inc) {
            for (int r = 0, sidx = scur, tidx = tcur; r < m_nrows; ++r, sidx += m.m_row_inc, tidx += m_row_inc) {
                m_data[tidx] = m.m_data[sidx];
            }
        }
    }

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

}