I am using the GAP (Groups, Algorithms and Programming) system. For some reason the function NullspaceModQ (which is supposed to give a left kernel of matrix modulo a prime power $Q$) works incorrectly. While
NullspaceModQ([[4]],8)
correctly gives
[[0],[2],[4],[6]]
as an aswer, when I try
NullspaceModQ([[2]],8)
I get
[[0]]
Does anyone have any idea about what is wrong?
This seems to be a long-standing bug in GAP (I just verified that it already occurs in GAP 4.4). I logged it in our issue tracker (see here), and hopefully this will be fixed in a future GAP version.
In the meantime, you can
BasisNullspaceModNinstead, which is undocumented, but is still perfectly safe to use; it is also likely to be more efficient if there are many solutions, as it only returns a $\mathbb{Z}$-basis of the null space, not all its elements. And from the basis, it's a an easy exercise to get all solutions. As a bonus, it supports arbitrary moduli, not just prime powers.Indeed, here is a function which does the same as
NullspaceModQbut for all moduli (it could be optimized, but for huge problems you are better of working with the basis instead anyway).