Linear Codes
Linear Codes
Terminal Connectivity
76a 76b
Types of Error Control (a) Stop-and-wait ARQ, requires half-
duplex link
Error detection and retransmission (b) Continuous ARQ with pullback; it
In this mode the receiver detects errors requires full duplex.
in the received data but cannot correct (c) Continuous ARQ with selective
them. Instead it asks the transmitter to repeat; it requires full duplex.
retransmit erroneous part of the data
sequence. This method requires a return
link.
U = mG
where U is the codeword, m is the
uncoded message. For example, a code
generator is
1 1 0 1 0 0 0
0 1 1 0 1 0 0
G=
1 1 1 0 0 1 0
1 0 1 0 0 0 1
If the message is
m = (1 1 0 1)
then the codeword is
85a 85b
1 1 0 1 0 0 0 code. In general, a message of k bits is
0 1 1 0 1 0 0 encoded into a codeword of n bits (n>k).
U = (1 1 0 1)
1 1 1 0 0 1 0
1 0 1 0 0 0 1
= (0 0 0 1 1 0 1)
Note that “modulo-2” addition and
multiplication is used in the computation
of the matrix.
86a 86b
The general form of the generator matrix The ratio k/n is called code rate. The
is ratio (n-k)/k is called redundancy. There
are 2k possible codewords corresponding
V1 v11 v12 " v1n to all possible k-bit messages. But there
V v v " v are total of 2n possible n-tuples. Among
G = 2 = 21 22 2n
them only 2k are codewords. From a
# # point of view of vector space, the 2n n-
k k1 k 2
V v v " v kn tuples form an n-dimensional vectors
space. And the 2k codewords form a k-
where V1, V2, …Vk are OLQHDUO\ dimensional subspace.
LQGHSHQGHQW row vectors (meaning any
Since the codewords form a subspace,
WKHVXPRIDQ\WZRFRGHZRUGVLV
one of them can not be expressed as a
88a 88b
positions without affect the code’s error Parity-Check Matrix
detection and correction capabilities.
If we express the codeword as: The parity-check matrix of a systematic
code is defined as follows.
U = p1 , p2 ,..., pn−k , m1 , m2 ,..., mk H = [I n − k | P T ]
The transpose of H is
Then the relationship between the parity- 1 0 " 0
check bits and the message bits is as 0 1 " 0
follows.
#
p1 = m1 p11 + m2 p21 + ... + mk pk 1
I 0 0 " 1
H T = n -k =
p2 = m1 p12 + m2 p22 + ... + mk pk 2 P p11 p12 " p1( n−k )
# p21 p22 " p2( n−k )
pn−k = m1 p1( n−k ) + m2 p2( n−k ) + ... + mk pk ( n−k ) #
pk 1 pk 2 " pk ( n−k )
The jth column is
hTj = (0,0,...,1,0,...,0, p1 j , p2 j ,..., pkj )
89a 89b
where 1 is at position j. Thus :KHQ6 ULVDFRGHZRUG
g i <hTj = pij + pij = 0 . RWKHUZLVHULVQRWDFRGHZRUG
And consequently,
GHT = 0 Assuming a codeword U is transmitted
UHT = mGHT = m0 = 0 and when it is received, there are errors
This is a very important property of a in it. These errors can be represented by
codeword. U is a codeword generated by an error pattern e, such that the received
G if and only if UHT = 0. Thus we can n-tuple is r=U+e. For example,
use H to check whether a received n- U=1101000, and r=1100001, then the
tuple is a codeword. error pattern is e=0001001. In fact the
error pattern is the difference between U
Syndrome Test and Error Detection and r, or e = U-r = U+r (modulo-2).
Syndrome is computed as
Denote the received n-tuple as r, let S = rHT = (U + e)HT = eHT
S = rHT Thus the syndrome only depends on the
S is called V\QGURPH. It is a vector of n- error pattern. 7KHPDSSLQJEHWZHHQ
DFRUUHFWDEOHHUURUSDWWHUQDQG
k bits because HT has n-k columns.
90a 90b
DV\QGURPHYHFWRUPXVWEHRQH 1 0 0
WRRQH. This allows the correctable error 0 1 0
pattern to be detected and corrected. 0 0 1
S = rHT = [1100001] 1 1 0 = [011]
If the error pattern happens to be the
same as a codeword, this error pattern 0 1 1
will produce a zero syndrome. Thus the
1 1 1
error pattern is not detectable. 1 0 1
Example: or
1 0 0
0 1 0
1 1 0 1 0 0 0
0 1 1 0 1 0 0 0 0 1
G=
1 1 1 0 0 1 0 S = eHT = [0001001] 1 1 0 = [011]
0 1 1
1 0 1 0 0 0 1
1 1 1
U=1101000, r=1100001, e=0001001 1 0 1
91a 91b
Standard Array and Error Correction called FRVHWOHDGHU, followed by
codewords perturbed by that error
U1 U2 " Ui " U 2k pattern.
e2 U 2 + e2 " Ui + e2 " U 2k + e 2 • The array contains all possible n-
e3 U 2 + e3 " U i + e3 " U 2k + e 3 tuples in the vector space Vn. None is
# # # # missing. None is replicated.
ej U2 + e j " Ui + e j " U 2k + e j • Example: the standard array for a (6,
# # # # 3) code with
e 2n−k U 2 + e 2n−k " U i + e 2n−k " U 2k + e 2n−k 1 0 0
0 1 0
1 1 0 1 0 0
• The first row is the codewords. 0 0 1
G = 0 1 1 0 1 0 ,H =
T
• The first column is the correctable 1 1 0
1 0 1 0 0 1
error patterns. 0 1 1
• U1=e1 is the all-zeros vector which is a
1 0 1
codeword and also an “error” pattern. The standard array is
• Each row, called a FRVHW, consists of
an error pattern in the first column,
92a 92b
• The syndrome of a member of a cost is
the same:
S j = (Ui + e j )HT = Ui HT + e j HT
= e j H , ' Ui H = 0
T T
95a 95b
inspection. It is also feasible for big- Thus one can inspect the H matrix, find
size codes with computer search. the least number of columns that add to
2. Method 2: use the parity-check zero, this number is equal to d min .
matrix H. 7KHRUHP d min LVHTXDO Again for big codes, computer may be
WRWKHPLQLPXPQXPEHURI programmed to check the H matrix for
OLQHDUO\GHSHQGHQWFROXPQVLQ
the minimum number of linearly
WKH+PDWUL[
dependent columns.
Example, for the (6, 3) code,
Proof: For any codeword 1 0 0 1 0 1
U = (u1 , u2 ,..., un ) and H = 0 1 0 1 1 0
H = (h1 , h 2 ,..., h n ) , where hi is the ith
0 0 1 0 1 1
column of H, we have
Any two columns add to nonzero. But
UHT = u1h1 + u2h 2 + ... + unh n = 0
columns 1, 2, 4 or 4, 5, 6 add to 0.
If the codeword has the minimum Thus d min = 3 .
• (UURUGHWHFWLRQFDSDELOLW\
weight wmin, then in the above sum
there are wmin columns that add to
zero, i.e., there are wmin columns that A code must detected errors in a
are linearly dependent. codeword before it can be corrected; or
a code may be used for error detection
96a 96b
only, such as in an ARQ system. The • 0D[LPXPOLNHOLKRRGGHFRGLQJ
error detection capability of a linear Assuming a DMC, when r is the
block code is equal to e = d min − 1 since output vector of the channel (which is
an error pattern of e or less nonzero the output of the demodulator), the
components will not alter the optimal decoder is the PD[LPXP
OLNHOLKRRGGHFRGHU(MLD), which
transmitted codeword to another one.
Such a code also is capable of
computes its likelihood conditioned on
detecting many error patterns with d min
all possible codewords and chooses the
or more errors. In fact it can detect any maximum: decoding in favor of Ui if
error patterns except for those that are P(r | U i ) = max
identical to the 2k codewords. That is, N P (r | U j )
over all U j
the number of detectable error pattern Since the channel is memoryless, the
is 2n-2k. For example, for the (7, 4) likelihood of the vector r is equal to
code, 2n-2k =112. The number of the product of likelihood of all
undetectable error pattern is only 16, a components of the vector. Thus
small fraction of the total error P(r | U) = ∏ P( ri | ui )
patterns. i
or
97a 97b
log P (r | U ) = ∑ log P (ri | ui ) log(p/(1-p))<0, the smaller the d (r , U ) ,
i the larger the log-likelihood function:
Now consider specializing the MLD log P (r | U ) . Thus the maximum
rule to the BSC. In this case, r is a likelihood-decoding rule becomes
PLQLPXPGLVWDQFHGHFRGLQJ (MDD)
binary sequence that may differ from
the transmitted codeword U in some
rule for a BSC.
• (UURUFRUUHFWLRQFDSDELOLW\
positions. It is clear that
p, ri ≠ ui
P( ri | ui ) = See the example in the figure below. U
1 − p, ri = ui and V are two codewords with d min = 5
Thus between them. Using the MDD rule, r1
log P (r | U ) = d (r , U ) log p
and r2 will be decoded as U and r3 will
+[n − d (r , U )]log(1 − p ) be decoded as V. If r1 is the result of a 1-
p bit error to U, the decoder has corrected
= d (r , U ) log+ n log(1 − p )
1− p the error. But if r1 is a result of 4-bit
where d (r , U ) is the Hamming distance error to V, the decoder has made an
error. Similar words can be said for r2
between r and U. For p<1/2, which is
usually true in a practical system, and r3. It is clear that if the error patterns
have more than (dmin-1)/2 errors, the
98a 98b
where x denotes the integer floor of x.
For the (6, 3) code, dmin=3, t=1. However
from the standard array in Fig. “6.11”,
the code can also correct a 2-bit error
pattern. In general, the number of
correctable error patterns is 2n-k since the
standard array has 2n-k error patterns. If
all 2n-k error patterns contain t or fewer
errors, the code is called SHUIHFWFRGH.
The message error probability of a t-
error correcting code is upper-bounded
n
n j
by PM ≤ ∑ p (1 − p ) n− j
j =t +1 j