public static void extractAligned(DMatrixRBlock src, DMatrixRBlock dst) {
        if( src.blockLength != dst.blockLength )
            throw new IllegalArgumentException("Block size is different");
        if( src.numRows < dst.numRows )
            throw new IllegalArgumentException("The src has fewer rows than dst");
        if( src.numCols < dst.numCols )
            throw new IllegalArgumentException("The src has fewer columns than dst");

        int blockLength = src.blockLength;

        int numRows = Math.min(src.numRows,dst.numRows);
        int numCols = Math.min(src.numCols,dst.numCols);

        for( int i = 0; i < numRows; i += blockLength ) {
            int heightSrc = Math.min(blockLength,src.numRows-i);
            int heightDst = Math.min(blockLength,dst.numRows-i);

            for( int j = 0; j < numCols; j += blockLength ) {
                int widthSrc = Math.min(blockLength,src.numCols-j);
                int widthDst = Math.min(blockLength,dst.numCols-j);

                int indexSrc = i*src.numCols + heightSrc*j;
                int indexDst = i*dst.numCols + heightDst*j;

                for( int k = 0; k < heightDst; k++ ) {
                    System.arraycopy(src.data, indexSrc + widthSrc * k, dst.data, indexDst + widthDst * k, widthDst);
                }
            }
        }
    }
public static void extractAligned ( DMatrixRBlock src , DMatrixRBlock dst ) { if ( src . blockLength != dst . blockLength ) throw new IllegalArgumentException ( "Block size is different" ) ; if ( src . numRows < dst . numRows ) throw new IllegalArgumentException ( "The src has fewer rows than dst" ) ; if ( src . numCols < dst . numCols ) throw new IllegalArgumentException ( "The src has fewer columns than dst" ) ; int blockLength = src . blockLength ; int numRows = Math . min ( src . numRows , dst . numRows ) ; int numCols = Math . min ( src . numCols , dst . numCols ) ; for ( int i = 0 ; i < numRows ; i += blockLength ) { int heightSrc = Math . min ( blockLength , src . numRows - i ) ; int heightDst = Math . min ( blockLength , dst . numRows - i ) ; for ( int j = 0 ; j < numCols ; j += blockLength ) { int widthSrc = Math . min ( blockLength , src . numCols - j ) ; int widthDst = Math . min ( blockLength , dst . numCols - j ) ; int indexSrc = i * src . numCols + heightSrc * j ; int indexDst = i * dst . numCols + heightDst * j ; for ( int k = 0 ; k < heightDst ; k ++ ) { System . arraycopy ( src . data , indexSrc + widthSrc * k , dst . data , indexDst + widthDst * k , widthDst ) ; } } } }
<p>
Extracts a matrix from src into dst.  The submatrix which is copied has its initial coordinate
at (0,0) and ends at (dst.numRows,dst.numCols). The end rows/columns must be aligned along blocks
or else it will silently screw things up.
</p>

@param src Matrix which a submatrix is being extracted from. Not modified.
@param dst Where the submatrix is written to.  Its rows and columns be less than or equal to 'src'.  Modified.