Now we start to investigate codes in GAP. This requires
the package GUAVA. To load GUAVA, type
RequirePackage("guava");. GAP will then display the GUAVA banner:
____ |
/ \ / --+-- Version 1.7
/ | | |\\ //| |
| _ | | | \\ // | Jasper Cramwinckel
| \ | | |--\\ //--| Erik Roijackers
\ || | | \\ // | Reinald Baart
\___/ \___/ | \\// | Eric Minkes
Lea Ruscio
David Joyner
true
How do you enter a code it using only the list of codes words? Easy, here's an example:
gap> C:=ElementsCode(["0000","1111"],"repetition code",GF(2)); a (4,2,1..4)2 repetition code over GF(2)
This notation (4,2,1..4)2 is GUAVA shorthand for:
the length is 4, the size is 2, the minimum distance in
the Hamming metric is between 1 and 4, and
the covering radius in the Hamming metric is
2.
Here's how to check all this is correct:
gap> Elements(C); [ [ 0 0 0 0 ], [ 1 1 1 1 ] ] gap> MinimumDistance(C); 4 gap> Dimension(C); 1 gap> CoveringRadius(C); 2
GUAVA didn't know the minimum distance before, but once you type the
MinimumDistance(C); command it modifies the GAP record
for
.
gap> C; a cyclic [4,1,4]2 repetition code over GF(2)
Let us not enter a code using a generator matrix
:
gap> G := Z(2)*[ [1,0,0,1,1,0], [0,1,0,1,1,0], [0,0,1,0,1,1] ]; [ [ Z(2)^0, 0*Z(2), 0*Z(2), Z(2)^0, Z(2)^0, 0*Z(2) ], [ 0*Z(2), Z(2)^0, 0*Z(2), Z(2)^0, Z(2)^0, 0*Z(2) ], [ 0*Z(2), 0*Z(2), Z(2)^0, 0*Z(2), Z(2)^0, Z(2)^0 ] ] gap> C:=GeneratorMatCode(G,GF(2)); a linear [6,3,1..3]2..3 code defined by generator matrix over GF(2) gap> MinimumDistance(C); 2 gap> IsLinearCode(C); true gap> Elements(C); [ [ 0 0 0 0 0 0 ], [ 0 0 1 0 1 1 ], [ 0 1 0 1 1 0 ], [ 0 1 1 1 0 1 ], [ 1 0 0 1 1 0 ], [ 1 0 1 1 0 1 ], [ 1 1 0 0 0 0 ], [ 1 1 1 0 1 1 ] ] gap> Dimension(C); 3
(Incidentally, Display(G); prints out on the screen a more readable
form of the matrix
than that outputted above.)
This code
is not 1 error correcting (try correcting
[ 1 1 0 1 1 0 ]).
Here's another example,
gap> G := Z(2)*[ [1,0,0,1,1,0], [0,1,0,1,0,1], [0,0,1,0,1,1] ]; [ [ Z(2)^0, 0*Z(2), 0*Z(2), Z(2)^0, Z(2)^0, 0*Z(2) ], [ 0*Z(2), Z(2)^0, 0*Z(2), Z(2)^0, 0*Z(2), Z(2)^0 ], [ 0*Z(2), 0*Z(2), Z(2)^0, 0*Z(2), Z(2)^0, Z(2)^0 ] ] gap> C:=GeneratorMatCode(G,GF(2)); a linear [6,3,1..3]2 code defined by generator matrix over GF(2) gap> MinimumDistance(C); 3 gap> Dimension(C); 3 gap> Elements(C); [ [ 0 0 0 0 0 0 ], [ 0 0 1 0 1 1 ], [ 0 1 0 1 0 1 ], [ 0 1 1 1 1 0 ], [ 1 0 0 1 1 0 ], [ 1 0 1 1 0 1 ], [ 1 1 0 0 1 1 ], [ 1 1 1 0 0 0 ] ]
This is 1 error correcting.