This answer works over finite fields (package already established and GF(4) already established, not included in code below), however, I think you would just need to use NullSpace[codewords,Modulus->4]NullSpace[codewords, Modulus->4]
in order to work over $\mathbb{Z}4$ instead.
Rather than attempt to find all of the possible tuples of {f4[0], f4[1], f4[2], f4[3]}{f4[0], f4[1], f4[2], f4[3]}
of length 6 and then finding which of these tuples is orthogonal to every vector in "codewords", instead I followed @ydd's approach of using the NullSpacenull space of my codewords.
I found the Nullspacenull space of my codewords, which provides a basis for all of the vectors which are orthogonal to the codewords (i.e satisfy the equation Cx=0C.x == 0
, where CC
are the codewords and xx
is a vector in GF(4) orthogonal to every codeword).
I then found all of the possible combinations of the row space multiplied by elements from the finite field, in order to find every vector orthogonal to the codewords in GF(4).
Then, I found the UnionUnion
of this result so as to remove duplicate vectors.
dualcodewords = Module[{H, row1, row2, row3},
H = RowReduce[NullSpace[codewords]];
row1 = H[[1]];
row2 = H[[2]];
row3 = H[[3]];
table = Table[
Table[f4[i] f4[i] row1 + f4[j] row2 + f4[k] row3,
{i, 0, 4}, {j, 0,
4}, {k, 0, 4}
];
Union[Flatten[table, 2]]
]