3
The Hadamard multiple-error correcting codes The (32, 6) 7-error correcting Hadamard code The Hadamard (32, 6) code was used by NASA for the Mariner spacecraft in 1969 as it sent pictures back to the Earth from Mars. The generator matrix is a 32 × 32 matrix H with entries in {-1, 1}. Numbering the rows and columns from 0 to 31, represent i and j in binary as i = a 4 a 3 a 2 a 1 a 0 and j = b 4 b 3 b 2 b 1 b 0 . Then the (i, j ) entry H ij in H is given by H ij =(-1) a 4 b 4 + a 3 b 3 + a 2 b 2 + a 1 b 1 + a 0 b 0 . Thirty-two of the codewords are the rows of H , and the other 32 are the rows of -H . A received message m (a 32-long string of 1’s and -1’s) can be decoded as follows. Take the dot product of m with each row of H . If the message is correct, it will have dot product 0 with all rows but one, and with that row it will have dot product 32 or -32. If the dot product is 32 (respectively, -32), the codeword is that row of H (respectively, of -H ). If the message has one error, all dot products are between 2 and -2, except for one, which will be 30 or -30, and that row is the correct codeword or its negative. This continues as follows: Number of errors Range for all dot products but one Range for the “right” row 2 -4 to 4 28 to 32 or - 28 to - 32 3 -6 to 6 26 to 32 or - 26 to - 32 4 -8 to 8 24 to 32 or - 24 to - 32 5 -10 to 10 22 to 32 or - 22 to - 32 6 -12 to 12 20 to 32 or - 20 to - 32 7 -14 to 14 18 to 32 or - 18 to - 32 With eight or more errors, the ranges overlap, and so correction is not possible. However, this code has minimum Hamming distance 16, so that one can detect up to 15 errors.

My Hadamar d Code

Embed Size (px)

DESCRIPTION

hadamard code

Citation preview

  • The Hadamard multiple-error correcting codes

    The (32, 6) 7-error correcting Hadamard code

    The Hadamard (32, 6) code was used by NASA for the Mariner spacecraft in 1969 as it sent pictures

    back to the Earth from Mars. The generator matrix is a 32 32 matrix H with entries in {1, 1}.Numbering the rows and columns from 0 to 31, represent i and j in binary as i = a4a3a2a1a0 and

    j = b4b3b2b1b0. Then the (i, j) entry Hij in H is given by

    Hij = (1)a4b4 + a3b3 + a2b2 + a1b1 + a0b0 .

    Thirty-two of the codewords are the rows of H, and the other 32 are the rows of H. A receivedmessage m (a 32-long string of 1s and 1s) can be decoded as follows. Take the dot product of mwith each row of H. If the message is correct, it will have dot product 0 with all rows but one, and

    with that row it will have dot product 32 or 32. If the dot product is 32 (respectively, 32), thecodeword is that row of H (respectively, of H). If the message has one error, all dot products arebetween 2 and 2, except for one, which will be 30 or 30, and that row is the correct codewordor its negative.

    This continues as follows:

    Number of errors Range for all dot products but one Range for the right row

    2 4 to 4 28 to 32 or 28 to 323 6 to 6 26 to 32 or 26 to 324 8 to 8 24 to 32 or 24 to 325 10 to 10 22 to 32 or 22 to 326 12 to 12 20 to 32 or 20 to 327 14 to 14 18 to 32 or 18 to 32

    With eight or more errors, the ranges overlap, and so correction is not possible. However, this

    code has minimum Hamming distance 16, so that one can detect up to 15 errors.

  • The (16, 5) 3-error correcting Hadamard code

    In this section, we describe the encryption and decryption procedures for the (16, 5) Hadamard

    code. The message words are the 32 five-bit strings that are the binary representations of the

    integers from 0 through 31. There is an encoding (or generating) 4 16 matrix G whose entriesare in {0, 1}, and a parity-check (i.e. decoding) matrix P whose entries are in {1,1}.

    The generating matrix has four rows and 16 columns, and the columns are numbered 0, 1, . . . , 14, 15.

    For 0 j 15, write j = 8j3 + 4j2 + 2j1 + j0; the jth column is the transpose of the row vector(j3, j2, j1, j0). Thus,

    G =

    0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 10 0 0 0 1 1 1 1 0 0 0 0 1 1 1 10 0 1 1 0 0 1 1 0 0 1 1 0 0 1 10 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

    Let x4x3x2x1x0 be the five-bit message word. To encode x, do the following:

    1. Remove the high-order bit, and form the vector x = (x3, x2, x1, x0).

    2. Form the 16-long vector y = x G = (y1, . . . , y16) mod 2

    3. For i = 1, . . . , 16, set zi = (1)yi .

    4. Set z = (z1, . . . , z16) or z = (z1, . . . ,z16) according as x4 = 0 or x4 = 1.

    5. z is the encoding of x.

    P is the 16 16 matrix whose jth row is the encoding of j 1, for j = 1, . . . , 16; it looks like this:

    P =

    1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

  • Sixteen of the codewords are the rows of P ; the other sixteen are the rows of P , correspondingto the encoding of the numbers 16, . . . , 31. To decode a 16-long string w of 1s and 1s, computethe product w P . As it was for the (64, 6) Hadamard code, the following table tells the tale:

    Number of errors Range for all dot products but one Range for the right row

    0 0 16 or 161 2 to 2 14 to 16 or 14 to 162 4 to 4 12 to 16 or 12 to 163 6 to 6 10 to 16 or 10 to 16

    As before, the right row is the one that contains either the codeword (corresponding to a trans-

    mitted number from 0 to 15) or its negative (corresponding to a transmitted number from 16 to

    31). With four or more errors, the ranges overlap, and so correction is not possible. However, this

    code has minimum Hamming distance 8, so that one can detect up to 7 errors.

    As an example, the 5-bit string 01011, corresponding to the integer 11, encodes as the 16-long

    (1, 1) vector e = (1,1,1, 1, 1,1,1, 1,1, 1, 1,1,1, 1, 1,1). Let f = e with the second 1changed to 1, let g = e with the first two 1s changed to 1s, and let h = 3 with the first three1s changed to 1s. Then

    e P = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0),f P = (2, 2, 2,2,2, 2, 2,2,2, 2, 2, 14,2, 2, 2,2),g P = (4, 0, 0,4,4, 0, 0,4,4, 0, 0, 12,4, 0, 0,4), andh P = (6,2,2,6,2, 2, 2,2,6,2,2, 10,2, 2, 2,2).

    In each case (with 0, 1, 2 or 3 errors), the outlier is the 12th entry, corresponding to the number

    11. However, if q = e with the first four 1s to 1s, we see that

    q P = (8, 0, 0,8, 0, 0, 0, 0,8, 0, 0, 8, 0, 0, 0, 0),

    and we have no outliers. That is because q is also the vector consisting of all 1s with four 1schanged to 1s, and so q is at a Hamming distance of four from at least two different codewords.

    If A is a matrix, denote its transpose by At. The matrix P has the property that P P t = 16I,where I denotes the identity matrix of order 16. Such matrices are called Hadamard matrices, and

    have connections with many other areas of mathematics including cryptography.