Skip to content

Commit

Permalink
ENHANCE: Option generatorNames to select names for free/pc generators
Browse files Browse the repository at this point in the history
  • Loading branch information
hulpke committed Sep 7, 2020
1 parent 9c05b45 commit 368c5e4
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
25 changes: 25 additions & 0 deletions doc/ref/grplib.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,31 @@ calculations.
<#Include Label="SuzukiGroup">
<#Include Label="ReeGroup">

<Subsection Label="Generator Names">
<Heading>Generator Names</Heading>
For groups created as finitely presented groups of polycyclic groups, the
generators are labelled, by default, with a letter and a number. Using the
option <C>generatorNames</C> it is possible to influcence this naming. If
this option holds a string, the generators are named with this sting and
numbers, if a list of strings of sufficient length is given, the generator
names are taken from this list of strings.
<P/>
<Example><![CDATA[
gap> GeneratorsOfGroup(AbelianGroup([5,7]));
[ f1, f2 ]
gap> GeneratorsOfGroup(AbelianGroup([5,7]:generatorNames:="a"));
[ a1, a2 ]
gap> GeneratorsOfGroup(AbelianGroup([5,7]:generatorNames:=["u","v","w"]));
[ u, v ]
gap> AsSSortedList(DihedralGroup(12:generatorNames:="a"));
[ <identity> of ..., a1, a2, a3, a1*a2, a1*a3, a2*a3, a3^2, a1*a2*a3,
a1*a3^2, a2*a3^2, a1*a2*a3^2 ]
gap> AsSSortedList(DihedralGroup(12:generatorNames:=["a","b","c"]));
[ <identity> of ..., a, b, c, a*b, a*c, b*c, c^2, a*b*c, a*c^2, b*c^2,
a*b*c^2 ]
]]></Example>
</Subsection>

</Section>


Expand Down
16 changes: 14 additions & 2 deletions lib/grpfree.gi
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,20 @@ InstallGlobalFunction( FreeGroup, function ( arg )
elif Length( zarg ) = 3 and zarg[1] = infinity then
names:= InfiniteListOfNames( zarg[2], zarg[3] );
elif Length( zarg ) = 1 and IsInt( zarg[1] ) and 0 <= zarg[1] then
names:= List( [ 1 .. zarg[1] ],
i -> Concatenation( "f", String(i) ) );
names:=ValueOption("generatorNames");
if names=fail then
names:= List( [ 1 .. zarg[1] ],
i -> Concatenation( "f", String(i) ) );
elif IsString(names) then
names:= List( [ 1 .. zarg[1] ],
i -> Concatenation( names, String(i) ) );

elif IsList(names) and ForAll(names,IsString)
and Length(names)>=zarg[1] then
names:=names{[1..zarg[1]]};
else
Error("Cannot process `generatorNames` option");
fi;
MakeImmutable( names );
elif Length( zarg ) = 2 and IsInt( zarg[1] ) and 0 <= zarg[1] then
names:= List( [ 1 .. zarg[1] ],
Expand Down

0 comments on commit 368c5e4

Please sign in to comment.