Add permutation_matrices() and its tests.