@Test
public void testGetPermutationMatrix() {

    Matrix M = new DenseMatrix(new double[][] {
        new double[] { 1, 5, 9,  13 },
        new double[] { 2, 6, 10, 14 },
        new double[] { 3, 7, 11, 15 },
        new double[] { 4, 8, 12, 16 },
    });
    int[] permutations = new int[] { 3, 2, 1, 0 };
    Matrix R = GraphPartition.getPermutedMatrix(M, permutations);
    Matrix R_e = new DenseMatrix(new double[][] {
        new double[] { 16, 12, 8, 4 },
        new double[] { 15, 11, 7, 3 },
        new double[] { 14, 10, 6, 2 },
        new double[] { 13, 9,  5, 1 },
    });
    assertArrayEquals(Matrices.getArray(R_e), Matrices.getArray(R));
}