Top Banner
Linear Codes
35

Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

Dec 27, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

Linear Codes

Page 2: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p2.

Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating matrices and encoding [7] Parity-check matrices [8] Equivalent codes [9] Distance of a linear code [10] Cosets [11] MLD for linear codes

CSC

Page 3: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p3.

Linear Codes [1] Linear codes

A code C is called a linear code if v+w is a word in C if v and w are in C

C must contain the zero word C is a linear code iff C is a subspace of Kn

We will use the knowledge of subspace to dramatically improve our techniques for encoding and decoding

The distance of a linear code is equal to the minimum weight of any nonzero codeword(ex2.1.4)

Advantage simpler procedure for MLD faster encoding and less storage space straightforward calculation for error patterns are easily describable

),( vCp

Page 4: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p4.

Linear Codes [2] Two important subspaces

<S> : Linear span of S Linear combination : w

Linear span of S : the set of all linear combinations of the vectors in set S

Theorem 2.2.1 : For any subset S of Kn , the code C=<S> generated by S consists precisely

of the following words : the zero word , all words in S, and all sums of two or more words in S.

Example :

kkvavavaw ...2211kvvv ,...,, 21vector

:kaaa ,..., 21scalar

}1100,0011,0100{S

}1011,1111,1000,0111,1100,0011,0100,0000{SC

111111000011,100011000100

,1011110000110100,011100110100

 

 

Page 5: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p5.

Linear Codes Dual code of C

Scalar product :

Orthogonal : Orthogonal complement of S : (a subspace of Kn)

The set of all vectors orthogonal to the set S of vectors Dual code of C :

If C = <S> , then Example :

nnn Kwvbbbwaaav ,),...,,(),,...,,( 2121   

nnbababawv ...2211

wv

0wvS

C SC

}1010,1000,0010,0000{

01010

00010

),,,(

}0101,0100{

SC

wzyx

wzyx

wzyxv

S

Page 6: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p6.

Linear Codes [3] Independence, basis, dimension

Linear independent Definition : A set of vectors is linearly independent i

f for all scalars such that iff

Example :

},...,,{ 21 kvvvS

0...2211 kkvavava 0),...,,( 21

kaaa

0

0

0

0

0

0)1011()1101()1001(

}1011,1101,1001{1

cba

cba

c

b

cba

cba

S

1

0

0

0

0)111()101()011()110(

}111,101,011,110{2

cba

dcb

dba

dca

dcba

S

S1  is a linear independent set.

S2  is a linearly dependent set.

Page 7: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p7.

Linear Codes Basis :

A nonempty subset B of vectors from a vector space V is a basis for V if both

B  spans V  ( that is , <B>=V )  B  is a linearly independent set

Example :

Dimension : The number of elements in any basis for a vector space

is called the dimension of the space.(all bases for a vector space contain the same number of elements.)

Example :

S  is a basis for C

The dimension of C  is 3

}1111,0110,0010,0100,1011,1101,1001,0000{

}1011,1101,1001{

SC

S a linearly independent set

Page 8: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p8.

Linear Codes

C : linear code of dimension k with basis

C has precisely different bases

Example: How many bases for K4 ?

                 (24-1)(24-2)(24-22)(24-23)/4! = 840

kkvavavaw ...2211

},...,,{ 21 kvvv

w in C can be expressed as a unique lin comb of the basis vectors

There are 2k choices of ai, and hence 2k words in C

)22(!

1 10

ikkik

Page 9: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p9.

Linear Codes

[4] Matrices Zero matrix

Identity matrix

Elementary row operations : Interchanging two rows Replacing a row by itself plus another row

00

00

100

0100

00

0010

001

Page 10: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p10.

Leading 1 : a 1 in a matrix M such that there are no 1s to its left in

the same row. Leading column :

a column of M contains a leading 1. REF : row echelon form

The zero rows of M are all at the bottom, and each leading 1 is to the right of the leading 1s in the rows above.

RREF : reduced row echelon form Each leading column of M contains exactly one 1

Linear Codes

1000

0110

0101

1000

0110

0101

1000

0110

0101

Page 11: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p11.

00000

11100

11010

10111

11100

11010

11010

10111

01011

11010

01101

10111

}11010,01011,10110,11101{

A

S

Linear Codes [5] Bases for

Algorithm 2.5.1 : finding a basis for C Form the matrix A whose rows are the words in S. Use elementary row operations to find a REF of A. Then the nonzero rows of the REF form a basis for C=<S>

Example :

CandSC   

}00111,01011,11101{ is a basis

Page 12: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p12.

0000

0000

1000

0110

1011

1110

1110

1000

0110

1011

0101

1110

0011

1101

1011

}11010,01011,10110,11101{

A

S

Linear Codes Algorithm 2.5.4 : finding a basis for C

Form the matrix A whose columns are the words in S. Use elementary row operations to place A in REF and

locate the leading columns in the REF. Then the original columns of A corresponding to these

leading columns form a basis for C=<S> Example :

Columns 1, 2, and 4 are the leading columns

}11010,10110,11101{ is a basis

Page 13: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p13.

Linear Codes Algorithm 2.5.7 : finding a basis for

Use elementary row operations to place A in RREF. Let G be the kxn matrix consisting of all the nonzero rows of the RRE

F. Form the matrix A whose rows are the words in S. Let X be the kx(n-k) matrix obtained from G by deleting the leading c

olumns of G. Form an nx(n-k) matrix H as follows :

In the rows of H corresponding to the leading columns of G, place, in order, the rows of X

In the remaining n-k rows of H, place, in order, the rows of the (n-k)x(n-k) identity matrix I

Then the columns of H form a basis of

C

C

Page 14: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p14.

Linear Codes Example 2.5.8 :

10

0111

11

10

,

11

11

10

,

11

11

10

|

100

010

001

00000

11100

11010

10001

00000

11100

11010

01011

00000

11100

11010

10111

00011

11010

01101

10111

HXG

A

      

Cforbasisais}11101,01110{

}11010,01011,10110,11101{S

Page 15: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p15.

Linear Codes Example 2.5.9 : n=10.1. Place A in RREF and delete zero rows to get G.2.The leading cols of G are cols 1, 4, 5, 7, 9, so we permute

the cols of G into the order 1, 4, 5, 7, 9, 2, 3, 6, 8, 10 to form G’.

3. Form H’.4. Rearrange the rows of H’ to get H.

The cols of H form a basis for

0000000011

0000001001

0000100100

0001010001

1010010101

G

00001

00001

00010

00101

01111

00001

00010

00100

01000

10000

'G

10

9

8

7

6

5

4

3

2

1

00001

00001

00010

00001

00100

00010

00101

01000

10000

01111

10

8

6

3

2

9

7

5

4

1

00001

00010

00100

01000

10000

00001

00001

00010

00101

01111

'

H

I

XH

C

Page 16: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p16.

Linear Codes

Why Algorithm 2.5.7 works?

1. Rows of G form a basis of C with dimension k

2. Cols of H form a basis of a linear code with dimension n-k

3. G H =

So cols of H form a basis of

C

OXXI

XXI

Page 17: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p17.

Linear Codes

[6] Generating matrices and encoding Rank : the number of nonzero rows in any REF of the matrix (n,k,d) linear code C : C has length n , distance d, dimension k Generator matrix :

Definition : Any matrix whose rows form a basis for C is called a generator matrix for C.

Theorem 2.6.1 :

A matrix G is a generator matrix for some linear code C iff the rows for G are linearly independent

Theorem 2.6.2 :

If G is a generator matrix for a linear code C, then any matrix row equivalent to G is also a generator matrix for C. In particular, any linear code has a generator matrix in RREF.

Page 18: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p18.

Linear Codes Example :

1110

0111

0000

0000

1110

0111

0000

1110

1110

0111

0000

1001

1110

0111

1001

1110

0111

0000

}1001,0111,1110,0000{

G

A

C

is a generator matrix for C 

Page 19: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p19.

Linear Codes Encoding :

Method :

Theorem 2.6.8If G is a generator matrix for a linear code C of length n and dimension k, then v=uG ranges over all 2k words in C as u ranges over all 2k words of length k . Thus C is the set of all words uG, u in Kk. Moreover, u1G = u2G iff u1=u2

uGv

),...,,(, 212

1

k

k

aaauCformatrixgeneratorais

g

g

g

G

 

kk gagagauGv ...2211

Page 20: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p20.

Linear Codes Example :

101,

10100

11010

01101

umessageG    

10011

00101

01011

10110

101

uGv

Page 21: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p21.

Linear Codes

[7] Parity-check matrices Parity-check matrix

Definition : a matrix H is called a parity-check matrix for a linear code C if the columns of H form a basis for the dual code

Theorem 2.7.1A matrix H is a parity-check matrix for some linear code C iff the columns of H are linearly independent.

Theorem 2.7.2If H is a parity-check matrix for a linear code C of length n , then C consists precisely of all words v in Kn such that vH = 0.

C

Page 22: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p22.

Linear Codes Example : find the parity-check matrix for C

01

10

11

01

1101

0110

}1001,0111,1110,0000{

I

XH

XIG

C

is a parity-check matrix for C 

use Algorithm 2.5.7

Page 23: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p23.

Linear Codes Generator matrix and parity-check matrix

Theorem 2.7.6Matrices G and H are generating and parity-check matrices for some linear code C iff

The rows of G are linearly independent The columns of H are linearly independent The number of rows of G plus the number of columns of H equals the nu

mber of columns of G which equals the number of rows of H GH = 0

Theorem 2.7.7H is a parity-check matrix of C iff HT is a generator matrix for C

CHCG

CH C

G

transpose

transpose

Algorithm 2.5.7

Algorithm 2.5.7

Page 24: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p24.

Linear Codes Example :

C: linear code

Parity-check matrix:

I

XH

01

10

01

11

11

A generator matrix for       is

C

11101

11010TH

The RREF of HT  is

00111

11010

A parity-check matrix for         :C

001

010

011

100

110

CHCG

CH C

G

transpose

transpose

Algorithm 2.5.7

Algorithm 2.5.7

Page 25: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p25.

Linear CodesFrom the form of H, we can get the generator matrix G for C:

111

110

001

010

100

][

01001

11010

11100

TG

XIG

It’s another parity-check matrix for

C

CHCG

CH C

G

transpose

transpose

Algorithm 2.5.7

Algorithm 2.5.7

Page 26: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p26.

Linear Codes [8] equivalent codes

Standard form : G k x n matrix G with k<n is in standard form

First k columns form k X k identity matrix Ik It has linearly independent rows It is in RREF It is a generator matrix for some linear code of length n and dim

ension k. Systematic code : C

The code C is generated by G which is in standard form. Theorem 2.8.2

If C is an linear code of length n and dimension k with generator matrix G in standard form, then the first k digits in the codeword v=uG form the word u in Kk

XIG k ,

Page 27: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p27.

Linear Codes Example :

][

0110001

1100010

1000100

1011000

4 XIG

0001011000,1011

0010111001,0111

uuGu

uuGu

 

 

          k n - k

information digits redundancy(parity-check digits)

v

Page 28: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p28.

Linear Codes Theorem 2.8.8

Any linear code C is equivalent to a linear code C’ having a generator matrix in standard form.

Example :

][

000000001

001000010

000100100

001101000

010110000

'

000000001

000001100

000010010

000100110

011000010

XIG

G

generator matrix in RREF

generator matrix in standard form

The code generated by G is equivalent to the code generated by G’.

Page 29: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p29.

Linear Codes

[9] Distance of a linear code The distance of a linear code can be determined from

a parity-check matrix for the code. Theorem 2.9.1

Let H be a parity-check matrix for a linear code C. Then C has distance d iff any set of d-1 rows of H is linearly independent , and at least one set of d rows of H is linearly dependent.

Example :

001

010

100

011

110

H

No two rows of H sum to 000 Any two rows of H are linearly independent.

Rows 1,3, and 4 sum to 000.Rows 1,3, and 4 are linearly dependentd-1 = 2the distance of C: d = 3

Page 30: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p30.

Linear Codes [10] Cosets

Definition : The coset of C determined by u is the set of all words of the form

v+u as v ranges over all the words in C. Theorem 2.10.3

Let C be a linear code of length n. Let u and v be words of length of n.

If u is in the coset C+v, then C+u=C+v The word u is in the coset C+u. If u+v is in C, then u and v are in the same coset. If u+v is not in C, the u and v are in different cosets. Every word in Kn is contained in one and only one coset of C. |C+u|=|C| If C has dimension k, then there are exactly 2n-k different cosets o

f C, and each coset contains exactly 2k words. The code C itself is one of its cosets.

Page 31: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p31.

Linear Codes Example :

}1110,0101,1011,0000{c

}1100,0111,1001,0010{0010,0010

}1010,0001,1111,0100{0100,0100

}0110,1101,0011,1000{1000,1000

Cu

Cu

Cu

 

 

 

The number of words in each coset :

The number of cosets :

The dimension of C: 2

42 24

422

Page 32: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p32.

Linear Codes

[11] MLD for linear codes Decoding

The error pattern u and the received word w are in the same coset of C

Error patterns of small weight are the most likely to occur Example :

1101},1110,0101,1011,0000{ wC

0000101101011110

1000001111010110

0100111100011010

0010100101111100

coset

010110001101

1000

v

u

vu

wchannel

It is hard to find the coset containing w and find a word of least weight in that coset !!!

Page 33: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p33.

Linear Codes Syndrome

Theorem 2.11.4Let C be a linear code of length n. Let H be a parity-check matrix for C. Let w and u be words in Kn.

wH=0 iff w is a codeword in C wH = uH iff w and u lie in the same coset of C If u is the error pattern in a received word w, then uH is t

he sum of the rows of H that correspond to the positions in which errors occurred in transmission.

kn

n

KinwH

Kinw               

C: a linear code of length n and dimension k

H : parity check matrix for CThe syndrome of w:

Page 34: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p34.

Linear Codes SDA : Standard Decoding Array

}1110,0101,1011,0000{C

Coset leader u Syndrome uH

0000 001000 110100 010010 10

Page 35: Linear Codes. p2. Outline [1] Linear codes [2] Two important subspaces [3] Independence,basis,dimension [4] Matrices [5] Bases for and [6] Generating.

p35.

Linear Codes Decoding with SDA

Example :

0101

1000

11

1101

01

10

01

11

uwv

u

wH

w

H

vu

wchannel