Skip to content

Commit

Permalink
ENHANCE: ReducedMultiplication for FpGroup uses known RWS
Browse files Browse the repository at this point in the history
If there is already a known confluent RWS, use it, and don't try new.
  • Loading branch information
hulpke authored and fingolfin committed May 3, 2021
1 parent 4fdb068 commit b1c4988
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions lib/grpfp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -5128,27 +5128,28 @@ end);
InstallMethod(FpElementNFFunction,true,[IsElementOfFpGroupFamily],0,
# default reduction --
function(fam)
local iso,k,id,f;
# first try whether the group is ``small''
iso:=FPFaithHom(fam);
if iso<>fail and Size(Image(iso))<50000 then
k:=ImagesSource(iso);
#return function(w)
# if not w in FreeGroupOfFpGroup(Source(iso)) then Error("flasch");fi;
# w:=ElementOfFpGroup(fam,w);
# Print("wa=",w,"\n");
# w:=ImageElm(iso,w);
# Print("wb=",w,"\n");
# w:=Factorization(k,w);
# Print("wc=",w,"\n");
# return UnderlyingElement(w);
#end;
return w->UnderlyingElement(Factorization(k,Image(iso,ElementOfFpGroup(fam,w))));
local iso,k,id,f,ran,g;
g:=CollectionsFamily(fam)!.wholeGroup;
if not (HasIsomorphismFpMonoid(g) and
HasReducedConfluentRewritingSystem(Image(IsomorphismFpMonoid(g)))) then
# first try whether the group is ``small''
iso:=FPFaithHom(fam);
if iso<>fail and Size(Image(iso))<50000 then
k:=ImagesSource(iso);
return w->UnderlyingElement(Factorization(k,
Image(iso,ElementOfFpGroup(fam,w))));
fi;
fi;

iso:=IsomorphismFpMonoidGeneratorsFirst(g);
ran:=Range(iso);
f:=FreeMonoidOfFpMonoid(ran);
if HasReducedConfluentRewritingSystem(ran) then
k:=ReducedConfluentRewritingSystem(ran);
else
k:=ReducedConfluentRewritingSystem(ran,
BasicWreathProductOrdering(f,GeneratorsOfMonoid(f)));
fi;
iso:=IsomorphismFpMonoidGeneratorsFirst(CollectionsFamily(fam)!.wholeGroup);
f:=FreeMonoidOfFpMonoid(Range(iso));
k:=ReducedConfluentRewritingSystem(Range(iso),
BasicWreathProductOrdering(f,GeneratorsOfMonoid(f)));
id:=UnderlyingElement(Image(iso,One(fam)));
return w->MonwordToGroupword(UnderlyingElement(One(fam)),
ReducedForm(k,GroupwordToMonword(id,w)));
Expand Down

0 comments on commit b1c4988

Please sign in to comment.