Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Get the inversion vector of a permutation written as a list
ResourceFunction["ToInversionVector"][p] gives the inversion vector of the permutation list p. |
This permutation has 3 numbers greater than 1 before 1, 2 numbers greater than 2 before 2, and so on:
| In[1]:= |
Therefore, this is its inversion vector:
| In[2]:= |
| Out[2]= |
Here is another example:
| In[3]:= |
| Out[3]= |
| In[4]:= |
| Out[4]= |
Here are all six permutation of {1,2,3}:
| In[5]:= |
| Out[5]= |
Here are the corresponding inversion vectors:
| In[6]:= |
| Out[6]= |
In the factorial base, ivs represents the numbers from 0 to 3!-1:
| In[7]:= |
| Out[7]= |
This work is licensed under a Creative Commons Attribution 4.0 International License