From a0d16f0c6cfc1af0f4e3cf3e2c910515c0f7bdf3 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 15 Apr 2021 02:12:53 +0200 Subject: [PATCH] Fix NewZeroMatrix for IsGF2MatrixRep with zero rows --- hpcgap/lib/vecmat.gi | 9 ++++----- lib/vecmat.gi | 9 ++++----- tst/testinstall/MatrixObj/ZeroMatrix.tst | 4 ++-- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/hpcgap/lib/vecmat.gi b/hpcgap/lib/vecmat.gi index f28aa5e0b3a..8148a2b51e6 100644 --- a/hpcgap/lib/vecmat.gi +++ b/hpcgap/lib/vecmat.gi @@ -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 ); diff --git a/lib/vecmat.gi b/lib/vecmat.gi index ff011542c97..bfbc243f3cc 100644 --- a/lib/vecmat.gi +++ b/lib/vecmat.gi @@ -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 ); diff --git a/tst/testinstall/MatrixObj/ZeroMatrix.tst b/tst/testinstall/MatrixObj/ZeroMatrix.tst index a66f1231708..2affaa554b8 100644 --- a/tst/testinstall/MatrixObj/ZeroMatrix.tst +++ b/tst/testinstall/MatrixObj/ZeroMatrix.tst @@ -7,7 +7,7 @@ gap> ReadGapRoot("tst/testinstall/MatrixObj/testmatobj.g"); gap> TestZeroMatrix(IsGF2MatrixRep, GF(2), 2, 3); gap> TestZeroMatrix(IsGF2MatrixRep, GF(2), 2, 0); -Error, Assertion failure + gap> TestZeroMatrix(IsGF2MatrixRep, GF(2), 0, 3); # TODO Error, IsGF2MatrixRep with zero rows not yet supported @@ -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); -[ , ] + # gap> ZeroMatrix(GF(3), 2, 3);