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

\begin{Mhelppage}{GenPerm}
  {V. Prosper}%
  \begin{MInfo}
    \eng{generates an element of the symmetric group}
  \end{MInfo}
  

\begin{MCalls}
  \Mcall{n,typeperm}
  \Mcall{perm,typeperm}
\end{MCalls}

\begin{MParameters}
  \param{n}
  \eng{any positive integer}
  \param{perm}
  \eng{any list denoting a permutation}
  \param{typeperm}
  \eng{\Mex{First}, \Mex{Previous}, \Mex{Next}, \Mex{Last}}
\end{MParameters}

\begin{MIntro}
  \eng{
The  {\Mthis}  function  generates  one  element of a symmetric group  in
lexicographic order, according to the parameter \Mex{typeperm}.

\Mex{\Mthis(n, First)} returns the first permutation of \Mmath{Sn}{S_n}.

\Mex{\Mthis(n, Last)} returns the last permutation of \Mmath{Sn}{S_n}.

\Mex{\Mthis(perm, Previous)}  gives  the  previous permutation according to
the lexicographic order.
It returns the \Mex{null()} value when perm is already the first permutation.
 
\Mex{\Mthis(perm, Next)}  gives the  next permutation  according  to the
lexicographic order.
It returns the \Mex{null()} value when perm is already the last permutation.
}
\end{MIntro}

\begin{MExample}{ex1}
\begin{Mexin}
muEC::SG::GenPerm( [3, 1, 4, 2], Next );
\end{Mexin}
\begin{Mexout}
                         [3, 2, 1, 4]
\end{Mexout}
\begin{Mexin}
muEC::SG::GenPerm(%, Previous);
\end{Mexin}
\begin{Mexout}
                         [3, 1, 4, 2]
\end{Mexout}
\end{MExample}

\MRelatedFunctions{}
\end{Mhelppage}
