Skip to content

Commit

Permalink
Enhance short option in StructureDescription
Browse files Browse the repository at this point in the history
Now the option short works for infinite abelian groups.
Further, it now recognizes nonprimepower duplicates, as well.
E.g. the short StructureDescription for the group C6 x C6 is now 6^2.
  • Loading branch information
hungaborhorvath committed Nov 27, 2016
1 parent 561d109 commit ce20d70
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 22 deletions.
50 changes: 34 additions & 16 deletions lib/grpnames.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1613,8 +1613,10 @@ InstallMethod( StructureDescription,
id, # id of G in the library of perfect groups
short, # short / long output format
nice, # nice output (slower)
i, # counter
i,j, # counters
primes, # prime divisors of Size(G)
d, # divisor of Size(G)
k, # maximal power of d in Size(G)
pi; # subset of primes

insertsep := function ( strs, sep, brack )
Expand All @@ -1637,22 +1639,24 @@ InstallMethod( StructureDescription,
return s;
end;

cycsaspowers := function ( name )
cycsaspowers := function ( name, cycsizes )

local p, k, q;
local d, k, j, n;

if not short then return name; fi;
RemoveCharacters(name," ");
for q in Filtered(Reversed(DivisorsInt(Size(G))),
IsPrimePowerInt)
do
p := SmallestRootInt(q); k := LogInt(q,p);
if k > 1 then
name := ReplacedString(name,insertsep(List([1..k],
i->Concatenation("C",String(p))),"x",""),
Concatenation(String(p),"^",String(k)));
fi;
od;
cycsizes := Collected(cycsizes);
for n in cycsizes
do
d := n[1]; k := n[2];
if k > 1 then
for j in Reversed([2..k]) do
name := ReplacedString(name,insertsep(List([1..j],
i->Concatenation("C",String(d))),"x",""),
Concatenation(String(d),"^",String(j)));
od;
fi;
od;
RemoveCharacters(name,"C");
return name;
end;
Expand All @@ -1666,7 +1670,21 @@ InstallMethod( StructureDescription,
i := IdGroup(G)[2];
if IsBound(NAMES_OF_SMALL_GROUPS[Size(G)][i]) then
name := ShallowCopy(NAMES_OF_SMALL_GROUPS[Size(G)][i]);
return cycsaspowers(name);
cycsizes := [];
if short then
# DivisorsInt is rather slow, but we only call it for small groups
for d in Reversed(DivisorsInt(Size(G))) do
if d >1 then
k := LogInt(Size(G), d);
if k>1 then
for j in [1..k] do
Add(cycsizes, d);
od;
fi;
fi;
od;
fi;
return cycsaspowers(name, cycsizes);
fi;
fi;
fi;
Expand All @@ -1681,7 +1699,7 @@ InstallMethod( StructureDescription,
cycsizes := Filtered(cycsizes,n->n<>1);
return cycsaspowers(insertsep(List(cycsizes,
n->Concatenation("C",String(n))),
" x ",""));
" x ",""), cycsizes);
fi;

if not IsFinite(G) then TryNextMethod(); fi;
Expand Down Expand Up @@ -1771,7 +1789,7 @@ InstallMethod( StructureDescription,
cycsizes := Filtered(cycsizes,n->n<>1);
cycname := cycsaspowers(insertsep(List(cycsizes,
n->Concatenation("C",String(n))),
" x ",":."));
" x ",":."), cycsizes);
else cycname := ""; fi;
noncyclics := Difference(Gs,cyclics);
noncycname := insertsep(List(noncyclics,StructureDescription),
Expand Down
12 changes: 6 additions & 6 deletions tst/testinstall/opers/StructureDescription.tst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ gap> List(l, StructureDescription);; l;
gap> List(AllSmallGroups(40),G->StructureDescription(G:short));
[ "5:8", "40", "5:8", "5:Q8", "4xD10", "D40", "2x(5:4)", "(10x2):2", "20x2",
"5xD8", "5xQ8", "2x(5:4)", "2^2xD10", "10x2^2" ]
gap> StructureDescription(SmallGroup(36, 14):short);
"6^2"
gap> StructureDescription(SmallGroup(216, 174):short,recompute);
"6^2xS3"
gap> List(AllSmallGroups(60), G -> StructureDescription(G:recompute));
[ "C5 x (C3 : C4)", "C3 x (C5 : C4)", "C3 : (C5 : C4)", "C60", "A5",
"C3 x (C5 : C4)", "C3 : (C5 : C4)", "S3 x D10", "C5 x A4", "C6 x D10",
Expand Down Expand Up @@ -58,6 +62,8 @@ gap> List(AllSmallNonabelianSimpleGroups([1..1000000]), StructureDescription);
"O(5,4)" ]
gap> StructureDescription(AbelianGroup([0,0,0,2,3,4,5,6,7,8,9,10]));
"C0 x C0 x C0 x C2520 x C60 x C6 x C2 x C2"
gap> StructureDescription(AbelianGroup([0,0,0,2,3,4,5,6,7,8,9,10]):short);
"0^3x2520x60x6x2^2"
gap> infolevel:=InfoLevel(InfoWarning);; SetInfoLevel(InfoWarning,2);
gap> StructureDescription(SmallGroup(48,16):recompute,nice);
#I Warning! Non-unique semidirect product:
Expand All @@ -68,10 +74,4 @@ gap> StructureDescription(SmallGroup(64,17):recompute,nice);
#I [ [ "C4 x C2", "C8" ], [ "C8 x C2", "C4" ] ]
"(C4 x C2) : C8"
gap> SetInfoLevel(InfoWarning,infolevel);

##
## Currently the value "short" does not work for infinite abelian groups.
##
##gap> StructureDescription(AbelianGroup([0,0,0,2,3,4,5,6,7,8,9,10]):short);
##"0^3x2520x60x6x2^2"
gap> STOP_TEST("StructureDescription.tst", 10000);

0 comments on commit ce20d70

Please sign in to comment.