Skip to content

Commit

Permalink
Revise printing of IsPlistMatrixRep
Browse files Browse the repository at this point in the history
This fixes printing of 0 x n matrices
  • Loading branch information
fingolfin committed May 3, 2022
1 parent 5182447 commit fefb213
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
9 changes: 2 additions & 7 deletions lib/matobjplist.gi
Original file line number Diff line number Diff line change
Expand Up @@ -748,14 +748,9 @@ InstallMethod( Display, "for a plist matrix", [ IsPlistMatrixRep ],
local i;
Print("<");
if not IsMutable(m) then Print("immutable "); fi;
Print(NrRows(m),"x",NrCols(m),"-matrix over ",m![BDPOS],":\n");
Print(NrRows(m),"x",NrCols(m),"-matrix over ",m![BDPOS],": [\n");
for i in [1..NrRows(m)] do
if i = 1 then
Print("[");
else
Print(" ");
fi;
Print(m![ROWSPOS][i],"\n");
Print(" ",m![ROWSPOS][i],"\n");
od;
Print("]>\n");
end );
Expand Down
8 changes: 4 additions & 4 deletions tst/testinstall/MatrixObj/Matrix.tst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ gap> START_TEST("Matrix.tst");
gap> m := Matrix( [[1,2],[3,4]] );
<2x2-matrix over Rationals>
gap> Display(m);
<2x2-matrix over Rationals:
[[ 1, 2 ]
<2x2-matrix over Rationals: [
[ 1, 2 ]
[ 3, 4 ]
]>

Expand Down Expand Up @@ -34,8 +34,8 @@ gap> Display(m);
gap> m := Matrix( IsPlistMatrixRep, GF(2), [[1,2],[3,4]] * Z(2) );
<2x2-matrix over GF(2)>
gap> Display(m);
<2x2-matrix over GF(2):
[[ Z(2)^0, 0*Z(2) ]
<2x2-matrix over GF(2): [
[ Z(2)^0, 0*Z(2) ]
[ Z(2)^0, 0*Z(2) ]
]>

Expand Down
14 changes: 7 additions & 7 deletions tst/testinstall/MatrixObj/NewMatrix.tst
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# IsPlistMatrixRep
gap> NewMatrix(IsPlistMatrixRep, Integers, 3, [ ] ); Display(last);
<0x3-matrix over Integers>
<0x3-matrix over Integers:
<0x3-matrix over Integers: [
]>
gap> NewMatrix(IsPlistMatrixRep, Integers, 3, [ 1, 2, 3 ] ); Display(last);
<1x3-matrix over Integers>
<1x3-matrix over Integers:
[[ 1, 2, 3 ]
<1x3-matrix over Integers: [
[ 1, 2, 3 ]
]>
gap> NewMatrix(IsPlistMatrixRep, Integers, 3, [ 1, 2, 3, 4, 5, 6 ] ); Display(last);
<2x3-matrix over Integers>
<2x3-matrix over Integers:
[[ 1, 2, 3 ]
<2x3-matrix over Integers: [
[ 1, 2, 3 ]
[ 4, 5, 6 ]
]>
gap> NewMatrix(IsPlistMatrixRep, Integers, 3, [ [1, 2, 3], [4, 5, 6] ] ); Display(last);
<2x3-matrix over Integers>
<2x3-matrix over Integers:
[[ 1, 2, 3 ]
<2x3-matrix over Integers: [
[ 1, 2, 3 ]
[ 4, 5, 6 ]
]>

Expand Down

0 comments on commit fefb213

Please sign in to comment.