diff --git a/src/vec8bit.c b/src/vec8bit.c index d83712c4cb..dcc74b7463 100644 --- a/src/vec8bit.c +++ b/src/vec8bit.c @@ -1409,7 +1409,7 @@ static Obj FuncPROD_VEC8BIT_FFE(Obj self, Obj vec, Obj ffe) GAP_ASSERT(CHAR_FF(FLD_FFE(ffe)) == P_FIELDINFO_8BIT(info)); // check for field compatibility - if (d % DEGR_FF(FLD_FFE(ffe))) { + if (d % DegreeFFE(ffe)) { prod = ProdListScl(vec, ffe); CALL_1ARGS(ConvertToVectorRep, prod); return prod; diff --git a/tst/testbugfix/2024-03-25-compressed-mat-scalar.tst b/tst/testbugfix/2024-03-25-compressed-mat-scalar.tst new file mode 100644 index 0000000000..0df7064a22 --- /dev/null +++ b/tst/testbugfix/2024-03-25-compressed-mat-scalar.tst @@ -0,0 +1,51 @@ +# Multiplying a compressed matrix by a scalar could result +# in corrupt data. See +# +gap> g1 := GO(1,6,64).1; +< immutable compressed matrix 6x6 over GF(64) > +gap> a := g1*Z(2^4)^5; +< immutable compressed matrix 6x6 over GF(64) > +gap> b := g1*Z(2^2); +< immutable compressed matrix 6x6 over GF(64) > +gap> a = b; +true +gap> TransposedMat(a) = TransposedMat(b); +true +gap> List(a, Q_VEC8BIT); +[ 64, 64, 64, 64, 64, 64 ] +gap> List(b, Q_VEC8BIT); +[ 64, 64, 64, 64, 64, 64 ] + +# also verify printing matches +gap> Display(a); +z = Z(64) + z^22 . . . . . + . z^20 . . . . + . . . z^21 . . + . . z^21 . . . + . . . . . z^21 + . . . . z^21 . +gap> Display(b); +z = Z(64) + z^22 . . . . . + . z^20 . . . . + . . . z^21 . . + . . z^21 . . . + . . . . . z^21 + . . . . z^21 . +gap> Display(TransposedMat(a)); +z = Z(64) + z^22 . . . . . + . z^20 . . . . + . . . z^21 . . + . . z^21 . . . + . . . . . z^21 + . . . . z^21 . +gap> Display(TransposedMat(b)); +z = Z(64) + z^22 . . . . . + . z^20 . . . . + . . . z^21 . . + . . z^21 . . . + . . . . . z^21 + . . . . z^21 .