public static DMatrixRMaj copyChangeRow ( int order [ ] , DMatrixRMaj src , DMatrixRMaj dst ) { if ( dst == null ) { dst = new DMatrixRMaj ( src . numRows , src . numCols ) ; } else if ( src . numRows != dst . numRows || src . numCols != dst . numCols ) { throw new IllegalArgumentException ( "src and dst must have the same dimensions." ) ; } for ( int i = 0 ; i < src . numRows ; i ++ ) { int indexDst = i * src . numCols ; int indexSrc = order [ i ] * src . numCols ; System . arraycopy ( src . data , indexSrc , dst . data , indexDst , src . numCols ) ; } return dst ; }
Creates a copy of a matrix but swaps the rows as specified by the order array .