Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENHANCE: Avoid memory issues in solvable conjugacy classes routine. #3078

Merged
merged 4 commits into from
Dec 19, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
ENHANCE: Avoid memory churning in solvable conjugacy classes routine.
Reduce assertion level in test, as the many tests otherwise make it unusable
  • Loading branch information
hulpke committed Dec 18, 2018
commit c8affc24071930d162ee9215d866ae2ae89ad1d6
21 changes: 15 additions & 6 deletions lib/claspcgs.gi
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ local classes, # classes to be constructed, the result
depthlev, # depth at which N starts
one,zero,
vec,
dict,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nitpick: tabs vs. spaces...

kern,img;

depthlev:=DepthOfPcElement(home,N[1]);
Expand Down Expand Up @@ -465,20 +466,28 @@ local classes, # classes to be constructed, the result
#k:=ExternalOrbitsStabilizers( xset );

# do the orbits stuff ourselves
blist:=BlistList([1..Length(aff)],[]);
dict:=NewDictionary(aff[1],true,aff); # keep the dictionary to avoid
# recreating blist.

if not IsPositionDictionary(dict) then
blist:=BlistList([1..Length(aff)],[]);
else
blist:=dict!.blist;
fi;
next:=1;
k:=[];
while next<>fail do
S:=Pcs_OrbitStabilizer(gens,aff,aff[next],imgs,OnRight);
# tick off
if IsPositionDictionary(S.dictionary) then
UniteBlist(blist,S.dictionary!.blist);
else
if IsPositionDictionary(dict) then
S:=Pcs_OrbitStabilizer(gens,aff,aff[next],imgs,OnRight,dict);
#S.dictionary!.vals:=[]; #Not really that expensive to keep
else
S:=Pcs_OrbitStabilizer(gens,aff,aff[next],imgs,OnRight);
for i in S.orbit do
blist[PositionCanonical(aff,i)]:=true;
od;
fi;
Unbind(S.dictionary);
S.orbit:=S.orbit{[1]}; # save memory

Add(k,S);

Expand Down
15 changes: 12 additions & 3 deletions lib/oprtpcgs.gi
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
## SPDX-License-Identifier: GPL-2.0-or-later
##

InstallGlobalFunction(Pcs_OrbitStabilizer,function(pcgs,D,pnt,acts,act)
local orb, # orbit
#function(pcgs,D,pnt,acts,act[,dict]) -- allow to reuse dictionary
# in case of many short orbits
InstallGlobalFunction(Pcs_OrbitStabilizer,function(arg)
local pcgs,D,pnt,acts,act,
orb, # orbit
len, # lengths of orbit before each extension
d, # dictionary
S, rel, # stabilizer and induced pcgs
Expand All @@ -19,8 +22,14 @@ local orb, # orbit
depths, # depths of stabilizer generators
i, ii, j, k; # loop variables

pcgs:=arg[1];D:=arg[2];pnt:=arg[3];acts:=arg[4];act:=arg[5];

pnt:=Immutable(pnt);
d:=NewDictionary(pnt,true,D);
if Length(arg)>5 then
d:=arg[6];
else
d:=NewDictionary(pnt,true,D);
fi;
orb := [ pnt ];
AddDictionary(d,pnt,1);
len := ListWithIdenticalEntries( Length( pcgs ) + 1, 0 );
Expand Down
21 changes: 21 additions & 0 deletions tst/teststandard/permgrp.tst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,27 @@ gap> dc1:=DoubleCosetRepsAndSizes(g,s,s:sisyphus);;
gap> Collected(List(dc,x->x[2]))=Collected(List(dc1,x->x[2]));
true

# The purpose of the following test is to test groups with a large number
# of classes. The assertions for checking the classes will slow the
# calculation down beyond usability, thus change assertion level
gap> SetAssertionLevel(1);
gap> g:=Group((1,27,22,31,13,3,25,24,29,16)(2,28,21,32,14,4,26,23,30,15)
> (5,17,37,43,33,8,19,40,41,35)(6,18,38,44,34,7,20,39,42,36)(9,12)
> (10,11), (1,20,21,33,26,2,19,22,34,25)(3,17,23,35,28)(4,18,24,36,27)
> (5,30,14,12,42)(6,29,13,11,41)(7,31,16,9,43)(8,32,15,10,44));;
gap> IsSolvableGroup(g);
true
gap> Sum(ConjugacyClasses(g),Size);
461373440
gap> g:=Group((1,2,4,3)(5,9,20,36,24,41,37,30,15,27,6,11,19,34,23,43,38,
> 32,16,25)(7,10,18,35,22,42,39,29,13,28,8,12,17,33,21,44,40,31,14,26),
> (1,20,38,30,42)(2,17,40,29,43,3,19,39,32,41,4,18,37,31,44)
> (5,36,13,23,10,6,33,15,24,11,8,34,14,22,12)(7,35,16,21,9)(25,27,28));;
gap> IsSolvableGroup(g);
true
gap> Sum(ConjugacyClasses(g),Size);
1384120320

# Unbind variables so we can GC memory
gap> Unbind(g); Unbind(dc); Unbind(ac); Unbind(g); Unbind(p); Unbind(s);
gap> STOP_TEST( "permgrp.tst", 1);