Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix multiplication of compressed matrix by scalar (#5688)
There was a long-standing bug where multiplying a compressed matrix over a finite field by a scalar could lead to a corrupt result which exhibited weird behavior in subsequent computations. The root cause of this is that in GAP, finite field elements like `Z(2^2)` and `Z(2^4)^5` are equal but (internally) not identical. In this case, a GAP library function had an input validation test that check if a scalar is in the right field (in the new test case, the field is GF(64), and `Z(2^2)` lives in that, hence also `Z(2^4)^5` as it is equal). But the kernel code then used a *different* test which distinguishes between these two elements. For `Z(2^2)` it happily proceeded as before and all was good. But for `Z(2^4)^5` it instead dispatches to a generic function which ends up producing a result over the wrong field. Specifically, before this patch, we had this in the example from the new .tst file: gap> List(a, Q_VEC8BIT); [ 64, 64, 4, 4, 4, 4 ] gap> List(b, Q_VEC8BIT); [ 64, 64, 64, 64, 64, 64 ] With the fix, both matrices give the correct second result.
- Loading branch information