% $Date: 2003/09/15 16:37:45 $ $Author: nthiery $ $Revision: 1.1.1.1 $

\begin{Mhelppage}{Code2Perm}{V. Prosper}%
  \begin{MInfo}
    \eng{calculates a permutation from its code}
  \end{MInfo}
  

  \begin{MCalls}
    \Mcall{code\Mopt{,n}}
  \end{MCalls}

  \begin{MParameters}
    \param{code}
    \eng{a list denoting the code of a permutation}
    \param{n}
    \eng{the degree of a symmetric group} 
  \end{MParameters}

  \begin{MIntro}
    \eng{The {\Mthis} function calculates a permutation from its
      Lehmer code.
      
      Let \Mmath{[c1, c2, ...]}{[c_1,c_2,\ldots]} be the code of
      \Mex{perm}, then \Mmath{ci}{c_i} is equal to the number of
      indices \Mmath{j>i}{j>i} such that
      \Mmath{\Mex{perm}[j]<\Mex{perm}[i]}{\mathtt{perm}_j<\mathtt{perm}_i}.
 
      The argument \Mex{n} specifies the degree of the symmetric
      group.  }
  \end{MIntro}

\begin{MExample}{ex1}
\begin{Mexin}
muEC::SG::Code2Perm( [2,4,0,1] );
\end{Mexin}
\begin{Mexout}
                      [3, 6, 1, 4, 2, 5]
\end{Mexout}
\begin{Mexin}
muEC::SG::Code2Perm( [2,4,0,1], 8 );
\end{Mexin}
\begin{Mexout}
                   [3, 6, 1, 4, 2, 5, 7, 8]
\end{Mexout}
\end{MExample}

\MRelatedFunctions{Perm2Code}
\end{Mhelppage}
