Skip to content

Commit

Permalink
Merge pull request #892 from hulpke/newmtc
Browse files Browse the repository at this point in the history
Performance improvement and fix of generators. This fixes the bugs reported in #887
  • Loading branch information
hulpke authored Aug 23, 2016
2 parents da0416e + 06a79e7 commit 8f5e7f4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
8 changes: 4 additions & 4 deletions lib/ghomfp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -858,17 +858,17 @@ local aug,w,p,pres,f,fam,G;
w:=FamilyObj(u)!.wholeGroup;
aug:=NEWTC_CosetEnumerator(FreeGeneratorsOfFpGroup(w),
RelatorsOfFpGroup(w),
List(GeneratorsOfGroup(u),UnderlyingElement),
List(gens,UnderlyingElement),
true);

pres:=NEWTC_PresentationMTC(aug,1,"%");
pres:=NEWTC_PresentationMTC(aug,1,nam);
if Length(GeneratorsOfPresentation(pres))>Length(gens) then
aug:=NEWTC_CosetEnumerator(FreeGeneratorsOfFpGroup(w),
RelatorsOfFpGroup(w),
List(GeneratorsOfGroup(u),UnderlyingElement),
List(gens,UnderlyingElement),
true,false);

pres:=NEWTC_PresentationMTC(aug,0,"%");
pres:=NEWTC_PresentationMTC(aug,0,nam);
fi;
Assert(0,Length(GeneratorsOfPresentation(pres))=Length(gens));

Expand Down
12 changes: 9 additions & 3 deletions lib/sgpres.gi
Original file line number Diff line number Diff line change
Expand Up @@ -2731,7 +2731,7 @@ local c,offset,f,b,r,i,j;
r:=Length(w);
f:=alpha;i:=1;
b:=alpha;j:=r;
while true do
while i<=j do
# forward scan
while i<=r and c[w[i]+offset][f]<>0 do
f:=c[w[i]+offset][f];
Expand All @@ -2750,12 +2750,14 @@ local c,offset,f,b,r,i,j;
j:=j-1;
od;
if j<i then

NEWTC_Coincidence(DATA,f,b);
elif j=i then
# deduction
c[w[i]+offset][f]:=b;
c[-w[i]+offset][b]:=f;
Add(DATA.deductions,[f,w[i]]);
return;
else
NEWTC_Define(DATA,f,w[i]);
fi;
Expand All @@ -2771,7 +2773,7 @@ local c,offset,f,b,r,i,j,fp,bp;
r:=Length(w);
b:=alpha;j:=r;
bp:=y;
while true do #N
while i<=j do #N
# forward scan
while i<=r and c[w[i]+offset][f]<>0 do
if DATA.useAddition then
Expand Down Expand Up @@ -2817,6 +2819,7 @@ local c,offset,f,b,r,i,j,fp,bp;
DATA.aug[-w[i]+offset][b]:=WordProductLetterRep(-Reversed(bp),fp);
fi;
Add(DATA.deductions,[f,w[i]]);
return;
else
NEWTC_Define(DATA,f,w[i]);
fi;
Expand Down Expand Up @@ -2966,6 +2969,7 @@ local m,offset,rels,ri,ccr,i,r,ct,A,a,w,n,DATA,p,ds,dr,
NEWTC_ScanAndFill(DATA,1,DATA.subgword[w]);
fi;
od;

NEWTC_ProcessDeductions(DATA);

# words we want to trace early (as they might reduce the number of
Expand Down Expand Up @@ -3383,6 +3387,8 @@ local DATA,rels,i,j,w,f,r,s,fam,new,ri,a,offset,p,rset,re,start,stack,pres,
CompletionBar(InfoFpGroup,2,"Coset Loop: ",i/DATA.n);
for w in DATA.rels do
r:=NEWTC_Rewrite(DATA,i,w);
MakeCanonical(r);

# reduce with others
for j in rels do
r:=NEWTC_ReplacedStringCyclic(r,j);
Expand Down Expand Up @@ -3488,7 +3494,7 @@ local DATA,rels,i,j,w,f,r,s,fam,new,ri,a,offset,p,rset,re,start,stack,pres,
TzSearch(pres);
TzEliminate(pres,i);
od;
Assert(1,Length(GeneratorsOfPresentation)=subnum);
Assert(1,Length(GeneratorsOfPresentation(pres))=subnum);

fi;
r:=List(GeneratorsOfPresentation(pres){
Expand Down
11 changes: 11 additions & 0 deletions tst/teststandard/bugfix.tst
Original file line number Diff line number Diff line change
Expand Up @@ -3135,6 +3135,17 @@ gap> rels:=[x_1^2+x_2,x_1*x_2+x_3,x_1*x_3+x_4, x_1*x_4+x_1,x_2^2+x_4,
gap> Size(r1/Ideal(r1,rels));
32

# 2016/8/18 (AH)
gap> src := FreeGroup(3);;
gap> src := src / [src.3*src.1];;
gap> SetReducedMultiplication(src);
gap> f1:=src.1;;f2:=src.2;;f3:=src.3;;
gap> gens := [ f1, f2, f2^-1*f3*f2 ];;
gap> fp := IsomorphismFpGroupByGeneratorsNC(src,gens,"F");;
gap> dst := Image(fp);;wrd:=RelatorsOfFpGroup(dst)[1];;
gap> m:=MappedWord(wrd,GeneratorsOfGroup(FreeGroupOfFpGroup(dst)),gens);
<identity ...>

#############################################################################
gap> STOP_TEST( "bugfix.tst", 831990000);

Expand Down

0 comments on commit 8f5e7f4

Please sign in to comment.