320 likes | 623 Views
Error Correcting Code. Dr. W. C. Shiu Hong Kong Baptist University Department of Mathematics. Examples:. Let us vonsider the following example. I am a dog, so you have to worship me. Meet me at 8:00 c.m. Parity Check: ISBN-10 ( I nternational S tandard B ook N umber). 0-471-61884- 5.
E N D
Error Correcting Code Dr. W. C. Shiu Hong Kong Baptist University Department of Mathematics
Examples: • Let us vonsider the following example. • I am a dog, so you have to worship me. • Meet me at 8:00 c.m.
Parity Check: ISBN-10 (International Standard Book Number) 0-471-61884-5 In general, assume the first 9 digits of an ISBN is a1a2…a9, where 0 ai 9 for 1 i 9, then the tenth digit (the check digit) is where 0 a10 10. If a10=10, then use X to instead of it.
Parity Check: ISBN-13 Jan. 1, 2007, ISBN-13 will instead of ISBN-10 How do we convert ISBN-10 to ISBN-13?
Parity Check: ISBN-13 • Drop the check digit from the existing ISBN-10 • Add the prefix 978 or 979 (usually is 978) • Calculate the check digit using modulo 10: Suppose the 13 digits is a1a2…a13, where 0 ai 9 for 1 i 13, then it satisfies
Parity Check: ISBN-13 • Original ISBN-10: 0-471-61884-5 • New ISBN-13: 978- 0-471-61884-? The new ISBN-13 is 978- 0-471-61884-4
香港身份證號碼 X354670(?) 身份證號碼的「結構」,可以用abcdef (z)表示。「」可能是「空格」或是一個英文字母,「 」則必定是英文字母。「 abcdef 」代表一個六位數字,而「z」是作為檢碼之用,它的可能選擇是0, 1, 2, ... , 9, A(代表10)。這些代號的背後,都可配上一個編碼值。透過編碼值,便可找出 9+8+7a+6b+5c+4d+3e+2f+z 的總和。該總和特別之處,是必須被11整除。利用這特點,我們便能找出括號內的數字。試試看!
X354670(?) 9(58)+8(33)+7(3)+6(5)+5(4)+4(6)+3(7)+2(0)+z = 902+z 被11整除,所以z=0。 我們可利用Modular arithmetic來簡化運算。 z = 987a6b5c4d3e2f 2+3+4a+5b5c4d3e2f (mod 11) 所以 z 2(58)+3(33)+4(3)+5(5) 5(4) 4(6) 3(7) 2(0) 2(3)+3(0)+12+252024210 6+0+1+3+22+10=11 0 (mod 11) 即 X354670(0) 是正確的香港身分證號碼。
Message We think of a message as a block of symbols from a finite alphabet. A commonly used alphabet is the set of two symbols 0 and 1. A possible message is 1001. This message is then transmitted over a communications channel that is subject to some amount of noise.
Noise e Message Channel Received Message v=0001 u=1001 No Encoding-Decoding System
Noise e Message Encoder Channel u=1001 Eu=b=1001100 Message Decoder Received Message E-1(Dc)=1001 Dc=1001100 c=b+e=0001100 Encoding-Decoding System
Binary Symmetric Channel (BSC) No memory. Receives and transmits two symbols 0 and 1. The BSC has the property that with probability q a transmitted digit will received correctly, and with probability p=1q it will not be. Boolean sum and product:
Encoded Message • Digits in the original message : Information digits • Digits added by the encoder : Redundancy digits Length of a code = the number of information digits + the number of redundancy digits
Examples of single-error detecting code: 1. Repetition code: Each message is repeated once. 2. Even-parity check code: Add an extra digit to the message. It is a 0 if there are an even number of 1’s, otherwise a 1.
Examples of Single-Error Correcting Code Repetition code: Each message is repeated twice. It can also correct some double errors and more errors. 100110011001100010111001100110011001 100110011001100010001001100010001000 100110011001100010110101100110011001
If u=(u1,u2,u3,u4), then we decode it as b=uG. Examples of Single-Error Correcting Code Hamming (7,4) code: Given a matrix
Let d=DcT, where For this example Examples of Single-Error Correcting Code The error occurred at the 4th position. D is called a parity check matrix.
Repetition code: Probability for Correct Sending Suppose we are transmitting a message of 4 digits on a binary channel and q=0.9. Then the probability of correctly sent for No coding: q4=0.6561; Hamming code: q7+7q6p 0.8503.
Probability for Correct Sending • Rate of a code is the ratio of the number of information digits with the length of the code. • Rate of the repetition code is 1/3. • Rate of the Hamming code is 4/7.
Linear Codes An (n, k) linear codeC over a finite field F is a k-dimensional vector subspace in Fn. Elements of C is called codeword. If F={0, 1}, then C is called a binary code Any kn matrix G whose rows are the basis vectors of C is called a generator matrix. This means that for each C, there exists b=(b1,…,bk) such that =bG. There exists (will show a proof later) an (nk)n matrix H called parity checkmatrix of C such that
By applying a sequence of elementary row operations and column operations, we may assume Proof: and rank(H)=n-k Linear Codes Theorem :If an (n, k) code C over a field has a generator matrix G=(Ik A), then H=(-AT In-k) is a parity check matrix of C.
Parity check matrix Hamming (7,4) code Generating matrix
Decoding Scheme • Let Fn . The weight of is defined by wt() the number of nonzero digits in =(a1,…,an). • The distance of two vectors , Fn is defined by d(,)=wt(). • The method of decoding a received vector to the closest codeword. It is called maximum-likelihood decoding.
For binary code, if u is transmitted and v is received, then the error e is defined to be Then d(u,v)=wt(e). Thus the decoded codeword is chosen such that Decoding Scheme
Mini-example Consider a binary code C with generator matrix Therefore, C={0000, 1010, 0111, 1101}. The number of all binary sequences of length 4 are 16.
Mini-example A decoding scheme is Another decoding scheme is
Detect and Correct Errors The minimum weightdof a code is defined to be the minimum value among all nonzero codewords. Theorem:C can detect t errors if and only if t=d-1. Theorem:C can correct t errors if and only if t=[(d-1)/2].
The decoding scheme is to choose a (fixed) vector such that , and then to decode the received vector to Decoding Scheme Suppose u is transmitted, v is received and e is the error, i.e., u+e=v. Then HvT=H(u+e)T=HuT+HeT=HeT.
Hamming Code Hamming (7,4)-code or Ham(3,2) Hamming (15,11)-code or Ham(4,2) Any Hamming code can only correct one error.
Hamming Code Given 15 coins which should be of equal weight, but you are told that there may be one that is different from the others. You have a balance on which to compare the weights of different coins or sets of coins. Devise a scheme using four balance checks to determine which coin, if any, has the wrong weight.