330 likes | 551 Views
exercise in the previous class (1). Consider an “odd” parity check code C whose codewords are ( x 1 , …, x k , p ) with p = x 1 +…+ x k +1. Is C a linear code? No. x 1 =1, x 2 = x 3 =...= x k =0 ⇒ p = 0, and 100 ... 00 is a codeword
E N D
exercisein the previous class (1) • Consider an “odd” parity check code C whose codewords are (x1, …, xk, p) with p = x1+…+xk+1. Is C a linear code? No. x1=1, x2=x3=...=xk=0 ⇒ p = 0, and 100...00 is a codeword x2=1, x1=x3=...=xk=0 ⇒ p = 0, and 010...00 is a codeword the sum of the two codewords = 110...0, not a codeword
p1 = x1 + x2 + x3 p2 = x4 + x5 + x6 q1 = x1 + x4 q2 = x2 + x5 q3 = x3 + x6 r = x1 + x2 + x3 + x4 + x5 + x6 p1 a1 a2 a3 q1 a4 q2 a5 a6 q3 p2 r exercisein the previous class (2) • Construct a 2D code for 6-bit information (a1, ..., a6) as follows. • determine the generator and parity check matrices • encode 011001 using the generator matrix • correct an error in the sequence 110111001010 (a1, ..., a6) → (a1, ..., a6, p1, p2, q1, q2, q3, r) parity symbols:
p1 = x1 + x2 + x3 p2 = x4 + x5 + x6 q1 = x1 + x4 q2 = x2 + x5 q3 = x3 + x6 r = x1 + x2 + x3 + x4 + x5 + x6 exercisein the previous class (3) 111000 000111 100100 010010 001001 111111 coefficients (係数) G: H: 100000 101001 010000 100101 001000 100011 000100 011001 000010 010101 000001 010011 111000 100000 000111 010000 100100 001000 010010 000100 001001 000010 111111 000001 as is transpose H(1 1 0 1 1 1 0 0 1 0 1 0)T = (0 1 1 0 0 1)T = the 4-th column 110111001010 110011001010 (0 1 1 0 0 1)G = (0 1 1 0 0 1 0 1 0 1 0 1)
in the previous class... linear codes: definition, encoding, decoding one-bit error at the i-th symbol position ⇔ syndrome equals thei-th vector of H • if several column vectors in H are the same, then we cannot correct one-bit errors in a codeword. • if all column vectors in H are different, then we cancorrect all one-bit errors in a codeword.
design of error correcting codes Construct a parity check matrix with all column vectors differ, then we have a one-bit error correcting code. OK examples: H= H= H= H= H= 101100 110010 011001 110100 101010 010001 1010011 0100111 1101001 1010011 1100111 1101001 101001 010011 110100 010101 NG examples: C = {v | HvT = 0 mod 2}, the discussion is easier if the right-submatrix of H is an identity matrix...
construction of a code coefficients H= G= 101 100 110 010 011 001 101 110 011 100 110 010 011 001 101 as is transpose 000000, 001101, 010011, 011110, 100110, 101011, 110101, 111000. p1 = x1 + x3 p2 = x1+ x2 p3= x2 + x3 codewords
the “shape” of a check matrix a parity check matrix with m rows and n columns a code with... code length 9 = 4 information symbols + 5 parity symbols m = 5 length # of information symbols # of parity symbols = n = n – m (= k) = m NG good n = 9 “vertically longer” H means more parity symbols in a codeword less number of information symbols not efficient, not favorable...
Hamming code To design a one-bit error correcting code with small redundancy, construct a horizontally longestcheck matrix (all columns differ). • Hamming code • determine m, # of parity check symbols • list up all nonzero vectors with length m • use the vectors as columns of H (any order is OK, but let the right-submatrix be an identity) Richard Hamming 1915-1998 m= 3: length 7 = 4 information + 3 parity
m 2 3 4 5 6 7 n 3 7 15 31 63 127 k 1 4 11 26 57 120 Parameters of Hamming code Hamming code • determine m, # of parity check symbols • design H to have 2m – 1 different column vectors H has m rows and 2m – 1 columns • length • # of information symbols • # of parity symbols n = 2m – 1 k = 2m – 1 – m m (n, k) code: code with length n, and k information symbols
comparison of codes two codes which can correct one-bit errors: • (7, 4) Hamming code • (9, 4) 2D code which is the “better”? • Hamming code is more efficient (small redundancy) • Hamming code is more reliable • correct data transmission with BSC with error prob. p: • Hamming code: (1-p)7 + 7p(1-p)6 • 2D code:(1-p)9 + 9p(1-p)8 “shorter is the better” = 0.85 = 0.77 if p=0.1
codes better than Hamming code? (7, 4) Hamming code • 3 parity bits are added to correct possible one-bit errors Is there a one-bit error correcting (6, 4) code, with only 2 parities? No. Assume that such a code exists, then... • there are 24 = 16 codewords • # of vectors decoded to a given codeword = 1+6=7 • # of vectors decoded to any one of codewords = 7×16 = 112 • # of vectors with length 6 = 26 = 64, which is < 112 contradiction! (矛盾) {0, 1}6
Hamming code is perfect (7, 4) Hamming code • there are 24 = 16 codewords • # of vectors decoded to a given codeword = 1+7=8 • # of vectors decoded to any one of codewords = 8×16 = 128 • # of vectors with length 7 = 27= 128 all of 128 vectors are exactly partitioned to 16 classes with 8 vectors {0, 1}7 Hamming code is a perfect one-bit error correcting code:
advanced topic: multi-bit errors? • Hamming code is a perfect one-bit error correcting code. • Are there codes which correct two or more errors? • Yes, there are many... • one-bit error: syndrome = one column vector of H • two-bits error: syndrome = sum of two column vectors of H different combinations of t columns in H results in different sums, the code corrects t-bits errors.
advanced topic: two-bits error correcting code if different two-bits errors results in different syndromes • received 11111000⇒ the syndrome is 110111T= h2 + h6 ⇒ errors at the 2nd and 6th bits ⇒ 10111100 should be transmitted
ability of the code Error-correcting capability of a code is determined by the relation of column vectors of a parity check matrix. • It is not easy to consider all the combinations of columns. • More handy and easy means is needed. • For linear codes,we can use minimum distance, or minimum weight
similarity of vectors a codewordu is sent, errors occur, and v is received: • In a practical channel, the distance between u and v is small. BSC with error prob. 0.1 v = 000, with probability 0.729 u = 000 v = 001, with probability 0.081 v = 011, with probability 0.009 v = 111, with probability 0.001 • If there is another codewordu’near u, then v = u’ occurs with notable probability. safe not safe
dH(0100,1101) = 2 Hamming distance • a=(a1, a2,..., an), b=(b1, b2,..., bn): binary vectors • the Hamming distance between a andb, dH(a, b) = the number of symbols which are differ between a and b dH(000, 011) = 2 dH(000, 111) = 3 dH(011, 011) = 0 dH(a, b) = dH(a + b, 0) If a vector u with length n is sent over BSC with error prob. p, then a vector v with dH(u, v) = i is received with prob. (1 – p)n–ipi. inverse correlation between the distance and the probability (逆相関)
Hamming distance between codewords code with length 4 ... • vectors = vertices of a 4-dimensional hyper-cube • codewords = subset of vertices C1={0000, 1100, 0011, 1111} C2={0000, 0001, 1110, 1111} two or more edges between codewords some codewords are side-by-side good bad
minimum distance • the minimum Hamming distance of a code C: C1={0000, 1100, 0011, 1111} C2={0000, 0001, 1110, 1111} dmin = 2 dmin = 1
000000 001011 010101 011110 100110 101101 110011 111000 000000 0 3 3 4 3 4 4 3 001011 3 0 4 3 4 3 3 4 010101 3 4 0 3 4 3 3 4 011110 4 3 3 0 3 4 4 3 100110 3 4 4 3 0 3 3 4 101101 4 3 3 4 3 0 4 3 110011 4 3 3 4 3 4 0 3 111000 3 4 4 3 4 3 3 0 computation of the minimum distance consider a linear code whose generator matrix is dmin = 3 for this code Do we need to consider all of 2k×2k combinations?
u + v v u 0 minimum Hamming weight • the Hamming weight of a vector u: wH(u) =dH(u, 0)...# of 1s • the minimum Hamming weight of a code C: wmin=min{wH(u) : uC, u 0} Lemma: if C is linear, then wmin = dmin. • proof of wmin≤dmin: • let u and v be codewords with dmin = dH(u, v). • u+ vC, and wmin ≤ wH(u+ v) =dH(u+ v, 0) = dH(u, v) = dmin. • proof of dmin≤wmin: • let ube the codeword with wmin = wH(u). • dmin≤ dH(u, 0) = wH(u) = wmin.
000000000 0 010010011 4 100010101 4 110000110 4 000101011 4 010111000 4 100111110 6 110101101 6 001001101 4 011011110 6 101011000 4 111001011 6 001100110 4 011110101 6 101110011 6 111100000 4 0000000 0 0001011 3 1000101 3 1001110 4 0100111 4 0101100 3 0010110 3 1101001 4 0010110 3 0011101 4 1010011 4 1011000 3 0110001 3 0111010 4 1110100 4 1111111 7 examples of minimum Hamming weight • (9, 4) 2D code:the minimum Hamming weight is 4 • (7, 4) Hamming code: the minimum Hamming weight is 3
general case of Hamming code lemma: The minimum Hamming weight of a Hamming code is 3. proof sketch: Let H = (h1, ..., hn) be a parity check matrix: • {h1, ..., hn} = the set of all nonzero vectors • if codewordu with weight 1, then HuT = hi = 0...contradiction • if codewordu with weight 2, then HuT = hi+ hj= 0 ...this means that hi= hj, contradiction no codewords with weight 1 or 2
proof (cnt’d) lemma: The minimum Hamming weight of a Hamming code is 3. proof sketch: Let H = (h1, ..., hn) be a parity check matrix: • {h1, ..., hn} = the set of all nonzero vectors • Choose x, yas you like, and choose zso that hx+ hy= hz. • Let u be a vector having 1 at the x-th, y-thand z-thpositions, then HuT=hx+ hy+ hz= 0, meaning that uC. codewords with weight 3 are constructible
error error error error error minimum distance and error correction What does dmin=3 mean? • Any two codewords are differ at three or more symbols. • At least three-bits errors are needed to change a codeword to a different codeword. u’ v’ u v u v • {u’ | dH(u, u’)=1, uC} {v’ | dH(v, v’)=1, vC} = We can distinguish a result of one-bit error from a codewordu, and a result of one-bit error from other codewordv.
decoding territory • dmin=3:define territories around codewords • radius = 1... territories do not overlap • radius = 2... territories do overlap • rule of the error correction: • if a received vector r falls in the territory of a codewordu, then r is decoded to u. • if dmin=3, then the maximum radius of the territory is at most 1. the code can correct up to one-bit errors
general discussion • define (is the largest integer ≤ x) dmin=7, tmax=3 dmin=8, tmax=3 tmax tmax tmax tmax territories do not overlap if the radius ≤ tmax ⇒C can correct up to tmaxbits errors in a codeword.
examples dmin tmax 3 1 4 1 5 2 6 2 7 3 8 3
tmax t about tmax • tmax is the maximum radius that is allowed • we can consider smaller territories with radius <tmax vectors which do not belong to any territory detect errors, but do not correct them
advantage and disadvantage sent codeword t received decoded to the correctcodeword error detection only decoded to a wrongcodeword radius correct detect wrong large large small large small small large small The radius should be controlled according to applications.
A familiar image? A: award of 10,000 Yen B, C, D: penalty of 1,000,000 Yen A B B C C D D P(A) …large P(B), P(C), P(D)…large P(miss)…small P(A) …small P(B), P(C), P(D)…small P(miss)…large
summary of today’s class • Hamming code • one-bit error correcting • perfect code • the minimum distance and minimum weight • handy measure of the error correcting capability • large minimum distance means more power
exercise • Define (one of) (15, 11) Hamming code: • construct a parity check matrix, and • determine the corresponding generator matrix • Let C be a linear code with the following parity check matrix. Show that the minimum distance of C is 4.