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

\begin{Mhelppage}{Perm2Length}{V. Prosper}%
  \begin{MInfo}
    \eng{calculates the length 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 length of the permutation  \Mex{perm},
that is its number of inversions. This is also the minimal length of an
expression of the permutation as a  product  of  simple  transpositions,
as well as the sum of the components of its code.
}
\end{MIntro}

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

\MRelatedFunctions{Perm2Code,Perm2Rd}
\end{Mhelppage}
