Skip to content

Commit

Permalink
Fix NewZeroMatrix for IsGF2MatrixRep with zero rows
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Apr 15, 2021
1 parent 3611770 commit a0d16f0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
9 changes: 4 additions & 5 deletions hpcgap/lib/vecmat.gi
Original file line number Diff line number Diff line change
Expand Up @@ -2480,12 +2480,11 @@ InstallMethod( NewZeroMatrix, "for IsGF2MatrixRep, GF(2), and two ints",
if rows = 0 then
Error("IsGF2MatrixRep with zero rows not yet supported");
fi;
m := 0*[1..rows];
m[1] := NewZeroVector(IsGF2VectorRep,f,cols);
for i in [2..rows] do
m[i] := ShallowCopy(m[1]);
m := EmptyPlist(rows);
for i in [1..rows] do
m[i] := ZERO_GF2VEC_2(cols);
od;
ConvertToMatrixRep(m,2);
ConvertToMatrixRepNC(m,2);
return m;
end );

Expand Down
9 changes: 4 additions & 5 deletions lib/vecmat.gi
Original file line number Diff line number Diff line change
Expand Up @@ -2473,12 +2473,11 @@ InstallMethod( NewZeroMatrix, "for IsGF2MatrixRep, GF(2), and two ints",
if rows = 0 then
Error("IsGF2MatrixRep with zero rows not yet supported");
fi;
m := 0*[1..rows];
m[1] := NewZeroVector(IsGF2VectorRep,f,cols);
for i in [2..rows] do
m[i] := ShallowCopy(m[1]);
m := EmptyPlist(rows);
for i in [1..rows] do
m[i] := ZERO_GF2VEC_2(cols);
od;
ConvertToMatrixRep(m,2);
ConvertToMatrixRepNC(m,2);
return m;
end );

Expand Down
4 changes: 2 additions & 2 deletions tst/testinstall/MatrixObj/ZeroMatrix.tst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ gap> ReadGapRoot("tst/testinstall/MatrixObj/testmatobj.g");
gap> TestZeroMatrix(IsGF2MatrixRep, GF(2), 2, 3);
<a 2x3 matrix over GF2>
gap> TestZeroMatrix(IsGF2MatrixRep, GF(2), 2, 0);
Error, Assertion failure
<a 2x0 matrix over GF2>
gap> TestZeroMatrix(IsGF2MatrixRep, GF(2), 0, 3); # TODO
Error, IsGF2MatrixRep with zero rows not yet supported

Expand Down Expand Up @@ -106,7 +106,7 @@ gap> ZeroMatrix(GF(2), 2, 3);
gap> ZeroMatrix(GF(2), 0, 3);
Error, IsGF2MatrixRep with zero rows not yet supported
gap> ZeroMatrix(GF(2), 2, 0);
[ <a GF2 vector of length 0>, <a GF2 vector of length 0> ]
<a 2x0 matrix over GF2>

#
gap> ZeroMatrix(GF(3), 2, 3);
Expand Down

0 comments on commit a0d16f0

Please sign in to comment.