Skip to content

Commit

Permalink
Make GroupWithMemory behave more like Group
Browse files Browse the repository at this point in the history
In particular, ensure that the wrapped generators are made
immutable, and in the case of matrices, possibly converted
to a better representation. This is achieved by calling
`GroupWithGenerators` on the given generators, and then
wrapping the generators of the resulting group.

This avoids a surprising mismatch in behavior between
ordinary groups and groups with memory in some situations.
And of course making the generators immutable prevents
further pitfalls.

Also make sure we have at least one test for GroupWithMemory
where the input is not a group.
  • Loading branch information
fingolfin authored and ThomasBreuer committed Aug 18, 2023
1 parent ea41bf9 commit ed50a6b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions lib/memory.gi
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,14 @@ InstallGlobalFunction( CopyMemory,

InstallGlobalFunction( GroupWithMemory,
function(gens)
# gens a list of generators
# gens a list of generators or a group
local g,memgens;
if IsGroup(gens) then
memgens := GeneratorsWithMemory(GeneratorsOfGroup(gens));
else
memgens := GeneratorsWithMemory(gens);
if not IsGroup(gens) then
# trick: ensure all transformations that GroupWithGenerators applies
# to the generators are applied here, too
gens := GroupWithGenerators(gens);
fi;
memgens := GeneratorsWithMemory(GeneratorsOfGroup(gens));
g := GroupWithGenerators(memgens);
return g;
end);
Expand Down
2 changes: 1 addition & 1 deletion tst/testinstall/memory.tst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#@local G, H, g, h, tmp, stabChain, s1, s2
gap> G := GroupWithMemory(GroupByGenerators([ (1,2,3,4,5), (1,2) ]));;
gap> G := GroupWithMemory([ (1,2,3,4,5), (1,2) ]);;
gap> H := GroupWithMemory(GL(IsMatrixGroup, 3, 3));;
gap> g := H.1 ^ 2;; h := H.2 ^ 2;;
gap> StripMemory(g);
Expand Down

0 comments on commit ed50a6b

Please sign in to comment.