II. Linear Block Codes Last Lecture H Matrix and Calculation of dmin Error Detection Capability Error Correction Capability Error Correction & Error Detection Operation © Tallal Elshabrawy 2 Decoding and Error Correction Let C be an (n,k) linear block code with codewords v1, v2,…,v2k v Channel 2k codewords e r Decoder 2n n-tuples Which vi was sent?? Decoding: A rule to partition 2n possible received vectors into 2k disjoint subsets D1, D2,…,D2k such that the codeword vi is contained in the subset Di, 1≤i ≤2k Decoding Rule: If r ∈ Di⇒Decoding Decision si vi Correct Decoding: Given vi is transmitted, error pattern e does not push r outside Di © Tallal Elshabrawy 3 Design of a Decoder How to divide 2n vectors into 2k disjoint subsets such that the error correcting capability is optimal? In other words, which n-tuples should be designed such that they belong to a given subset Di? © Tallal Elshabrawy 4 Standard Array Partitioning 2n possible received vectors into 2k disjoint subsets with each subset containing only one codeword D1 D2 v1 = 0 v2 e2 e2 + v 2 e3 e3 + v 2 . . . . e2n-k e2n-k + v 2 © Tallal Elshabrawy Di ... vi ... e2+ vi ... e3+ vi . . . . ... e2n-k + vi D2k ... v 2k ... e2+ v 2k ... e3+ v 2k . . . . ... e2n-k + v 2k 5 Standard Array Partitioning 2n possible received vectors into 2k disjoint subsets with each subset containing only one codeword D1 e2≠v1,v2,…,v2k © Tallal Elshabrawy D2 v1 = 0 v2 e2 e2 + v 2 e3 e3 + v 2 . . . . e2n-k e2n-k + v 2 Di ... vi ... e2+ vi ... e3+ vi . . . . ... e2n-k + vi D2k ... v 2k ... e2+ v 2k ... e3+ v 2k . . . . ... e2n-k + v 2k 6 Standard Array Partitioning 2n possible received vectors into 2k disjoint subsets with each subset containing only one codeword D1 e3≠v1,v2,…,v2k, e2,…,e2+v2k © Tallal Elshabrawy D2 v1 = 0 v2 e2 e2 + v 2 e3 e3 + v 2 . . . . e2n-k e2n-k + v 2 Di ... vi ... e2+ vi ... e3+ vi . . . . ... e2n-k + vi D2k ... v 2k ... e2+ v 2k ... e3+ v 2k . . . . ... e2n-k + v 2k 7 Standard Array Partitioning 2n possible received vectors into 2k disjoint subsets with each subset containing only one codeword D1 e2n-k ≠Any previous element in the array © Tallal Elshabrawy D2 v1 = 0 v2 e2 e2 + v 2 e3 e3 + v 2 . . . . e2n-k e2n-k + v 2 Di ... vi ... e2+ vi ... e3+ vi . . . . ... e2n-k + vi D2k ... v 2k ... e2+ v 2k ... e3+ v 2k . . . . ... e2n-k + v 2k 8 Theorem 1. 2. No two n-tuples in the same row of a standard array are identical. Every n-tuple appears in one and only one row. PROOF: 1. Given a linear block code is considered. By definition of the standard array construction, ej is not a codeword. Therefore, ej+ vj generate distinct patterns 2. Select row l<m, assume el+vi= em+vj. Therefore, em= el+vi+vj em= el+vs (because vi and vj are codewords) This means that em could be found in row l This is a contradiction to the construction rule of the standard array © Tallal Elshabrawy 9 Standard Array Partitioning 2n possible received vectors into 2k disjoint subsets with each subset containing only one codeword D1 e2n-k ≠Any previous element in the array © Tallal Elshabrawy D2 v1 = 0 v2 e2 e2 + v 2 e3 e3 + v 2 . . . . e2n-k e2n-k + v 2 Di ... vi ... e2+ vi ... e3+ vi . . . . ... e2n-k + vi D2k ... v 2k ... e2+ v 2k ... e3+ v 2k . . . . ... e2n-k + v 2k 10 Coset of a Code, Coset Leader Given the standard array. The 2n-k rows are called the cosets of the code. The first n-tuple ej of each coset is called the coset leader © Tallal Elshabrawy 11 Error Correction If r ∈Di⇒Decoding Decision si v i If the error pattern is a cosetleader⇒CORRECT DEC ODING If the error pattern is not a cosetleader⇒FALSE DEC ODING Assume error pattern x is in the lth coset x = el + vi ⇒ r = v j+ x = v j + el + v i = el + v s r is found in the subset Ds≠Dj ⇒ FALSE DEC ODING A Linear block code can correct 2n-k-1 error patterns corresponding to 2n-k-1 coset leaders Note that one of the coset leaders is the zero vector © Tallal Elshabrawy 12 Error Correction Methodology The error patterns that are most likely to occur should be used as the coset leaders Example: A (7,4) code can correct 2(7-4)-1=7 error patterns To correct a single error. The coset leaders should be selected as: e1= v1= (0 0 0 0 0 0 0) e2 =(0 0 0 0 0 0 1) e3 =(0 0 0 0 0 1 0) e4 =(0 0 0 0 1 0 0) e5 =(0 0 0 1 0 0 0) e6 =(0 0 1 0 0 0 0) e7 =(0 1 0 0 0 0 0) e8 =(1 0 0 0 0 0 0) © Tallal Elshabrawy 13 Theorem 1. All 2k n-tuples of a coset have the same syndrome. 2. The syndrome for different cosets are different PROOF: 1. (el+vi)HT=elHT+viHT=elHT (independent of vi) 2. Let ej and ei be the coset leaders. If they have the same syndrome ejHT+eiHT=0. Therefore, (ej+ei) is a codeword This contradicts the definition of a linear block code because ej and ei are not codewords Advantages: We can use a syndrome decoding table which is much simpler to use than a standard array © Tallal Elshabrawy 14 Syndrome Decoding 1. Compute syndrome of r (i.e., rHT) 2. Locate the coset leader el whose syndrome is equal to rHT 3. v*= r+el where v* is the codeword output by the decoder © Tallal Elshabrawy 15 Weight Distribution of a Block Code Code Word Information Parity Bits 0 0000 000 1 0001 101 2 0010 111 3 0011 010 4 0100 011 5 0101 110 Example: 6 0110 100 For the (7,4) code shown, A0 = A7 = 1, A1 = A2 = A5 = A6= 0 A3 = A4 = 7 Note that: ∑Ai=16=24 (Number of valid code words) 7 0111 001 8 1000 110 9 1001 011 10 1010 001 11 1011 100 12 1100 101 13 1101 000 14 1110 010 15 1111 111 For an (n.k) block code: Let Ai be the number of codewords of weight i in C. The numbers A0, A1, …, An are called the Weight Distribution © Tallal Elshabrawy 16 Weight Distribution and Probability of Detecting an Error Pattern For an (n,k) linear code: Given that the bit error probability of the physical channel is p. The probability that an error pattern of weight j occurs is pj(1-p)n-j In Total, there are nCj error patterns that have j erroneous bits. ONLY Aj of those are NOT DETECTABLE because they represent valid codewords Probability of not detecting an error pattern (Pu(E)) is: n Pu E A jp j 1 p n j j 1 Example: For the (7,4) code in the previous slide, Pu(E)=7p3(1-p)4 + 7p4(1-p)3 + p7 © Tallal Elshabrawy 17 Weight Distribution of Coset Leaders Let αi denote the number of coset leaders of weight i. Then the numbers α0,α1,…, αn are the weight distribution of the coset leaders Probability of Correct Decoding of an error pattern Ps(E) PS(E)=∑ αi pi(1-p)(n-i) where is the bit error probability of the channel Probability of False Decoding of an error pattern P(E) P (E)=1-PS(E) © Tallal Elshabrawy 18