Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions lib/properties.gd
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,19 @@ DeclareAttribute("LeftOrder", IsExtLElement);
#! returns a right order of element <A>m</A>.
DeclareAttribute("RightOrder", IsExtRElement);

#! @Arguments [m]
#! @Description
#! returns a list <A>[i, p]</A> of minimum numbers such that
#! <A>LeftPower(m, i + p) = LeftPower(m, i)</A>; computed via transposition
#! and right-hand index-period on the transposed magma.
DeclareAttribute("LeftIndexPeriod", IsExtLElement);

#! @Arguments [m]
#! @Description
#! returns a list <A>[i, p]</A> of minimum numbers such that
#! <A>RightPower(m, i + p) = RightPower(m, i)</A>.
DeclareAttribute("RightIndexPeriod", IsExtRElement);

#! @Arguments [m]
#! @Description
#! returns a left order of element <A>m</A>.
Expand Down
36 changes: 35 additions & 1 deletion lib/properties.gi
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,40 @@ InstallMethod(RightOrder, "for a right-multiplicable element", [IsExtRElement],
return infinity;
end);

InstallMethod(LeftIndexPeriod, "for a left-multiplicable element", [IsExtLElement],
function(m)
local M, MT, pos;
M := Parent(m);
MT := TransposedMagma(M);
pos := Position(Elements(M), m);
if pos = fail then
Error("LeftIndexPeriod: element ", m, " not found in parent magma");
fi;
return RightIndexPeriod(Elements(MT)[pos]);
end);

InstallMethod(RightIndexPeriod, "for a right-multiplicable element", [IsExtRElement],
function(m)
local index, maxExponent, n, powerExponent, powers, y;
n := Size(Parent(m));
if n = 1 then
return [1, 1];
fi;
maxExponent := n ^ 2;
y := m;
powers := [];

for powerExponent in [1 .. maxExponent] do
index := Position(powers, y);
if index <> fail then
return [index, powerExponent - index];
fi;
Add(powers, y);
y := y * m;
od;
Error("RightIndexPeriod: no index-period found up to n^2 for element ", m, " in magma of size ", n);
end);

InstallMethod(LeftOrdersOfElements, "for a magma", [IsMagma],
function(M)
return Collected(List(M, m -> LeftOrder(m)));
Expand Down Expand Up @@ -285,4 +319,4 @@ end);
InstallMethod(DigraphOfDiagonal, "for a magma", [IsMagma],
function(M)
return DigraphByEdges(List([1 .. Size(M)], m -> [m, DiagonalOfMultiplicationTable(M)[m]]));
end);
end);
65 changes: 65 additions & 0 deletions tst/test_properties_element_left_right_index_period.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
gap> START_TEST("test_properties_element_left_right_index_period.tst");

gap> BruteRightIndexPeriod := function(m)
> local i, n, p;
> n := Size(Parent(m));
> for i in [1 .. n ^ 2] do
> for p in [1 .. n ^ 2] do
> if RightPower(m, i + p) = RightPower(m, i) then
> return [i, p];
> fi;
> od;
> od;
> end;
function( m ) ... end

gap> BruteLeftIndexPeriod := function(m)
> local M, T, em, pos;
> M := Parent(m);
> T := TransposedMagma(M);
> em := Elements(M);
> pos := Position(em, m);
> return BruteRightIndexPeriod(Elements(T)[pos]);
> end;
function( m ) ... end

gap> ForAll(AllSmallGroups([1 .. 10]), G -> ForAll(Elements(G), g -> LeftIndexPeriod(g) = [1, Order(g)]));
true

gap> ForAll(AllSmallGroups([1 .. 10]), G -> ForAll(Elements(G), g -> RightIndexPeriod(g) = [1, Order(g)]));
true

gap> G := SmallGroup(1, 1);;
gap> LeftIndexPeriod(One(G));
[ 1, 1 ]
gap> RightIndexPeriod(One(G));
[ 1, 1 ]

gap> ForAll(AllSmallGroups([1 .. 10]), G -> ForAll(Elements(G), g -> LeftIndexPeriod(g) = BruteLeftIndexPeriod(g)));
true

gap> ForAll(AllSmallGroups([1 .. 10]), function(G)
> local T, eg, et;
> T := TransposedMagma(G);
> eg := Elements(G);
> et := Elements(T);
> return ForAll([1 .. Length(eg)], i -> LeftIndexPeriod(eg[i]) = RightIndexPeriod(et[i]));
> end);
true

gap> ForAll(AllSmallAntimagmas([2 .. 3]), function(M)
> local T, em, et;
> T := TransposedMagma(M);
> em := Elements(M);
> et := Elements(T);
> return ForAll([1 .. Length(em)], i -> LeftIndexPeriod(em[i]) = RightIndexPeriod(et[i]));
> end);
true

gap> ForAll(AllSmallAntimagmas([2 .. 3]), M -> ForAll(Elements(M), m -> RightIndexPeriod(m) = BruteRightIndexPeriod(m)));
true

gap> ForAny(AllSmallAntimagmas([2 .. 3]), M -> ForAny(Elements(M), m -> LeftIndexPeriod(m) <> RightIndexPeriod(m)));
true

gap> STOP_TEST("test_properties_element_left_right_index_period.tst");
Loading