Application Center - Maplesoft

App Preview:

Error correcting codes

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

Error Correcting Codes

Mike May, S. J., 1998

When we say that an (m, n) cyclic code generated by p(x) is t-error correcting,

we mean that we have a polynomial p(x) of degree (m-n) over Z[2] ,

such that the map taking f(x) to f(x)*x^(m-n)+r(x) , where r(x) is the remainder

obtained after dividing f(x)*x^(m-n) by p(x) , takes distinct polynomials to polynomials that

differ in at least 2*t+1 coefficients. (Note that to f(x)*x^(m-n)+r(x) , is divisible by p(x) , since the characteristic is 2.) This is equivalent to claiming that

multiplication by p(x) is a map from polynomials of degree less than n

to polynomials of degree less than m, with the added property that any two

distinct polynomials f[1](x) and f[2](x) are taken to polynomials f[1](x)*p(x)

and f[2](x)*p(x) that differ in at least 2*t+1 coefficients.

>

Verifying error correction

Since an (m, n) code has 2^n message, we could check that a code is t-error correcting

by checking the (2^n-1)*(2^n-2)/2 pairs of messages to see that the two members

of each pair differ from each other in at least 2*t+1 coefficients.

The alternative is to note that this is

equivalent to checking that (f[1](x)-f[2](x))*p(x) = f(x)*p(x) has at least 2*t+1

nonzero coefficeints for all polynomials f(x) of degree less than n.

We list three well chosen polynomials to explore with.

> p1 := x^3+x+1;
p2 := sort(expand((x^4+x+1)*(x^4+x^3+x^2+x+1)));
p3 := sort(expand((x^4+x+1)*(x^4+x^3+x^2+x+1)*(x^2+x+1)));

p1 := x^3+x+1

p2 := x^8+x^7+x^6+2*x^5+3*x^4+2*x^3+2*x^2+2*x+1

p3 := x^10+2*x^9+3*x^8+4*x^7+6*x^6+7*x^5+7*x^4+6*x^...

p1 is the generator of a single error correcting (7,4) code.

p2 is the generator of a double error correcting (15, 8) code.
p3 is the generator of a triple error correcting (15, 5) code.

We want some procedures for turning the binary representation of a number

into a polynomial over Z2.

> makepoly := proc(n,m)
# n should be less than 2^m
local i, tempn, tempp:
tempp := 0: tempn := n:
for i from 0 to m-1 do
tempp := tempp + irem(tempn,2)*x^i:
tempn:= iquo(tempn,2):
od:
sort(tempp):
end:

> makepoly(62,6);

x^5+x^4+x^3+x^2+x

For an t-error correcting (m,n) code generated by p, we need to check

that for any nonzero polynomial f(x) over Z2 of degree < (m-n),

the polynomial f(x)*p(x) has at least 2t+1 nonzero terms.

> minlength := 7:
for i from 1 to 15 do
tpoly := makepoly(i,4):
q1 := sort(expand((p1*tpoly)) mod 2):
print(tpoly,q1,`length = `,subs(x=1,q1));
minlength := min(minlength,subs(x=1,q1)):
od:
minlength;

1, x^3+x+1, `length = `, 3

x, x^4+x^2+x, `length = `, 3

x+1, x^4+x^3+x^2+1, `length = `, 4

x^2, x^5+x^3+x^2, `length = `, 3

x^2+1, x^5+x^2+x+1, `length = `, 4

x^2+x, x^5+x^4+x^3+x, `length = `, 4

x^2+x+1, x^5+x^4+1, `length = `, 3

x^3, x^6+x^4+x^3, `length = `, 3

x^3+1, x^6+x^4+x+1, `length = `, 4

x^3+x, x^6+x^3+x^2+x, `length = `, 4

x^3+x+1, x^6+x^2+1, `length = `, 3

x^3+x^2, x^6+x^5+x^4+x^2, `length = `, 4

x^3+x^2+1, x^6+x^5+x^4+x^3+x^2+x+1, `length = `, 7

x^3+x^2+x, x^6+x^5+x, `length = `, 3

x^3+x^2+x+1, x^6+x^5+x^3+1, `length = `, 4

3

We would like a procedure that checks the minimum length of a

nonzero codeword.

> minlengthcheck := proc(m,n,p,x)
#This checks the minimal distance of an (m,n) code
#generated by p, a polynomial in x.
local minlength, tpoly, q,len1, i:
minlength := 2^n-1;
for i from 1 to (2^(n)-1) do
tpoly := makepoly(i,n):
q := sort(expand((p*tpoly)) mod 2):
len1 := subs(x=1,q):
if len1 < minlength then minlength := len1 fi:
od:
minlength;
end:

We can now verify the lengths of the codes generated by the three polynomials

given earlier.

> minlengthcheck(7,4,p1,x);
minlengthcheck(15,7,p2,x);
minlengthcheck(15,5,p3,x);

3

5

7

Cyclic generators.

It has been noted that we often want to list the nonzero elements of a field

in terms of a primitive element. If the generating polynomial is minp, an

nth degree polynomial in alpha, we want the remainder of alpha^i divided by

minp, for i from 1 to 2^n-1 .

> lister := proc(minp, alpha)
local i,n;
n := degree(minp, alpha):
for i from 1 to 2^n-1 do
print(alpha^i = Rem(alpha^i,minp,alpha) mod 2) od:
end:

> minp := alpha^3 + alpha^1 + 1;
lister(minp,alpha);

minp := alpha^3+alpha+1

alpha = alpha

alpha^2 = alpha^2

alpha^3 = alpha+1

alpha^4 = alpha^2+alpha

alpha^5 = alpha^2+alpha+1

alpha^6 = alpha^2+1

alpha^7 = 1

Producing the polynomials in error correcting codes

We also want to produce the polynomials used in error correcting codes. We first want to find an irreducible polynomial for an odd power of the primitive element we have described the field in terms of.

> fsubbeta := proc(d,minp, alpha)
local n, i, solset, sollist,f1, t1, t2:
n := degree(minp, alpha):
solset := {}:
for i from 0 to n-1 do
t1 := Rem(alpha^(d*2^i), minp, alpha) mod 2:
solset := solset union {t1}:
sollist[i+1] := t1:
od:
f1 := 1:
for i from 1 to nops(solset) do
f1 := f1*(x-sollist[i]) od:
sort(rem(f1,minp,alpha) mod 2);
end:

> minp := alpha^4+alpha+1:
for i from 1 to 3 do print(2*i-1, fsubbeta(2*i-1, minp, alpha)) od:
f1 := 1:
for i from 1 to 3 do f1 := f1*fsubbeta(2*i-1, minp, alpha) mod 2 od:
sort(expand(f1) mod 2);

1, x^4+x+1

3, x^4+x^3+x^2+x+1

5, x^2+x+1

x^10+x^8+x^5+x^4+x^2+x+1

>

Note that the polynomial for alpha^5 is only quadratic, thus we only need a 10th degree

polynomial for triple error correction.

Consider now the case for (31,x) codes.

> minp := alpha^5+alpha^2+1:
for i from 1 to 6 do print(2*i-1, listells(2*i-1, minp, alpha)) od:

1, listells(1,alpha^5+alpha^2+1,alpha)

3, listells(3,alpha^5+alpha^2+1,alpha)

5, listells(5,alpha^5+alpha^2+1,alpha)

7, listells(7,alpha^5+alpha^2+1,alpha)

9, listells(9,alpha^5+alpha^2+1,alpha)

11, listells(11,alpha^5+alpha^2+1,alpha)

Note that the polynomial for alpha^9 is the same as the polynomial for alpha^5 . Thus

the 20th degree polynomial obtained by taking the product of the first 4 polynomials

given produces a (31,11) code that is 5-error correcting rather than 4-error

correcting as we would suspect.

> minp := alpha^9+alpha+1: s1 := {}:
for i from 1 to 17 do
t1 := fsubbeta(2*i-1, minp, alpha):
print(2*i-1, degree(t1), t1):
s1 := s1 union {t1}:
od:
s1; nops(s1);
#for i from 1 to 3 do f1 := f1*fsubbeta(2*i-1, minp, alpha) mod 2 od:
#sort(expand(f1) mod 2);

1, 9, x^9+x+1

3, 9, x^9+x^6+x^3+x+1

5, 9, x^9+x^4+x^2+x+1

7, 9, x^9+x^4+x^2+x+1

9, 9, x^9+x^8+1

11, 9, x^9+x^6+x^5+x^2+1

13, 9, x^9+x^7+x^4+x^3+1

15, 9, x^9+x^6+x^5+x^2+1

17, 9, x^9+x^8+x^7+x^5+1

19, 9, x^9+x^6+x^3+x+1

21, 9, x^9+x^6+x^5+x^2+1

23, 9, x^9+x^6+x^3+x+1

25, 9, x^9+x^8+x^6+x^3+1

27, 9, x^9+x^8+x^6+x^3+1

29, 9, x^9+x^7+x^4+x^3+1

31, 9, x^9+x^7+x^4+x^3+1

33, 9, x^9+x^8+x^7+x^5+1

{x^9+x^6+x^3+x+1, x^9+x^8+1, x^9+x^8+x^6+x^3+1, x^9...
{x^9+x^6+x^3+x+1, x^9+x^8+1, x^9+x^8+x^6+x^3+1, x^9...

8

>