Skip to content

Commit

Permalink
kernel: make OnLeftInverse use LQUO
Browse files Browse the repository at this point in the history
This ensures that the mutability of the inputs correctly transfers to
the results. In addition, we now benefit from kernel functions
handling LQUO for e.g. permutations.
  • Loading branch information
fingolfin committed Oct 8, 2018
1 parent fc3e4a5 commit 7c1f3e9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/listfunc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1369,8 +1369,7 @@ Obj FuncOnLeftInverse (
Obj point,
Obj elm )
{
elm = INV(elm);
return PROD( elm, point );
return LQUO(elm, point);
}

/****************************************************************************
Expand Down
26 changes: 26 additions & 0 deletions tst/testbugfix/2018-10-08-OnLeftInverse.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Ensure OnLeftInverse preserves the mutability of its
# input arguments.
gap> m:=IdentityMat(2);
[ [ 1, 0 ], [ 0, 1 ] ]
gap> IsMutable(m);
true
gap> IsMutable(m/m);
true
gap> IsMutable(LQUO(m,m));
true
gap> IsMutable(OnRight(m,m));
true
gap> IsMutable(OnLeftInverse(m,m));
true

#
gap> MakeImmutable(m);
[ [ 1, 0 ], [ 0, 1 ] ]
gap> IsMutable(m/m);
false
gap> IsMutable(LQUO(m,m));
false
gap> IsMutable(OnRight(m,m));
false
gap> IsMutable(OnLeftInverse(m,m));
false

0 comments on commit 7c1f3e9

Please sign in to comment.