In a sense the “sparse” representation of your permutation matrix is just the permutation vector. So you could just wrap that into a type that overloads multiplication to instead perform the permutation of rows/columns.
4 Likes