> < ^ Date: Fri, 03 Aug 2001 22:08:52 +0200
> < ^ From: Greg Gamble <greg.gamble@math.rwth-aachen.de >
< ^ Subject: Re: PermutationMat

GAP Forum
On Fri, Aug 03, 2001 at 09:48:34AM -0400, Vivek Shende wrote:
> Does the function PermutationMat have an inverse? that is, if i have a matrix
> that is the matrix of a permutation, is there some function that will give me
> that permutation?

Dear Vivek,

In fact, `Permutation' does what you want, though the documentation
does not currently make this clear e.g.

```gap> g := PermutationMat((1,2,3,4)(5,6,7), 10);
[ [ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ],
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ],
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 ] ]
```

returns a 10x10 matrix that permutes the 10 standard basis (row) vectors
of Q^n (Q = Rationals), which, since GAP doesn't really distinguish a
matrix from a list of row vectors, is given by:

```gap> xset := PermutationMat((), 10); #among other ways
[ [ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ],
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ],
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 ] ]

If we identify each element of xset with its position index i.e.
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] is 1, [ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ] is 2,
etc. then `Permutation( <g>, <xset> );' returns the permutation that
corresponds to the action of <g> on <xset> in terms of <xset>'s position
indices i.e. since <g> takes the 1st <xset> vector to the 2nd <xset> vector
etc. `Permutation( <g>, <xset> );' will start `(1, 2, ...'. So:

gap> Permutation(g, xset);
(1,2,3,4)(5,6,7)
```

I'll see what I can do to improve the documentation here for the next
release.

[The example given in the current documentation is:

```gap> Permutation((1,2,3)(4,5)(6,7),[4..7]);
(1,2)(3,4)

One might have thought the result should be (4,5)(6,7) as the action of
(1,2,3)(4,5)(6,7) restricted to the points [4,5,6,7] is (4,5)(6,7), but
`Permutation' returns a permutation in terms of the position indices of
the points 4 .. 7 in the list [4,5,6,7].]

Regards,
Greg Gamble
___________________________________________________________________
Greg Gamble   __________________   mailto:gregg@math.rwth-aachen.de
Lehrstuhl D fuer Mathematik                     Tel: +49 241 804545
Templergraben 64
52062 Aachen, Germany   http://www.math.rwth-aachen.de/~Greg.Gamble
___________________________________________________________________
```

> < [top]