Skip to content

Commit fb33db8

Browse files
Add CanUseFroidurePin + nec. code
1 parent 4e79247 commit fb33db8

File tree

3 files changed

+34
-38
lines changed

3 files changed

+34
-38
lines changed

gap/elements/twisted-bipart.gd

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
DeclareCategory("IsTwistedBipartition", IsMultiplicativeElementWithOne
33
and IsMultiplicativeElementWithZero and
44
IsAssociativeElement);
5+
DeclareCategoryCollections("IsTwistedBipartition");
6+
DeclareCategoryCollections("IsTwistedBipartitionCollection");
7+
58

69
DeclareOperation("TwistedBipartition", [IsInt, IsBipartition, IsInt]);
710
DeclareOperation("ZeroTwistedBipartition", [IsInt, IsInt]);
@@ -17,3 +20,12 @@ IsTwistedBipartition);
1720
DeclareOperation("RandomNonZeroTwistedBipartition", [IsInt, IsInt]);
1821
DeclareProperty("IsZero", IsTwistedBipartition);
1922
DeclareAttribute("ZeroImmutable", IsTwistedBipartition);
23+
24+
#TODO move the following into a separate file named semitwistedbipart.gd
25+
26+
DeclareSynonym("IsTwistedBipartitionSemigroup",
27+
IsTwistedBipartitionCollection and IsSemigroup);
28+
DeclareSynonym("IsTwistedBipartitionMonoid",
29+
IsTwistedBipartitionCollection and IsMonoid);
30+
31+
InstallTrueMethod(IsFinite, IsTwistedBipartitionSemigroup);

gap/elements/twisted-bipart.gi

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

22

3+
InstallTrueMethod(CanUseGapFroidurePin, IsTwistedBipartitionSemigroup);
4+
35
BindGlobal("TYPES_TWISTED_BIPART", []);
46
BindGlobal("TYPE_TWISTED_BIPART",
57
function(n, d)
@@ -153,7 +155,25 @@ return not IsZero(y);
153155
elif IsZero(y) then
154156
return false;
155157
fi;
156-
return NrFloatingBlocks(x) < NrFloatingBlocks(y) or NrFloatingBlocks(x) <
157-
NrFloatingBlocks(y) and UnderlyingBipartition(x) < UnderlyingBipartition(y);
158+
return NrFloatingBlocks(x) < NrFloatingBlocks(y) or (NrFloatingBlocks(x) =
159+
NrFloatingBlocks(y) and UnderlyingBipartition(x) < UnderlyingBipartition(y));
158160
end);
159161

162+
SEMIGROUPS.TwistedBipartitionHashFunc := function(x, data)
163+
if IsZero(x) then
164+
return 1;
165+
fi;
166+
return (211 * data[1].func(NrFloatingBlocks(x), data[1].data)
167+
+ data[2].func(UnderlyingBipartition(x), data[2].data)) mod data[3] + 1;
168+
end;
169+
170+
InstallMethod(ChooseHashFunction, "for a twisted bipartition",
171+
[IsTwistedBipartition, IsInt],
172+
function(x, hashlen)
173+
local data;
174+
data := [ChooseHashFunction(NrFloatingBlocks(x), hashlen),
175+
ChooseHashFunction(UnderlyingBipartition(x), hashlen),
176+
hashlen];
177+
return rec(func := SEMIGROUPS.TwistedBipartitionHashFunc,
178+
data := data);
179+
end);

twisted.g

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)