[GAP Forum] ConvertToMagma

R. K. Dennis gap at rkd.math.cornell.edu
Tue Jul 28 20:58:01 BST 2020


Colleagues:

GAP provides a utility called

  ConvertToMagmaInputString(group)

which will give a description, in terms of magma commands, of a
group, group, given by GAP.

For example, a permutation is given by

  PermutationGroup<n|perm1,perm2,...>

Here perm1, perm2, etc are permutations in cycle notation.
Presumably, (I didn't try this) if one inputs this on the
magma command line, everthing works out fine.

However, if one has a large n (the number of moved points),
then one doesn't want to input this by hand, so one saves it
to a file.  No matter what I tried, I couldn't get this 
to work properly.

I wrote to magma help and received a reply from John
Cannon:  He said (using GAP terminology), use ListPerm
notation for the saved permutations.

So I wrote a GAP program to implement this:

Perm2MagmaFile.gap
Perm2MagmaFile:=function(grp,fil)
    local str,lrg,gen,num,i,beg,tmp,cat,prm,out;
    if((not IsBound(grp)) or (not IsBound(fil))) then
        return "A permutation group and an output file name must be given\n";
    fi;
    if(not IsPermGroup(grp)) then
        return "Input group must be a permutation group\n";
    fi;
    str:="PermutationGroup<";
    lrg:=LargestMovedPoint(grp);
    gen:=SmallGeneratingSet(grp);
    num:=Size(gen);
    LogTo(fil);;
    beg:=Concatenation(str,String(lrg),"|");
    Print(beg);
    for i in [1..num] do
        prm:=ListPerm(gen[i],lrg);    
        tmp:=String(prm);
        RemoveCharacters(tmp," \n\t\r");    
        if(i<num) then
            cat:=Concatenation("\\",tmp,",");
            Print("\n",cat);
        else
            cat:=Concatenation("\\",tmp,"\n>\n");
            Print("\n",cat);
        fi;
    od;
    LogTo();;
end;


For example, for the group PSL(3,3) one obtains the file

PermutationGroup<13|
\[1,2,3,4,8,9,10,11,12,13,5,6,7],
\[2,5,8,11,1,4,3,7,10,13,6,12,9]
>

I chose an example that should appear correctly under e-mail.

The files written by the program, if read by "more" or "less" on
a unix system will have no backslashes ( \ ) indicating line
wraps; such will probably appear when using an editor (such as
emacs) however.

One the reads the file from the command line as follows:

G := eval Read("file.lp");

which creates the group G from the file read.

I've tested this successfuly with reasonably large groups such as the
Tits simple group and ON.

The main AWFUL problem with this program is that it sends the data to
the screen as well as the file.  Presumably if one creates a file and
uses AppentTo(file,data) one needs to prevent wrapping in the file
using SetPrintFormattingStatus( , ), but I never could get this set
properly.

So I'll end with a request and a suggestion:

1.  Could someone show me how to stop the file printing from wrapping
    lines without using LogTo?

2.  I suggest that the manual pages for ConvertToMagmaInputString
    either give an example to show exactly what to put on the
    magma command line to input data saved as a file from output
    described in the form as given.  Or, remark that results saved
    in a file should be in ListPerm format, and give an example.


Keith Dennis






More information about the Forum mailing list