







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!








Objective: To deepen understanding of the concepts of linear block codes previ- ously introduced.
Recall the example from the last time of a code: we had some generator matrix, some parity check matrix, and a means of doing some decoding. We will generalize these ideas. A block code is a code in which k bits (or, more generally, symbols) are input and n bits (or, more generally symbols) are output. We designate the code as an (n, k) code. We will start with bits, elements from the field GF (2); later we will consider elements from a field GF (q) (after we know what this means). If we input k bits, then there are 2k^ distinct messages (or, more generally qk). Each message of n symbols associated with a with each input block is called a codeword. We could, in general, simply have a lookup table with k inputs and n outputs. However, as k gets large, this quickly becomes infeasible. (Try k = 255, for example.) We therefore restrict our attention to linear codes.
Definition 1 A block code C of length n with 2k^ codewords is called a linear (n, k) code if and only if its 2k^ code words form a k-dimensional subspace of the vector space of all n-tuples over the field GF (2). More generally, with a bigger field, a block code C of length n with qk^ is called a linear (n, k) code if and only if its qk^ code words form a k-dimensional subspace of the vector space of all n-tuples over the field GF (q). 2
We remind ourselves of what a vector space is: we have an addition defined that is commutative and closed; we have scalar multiplication that is closed, distributive, and associative. We will formalize these properties a little further, but this suffices for the present purposes. We will see (later) that we have a group structure on the addition operation. So what does this mean for codewords: the sum of any two codewords is a codeword. Being a linear vector space, there is some basis, and all codewords can be obtained as linear combinations of the basis. We can designate {g 0 , g 1 ,... , gk− 1 } as the basis vectors. In a nutshell, it means that we can represent the coding operation as matrix multiplication, as we have already seen. We can formulate a generator matrix as
g 0 g 1 .. . gk− 1
G is a k × n matrix. If m = (m 0 , m 1 ,... , mk− 1 ) is an input sequence, then the output is the codeword
mG = m 0 g 0 + m 1 g 1 + · · · + mk− 1 gk− 1.
We observe that the all-zero sequence must be a codeword. Therefore, the minimum distance of the code C is the codeword of smallest weight. Comment on circuits to implement encoding.
We have a vector space of dimension k embedded in a vector space of dimension n, the set of all n-tuples. Associated with every linear block code generator G is a matrix H called the parity check matrix whose rows span the nullspace of G. Then if c is a codeword, then
cHT^ = 0.
That is, a codeword is orthogonal to each row of H. From this we observe that
GHT^ = 0.
There is also associated with each code a dual code that has H as its generator matrix. The dual code is denoted as C⊥. If G is the generator for an (n, k) code, then H is the generator for an (n, n − k) code. Example 1 A (7, 4) Hamming code can be generated by
The 16 codewords are
The parity check matrix is
When regarded as a generator of an (7, 3) code, the codewords of this code, the dual code has the codewords
0 0 0 0 0 0 0 1 1 0 1 0 0 1 1 0 1 1 0 1 0 0 1 1 0 0 1 1 0 1 1 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 1 0 0 0 0 1 1 1 1
Furthermore, if two error vectors e and e′^ have the same syndrome, then the error vectors must differ by a nonzero codeword. That is, if
eHT^ = e′HT
then
(e − e′)HT^ = 0
which means they must be a codeword.
Before talking about decoding, we should introduce a probabilistic criterion for decoding, and show that it is equivalent to finding the closest codeword. Given a received vector r, the decision rule that minimizes the probability of error is to find that codeword ci which maximizes P (c = ci|r). This is called the maximum a posteriori decision rule. (Proof that this minimizes probability of error is shown in the communications class.) We note by Bayes rule that
P (c|r) =
P (c)P (r|c) P (r)
where, for example, P (r) is the probability of observing the vector r. Now, since P (r) is independent of c, maximizing P (c|r) is equivalent to maximizing
P (c)P (r|c).
If we now assume that each codeword is chosen with equal probability, then maxi- mizing P (c)P (r|c) is equivalent to maximizing
P (r|c).
A codeword which is selected on the basis of maximizing P (r|c) is said to be selected according to the maximum likelihood criterion. We shall assume throughout the text a maximum likelihood criterion. Let us see what this means for us.
P (r|c) =
∏^ n
i=
P (ri|ci)
Assuming a BSC channel with crossover probability p, we have
P (ri|ci) =
1 − p ifci = ri p ifci 6 = ri
Then
P (r|c) =
∏^ n
i=
P (ri|ci) = (1 − p)#(pi=ci)p#(pi^6 =ci)
= (1 − p)n−#(pi^6 =ci)p#(pi^6 =ci)^ = (1 − p)n
p 1 − p
)d(c,r) .
Then if we want to maximize P (r|c), we should choose that c which is closest to r, since 0 ≤ (p/(1 − p)) ≤ 1. Thus, under our assumptions, the ML criterion is the minimum distance criterion. In every case, we should choose the error vector of lowest weight.
Suppose we send c and we receive
r = c + e.
Assuming that error sequences with lower weight are more probable than error sequences with higher weight (the maximum likelihood criterion), we want to de- termine our decoded word c′^ such that the error sequence e′^ satisfying
r = c′^ + e′
has minimum weight. One way to do this is to create a standard array. We form it the following way:
An example standard array for a (7, 3) code is shown here, where
We make the following observations:
Steps to decoding
Example 2 We provide another example of the standard array, because it raises some interesting issues. For the (5, 2) code with
the standard array is.
This code is capable of correcting all errors of one bit. In addition, there are two other errors of two bits that can be corrected. Note that the minimum distance of this code is 3. The parity check matrix is
The standard array using syndromes is
Hamming codes are the earliest and simples example of linear block codes. The parameters are as follows, for m ≥ 2: code length: n = 2m^ − 1 Number of information symbols: k = 2m^ − m − 1 Number of parity symbols: n − k = m Error correcting capability: t = 1 Examples are: (3, 1), (7, 4), (15, 11) and (31, 26) codes. The parity check matrix of a Hamming code consists of all nonzero binary m- tuples. The columns may be ordered to correspond to a systematic code. Syndrome decoding of Hamming codes using the standard array is straightforward: the syn- drome indicates which column of H corresponds to the error position.
We pause in our development of decoding algorithms to address the question of how well linear codes can perform. We recall that we can correct up to t errors if d∗^ = 2t + 1. We can also detect up to d∗^ − 1 errors. It may be possible to detect some errors up to d∗, but it cannot detect all of them, because there is at least one codeword with weight d∗. We say that the random error detecting capability of a code is d∗. However, it may be possible to detect a large number of error patterns with weight ≥ d∗. Consider the following: there are 2n^ possible vectors, of which 2k^ are codewords. There are thus 2n^ − 2 k^ error patterns which are distinct from codewords. It is possible that an error sequence is exactly equal to a codeword, in which case the error is undetectable. There are 2k^ − 1 undetectable error patterns (the all zero error does not matter). The 2n^ − 2 k^ patterns which are detectable are called detectable error patterns. In many codes, 2k^ − 1 is much smaller than 2n, so that only a small fraction of the error patterns are undetectable. In carefully characterizing the performance of codes, the weight distribution of the code is important. Consider the codewords of a linear (n, k) code C. One of the codewords has weight 0. There may be codewords with weight 1, weight 2, and so forth. Let Ai be the number of code vectors of weight i. The numbers A 0 , A 1 ,... , An are called the weight distribution of C. Example 3 For the (7, 4) Hamming code presented above,
A 0 = 1 A 1 = 0 A 2 = 0 A 3 = 7 A 4 = 7 A 7 = 1.
This polynomial is called the weight enumerator for C. (Think of the Z transform of a finite series.) Let
B(z) = B 0 + B 1 z + · · · + Bnzn.
The following identity is known as the MacWilliams identity:
A(z) = 2−(n−k)(1 + z)nB
1 − z 1 + z
The MacWilliams identity can be used to compute the probability of an undetected error from a linear code from the weight distribution of its dual. It can be shown that
Pu(E) = 2−(n−k)B(1 − 2 p) − (1 − p)n.
We introduce some minor modifications to linear codes.
Definition 2 A code is punctured by deleting one of its parity symbols. An (n, k) code becomes an (n − 1 , k) code. 2
Definition 3 A code is shortened by deleting a message symbol. An (n, k) code becomes an (n, k − 1) code. 2
Definition 4 A code is expurgated by deleting some of its codewords (while still maintaining the linear code properties.) 2
Definition 5 A code is extended by adding an additional redundant coordinate, producing an (n + 1, k) code. 2
Thinking geometrically, around each code point is a cloud of points corresponding to non-codewords. These form a “sphere” around each of the code vectors. The Hamming sphere is the sphere of radius t that contains vectors a distance ≤ t from a codeword. The number of vectors in the Hamming sphere is denoted Vq (n, t) (where q = 2 for binary codes). We can see that
Vq (n, t) =
∑^ t
j=
n j
(q − 1)j^.
From a decoding point of view, if a received vector r falls inside the Hamming sphere of a codeword, then that codeword is selected. The redundancy of a code is essentially the number of parity symbols in a codeword. More precisely we have
r = n − logq M
where M is the number of codewords. For the codewords we have seen to this point, r = n − k.
Theorem 2 (The Hamming Bound) A t-error correcting q-ary code must have redundancy r satisfying
r ≥ logq Vq (n, t)
Proof Each of M spheres in C has radius t. The spheres do not overlap. The total number of points enclosed by the spheres must be ≤ qn. We must have
M Vq (n, t) ≤ qn
so
qn/M ≥ Vq (n, t)
from which the result follows. 2
A code that satisfies the Hamming bound with equality is said to be a perfect code. In terms of the standard array, it means that the random error correcting capability is the best it gets: there are no leftover codewords. Hamming codes are perfect codes. (Actually, being perfect codes does not mean the codes are the best possible codes.) The set of perfect codes is actually quite limited, since (it can be shown that) the number of codewords of a q-ary code must be M = qk. Possible perfect codes:
An upper bound on the redundancy is the Gilbert bound:
Theorem 3 There exists a t-error correcting q-ary code of length n and redundancy r that satisfies
r ≤ logq Vq (n, 2 t).
The proof is interesting, because it demonstrates a power technique in coding, the random code. It also points out that the code need not be linear.
Proof There are qn^ n-tuples possible. Begin by selecting one of these at random, then delete from further consideration all vectors that are at Hamming distance less than or equal to 2t from the selected codeword. Repeat, selecting another codeword at random from those still available. The selection of each code word results in the deletion of at most Vq (n, 2 t) vectors from the set of qn^ possible. Continuing, at least M code vectors may be selected, where
M = dqn/Vq (n, 2 t)e ≥ qn Vq (n, 2 t)
Theorem 5 (Gilbert-Varsharmov bound) If 0 ≤ δ ≤ (q − 1)/q, then a(δ) ≥ 1 − Hq (δ).
Proof The error correction capability is
t = b(δn − 1)/ 2 c,
so that
Vq (n, 2 t) ≤ Vq (n, bδnc).
Then
a(δ) = lim sup n→∞
logq Aq (n, bδnc) n ≥ lim n→∞
n
logq
qn Vq (n, bδnc)
Gilber bound
= lim n→∞
logq Vq (n, bδnc) n
= 1 − Hq (δ) previous lemma
2
We also can state a lower bound:
Theorem 6 (McEliece-Rodemich-Rumsey-Welch bound)
a(δ) ≤ H 2 (
δ(1 − δ)).
Plots of these bounds for binary codes are shown.