Skip to content

Commit

Permalink
improved the IsOne method for IsPlistMatrixRep
Browse files Browse the repository at this point in the history
as in pull request #5342 for other `IsOne` methods
  • Loading branch information
ThomasBreuer authored and fingolfin committed Feb 2, 2023
1 parent 05ab257 commit e7fb973
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
15 changes: 7 additions & 8 deletions lib/matobjplist.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1127,20 +1127,19 @@ InstallMethod( IsZero,
InstallMethod( IsOne,
[ "IsPlistMatrixRep" ],
function( m )
local i,j,n;
local n, i, row;
if Length(m![ROWSPOS]) <> m![RLPOS] then
#Error("IsOne: Matrix must be square");
return false;
fi;
n := m![RLPOS];
for i in [1..n] do
if not IsOne(m![ROWSPOS][i]![ELSPOS][i]) then return false; fi;
for j in [1..i-1] do
if not IsZero(m![ROWSPOS][i]![ELSPOS][j]) then return false; fi;
od;
for j in [i+1..n] do
if not IsZero(m![ROWSPOS][i]![ELSPOS][j]) then return false; fi;
od;
row:= m![ROWSPOS][i];
if PositionNonZero( row ) <> i or
not IsOne( row![ELSPOS][i] ) or
PositionNonZero( row, i ) <= n then
return false;
fi;
od;
return true;
end );
Expand Down
4 changes: 3 additions & 1 deletion lib/vspcrow.gi
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ InstallOtherMethod( LeftModuleByGenerators,
#FIXME: Setting the filter 'IsNonGaussianRowSpace' enables the handling
# via nice bases, but there is currently no support for that
# in the case of vector spaces of 'IsVectorObj' objects.
# See issue #5347 and discussion #5346 for more information.
# See https://github.com/gap-system/gap/issues/5347
# and https://github.com/gap-system/gap/discussions/5346
# for more information.
fi;

if Length(mat)>0 and ForAny(mat,x->not IsZero(x)) then
Expand Down

0 comments on commit e7fb973

Please sign in to comment.