public static PermutationMatrix fromPartialPivots(int[] pivots) {
        int[] permutations = new int[pivots.length];
        for (int i = 0; i < pivots.length; i++) {
            permutations[i] = i;
        }

        for (int i = 0; i < pivots.length; i++) {
            int j = pivots[i] - 1;
            if (j == i)
                continue;
            int tmp = permutations[i];
            permutations[i] = permutations[j];
            permutations[j] = tmp;
        }

        return new PermutationMatrix(permutations, pivots);
    }
public static PermutationMatrix fromPartialPivots ( int [ ] pivots ) { int [ ] permutations = new int [ pivots . length ] ; for ( int i = 0 ; i < pivots . length ; i ++ ) { permutations [ i ] = i ; } for ( int i = 0 ; i < pivots . length ; i ++ ) { int j = pivots [ i ] - 1 ; if ( j == i ) continue ; int tmp = permutations [ i ] ; permutations [ i ] = permutations [ j ] ; permutations [ j ] = tmp ; } return new PermutationMatrix ( permutations , pivots ) ; }
The sequential row permutations to perform, e.g. (2, 3, 3) means: permute
row 1 with row 2, then permute row 2 with row 3, then permute row 3 with
row 3 (i.e. do nothing).
<p>
Using this factory will ensure that LAPACK optimisations are available
for multiplication operations.

@param pivots
using fortran (1-indexed) notation.