Download Applied Algebra: Codes & Ciphers - Matrix Codes and Decoding Algorithms - Prof. Julie M. C and more Assignments Mathematics in PDF only on Docsity! Math 350: Applied Algebra: Codes & Ciphers Spring 2009 Matrix Codes 1 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1 1 1 1 G ⎡ ⎤ ⎢ ⎥= ⎢ ⎥ ⎢ ⎥⎣ ⎦ 1 1 0 1 1 0 0 1 1 1 0 1 0 0 1 1 0 0 1 H ⎡ ⎤ ⎢ ⎥= ⎢ ⎥ ⎢ ⎥⎣ ⎦ Decoding algorithm: 1) Compute syn(r) = H•r t. 2) If syn(r) = 0, assume no errors in transmission and peel off the first k digits of r as the correct information digits. 3) If syn(r) ≠ 0 and syn(r) = column i of H, then assume a single error in transmission, and it must be in position i. Correct that position, and then peel off the correct information digits. 4) If syn(r) ≠ 0 and syn(r) ≠ any column of H, then assume at least 2 errors in transmission - so you cannot decode correctly. Theorem 3: An (n-k)×k parity check matrix H will correctly decode all single errors if and only if the columns of H are all non-zero and distinct. Proof: <== Assume the columns of H are non-zero and distinct. Let ei = the row vector with a 1 in position i and 0's everywhere else. Let r = c + ei (a received word with a single error) Then H•rt = H•[c+ei]t = H•ct + H•eit = 0 + ith column of H so we will correctly decode the single error. Proof: ==> (by contradiction): Assume either the j th column of H is zero. (1) Then H•rt = H•[c + ej]t = H•ct + H•ejt = 0 + 0 = 0 which means we will not correct the single error. or assume column i = column j [in H] (2) Then H•]c+ej]t = H•ct + H•ejt = 0 + j th column of H = 0 + i th column of H = H•ct + H•eit = H•[c + ei]t So we cannot tell if the single error is in position i or j. Dual Codes: Let C be an (n,k)-code with generator matrix G = (Ik | A) and parity check matrix H = (At | In-k). Then H = G┴ = G perp is a generator matrix for the dual code C┴ = C perp. Page 1 Math 350: Applied Algebra: Codes & Ciphers Spring 2009 Maple and Matrix Codes: > restart: with(linalg): with(LinearAlgebra): We define a generating matrix G1 for generating a (6,3) linear binary code C1: > G1:=matrix(3,6,[1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,1,1,1]): Now we want to use this matrix to encode every combination of 3-information digits. So - we list all the possible information sets: > Info3:=matrix(8,3,[0,0,0,1,0,0,0,1,0,0,0,1,0,1,1,1,1,0,1,0, 1,1,1,1]); := Info3 ⎡ and then multiply each information triple by the generating matrix ‐ mod 2 to obtain our list of codewords: ⎣ ⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢ ⎤ ⎦ ⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥ 0 0 0 1 0 0 0 1 0 0 0 1 0 1 1 1 1 0 1 0 1 1 1 1 > C1:=map(modp,multiply(Info3,G1),2); := C1 ⎡ ⎣ ⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢ ⎤ ⎦ ⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥ 0 0 0 0 0 0 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1 1 1 1 0 1 1 1 0 0 1 1 0 1 0 1 1 0 1 0 0 1 1 1 1 0 1 0 Now – to decode with the parity check matrix, we define H1 (the parity check matrix for C1) by: > H1:=matrix(3,6,[1,0,1,1,0,0,1,1,1,0,1,0,0,1,1,0,0,1]); := H1 ⎡ ⎣ ⎢⎢⎢⎢⎢ ⎤ ⎦ ⎥⎥⎥⎥⎥ 1 0 1 1 0 0 1 1 1 0 1 0 0 1 1 0 0 1 Now for each received word r, define its syndrome, syn(r) to be H1*c^t. Let's compute the syndrome for a received vector r: > r:=matrix(1,6,[0,1,1,0,1,1]); := r [ ]0 1 1 0 1 1 Page 2