Skip to content

Commit

Permalink
ENHANCE IsomorphicSubgroups generators
Browse files Browse the repository at this point in the history
choose with preference for lower orders.
  • Loading branch information
hulpke authored and fingolfin committed Aug 18, 2023
1 parent cdaf1e6 commit ea41bf9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
5 changes: 5 additions & 0 deletions lib/morpheus.gd
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,11 @@ DeclareOperation("GQuotients",[IsGroup,IsGroup]);
## gap> emb:=IsomorphicSubgroups(g,h);
## [ [ (3,4), (1,2) ] -> [ (1,2), (3,4) ],
## [ (3,4), (1,2) ] -> [ (1,3)(2,4), (1,2)(3,4) ] ]
## gap> g1:=PSO(-1,8,2);;
## gap> Length(IsomorphicSubgroups(g1,PSL(2,7)));
## 3
## gap> Length(IsomorphicSubgroups(g1,PSL(2,7):findall:=false));
## 1
## ]]></Example>
## </Description>
## </ManSection>
Expand Down
24 changes: 20 additions & 4 deletions lib/morpheus.gi
Original file line number Diff line number Diff line change
Expand Up @@ -3068,7 +3068,7 @@ InstallMethod(IsomorphicSubgroups,"for finite groups",true,
# override `IsFinitelyPresentedGroup' filter.
1,
function(G,H)
local cl,cnt,bg,bw,bo,bi,k,gens,go,imgs,params,emb,clg,sg,vsu,c,i;
local cl,cnt,bg,bw,bo,bi,k,gens,go,imgs,params,emb,clg,sg,vsu,c,i,ranfun;

if not IsInt(Size(G)/Size(H)) then
Info(InfoMorph,1,"sizes do not permit embedding");
Expand Down Expand Up @@ -3114,6 +3114,22 @@ local cl,cnt,bg,bw,bo,bi,k,gens,go,imgs,params,emb,clg,sg,vsu,c,i;
cnt:=cnt+1;
od;

# "random element" function, possibly biased towards smaller orders
ranfun:=x->Random(H);
if Size(H)<10^5 and Length(AbelianInvariants(H))<4 then
# classes that are not contained in normal
vsu:=ConjugacyClasses(H);
vsu:=Filtered(vsu,x->Size(H)
=Size(NormalClosure(H,SubgroupNC(H,[Representative(x)]))));
if Length(vsu)>0 then
SortBy(vsu,x->Order(Representative(x)));
ranfun:=function(x)
# random element of a class, selected with bias for smaller orders
return Random(vsu[Random([1..Random([1..Length(vsu)])])]);
end;
fi;
fi;

# find a suitable generating system
bw:=infinity;
bo:=[0,0];
Expand All @@ -3128,9 +3144,9 @@ local cl,cnt,bg,bw,bo,bi,k,gens,go,imgs,params,emb,clg,sg,vsu,c,i;
repeat
if Length(gens)>2 and Random(1,2)=1 then
# try to get down to 2 gens
gens:=List([1,2],i->Random(H));
gens:=List([1,2],i->ranfun(1));
else
gens:=List([1..sg],i->Random(H));
gens:=List([1..sg],i->ranfun(1));
fi;
# try to get small orders
for k in [1..Length(gens)] do
Expand All @@ -3155,7 +3171,7 @@ local cl,cnt,bg,bw,bo,bi,k,gens,go,imgs,params,emb,clg,sg,vsu,c,i;
elif Set(go)=Set(bo) then
# we hit the orders again -> sign that we can't be
# completely off track
cnt:=cnt+Int(bw/Size(G)*3);
cnt:=cnt+Int(bw/Size(G)/20);
fi;
cnt:=cnt+1;
until bw/Size(G)*3<cnt;
Expand Down

0 comments on commit ea41bf9

Please sign in to comment.