Skip to content

Commit

Permalink
adding ComputeSkeletonNavigationTables
Browse files Browse the repository at this point in the history
  • Loading branch information
egri-nagy committed Aug 13, 2023
1 parent 8549aba commit 55d0f9b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 28 deletions.
1 change: 1 addition & 0 deletions lib/skeletongroups.gd
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ DeclareAttribute("FromRepLookup", IsSkeleton);
DeclareAttribute("FromRepwLookup", IsSkeleton);
DeclareAttribute("ToRepLookup", IsSkeleton);
DeclareAttribute("ToRepwLookup", IsSkeleton);
DeclareGlobalFunction("ComputeSkeletonNavigationTables");

#PERMUTATORS
DeclareGlobalFunction("RoundTripWords");
Expand Down
65 changes: 38 additions & 27 deletions lib/skeletongroups.gi
Original file line number Diff line number Diff line change
Expand Up @@ -32,37 +32,18 @@ local pos, scc,o, w;
fi;
end);

InstallMethod(FromRepwLookup,
"for a skeleton (SgpDec)", [IsSkeleton],
function(sk)
local m;
m := HashMap();
Perform(ForwardOrbit(sk), function(set) m[set]:=FromRepw(sk,set);end);
return m;
end);

#evaluates the word as transformation and stores it
InstallGlobalFunction(FromRep,
function(sk, A)
if HasFromRepLookup(sk) then return FromRepLookup(sk)[A]; fi;
return EvalWordInSkeleton(sk, FromRepw(sk,A));
end);

InstallMethod(FromRepLookup,
"for a skeleton (SgpDec)", [IsSkeleton],
function(sk)
local m;
m := HashMap();
Perform(ForwardOrbit(sk), function(set) m[set]:=FromRep(sk,set);end);
return m;
end);


#returns a word that takes A to its representative
InstallGlobalFunction(ToRepw,
function(sk, A)
local w, pos, scc, n, outw, fg, inn, inw, out,l,o;
if HasToRepwLookup(sk) then return ToRepwLookup(sk)[A]; fi;
if HasToRepwLookup(sk) then return ToRepwLookup(sk)[A]; fi; #checking the cache
o := ForwardOrbit(sk);
pos := Position(o, A);
scc := OrbSCCLookup(o)[pos];
Expand Down Expand Up @@ -90,21 +71,51 @@ local w, pos, scc, n, outw, fg, inn, inw, out,l,o;
return w;
end);

InstallMethod(ToRepwLookup,
#evaluates the word as transformation
InstallGlobalFunction(ToRep,
function(sk, A)
if HasToRepLookup(sk) then
return ToRepLookup(sk)[A];
else
return EvalWordInSkeleton(sk,ToRepw(sk,A));
fi;
end);

InstallGlobalFunction(ComputeSkeletonNavigationTables,
function(sk)
FromRepwLookup(sk);
FromRepLookup(sk);
ToRepwLookup(sk);
ToRepLookup(sk);
end);

################################################
# hashmaps for precomputing the above functions
InstallMethod(FromRepwLookup,
"for a skeleton (SgpDec)", [IsSkeleton],
function(sk)
local m;
m := HashMap();
Perform(ForwardOrbit(sk), function(set) m[set] := ToRepw(sk,set);end);
Perform(ForwardOrbit(sk), function(set) m[set]:=FromRepw(sk,set);end);
return m;
end);

InstallMethod(FromRepLookup,
"for a skeleton (SgpDec)", [IsSkeleton],
function(sk)
local m;
m := HashMap();
Perform(ForwardOrbit(sk), function(set) m[set]:=FromRep(sk,set);end);
return m;
end);

#evaluates the word as transformation and stores it
InstallGlobalFunction(ToRep,
function(sk, A)
if HasToRepLookup(sk) then return ToRepLookup(sk)[A]; fi;
return EvalWordInSkeleton(sk,ToRepw(sk,A));
InstallMethod(ToRepwLookup,
"for a skeleton (SgpDec)", [IsSkeleton],
function(sk)
local m;
m := HashMap();
Perform(ForwardOrbit(sk), function(set) m[set] := ToRepw(sk,set);end);
return m;
end);

InstallMethod(ToRepLookup,
Expand Down
2 changes: 1 addition & 1 deletion tst/holonomy.tst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ gap> TestHolonomyRelationalMorphism(skBEX);
true
gap> TestHolonomyAction(skBEX);
true
gap> ToRepLookup(skBEX);; ToRepwLookup(skBEX);; FromRepLookup(skBEX);; FromRepwLookup(skBEX);;
gap> ComputeSkeletonNavigationTables(skBEX);; #precomputing all the words and transformation torep,fromrep
gap> TestHolonomyEmulation(skBEX);
true
gap> TestHolonomyRelationalMorphism(skBEX);
Expand Down

0 comments on commit 55d0f9b

Please sign in to comment.