InversePermutation¶
Returns the inverse of a permutation given in list form.
Also accepts a permutation in disjoint cycle form. Each cycle is reversed and rotated so its smallest element comes first; cycles are then sorted by their smallest element.
Involutions are their own inverse: