MATH 392 -- Seminar in Coding Theory

Reed-Solomon decoding example

April 19, 2002

First, read in a package of coding theory Maple procedures. (These

can be downloaded from the course homepage for your future use, if you like.)

> read "/home/fac/little/public_html/SemCodTh/CTPMaple6.map";

Warning, the protected names norm and trace have been redefined and unprotected

We will work an example with the code RS( 2^6, 25 ) -- a Reed-Solomon code

over F[2^6] with n = 63, k = 39, delta = 25 . To construct the field we need an

irreducible polynomial of degree 6 whose roots are primitive elements. To

find an appropriate one, we can factor x^63+1 in F[2] [ x ]

> Factor(x^63+1) mod 2;

(x^6+x^5+1)*(x^3+x+1)*(x^6+x^4+x^2+x+1)*(x^6+x^4+x^...
(x^6+x^5+1)*(x^3+x+1)*(x^6+x^4+x^2+x+1)*(x^6+x^4+x^...
(x^6+x^5+1)*(x^3+x+1)*(x^6+x^4+x^2+x+1)*(x^6+x^4+x^...

Check primitivity:

> alias(alpha=RootOf(z^6+z^5+1));

alpha

> h:=z^6+z^5+1;

h := z^6+z^5+1

> for i from 0 to 63 do if (Normal(alpha^i) mod 2) = 1 then lprint(i); end if; end do;

0

63

The powers of alpha give all 63 nonzero elements of the field, so this is our primitive element.

The Reed-Solomon generator polynomial (using m = 0 in general formula) -- this is

the expanded form of the product (with like terms collected):

> gp:=RSGenPoly(2,6,25,0,h,x);

gp := x^24+(alpha^4+alpha^2+alpha+1)*x^23+(alpha^5+...
gp := x^24+(alpha^4+alpha^2+alpha+1)*x^23+(alpha^5+...
gp := x^24+(alpha^4+alpha^2+alpha+1)*x^23+(alpha^5+...
gp := x^24+(alpha^4+alpha^2+alpha+1)*x^23+(alpha^5+...
gp := x^24+(alpha^4+alpha^2+alpha+1)*x^23+(alpha^5+...

Next, we'll enerate a random codeword by encoding a particular vector of information symbols. The

procedure RSEncode uses the polynomial division encoder we talked about in class:

> infosyms:=vector([seq(alpha^i,i=1..64-25)]):

> codeword:=RSEncode(infosyms,gp,x,h,2);

codeword := vector([alpha^5+alpha^3+alpha^2+alpha+1...
codeword := vector([alpha^5+alpha^3+alpha^2+alpha+1...
codeword := vector([alpha^5+alpha^3+alpha^2+alpha+1...
codeword := vector([alpha^5+alpha^3+alpha^2+alpha+1...
codeword := vector([alpha^5+alpha^3+alpha^2+alpha+1...
codeword := vector([alpha^5+alpha^3+alpha^2+alpha+1...
codeword := vector([alpha^5+alpha^3+alpha^2+alpha+1...
codeword := vector([alpha^5+alpha^3+alpha^2+alpha+1...
codeword := vector([alpha^5+alpha^3+alpha^2+alpha+1...

A random error vector -- weight is 8 ( < t = 12 for this code)

> errorvector:=vector([1,0,0,0,alpha,0,0,0,0,0,0,0,0,alpha^43,0,0,0,0,0,0,1,

> calpha^7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,alpha^6,0,0,0,0,0,0,0,0,0,0,0,0,0,1,alpha^11,0,0,0]);

errorvector := vector([1, 0, 0, 0, alpha, 0, 0, 0, ...
errorvector := vector([1, 0, 0, 0, alpha, 0, 0, 0, ...

> vectdim(errorvector);

63

> received:=map(y->Normal(y) mod 2,matadd(codeword,errorvector)):

> st:=time():

> decoded:=RSBMDecode(received,2,h,25,0);

decoded := vector([alpha^5+alpha^3+alpha^2+alpha+1,...
decoded := vector([alpha^5+alpha^3+alpha^2+alpha+1,...
decoded := vector([alpha^5+alpha^3+alpha^2+alpha+1,...
decoded := vector([alpha^5+alpha^3+alpha^2+alpha+1,...
decoded := vector([alpha^5+alpha^3+alpha^2+alpha+1,...
decoded := vector([alpha^5+alpha^3+alpha^2+alpha+1,...
decoded := vector([alpha^5+alpha^3+alpha^2+alpha+1,...
decoded := vector([alpha^5+alpha^3+alpha^2+alpha+1,...
decoded := vector([alpha^5+alpha^3+alpha^2+alpha+1,...

> time() - st;

12.060

> for i to 63 do if codeword[i] <> decoded[i] then lprint(i,codeword[i],decoded[i]) end if end do;

(no output so correctly decoded!)

Note: The decoding took about 12 seconds in Maple. In fact, it is true in general

that Maple is relatively slow for this type of procedure (its programming language

is interpreted vs. compiled, and it is not optimized for finite field arithmetic

the way "professional" coding theory software would be.)

On the other hand, consider the job of constructing the SDA for this code and

looking up an error syndrome to find the coset leaders.

There are 64^24 = 2^144 approx = 2 x 10^43 different cosets. If you could compute

a billion ( = 10^9 ) coset leaders per second (not likely!), just constructing the SDA would

take 2 x 10^34 seconds approx = 6 x 10^26 years, or longer than the total age of the universe!

It would take more than 7 x 10^36 gigabytes to store all that information (a HUGE

amount -- immensely more than all the computer memory in the world now -- more

than is conceivable any time in the forseeable future).

And even assuming we could store all that information somehow, we would still need

some way to retrieve leaders from the SDA -- not a trivial task with that much info.

12 seconds to decode a received word doesn't look so bad any more, does it!

> evalf(2^144*6*63/(2^30));

.785075285010465937433811044978e37

> evalf(2*10^34/(60*60*24*365));

634195839675291730086250634.196

>