Skip to content

Commit

Permalink
CLEANUP: Matrix over rings checks
Browse files Browse the repository at this point in the history
for square list of lists and otherwise bails out.
This resolves gap-system#4885
  • Loading branch information
hulpke committed Jul 1, 2022
1 parent ee7c18e commit bdd25dd
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/matobj.gi
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,18 @@ InstallMethod( Matrix,
# in and causes an error when testing
# line 318 of semigroups-3.4.0/gap/elements/semiringmat.gi
20,
function( R, list )
function( R, list )
local l;
if Length(list) = 0 then
Error( "list must be not empty" );
TryNextMethod();
fi;
l:=Length(list[1]);
if ForAny([2..Length(list)],x->Length(list[x])<>l) then
TryNextMethod();
fi;
return NewMatrix( DefaultMatrixRepForBaseDomain( R ),
R, Length( list[1] ), list );
end );
R, l, list );
end );

InstallMethod( Matrix,
[ IsSemiring, IsMatrixObj ],
Expand Down

0 comments on commit bdd25dd

Please sign in to comment.