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

\begin{Mhelppage}{Perm2Code}{V. Prosper}%
  \begin{MInfo}
    \eng{calculates the code of a permutation}
  \end{MInfo}
  

\begin{MCalls}
  \Mcall{perm}
\end{MCalls}

\begin{MParameters}
  \param{perm}
  \eng{any list denoting a permutation} 
\end{MParameters}

\begin{MIntro}
  \eng{
The {\Mthis} function calculates  the  Lehmer  code  of  a  permutation.

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}.
}
\end{MIntro}

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

\MRelatedFunctions{Code2Perm}
\end{Mhelppage}
