Skip to content

Commit

Permalink
Fix BaseDomain method ordering for row vectors
Browse files Browse the repository at this point in the history
Since IsMatrix has a high rank and IsGF2VectorRep / Is8BitVectorRep objects
are in the filter IsMatrix, the wrong BaseDomain method was selected for such
objects. This reduces performance, and also caused an error with vectors of
length 0.
  • Loading branch information
fingolfin committed Apr 15, 2021
1 parent b55dcfe commit 1a17ffc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions lib/matrix.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1258,6 +1258,7 @@ end );
InstallOtherMethod( BaseDomain,
"generic method for a row vector",
[ IsRowVector ],
-SUM_FLAGS,
DefaultRing );

InstallOtherMethod( OneOfBaseDomain,
Expand Down
12 changes: 6 additions & 6 deletions tst/testinstall/MatrixObj/ZeroVector.tst
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ gap> ReadGapRoot("tst/testinstall/MatrixObj/testmatobj.g");
# IsGF2VectorRep
#
gap> TestZeroVector(IsGF2VectorRep, GF(2), 3);
Error, Assertion failure
<a GF2 vector of length 3>
gap> TestZeroVector(IsGF2VectorRep, GF(2), 0);
Error, Assertion failure
<a GF2 vector of length 0>

# test error handling
gap> TestZeroVector(IsGF2VectorRep, GF(2), -1);
Expand All @@ -19,15 +19,15 @@ Error, IsGF2VectorRep only supported over GF(2)
# Is8BitVectorRep
#
gap> TestZeroVector(Is8BitVectorRep, GF(3), 3);
Error, Assertion failure
[ 0*Z(3), 0*Z(3), 0*Z(3) ]
gap> TestZeroVector(Is8BitVectorRep, GF(3), 0);
Error, Z: <q> must be a positive prime power (not the integer 1)
< mutable compressed vector length 0 over GF(3) >

#
gap> TestZeroVector(Is8BitVectorRep, GF(251), 3);
Error, Assertion failure
[ 0*Z(251), 0*Z(251), 0*Z(251) ]
gap> TestZeroVector(Is8BitVectorRep, GF(251), 0);
Error, Z: <q> must be a positive prime power (not the integer 1)
< mutable compressed vector length 0 over GF(251) >

# test error handling
gap> TestZeroVector(Is8BitVectorRep, GF(3), -1);
Expand Down

0 comments on commit 1a17ffc

Please sign in to comment.