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

\begin{Mhelppage}{Perm2Mat}%
  {V. Prosper}%
  \begin{MInfo}
    \eng{calculates the permutation matrix}
  \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 permutation matrix corresponding to
\Mex{perm}. This matrix has entries 1 in position
\Mmath{(i, \Mex{perm}[i])}{(i,\mathtt{perm}_i)} and 0 otherwise.
}
\end{MIntro}

\begin{MExample}{ex1}
\begin{Mexin}
muEC::SG::Perm2Mat( [2,4,3,1] );
\end{Mexin}
\begin{Mexout}
                       +-            -+
                       |  0, 1, 0, 0  |
                       |              |
                       |  0, 0, 0, 1  |
                       |              |
                       |  0, 0, 1, 0  |
                       |              |
                       |  1, 0, 0, 0  |
                       +-            -+
\end{Mexout}
% \begin{Mexout}[hide]
% array(1..4, 1..4, (1,1) = 0, (1,2) = 1, (1,3) = 0, (1,4) = 0,
%                   (2,1) = 0, (2,2) = 0, (2,3) = 0, (2,4) = 1,
%                   (3,1) = 0, (3,2) = 0, (3,3) = 1, (3,4) = 0,
%                   (4,1) = 1, (4,2) = 0, (4,3) = 0, (4,4) = 0 )
% \end{Mexout}
\end{MExample}

\MRelatedFunctions{Mat2Perm,Perm2RRep,RRep2Perm}
\end{Mhelppage}
