[Next][Prev] [Right] [Left] [Up] [Index] [Root]

The Gray Map

For an element x in Z_4, the Gray map phi: Z_4 -> Z_2^2 is defined by: 0 |-> 00, 1 |-> 01, 2 |-> 11, 3 |-> 10. This map is extended to a map from Z_4^n onto Z_2^(2n) in the obvious way (by concatenating the images of each component) and is then a weight- and distance-preserving map from (Z_4^n, Lee weight) to (Z_2^(2n), Hamming weight). See [Wan97, Chapter 3] for more information (but note that that author has a different order for the components of the image of a vector).

GrayMap(C) : Code -> Map
Given a Z_4-linear code C, this function returns the Gray map for C, which is the map phi from C to GF(2)^(2n), as defined above.
GrayMapImage(C) : Code -> [ ModTupRngElt ]
Given a Z_4-linear code C, this function returns the image of C under the Gray map as a sequence of vectors in GF(2)^(2n). The resulting image may not be a GF(2)-linear code, so that is why only a sequence of vectors is returned.
HasLinearGrayMapImage(C) : Code -> BoolElt, Code
Given a Z_4-linear code C, this function returns true iff the image of C under the Gray map is a GF(2)-linear code. If so, the function also returns the image B as a GF(2)-linear code, together with the bijection phi: C -> B.

Example CodeRng_GrayMap (H98E9)

Let phi(O_8) be the image of the octacode O_8 under the Gray map. This image is not a GF(2)-linear code, but it is the non-linear (8, 256, 6) Nordstron-Robinson code [Wan97, Ex.3.4]. We note the weights of all the vectors in this non-linear image.

> Z4 := IntegerRing(4);
> O8 := LinearCode<Z4, 8 |
>     [1,0,0,0,3,1,2,1],
>     [0,1,0,0,1,2,3,1],
>     [0,0,1,0,3,3,3,2],
>     [0,0,0,1,2,3,1,1]>;
> HasLinearGrayMapImage(O8);
false
> NR := GrayMapImage(O8); 
> #NR;
256
> {Weight(v): v in NR};
{ 0, 6, 8, 10, 16 }
For the code K_8, we first note the image of some of the vectors under the Gray map.

> Z4 := IntegerRing(4);
> K8 := LinearCode< Z4, 8 |
>     [1,1,1,1,1,1,1,1],
>     [0,2,0,0,0,0,0,2],
>     [0,0,2,0,0,0,0,2],
>     [0,0,0,2,0,0,0,2],
>     [0,0,0,0,2,0,0,2],
>     [0,0,0,0,0,2,0,2],
>     [0,0,0,0,0,0,2,2]>;
> f := GrayMap(K8);
> K8.1;
(1 1 1 1 1 1 1 1)
> f(K8.1);
(0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1)
> K8.2;
(0 2 0 0 0 0 0 2)
> f(K8.2);
(0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1)
Finally, we see that the image of K_8 is linear over GF(2).

> l, B, g := HasLinearGrayMapImage(K8);
> l;
true
> B;
[16, 8, 4] Linear Code over GF(2)
Generator matrix:
[1 0 0 1 0 1 0 1 0 1 0 1 0 1 1 0]
[0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1]
[0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1]
[0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1]
[0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 1]
[0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 1]
[0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1]
[0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1]
> g(K8.1) in B;
true

 [Next][Prev] [Right] [Left] [Up] [Index] [Root]