[GAP Forum] GAP permutation question

David Joyner wdjoyner at comcast.net
Sun Mar 26 04:36:55 BST 2006


This is simpler than I thought. Here is
an answer to my own question:

ListIsomorphism:=function(L1,L2)
local i,x,p,L,n1,n2;
L:=[];
n1:=Length(L1);
n2:=Length(L2);
if n1<>n2 then return fail; fi;
if n1<>Length(Set(L1)) then Print("Contains duplicates.\n"); return 
fail; fi;
if n2<>Length(Set(L2)) then Print("Contains duplicates.\n"); return 
fail; fi;
for x in L1 do
 i:=Position(L2,x);
 if i=fail then return fail; fi;
 Append(L,[i]);
od;
return PermList(L);
end;

gap> L1:=[1,2,"a",[1,1]]; L2:=[[1,1],"a",2,1];
[ 1, 2, "a", [ 1, 1 ] ]
[ [ 1, 1 ], "a", 2, 1 ]
gap> ListIsomorphism(L1,L2);
(1,4)(2,3)

+++++++++++++++++++++++++

David Joyner wrote:

> Hello all:
>
> Let L1, L2 be lists of objects (lists of vectors or lists of strings).
> Is there a GAP function which returns a permutation which
> send L1 to L2, if one exists, and "false" otherwise?
>
> In case L1 = L2 = columns of a matrix M then the
> function could be paired with the MatrixAutomorphism group of
> M to return an "isomorphism" between two matrices.
>
> - David Joyner
>
> _______________________________________________
> Forum mailing list
> Forum at mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum
>



More information about the Forum mailing list