## Hamming codes

The -Hamming code over having generator matrix

is obtained by typing

C:=HammingCode(GF(2),3);
C;
G:=GeneratorMatrix(C);
G;

Encoding a message using , is simply the map . Type
W:=InformationSpace(C);
Cwords:=<w*G : w in W>;
Cwords;
#Cwords;


From this, you see all the codewords of C and how many there are.

To get the parity check matrix, type H:=ParityCheckMatrix(C); H; To see if a vector in is a codeword, simply compute and check if it is zero or not. Here's a MAGMA example 3.3:

V:=AmbientSpace(C);
v:=V![1,0,0,0,0,0,0];
v*Transpose(H);


Since this last vector is non-zero, is not a codeword. If it was a vector received in transmission (with at least one error) then to decode it, hence to find the most likely codeword sent, type

Decode(C,v);


Exercise 3.15.2 (a)   For the parity check matrix of the binary Hamming code of length , verify for three or four codewords c. Decode .

(b) Find a parity check matrix of the -ary Hamming code of length . Verify for three or four codewords . Decode .

To get the dimension of the code, type Dimension(C); To get its minimum distance, type MinimumDistance(C);

Exercise 3.15.3   Find the dimension and minimum distance of

(a) the binary Hamming code of length ,

(b) the 3-ary Hamming code of length .

david joyner 2008-04-20