Notes 3
Notes 3
Minimum weight
The Hamming weight wH (v) is the number of nonzero components of v.
Obvious facts:
• wH (v) = dH (0, v)
• dH (v1, v2) = wH (v1 − v2) = wH (v2 − v1)
• wH (v) = 0 if and only if v = 0
Definition: The minimum (Hamming) weight of a block code is the weight of the
nonzero codeword with smallest weight:
w = w∗ = min{w (c) : c ∈ C, c 6= 0}
min H
Examples of minimum weight:
• Simple parity-check codes: w∗ = 2.
• Repetition codes: w∗ = n.
• (7,4) Hamming code: w∗ = 3. (There are 7 codewords of weight 3.)
Weight enumerator: A(x) = 1 + 7x3 + 7x4 + x7.
• Simple product code: w∗ = 4.
EE 387 Notes #3, Page 2
Minimum distance = minimum weight
Theorem: For every linear block code, d∗ = w∗.
Proof : We show that w∗ ≥ d∗ and w∗ ≤ d∗.
(≥) Let c0 be a nonzero minimum-weight codeword. the 0 vector is a codeword, so
w∗ = w (c ) = d (0, c ) ≥ d∗ .
H 0 H 0
The result d∗ = w∗ holds for group codes, since the proof used only subtraction.
EE 387 Notes #3, Page 3
Generator matrix
Definition: A generator matrix for a linear block code C of blocklength n and
dimension k is any k × n matrix G whose rows form a basis for C.
Every codeword is a linear combination of the rows of a generator matrix G:
g0
g1
c = mG = [ m0 m1 . . . mk−1 ] ..
gk−1
Both sets of equations can be used for encoding. In either case, each codeword
symbol requires k multiplications by constants and k − 1 additions.
A cyclic code is a linear block code such that the cyclic shift of every codeword is also a codeword. It is not obvious by
inspection that this property holds for the code generated by G.
EE 387 Notes #3, Page 5
The Big Question: how to find H such that no 5 (or 7 or more) columns are LI?
Exercise: Show that the repetition codes and the simple parity-check codes are the
only nontrivial binary MDS codes.
Syndrome decoding
Linear block codes are much simpler than general block codes:
• Encoding is vector-matrix multiplication.
(Cyclic codes are even simpler — polynomial multiplication/division is used.)
• Decoding is inherently nonlinear. Fact: linear decoders are very weak.
However, several steps in the decoding process are linear:
◦ syndrome computation
◦ final correction after error pattern and location have been found
◦ extracting estmated message from estimated codeword
Definition: The error vector or error pattern e is the difference between the
received n-tuple r and the transmitted codeword c:
∆
e = r−c ⇒ r = c+e
Note: The physical noise model may not be additive noise, and the probability distribution for the error e may depend
on the data c. We assume a channel error model determined by P(e).
EE 387 Notes #3, Page 14
Syndrome decoding (2)
Multiply both sides of the equation r = c + e by H:
∆
s = rH T = (c + e)H T = cH T + eH T = 0 + eH T = eH T .
Standard array
Syndrome table decoding can also be described using the standard array.
The standard array of a group code C is the coset decomposition of F n with
respect to the subgroup C.
0 c2 c3 ··· cM
e2 c2 + e2 c3 + e2 ··· cM + e2
e3 c2 + e3 c3 + e3 ··· cM + e3
.. .. .. ... ..
eN c2 + eN c3 + eN ··· cM + eN
1. The first row is the code C, with the zero vector in the first column.
2. Every other row is a coset.
3. The n-tuple in the first column of a row is called the coset leader
We usually choose the coset leader to be the most plausible error pattern, e.g.,
the error pattern of smallest weight.
EE 387 Notes #3, Page 18
Standard array: decoding
An (n, k) LBC over GF(Q) has M = Qk codewords.
Every n-tuple appears exactly once in the standard array. Therefore the number of
rows N satisfies
M N = Qn ⇒ N = Qn−k .
All vectors in a row of the standard array have the same syndrome.
Thus there is a one-to-one correspondence between the rows of the standard array
and the Qn−k syndrome values.
Decoding using the standard array is simple: decode senseword r to the codeword
at the top of the column that contains r.
The decoding region for a codeword is the column headed by that codeword.
The decoder subtracts the coset leader from the received vector to obtain the
estimated codeword.
shells of radius 1
wt 2
shells of radius 2
coset leaders
wt t
shells of radius t
wt >t
The standard array has six coset leaders of weight 1 and one of weight 2.
000000 001110 010101 011011 100011 101101 110110 111000
000001 001111 010100 011010 100010 101100 110111 111001
000010 001100 010111 011001 100001 101111 110100 111010
000100 001010 010001 011111 100111 101001 110010 111100
001000 000110 011101 010011 101011 100101 111110 110000
010000 011110 000101 001011 110011 111101 100110 101000
100000 101110 110101 111011 000011 001101 010110 011000
001001 000111 011100 010010 101010 100100 111111 110001
See http://www.stanford.edu/class/ee387/src/stdarray.pl for the short Perl script that generates the above standard
array. This code is a shortened Hamming code.
EE 387 Notes #3, Page 21
• The first row is the code C, with the zero vector in the first column.
• Every other row is a coset.
• The n-tuple in the first column of a row is called the coset leader.
• Senseword r is decoded to codeword at top of column that contains r.
• The decoding region for codeword is column headed by that codeword.
• The decoder subtracts coset leader from r to obtain the estimated codeword.
EE 387 Notes #3, Page 22
Syndrome decoding: summary
Syndrome decoding is closely connected to standard array decoding.
1. Calculate syndrome s = rH T of received n-tuple.
2. Find most plausible error pattern e with eH T = s.
This error pattern is the coset leader of the coset containing r.
3. Estimate transmitted codeword: ĉ = r − e.
The estimated codeword ĉ is the entry at the top of the column containing r in
the standard array.
4. Determine message m from the encoding equation c = mG.
In general, m = cR, where R is an n × k pseudoinverse of G. If the code is
systematic, then R = [ 0(n−k)×k | Ik×k ]T .
Only step 2 requires nonlinear operations and is the conceptually the most difficult.
0.8
0.7
rate = k/n
0.6
0.5
0.4
0.3
0.2
0.1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
δ = d∗/n
The MRRW bound is stronger than the Hamming bound except for high rates.
The Hamming bound is fairly tight for high rates. For example, to correct 10 errors in 1000 bits, the Hamming bound
requires 78 check bits, but there exists a BCH code that has 100 check bits.
EE 387 Notes #3, Page 28
Perfect codes
Definition: A block code is called perfect if every senseword is within distance t of
exactly one codeword.
Other definitions of perfect codes:
• decoding spheres pack perfectly
• have complete bounded-distance decoders
• satisfy the Hamming bound with equality
There are only finitely many classes of perfect codes:
• Codes with no redundancy (k = n)
• Repetition codes with odd blocklength: n = 2m + 1, k = 2m, t = m
• Binary Hamming codes: n = 2m − 1, n − k = m
• Nonbinary Hamming codes: n = (q m − 1)/(q − 1), n − k = m, q > 2
• Binary Golay code: q = 2, n = 23, k = 12, t = 3
• Ternary Golay code: q = 3, n = 11, k = 6, t = 2
Golay discovered the perfect Golay codes in 1949 — a very good year for Golay. EE 387 Notes #3, Page 29
Quasi-perfect codes
Definition: A code is quasi-perfect if every n-tuple is
• within distance t of at most one codeword, and is
• within distance t + 1 of at least one codeword.
Equivalently, a code is quasi-perfect if spheres of radius t surrounding codewords
do not overlap, while spheres of radius t + 1 cover the space of n-tuples.
Examples of quasi-perfect codes:
• Repetition codes with even blocklength
• Expanded Hamming and Golay codes with overall parity-check bit
Exercise: Show that expurgated Hamming codes (obtained by adding an overall
parity-check equation) are not quasi-perfect.
Shortened codes
Shorten: Fix n − k, decrease k and therefore n.
Information symbols are deleted to obtain a desired blocklength smaller than the
design blocklength.
The missing information symbols are usually imagined to be at the beginning of the
codeword and are considered to be 0.
Example: Ethernet frames are variable-length packets. Maximum packet size is
about 1500 data octets or 12000 bits.
The 32-bit ethernet checksum comes from a Hamming code with design
blocklength 232 − 1 = 4294967295 bits, or 536870907 octets.
Encoder/decoder cost can be reduced by deleting carefully chosen symbols.
The shortened code can correct single bit errors in an 8-bit data byte.
Each check equation is the exclusive-or of 5 or 6 input bits, compared to 8 inputs
in original code.
Lengthened codes
Lengthen: Fix n − k, increase k and therefore n.
New information symbols are introduced and included in check equations.
Usually difficult to do without reducing the minimum distance of the code.
Example: Extended Reed-Solomon codes, obtained by lengthening the (Q − 1, k)
R-S codes to (Q + 1, k + 2) by adding two columns at the left of H:
α α2 · · · αQ−2
1
1 α2 α4 · · · α2(Q−2)
H = .. .. .. ... .. ⇒
1 αd α2d · · · αd(Q−2)
α α2 · · · αQ−2
1 0 1
0 0 1 α2 α4 · · · α2(Q−2)
H′ =
.. .. .. .. .. ... ..
0 1 1 αd α2d · · · α d(Q−2)
Augmented codes
Augment: Fix n, increase k and decrease n − k.
Add codewords by adding new basis vectors — new rows of generator matrix.
This increases rate of code while possibly decreasing the minimum distance.
Example: The generator matrix of Reed-Muller code R(r, m) is defined by
augmentation:
G0
G1
G= ..
Gr
“m”
Submatrix Gi has rows and n = 2m columns. Number of information bits is
i
m m m
k = + + ··· +
0 1 r
Punctured codes
Puncture: Fix k, decrease n − k and therefore n.
Deleting check symbols may reduce minimum distance.
However, punctured codes may correct the large majority of errors up to the
minimum distance of the original code.
Puncturing may reduce minimum distance but not significantly reduce reliability.
Punctured codes may be obtained from simple codes that have too much
redundancy.
Example: We can puncture a (9, 4) simple product code with d∗ = 4 to obtain a
(8, 4) code with d∗ = 3. If we expand the punctured code by adding an overall
parity-check bit, we recover the simple product code.
Soft-decision decoders or error-and-erasure decoders can treat the missing check
symbols as unreliable.
lengthen expand
shorten puncture
expurgate
augment