§6 Linear Codes § 6.1 Classification of error control system § 6.2 Channel coding conception §...

Post on 04-Jan-2016

220 views 1 download

transcript

§6 Linear Codes

§ 6.1 Classification of error control system

§ 6.2 Channel coding conception

§ 6.3 The generator and parity-check matrices

§ 6.5 Hamming codes

§ 6.4 Syndrome decoding

§6.1.1 Error control system

§6.1.2 classification of error correcting codes

§6.1.1 Error control system

FECHECIRQ

ARQ

Automatic Repeat Request

Forward Error Correction

Hybrid Error Correction

Information Repeat Request

§6.1.1 Error control system

1. ARQ (Automatic Repeat Request)

Error detecting codeword

verdict

§6.1.1 Error control system

1. ARQ (Automatic Repeat Request)

1

1

2

ACK1

NA

K2

2

2

AC

K2

3

§6.1.1 Error control system

1 2 3 4 5 1

1 2 3 4 5х

NA

K1

2 3 4 5

1 2 3

6 7

х 4 5 6 7

3 4 5

1. ARQ (Automatic Repeat Request)

§6.1.1 Error control system

1 2 3 4 5 1

1 2 3 4х

NA

K1

6 7

х

NA

K4

4

5 1 6 7

8

4

9

8

10

9

11

10х

12

1. ARQ (Automatic Repeat Request)

Error correcting codeword

§6.1.1 Error control system

2. FEC (Forward Error Correction)

codeword

3. HEC (Hybrid Error Correction)

§6.1.1 Error control system

verdict

messages

messages

4. IRQ (Information Repeat Request)

§6.1.1 Error control system

1. ClassificationError

correct

Non-linear codes

Linear codes

Block codesConvolution-al codes

Cyclic codes

Non-Cyclic codes

Correct random errors

Correct burst errors

Correct hybrid errors

§6.1.2 classification of error correcting codes

2 0 1

3 0

c c c

c c

2 0 1

3 0 1

1c c c

c c c

linear codes and nonlinear codes

1. Classification

§6.1.2 classification of error correcting codes

( 00 ) ( 10 ) ( 01 ) ( 11 )messages

( 001 )( 010 )( 100 )( 111 )forbidden words

( 000 ) codewords( 110 ) ( 101)

( 011)

(3,2) block codes

2 0 1c c c 2 1 0( )C c c c

Example 6.1.1

block codes and convolutional codes

§6.1.2 classification of error correcting codes

jm 1jm 2jm in

out

(2,1,3)convolutional codes

Example 6.1.2 block codes and convolutional codes

The encoder for (3,2,2)convolutional codes

§6.1.2 classification of error correcting codes

systematic codes and nonsystematic codes

Information sequence codeword

00 00000 01 10110 10 11011 11 01101

Information sequence codeword

00 00000 01 01011 10 10101 11 11110

1. Classification

§6.1.2 classification of error correcting codes

• Exercise:

输入输出

)1(LC

)2(LC

)3(LC

+

M2

M1

M0

C0

C1

C2

C3

C4

• Exercise:

M3

M2

M1

M0

C6

C5

C4

C3

C2

C1

C0

M3

M2

M1

C6

C5

C4

C3

C2

C1

C0

M0

2. Error detecting codes

parity check codes

horizontal parity check codes

Example:

m=1101001001110011110000111

C = 101101111000011100010110110111

C’ =( transmitting by column) 101101111100000110100010011011101110

phalanx check codes

§6.1.2 classification of error correcting codes

2. Error detecting codes

parity check codes

horizontal parity check codes

phalanx check codes

group counting codes

Information bits Check bits

111011 101 110110 100 111100 100 100011 011 000111 011 101001 011

§6.1.2 classification of error correcting codes

2. Error detecting codes constant rate codes

Arabic numerals Fomer codes (3:2)codes

1 11101 01011 2 11001 11001 3 10000 10110 4 01010 11010 5 00001 00111 6 10101 10101 7 11100 11100 8 01100 01110 9 00011 10011 0 01101 01101

10

10

1

0

1

0

§6.1.2 classification of error correcting codes

Review

• KeyWords:

ARQ FEC HEC IRQ

Linear block codes Convolutional codes

systematic codes

Error detecting codes

Homework

1. List all (3:4) constant weight codewords .

2. If phalanx check code has error pattern as follows, can itdetect these errors?

§6 Linear Codes

§ 6.1 Classification of error control system

§ 6.2 Channel coding conception

§ 6.3 The generator and parity-check matrices

§ 6.5 Hamming codes

§ 6.4 Syndrome decoding

§ 6.2 Channel coding conception

1. General method for channel coding

Channel encoder

M=(mk-1,…,m0)

Redundant bits

Rules

(n>k)

C=(cn-1,…,c0)

§ 6.2 Channel coding conception

§ 6.2 Channel coding conception

2. Decoding methods

C0

C1

Ci

C2k

-1

C0

C1

Ci

Cj

C2k

-1

C2k

Ci’

C2n

-1

Permittedcodewords

Forbidden vectors

Permittedcodewords

Transmitter

Receiver

Transmission mode map

Decoding rules table:

2. Decoding methods

Subset m0 m1 m2 … m2k-1 Permitted

codes C0 C1 C2 C2k-1

)1(0C )1(

1C )1(2C )1(

12 kC

)2(0C )2(

1C )2(2C )2(

12 kC

┇ ┇ ┇ ┇

Forbidden codes

)12(0

knC )12(

1 kn

C )12(2

knC )12(

12

kn

kC

§ 6.2 Channel coding conception

Example 6.2.1

2. Decoding methods

( 4 , 2 ) decoding table

Informtion 00 10 01 11

Codes 0000 1001 0111 1110

Forbidden

vectors

1000

0100

0010

0001

1101

1011

1111

0011

0101

0110

1010

1100

§ 6.2 Channel coding conception

( 6 , 3 ) decoding table

§ 6.2 Channel coding conception

2. Decoding methods

message

codeword

one bit

error

two bits error

1) Code rate

3. Parameters of coding

( n , k ) codes:

kR

n

§ 6.2 Channel coding conception

Example 6.2.2

( 23 , 12 ) BCH code:

120.52

23R

DVB-S2( 16200 , 10800 ) LDPC code:

108000.67

16200R

Definition: The number of nonzero components in a codeword c.

2) Hamming weight

1 (001)c

2 (011)c

1( ) 1w c

2( ) 2w c

§ 6.2 Channel coding conception

3. Parameters of coding

3) Hamming distance

Definition: The number of bit positions which are different between two codewords c and c’.

1 (101)c

2 (110)c 1 2( , ) 2d c c

§ 6.2 Channel coding conception

3. Parameters of coding

( , ) 0.( , ') 0 if

:

'.( , ') ( ', ).( , ') ( , '') ( '', ').

d c cd c c c cd c c d c cd c c d c c d

Properties

c c

4) Minimum hamming weight

Definition: The minimum value of nonzero hamming weight in a code C.

}0,:)(min{)(min cCccwCw

0000 1001 0111 1110(4,2) code:

wmin=2

§ 6.2 Channel coding conception

3. Parameters of coding

5) Minimum hamming distance

Definition: The minimum value of hamming distance in a code C.

},,:),(min{)(min ccCccccdCd

0000 1001 0111 1110(4,2)code:

dmin(C) = 2

§ 6.2 Channel coding conception

3. Parameters of coding

Theorem 6.1: A code C={c1, c2, …, cM} is capable of detecting all error patterns of weight e iff dmin(C) e + 1.

§ 6.2 Channel coding conception

3. Parameters of coding

Theorem 6.2: A code C={c1, c2, …, cM} is capable of correcting all error patterns of weight t iff dmin(C) 2t + 1.

(p147 theorem 7.2 in textbook)

§ 6.2 Channel coding conception

3. Parameters of coding

Review

• KeyWords:

The method for codingrate

Hamming weight,

Capability of code

(encoding and decoding)

Minimum hamming weight

Hamming distance,Minimum hamming distance

(for detecting errors or for correcting errors )

Homework

1. P163: T7.22 ;

2. Let code C={ (000000), (001110), (010101), (011011), (100011), (101101), (110110), (111000)} .

(1) calculate its minimum distance. (2) if it is used as error-detecting code, how many errors

can it detect?(3) if it is used as error-correcting code, how many errors

can it correct?

Homework

3. Let C be an (n,k) code with minimum distance dmin, and let t≤e be nonnegative integers. Show that if dmin≥e+t+1, the C is t-error-correcting, e-error-detecting. (that is to say the errors within t can be corrected and meanwhile the e (t≤e ) errors can be detected.)

§6 Linear Codes

§ 6.1 Classification of error control system

§ 6.2 Channel coding conception

§ 6.3 The generator and parity-check matrices

§ 6.5 Hamming codes

§ 6.4 Syndrome encoding§6.3.1 Definition of linear block codes

§6.3.2 The generator matrix

§6.3.3 The parity-check matrix

§6.3.1 Definition of linear block codes

1. Vector spaceLet K be a field, a vector space over K is a set V with a special element 0(the zero vector) and with a vector addition denoted ‘+’ with the expected properties.

0 + v = v + 0 for all v V (property of 0)

v + w = w + v for all v,w V (commutativity)

(u +v) + w = u + (v + w) for all u,v,w V (associativity)

a(v +w) = av + aw for all v,w V, a K (distributivity)(a + b)v = av + bv for all v V, ab K (distributivity)a(bv) = (ab)v for all v V, ab K (associativity)

1*v = v for all v V (property of 1)

V

V

1. Vector space

A linear combination of vectors v1, …, vn in a vector space V withcoefficients a1,…, an in the scalars K is the vector

nn vava ...11

The vectors v1,…,vn are linearly dependent if there is a set of coefficientsa1,…,an not all zero such that the corresponding linear combination is the zero vector: 0...11 nn vava

Conversely, vectors v1,…,vn are linearly independent if

0...11 nn vava

implies that all the coefficients ai are 0.

§6.3.1 Definition of linear block codes

1. Vector space

Proposition: Given a basis e1,…,en for a vector space V, there is exactly one expression for an arbitrary vector v V as a linear combination of e1, …, en.

Definition: The dimension of a vector space to be the number of elements in a basis for it.

§6.3.1 Definition of linear block codes

2. Linear block codesInformation

sequence codeword

00 11100 01 01011 10 10110 11 01101

4 1

3 0

2 1 0

1 1

0 0

C m

C m

C m m

C m

C m

Information sequence codeword

00 11000 01 10101 10 01110 11 00011

Example 6.3.1

§6.3.1 Definition of linear block codes

2. Linear block codesExample 6.3.1

4 1 0

3 1

2 0

1 1 0

0 1

C m m

C m

C m

C m m

C m

Information sequence

codeword

00 00000 01 10110 10 11011 11 01101

4 1

3 0

2 1

1 0

0 1 0

C m

C m

C m

C m

C m m

Information sequence

codeword

00 00000 01 01011 10 10101 11 11110

C:

D:

§6.3.1 Definition of linear block codes

2. Linear block codes

Definition: An (n, k) linear code over Fq is a k-dimensional

subspace of the n-dimensional vector space Vn,k(Fq)={(x1,…,xn): xi Fq}; n is called the length of the code, k the dimension. The code’s rate is the ratio k/n.

Encoder),,...,,( 0121 mmmm kk

),,...,,( 0121 cccc nn

(p140 definition in textbook)

§6.3.1 Definition of linear block codes

min

0

for a linear block code ,theorem 6 . there exists:

( ) min ( )

3

i

i

ix Cx

C

d C W x

Example 6.3.2

2. Linear block codes

450

561

4562

463

ccc

ccc

cccc

ccc

Information sequence codewords

000001010

100011

101110111

00000000011101010011101110101001110101001111010011110100

(7,3) linear code

§6.3.1 Definition of linear block codes

§6.3.2 The generator matrix

1. The generator matrix

1

2

1

0

k

k

g

g

G

g

g

1,0 1,1 1, 1

2,0 2,1 2, 1

1,0 1,1 1, 1

0,0 0,1 0, 1

k k k n

k k k n

n

n k n

g g g

g g g

g g g

g g g

1 1 2 2 1 1 0 0k k k kx m g m g m g m g

1

2

1 0 1 2 1 0

1

0

( ) ( )

k

k

n k k

g

g

c c m m m m

g

g

§6.3.2 The generator matrix

1. The generator matrix

Definition: Let C be an (n,k) linear code over Fq . A matrix G whose row-space equals C is called a generator matrix for C. Conversely, if G is a matrix with entries from Fq, its row-space is called the code generated by G.

Example 6.3.3

A (5,1) linear code C1 with generator matrix.

G1 = [1 1 1 1 1].

(p140 definition in textbook)

§6.3.2 The generator matrix

1. The generator matrix

Example 6.3.4

A (5,3) linear code C2 with generator matrix.

11111

01100

00111

2G

§6.3.2 The generator matrix

1. The generator matrix

450

561

4562

463

ccc

ccc

cccc

ccc

0

1

2

0

1

2

3

4

5

6

110

011

111

101

100

010

001

m

m

m

c

cc

c

c

c

c

1011100

1110010

0111001

][ 0120123456 mmmccccccc

Gmmm 012

Example 6.3.2 (continued)

120

121

0122

023

04

15

26

mmc

mmc

mmmc

mmc

mc

mc

mc

120

121

0122

023

04

15

26

mmc

mmc

mmmc

mmc

mc

mc

mc

§6.3.2 The generator matrix

1. The generator matrix

11 1

21 20

1

10 0

01 0

00 1

r

rk k r

k kr

p p

p pG I P

p p

For systematic codes:

2. The encoder circuit of linear block codes

§6.3.2 The generator matrix

c6

c5

c4

c3

c2

c1

c0

1011100

1110010

0111001

G m2

m1

m0

§6.3.3 The parity-check matrix

1. The parity-check matrix

01000110

00100011

00010111

00001101

0123456

0123456

0123456

0123456

ccccccc

ccccccc

ccccccc

ccccccc

450

561

4562

463

ccc

ccc

cccc

ccc

§6.3.3 The parity-check matrix

1. The parity-check matrix

01000110

00100011

00010111

00001101

0123456

0123456

0123456

0123456

ccccccc

ccccccc

ccccccc

ccccccc

0

0

0

0

1000110

0100011

0010111

0001101

0

1

2

3

4

5

6

c

c

c

c

c

c

c

0 ( 0)T T THx or xH

§6.3.3 The parity-check matrix

1. The parity-check matrix

Definition: Let C be an (n,k) linear code over Fq . A matrix H with the property that HxT = 0 iff x C is called a parity-check matrix for C.

(p142 definition in textbook)

2. Relationship of G and H

§6.3.3 The parity-check matrix

1011100

1110010

0111001

G

1000110

0100011

0010111

0001101

H

(7,3) linear code

Example 6.3.2 (continued)

2. Relationship of G and H

§6.3.3 The parity-check matrix

For systematic linear codes:

G = [Ik| P]

H = [PT| In-k]

0

0

T

T T

GH

or HG

3. Shortened codes and dual codes

§6.3.3 The parity-check matrix

1) Shortened codes

C0=( 0000000) C4=( 1001011)C1=( 0010111) C5=( 1011100)C2=( 0101110) C6=( 1100101)C3=( 0111001) C7=( 1110010)

( 7, 3) linear block code:

(6,2)shortened code : C0 =( 000000 )C1 =( 010111 )C2 =( 101110 )C3 =( 111001 )

Example 6.3.5

3. Shortened codes and dual codes

§6.3.3 The parity-check matrix

1) Shortened codes

1110100

0111010

1101001

)3,7(G )2,6(G

1000101

0100111

0010110

0001011

)3,7(H )2,6(H

3. Shortened codes and dual codes

§6.3.3 The parity-check matrix

2) Dual codes

Example 6.3.5 (continued )

1000101

0100111

0010110

0001011

)3,7(H (7,4)

Overview

• KeyWords:

Linear block code

The generator matrix

The parity-check matrix

Shortened codes and dual codes

Homework

1. p159: T7.2 (a) ,(b)

2. A (7,4)linear code has generator matrix as follows:

0111000

1100100

1010010

1110001

G

(a)Plot the encoder circuit.(b)Find its parity-check matrix H.

§6 Linear Codes

§ 6.1 Classification of error control system

§ 6.2 Channel coding conception

§ 6.3 The generator and parity-check matrices

§ 6.5 Hamming codes

§ 6.4 Syndrome decoding

§6.4.1 Standard array decoding

§6.4.2 Syndrome decoding

§6.4.1 Standard array decoding

1. The standard array

Set of codewords

x ( 0 ) x ( 1 ) x ( 2 ) x ( 2k-1 )

(00…0)…

Subset …m0 m1 m2 m2k-1

Forbidden

vectors

E1 E1+x ( 1 ) E1+x ( 2 ) E1+x ( 2k-1 ) …

E2 E2+x ( 1 ) E2+x ( 2 ) E2+x ( 2k-1 ) …

E2n-k-1 E2n-k-1 +x ( 1 )E2n-k-1 +x ( 2 ) … E2n-k-1 +x ( 2k-1 )

§6.4.1 Standard array decoding

1. The standard array 3 1

2 0

1 1 0

0 0

c m

c m

c m m

c m

Example 6.4.1:(4,2)linear code

1010

0111G

codewords x(0)

0000 x(1)

0111 x(2)

1010 x(3)

1101

Forbiddencodewords

1000 1111 0010 01010100 0011 1110 10010001 0110 1011 1100

§6.4.1 Standard array decoding

2. The characters of standard array

The sum vector of two vectors in the same row is a codeword in the set of C.There are not the same n-dimensional vectors in the same

row. Each n-dimensional vector exists only in one row.

Theorem 6.4 Each (n,k) linear code is capable of correcting all of 2n-k error patterns.

(Prove it by yourself)

000000 001110 010101 100011 011011 101101 110110 111000 S=000

000001 001111 010100 100010 011010 101100 110111 111001 001

000010 001100 010111 100001 011001 101111 110100 111010 010

000100 001010 010001 100111 011111 101001 110010 111100 100

001000 000110 011101 101011 010011 100101 111110 110000 111

010000 011110 000101 110011 001011 111101 100110 101000 011

100000 101110 110101 000011 111011 001101 010110 011000 110

001001 000111 011100 101010 010010 100100 111111 110001 101

§6.4.1 Standard array decoding

Example 6.4.2

§6.4.2 Syndrome decoding

1. Syndrome vector

R=x+E

xHT=0

S=RHT=(sn-k-1…s1s0) =EHT

§6.4.2 Syndrome decoding

1. Syndrome vector

Codewords C(0)

0000 C(1)

0111 C(2)

1010 C(3)

1101

S

00

1000 1111 0010 0101 10

0100 0011 1110 1001 11 Forbidden codewords

0001 0110 1011 1100 01

C(0)

0000 C(1)

0111 C(2)

1010 C(3)

1101

S

00

1000 1111 0010 0101 10

0100 0011 1110 1001 11

0001 0110 1011 1100 01

Theorem 6.5 2k codewords in each coset have the same syndrome, and different coset with different syndrome.

Example 6.4.1 ( continued ) (Prove it by yourself)

000000 001110 010101 100011 011011 101101 110110 111000 S=000

000001 001111 010100 100010 011010 101100 110111 111001 001

000010 001100 010111 100001 011001 101111 110100 111010 010

000100 001010 010001 100111 011111 101001 110010 111100 100

001000 000110 011101 101011 010011 100101 111110 110000 111

010000 011110 000101 110011 001011 111101 100110 101000 011

100000 101110 110101 000011 111011 001101 010110 011000 110

001001 000111 011100 101010 010010 100100 111111 110001 101

§6.4.1 Standard array decoding

Example 6.4.2 ( continued )

§6.4.2 Syndrome decoding

2. Syndrome decoding Example 6.4.3:

( 4 , 2 ) linear code syndrome decoding

Step1 : Computing the syndrome S=RHT

Step2 : getting E by S 令 E = (e3 e2 e1 e0) ,

3 2 1 0 1 0

1 0

1 1( ) ( )

1 0

0 1

TS EH e e e e s s

E Syndrome S

0000 00 1000 10 0100 11 0001 01

Step3 :x̂ R E

S0

R=(r3r2r1r0)

c0 c1 c2 c3

r0 r1 r2 r3

S1

e0 e2 e3

Output in series

x=R+E^

§6.4.2 Syndrome decoding

2. Syndrome decoding

r0 r1 rn-1

s0 s1 sr-1

e0 e1 en-1

c0 c1 cn-1

A general decoding circuit of (n,k) linear codes

S=RHt

S=EHt

^x=R+E

Received vectors storage

Compute syndrome circuit

Error pattern generator

n-step shift-register output

§6.4.2 Syndrome decoding

Overview

• KeyWords:

Syndrome decoding

Standard array decoding

Homework

1. p159: T7.2 (c) ,(e)

2. p159: T7.6

3. p159: T7.8

4. Give the standard array of (7,4) linear code with a parity matrix as follows:

1001011

0101101

0010111

H

§6 Linear Codes

§ 6.1 Classification of error control system

§ 6.2 Channel coding conception

§ 6.3 The generator and parity-check matrices

§ 6.5 Hamming codes

§ 6.4 Syndrome decoding

1. Relationship between H and S

§6.5 Hamming codes

Example 6.5.1: (7,3)linear code

0 6 5 4 3 2 1 0

1011000

1110100

1100010

0110001

H h h h h h h h

E = (e6 e5 e4 e3 e2 e1 e0)

S=RHT= EHT

3 6 4 3

2 6 5 4 2

1 6 5 1

0 5 4 0

s e e e

s e e e e

s e e e

s e e e

S=RHT= EHT

1 1 1 2 10

1 2 0

1 2 0

n n

n n

rn rn r r n

h h h

H h h h

h h h

l et

1

2

j

j

j

rj

h

hh

h

1 0 1 2( ) (0 0 0)n i i itE e e e e e

1. Relationship between H and S

§6.5 Hamming codes

1. Relationship between H and S1

21 0

0

[ ]

Tn

TT n

n

T

h

hS EH e e

h

1 1 2 2 0 0

1

T T Tn n n n

tT

ijj

e h e h e h

h

S is the linear

combination of columns of H

according to nonzero codebits

in E.

§6.5 Hamming codes

1. Relationship between H and S

(p147 Theorem 7.3 in textbook)

§6.5 Hamming codes

Theorem 6.6 If all possible linear combinations of ≤ t columns of H are distinct, then dmin(C) ≥ 2t + 1, And so C can correct all error patterns of weight ≤t.

(p148 Corollary in textbook)Corollary If C is an (n,k) linear code with parity-check matrix H, dmin(C) = the smallest number of columns of H that are linearly dependent. Hence if every subset of 2t or fewer columns of H is linearly independent, the code is capable of correcting all error patterns of weight ≤ t.

Corollary : For a linear block code C(n, k) completely determined by its parity check matrix H, the minimum weight or minimum distance

of this code is equal to the minimum number of columns of that matrix which when added together result in the all-zero vector.

Corollary : Let a linear block code C have a parity check matrix H.

The minimum distance dmin of C is equal to the smallest positive number

of columns of H which are linearly dependent. That is, all combinations of

dmin - 1 columns are linearly independent, so there is some set of dmin columns

which are linearly dependent.

2. Some bounds on error correcting codes

Theorem 6.7 The minimum distance for an (n, k) linear code is bounded by dmin (C)≤n-k+1.

Theorem 6.8 Let C is an (n,k) linear code, A t-random error correcting code C must have redundancy r(=n-k) satisfying:

1

2 1t

r in

i

C

§6.5 Hamming codes

3. Hamming codes

Definition: Let H be an m ╳ (2m-1) binary matrix such that the columns of H are the 2m-1

nonzero vectors from Vm(F2) in some order. Then the n=2m-1, k=2m-1-m linear code over F2 whose parity-check matrix is H is called a (binary) Hamming code of length 2m-1.

(p149 Definition in textbook)

§6.5 Hamming codes

Length: n = 2m − 1Number of information bits: k = 2m − m − 1Number of parity check bits: n − k = mError-correction capability: t = 1, (dmin = 3)

Example 6.5.2 : n=7

( 7 , 4 ) hamming codes

0001111

0110011

1010101

H

1 + 2→1

1 + 3→2

1 + 2 + 3→1

1101001

1011010

0111100

1H

1

1000011

0100101

0010110

0001111

G

1

0111100

1011010

1101001

H

2

1110100

0111010

1101001

H

2

1000101

0100111

0010110

0001011

G

§6.5 Hamming codes

Encoding circuit

2

1000101

0100111

0010110

0001011

G

§6.5 Hamming codes

3. Hamming codes

Decoding circuit

2

1110100

0111010

1101001

H

§6.5 Hamming codes

3. Hamming codes

Overview

• KeyWords:

Hamming codes

The singleton bound

The Hamming bound

H, S, dmin, t

Homework

1. p161: T7.17

2. p163: T7.23