Perm inv

perm_inv is a function that computes the inverse of a permutation.

Syntax

 * PI = perm_inv(PERM)

Argument descriptions

 * PERM: A vector containing a permutation of the integers 1, 2, ..., n.

Small examples
The identity permutation is its own inverse:

To compute the inverse of the permutation on this MathWorld page, we can use the following line of code: