a codeword over $\operatorname{GF}(4)$ -> two codewords over $\operatorname{GF}(2)$ using MAGMA

71 Views Asked by At

A codeword $X$ over $\operatorname{GF}(4)$ is given. How can I write it as $X= A+wB$ using MAGMA? where $A$ and $B$ are over $\operatorname{GF}(2)$ and $w^2 + w =1$.
Is there an easy way, or do I have to write some for loops and if statements?

1

There are 1 best solutions below

1
On BEST ANSWER

Probably there is an easier way, but the following function should do the job:

function f4tof2(c)
    n := NumberOfColumns(c);
    V := VectorSpace(GF(2),n);
    ets := [ElementToSequence(c[i]) : i in [1..n]];
    return [V![ets[i][1] : i in [1..n]],V![ets[i][2] : i in [1..n]]];
end function;