public static void permuteRowInv(int permInv[], DMatrixSparseCSC input, DMatrixSparseCSC output) {
        if( input.numRows > permInv.length )
            throw new IllegalArgumentException("permutation vector must have at least as many elements as input has rows");

        output.reshape(input.numRows,input.numCols,input.nz_length);
        output.nz_length = input.nz_length;
        output.indicesSorted = false;

        System.arraycopy(input.nz_values,0,output.nz_values,0,input.nz_length);
        System.arraycopy(input.col_idx,0,output.col_idx,0,input.numCols+1);

        int idx0 = 0;
        for (int i = 0; i < input.numCols; i++) {
            int idx1 = output.col_idx[i+1];

            for (int j = idx0; j < idx1; j++) {
                output.nz_rows[j] = permInv[input.nz_rows[j]];
            }
            idx0 = idx1;
        }
    }
public static void permuteRowInv ( int permInv [ ] , DMatrixSparseCSC input , DMatrixSparseCSC output ) { if ( input . numRows > permInv . length ) throw new IllegalArgumentException ( "permutation vector must have at least as many elements as input has rows" ) ; output . reshape ( input . numRows , input . numCols , input . nz_length ) ; output . nz_length = input . nz_length ; output . indicesSorted = false ; System . arraycopy ( input . nz_values , 0 , output . nz_values , 0 , input . nz_length ) ; System . arraycopy ( input . col_idx , 0 , output . col_idx , 0 , input . numCols + 1 ) ; int idx0 = 0 ; for ( int i = 0 ; i < input . numCols ; i ++ ) { int idx1 = output . col_idx [ i + 1 ] ; for ( int j = idx0 ; j < idx1 ; j ++ ) { output . nz_rows [ j ] = permInv [ input . nz_rows [ j ] ] ; } idx0 = idx1 ; } }
Applies the row permutation specified by the vector to the input matrix and save the results
in the output matrix.  output[perm[j],:] = input[j,:]

@param permInv (Input) Inverse permutation vector.  Specifies new order of the rows.
@param input (Input) Matrix which is to be permuted
@param output (Output) Matrix which has the permutation stored in it.  Is reshaped.