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

Performance improvements and Corrections (in code used by group automorphisms) #968

Merged
merged 10 commits into from
Dec 8, 2016
117 changes: 93 additions & 24 deletions lib/clashom.gi
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ local clT, # classes T
smare,
ppos,
maxdiff,
cystr,
again, # run orbit again to get all
trymap, # operation to try
skip, # skip (if u=ug)
Expand Down Expand Up @@ -429,7 +430,10 @@ local clT, # classes T
# further fusion among bars
newreps:=[];
Info(InfoHomClass,2,"computing centralizers");
k:=0;
for bar in bars do
k:=k+1;
CompletionBar(InfoHomClass,3,"Color Bars ",k/Length(bars));
b1:=Immutable(bar[1]);
select:=Filtered([1..Length(reps)],i->colourbar[i]=b1);
if Length(select)>1 then
Expand Down Expand Up @@ -457,6 +461,7 @@ local clT, # classes T
fi;
od;
od;
CompletionBar(InfoHomClass,3,"Color Bars ",false);

Info(InfoHomClass,1,"fused to ",Length(newreps)," inner classes");
clF:=newreps;
Expand Down Expand Up @@ -564,11 +569,25 @@ local clT, # classes T

# put small classes to the top (to be sure to hit them and make
# large local stabilizers)
Sort(clTR,function(a,b) return Size(a[3])<Size(b[3]);end);
SortBy(clTR,x->Size(x[3]));

Info(InfoHomClass,3,Length(clTR)," local classes");

cystr:=[];
for p in [1..Length(clTR)] do
repres:=Immutable(CycleStructurePerm(Representative(clTR[p][3])));
select:=First(cystr,x->x[1]=repres);
if select=fail then
Add(cystr,[repres,[p]]);
else
AddSet(select[2],p);
fi;
od;

cengen:=GeneratorsOfGroup(centralizers[j]);
if Length(cengen)>10 then
cengen:=SmallGeneratingSet(centralizers[j]);
fi;
#cengen:=Filtered(cengen,i->not i in localcent_r);

while Length(clTR)>0 do
Expand Down Expand Up @@ -632,12 +651,13 @@ local clT, # classes T
else
# we have the stabilizer and thus are only interested in
# getting new elements.
ppos:=PositionProperty(select,
i->Size(clTR[i][3])<=maxdiff and img in clTR[i][3]);
p:=CycleStructurePerm(img);
ppos:=First(First(cystr,x->x[1]=p)[2],
i->i in select and
Size(clTR[i][3])<=maxdiff and img in clTR[i][3]);
if ppos=fail then
p:="ignore"; #to avoid the first case
else
ppos:=select[ppos]; # get the right value
p:=fail; # go to first case
fi;
fi;
Expand All @@ -646,28 +666,35 @@ local clT, # classes T
if ppos=fail then
p:=First(select,
i->Size(clTR[i][3])<=maxdiff and img in clTR[i][3]);
#if p=fail then Error("nanu"); fi;
else
p:=ppos;
fi;

RemoveSet(select,p);
Add(orb,clTR[p]);

#change the transversal element to map to the representative
con:=trans[orpo]*gen;
limg:=opfun(repres,con);
con:=con*PreImagesRepresentative(centrhom,
RepresentativeAction(localcent_r,
Image(projections[i],limg),
Representative(clTR[p][3])));
Assert(2,Image(projections[i],opfun(repres,con))
=Representative(clTR[p][3]));
Add(trans,con);
for stgen in GeneratorsOfGroup(clTR[p][2]) do
Assert( 2, IsOne( Image( projections[i],
opfun(repres,con*stgen/con)/repres ) ) );
stab:=ClosureGroup(stab,con*stgen/con);
od;
if trans[orpo]=false then
Add(trans,false);
else
#change the transversal element to map to the representative
con:=trans[orpo]*gen;
limg:=opfun(repres,con);
con:=con*PreImagesRepresentative(centrhom,
RepresentativeAction(localcent_r,
Image(projections[i],limg),
Representative(clTR[p][3])));
Assert(2,Image(projections[i],opfun(repres,con))
=Representative(clTR[p][3]));

Add(trans,con);

for stgen in GeneratorsOfGroup(clTR[p][2]) do
Assert( 2, IsOne( Image( projections[i],
opfun(repres,con*stgen/con)/repres ) ) );
stab:=ClosureGroup(stab,con*stgen/con);
od;
fi;

# compute new minimum length

Expand Down Expand Up @@ -762,9 +789,10 @@ local clT, # classes T
pf:=Length(smacla);
remainlen:=List(clTR{smacla},i->Size(i[3]));

Info(InfoHomClass,3,
"This is the true orbit length (missing ",
maxdiff,")");
CompletionBar(InfoHomClass,3,"trueorb ",1-maxdiff/minlen);
#Info(InfoHomClass,3,
# "This is the true orbit length (missing ",
# maxdiff,")");

if Size(stab)*Sum(orb,i->Size(i[3]))
=Size(centralizers[j]) then
Expand Down Expand Up @@ -839,7 +867,7 @@ local clT, # classes T
Info(InfoHomClass,3,"Completed orbit (hard)");
fi;
fi;
else
elif Length(combl)>0 then
combl:=combl[1];
orb:=Concatenation(orb,clTR{smacla{combl}});
select:=Difference(select,smacla{combl});
Expand All @@ -862,13 +890,54 @@ local clT, # classes T
(Sum(orb,i->Size(i[3]))*Size(stab))/Size(centralizers[j])),
" orbit consists of ",Length(orb)," suborbits, iterating");

if stabtrue then
# we know stabilizer, just need to find orbit. As these are
# likely small additions, search in reverse.
for p in select do
for genpos in [1..Length(cengen)] do
gen:=Random(centralizers_r[j])*cengen[genpos];
img:=Image(projections[i],opfun(clTR[p][1],gen));
orpo:=CycleStructurePerm(img);
ppos:=First(First(cystr,x->x[1]=orpo)[2],
i->not i in select and
img in clTR[i][3]);
if ppos<>fail and p in select then
# so the image is in clTR[ppos] which must be in orb
ppos:=Position(orb,clTR[ppos]);
Info(InfoHomClass,3,"found new orbit addition ",p);
Add(orb,clTR[p]);

# #change the transversal element to map to the representative
# con:=trans[ppos]*RepresentativeAction(localcent_r,
# Representative(orb[ppos][3]),img)/gen;
# if not Image(projections[i],opfun(repres,con))
# =Representative(clTR[p][3]) then
# Error("wrong rep");
# fi;
# Add(trans,con);
# cannot easily do transversal this way.
Add(trans,false);

RemoveSet(select,p);
fi;
od;
od;


fi;


orpo:=1;
again:=again+1;
fi;
od;
Info(InfoHomClass,2,"Stabsize = ",Size(stab),
", centstabsize = ",Size(orb[1][2]));
clTR:=clTR{select};
# fix index positions
for p in cystr do
p[2]:=Filtered(List(p[2],x->Position(select,x)),IsInt);
od;

Info(InfoHomClass,2,"orbit consists of ",Length(orb)," suborbits,",
Length(clTR)," classes left.");
Expand Down Expand Up @@ -2957,7 +3026,7 @@ end );
#M ConjugacyClasses( <G> ) . . . . . . . . . . . . . . . . . . of perm group
##
InstallMethod( ConjugacyClasses, "TF Method", true,
[ IsGroup and IsFinite and HasFittingFreeLiftSetup],OVERRIDENICE,
[ IsGroup and IsFinite and CanComputeFittingFree],OVERRIDENICE,
function(G)
if IsPermGroup(G) or IsPcGroup(G) then TryNextMethod();fi;
return ConjugacyClassesViaRadical(G);
Expand Down
74 changes: 67 additions & 7 deletions lib/factgrp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ local pool, dom, o, bl, op, Go, j, b, i,allb,newb,mov;
allb:=ShallowCopy(RepresentativesMinimalBlocks(Go,mov));
for j in allb do
b:=Orbit(G,i{j},OnSets);

Add(bl,Immutable(Set(b)));
# also one finer blocks (as we iterate only once)
newb:=Blocks(Go,Blocks(Go,mov,j),OnSets);
Expand All @@ -513,6 +514,7 @@ local pool, dom, o, bl, op, Go, j, b, i,allb,newb,mov;
Add(allb,newb);
fi;
fi;

od;

#if Length(i)<500 and Size(Go)>10*Length(i) then
Expand All @@ -537,6 +539,43 @@ local pool, dom, o, bl, op, Go, j, b, i,allb,newb,mov;

end);

BindGlobal("DoActionBlocksForKernel",
function(G,mustfaithful)
local pool, dom, o, bl, op, Go, j, b, i,allb,newb,movl;

dom:=MovedPoints(G);
# orbits
o:=OrbitsDomain(G,dom);
o:=Set(List(o,Set));


# all good blocks
bl:=dom;
allb:=ShallowCopy(RepresentativesMinimalBlocks(G,dom));
for j in allb do
if Length(dom)/Length(j)<Length(bl) and
Size(Core(mustfaithful,Stabilizer(mustfaithful,j,OnSets)))=1
then
b:=Orbit(G,j,OnSets);
bl:=b;
# also one finer blocks (as we iterate only once)
newb:=Blocks(G,b,OnSets);
if Length(newb)>1 then
newb:=Union(newb[1]);
if not newb in allb then
Add(allb,newb);
fi;
fi;
fi;
od;
if Length(bl)<Length(dom) then
return bl;
else
return fail;
fi;

end);


#############################################################################
##
Expand Down Expand Up @@ -708,10 +747,15 @@ totalcnt, interupt, u, nu, cor, zzz,bigperm,perm,badcores,max,i;
zzz:=DegreeNaturalHomomorphismsPool(G,N);

Info(InfoFactor,3," ext ",cnt,": ",Index(G,u)," best degree:",zzz);
if Size(cor)>Size(N) and Index(G,u)*2<knowi and
ValueOption("inmax")=fail then
max:=Filtered(MaximalSubgroupClassReps(u:inmax,cheap),
x->IndexNC(G,x)<knowi and IsSubset(x,N));
if cnt<10 and Size(cor)>Size(N) and Index(G,u)*2<knowi and
ValueOption("inmax")=fail then
if IsSubset(RadicalGroup(u),N) and Size(N)<Size(RadicalGroup(u)) then
# only affine ones are needed, rest will have wrong kernel
max:=DoMaxesTF(u,["1"]:inmax,cheap);
else
max:=MaximalSubgroupClassReps(u:inmax,cheap);
fi;
max:=Filtered(max,x->IndexNC(G,x)<knowi and IsSubset(x,N));
for i in max do
cor:=Core(G,i);
AddNaturalHomomorphismsPool(G,cor,i,Index(G,i));
Expand Down Expand Up @@ -747,7 +791,7 @@ end;
##
InstallGlobalFunction(SmallerDegreePermutationRepresentation,function(G)
local o, s, k, gut, erg, H, hom, b, ihom, improve, map, loop,
i,cheap,first;
i,cheap,first,k2;
#if not HasSize(G) then Error("SZ");fi;
Info(InfoFactor,1,"Smaller degree for order ",Size(G),", deg: ",NrMovedPoints(G));
cheap:=ValueOption("cheap");
Expand Down Expand Up @@ -799,12 +843,28 @@ local o, s, k, gut, erg, H, hom, b, ihom, improve, map, loop,
Sort(o,function(a,b)return Length(a)>Length(b);end);
od;

Sort(o,function(a,b)return Length(a)<Length(b);end);

erg:=List(GeneratorsOfGroup(G),i->());
k:=G;
for i in [1..Length(o)] do
Info(InfoFactor,1,"Try to shorten orbit ",i," Length ",Length(o[i]));
s:=ActionHomomorphism(G,o[i],OnPoints,"surjective");
Range(s);
k2:=Image(s,k);
k:=Stabilizer(k,o[i],OnTuples);
H:=Range(s);

# is there an action that is good enough for improving the overall
# kernel, even if it is not faithful? If so use the best of them.
b:=DoActionBlocksForKernel(H,k2);
if b<>fail then
Info(InfoFactor,2,"Blocks for kernel reduce to ",Length(b));
b:=ActionHomomorphism(H,b,OnSets,"surjective");
s:=s*b;
fi;

s:=s*SmallerDegreePermutationRepresentation(Image(s));
Info(InfoFactor,1,"Shortened to ",NrMovedPoints(Range(s)));
erg:=SubdirectDiagonalPerms(erg,List(GeneratorsOfGroup(G),i->Image(s,i)));
od;
if NrMovedPoints(erg)<NrMovedPoints(G) then
Expand Down Expand Up @@ -874,7 +934,7 @@ local o, s, k, gut, erg, H, hom, b, ihom, improve, map, loop,
if map<>fail and Image(map)<>H then
improve:=true;
H:=Image(map);
Info(InfoFactor,2," improved to degree ",NrMovedPoints(H));
Info(InfoFactor,2,"improved to degree ",NrMovedPoints(H));
hom:=hom*map;
ihom:=H;
fi;
Expand Down
2 changes: 2 additions & 0 deletions lib/fitfree.gd
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ InstallTrueMethod(IsFinite,CanComputeFittingFree);
InstallTrueMethod(IsGroup,CanComputeFittingFree);

InstallTrueMethod(CanComputeFittingFree, IsPermGroup);
InstallTrueMethod(CanComputeFittingFree, IsPcGroup);



Expand Down Expand Up @@ -81,6 +82,7 @@ InstallTrueMethod(CanComputeFittingFree, IsPermGroup);
## The record may hold other components that are germane to the recognition
## setup. These components may not be modified by user code.
DeclareAttribute("FittingFreeLiftSetup",IsGroup);
InstallTrueMethod(CanComputeFittingFree,HasFittingFreeLiftSetup);

#############################################################################
##
Expand Down
1 change: 1 addition & 0 deletions lib/gpprmsya.gd
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ DeclareAttribute("AlternatingSubgroup",IsPermGroup);
##
DeclareAttribute("OrbitStabilizingParentGroup",IsPermGroup);

DeclareGlobalFunction("NormalizerParentSA");

#############################################################################
##
Expand Down
Loading