Skip to content

Commit

Permalink
Rank down MatrixObj emulation methods
Browse files Browse the repository at this point in the history
Reduce the rank of `NumberRows` and `NumberColumns` methods that are meant to
emulate the MatrixObj interface for classic plist-of-list matrices.

These methods were in some cases ranked higher than their counterparts
for compressed matrices, leading to unnecessary overhead for e.g.
`NumberRows` when invoked on a compressed matrix.
  • Loading branch information
fingolfin authored and ThomasBreuer committed Sep 18, 2023
1 parent bcf9890 commit 7ee7ce9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/matrix.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1338,11 +1338,13 @@ InstallMethod( RowsOfMatrix,
InstallMethod( NumberRows,
"generic method for a (perhaps empty) matrix",
[ IsMatrix ],
-SUM_FLAGS,
Length );

InstallMethod( NumberColumns,
"generic method for a (perhaps empty) matrix",
[ IsMatrix ],
-SUM_FLAGS,
function( mat )
if Length( mat ) = 0 then
return 0;
Expand Down

0 comments on commit 7ee7ce9

Please sign in to comment.