Skip to content

Commit

Permalink
Add ImmutableMatrix method for IsObjWithMemory (#5874)
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin authored Dec 18, 2024
1 parent 26b374f commit b1a206f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/memory.gi
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,21 @@ InstallOtherMethod(ProjectiveOrder,"object with memory",
return ProjectiveOrder(a!.el);
end);

InstallOtherMethod( ImmutableMatrix,"object with memory",[IsField,IsMatrixOrMatrixObj and IsObjWithMemory],
function(f,a)
local r;
r := rec(slp := a!.slp, n := a!.n, el := ImmutableMatrix(f, a!.el));
Objectify(TypeOfObjWithMemory(FamilyObj(a)),r);
SetFilterObj(r,IsMatrixOrMatrixObj);
if IsMatrix(a) then
SetFilterObj(r,IsMatrix);
fi;
if IsMatrixObj(a) then
SetFilterObj(r,IsMatrixObj);
fi;
return r;
end);

# Free group methods:

InstallOtherMethod( Length, "for a word with memory",
Expand Down
8 changes: 8 additions & 0 deletions tst/testinstall/memory.tst
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,11 @@ gap> g * h;
[ Z(3)^0, 0*Z(3), 0*Z(3) ] ] with mem>
gap> g * G.1;
Error, \* for objects with memory: a!.slp and b!.slp must be identical

# ImmutableMatrix on a matrix with memory
# see https://github.com/gap-system/gap/issues/5872
gap> G:=GroupWithMemory(SL(4,16));;
gap> g:=ImmutableMatrix(GF(4), G.1^5);
<[ [ Z(2^2), 0*Z(2), 0*Z(2), 0*Z(2) ], [ 0*Z(2), Z(2^2)^2, 0*Z(2), 0*Z(2) ],
[ 0*Z(2), 0*Z(2), Z(2)^0, 0*Z(2) ], [ 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0 ]
] with mem>

0 comments on commit b1a206f

Please sign in to comment.