Mehmet Emre Tiryaki
Back to Notes

Linear Block Codes

Fundamentals

An information source produces bits, segmented into messages of length kk (2k2^k possible messages). Each message is encoded to nn bits, n>kn > k: an (n,k)(n, k) code with kk message digits and n−kn - k parity check digits.

Over F2\mathbb{F}_2, v=uGv = uG, where u∈F21×ku \in \mathbb{F}_2^{1 \times k} is the message and v∈F21×nv \in \mathbb{F}_2^{1 \times n} the codeword.

G=[P∣Ik],H=[In−k∣PT]∈F2(n−k)×n,GHT=0G = [P \mid I_k], \qquad H = [I_{n-k} \mid P^T] \in \mathbb{F}_2^{(n-k) \times n}, \qquad GH^T = 0

so every codeword satisfies vHT=0vH^T = 0.

Syndrome

A received word is r=v+er = v + e with error pattern ee. Its syndrome is

s=rHT=eHTs = rH^T = eH^T

A single error in bit ii gives the ii-th column of HH. Select the ee with minimum weight for that syndrome, and the corrected codeword is v^=r+e\hat{v} = r + e.

Minimum Distance

dmin=min⁡v≠w∈Cd(v,w)d_{min} = \min_{v \neq w \in \mathcal{C}} d(v, w)

For linear codes, dmind_{min} equals the minimum weight of a nonzero codeword, and the smallest number of columns of HH that sum to 0.

Error detection A block code detects all errors up to dmin−1d_{min} - 1. For a BSC, with AiA_i the number of codewords of weight ii, the probability of not detecting errors is

Pu=∑i=dminnAipi(1−p)n−iP_u = \sum_{i = d_{min}}^{n} A_i p^i (1-p)^{n-i}

Error correction With tt the maximum number of errors the code can correct, 2t+1≤dmin≤2t+22t + 1 \le d_{min} \le 2t + 2, so

t=⌊dmin−12⌋,Pe≤∑i=t+1n(ni)pi(1−p)n−it = \left\lfloor \frac{d_{min} - 1}{2} \right\rfloor, \qquad P_e \le \sum_{i = t+1}^{n} \binom{n}{i} p^i (1-p)^{n-i}

With standard array decoding on a BSC, Pe=1−∑i=0nαipi(1−p)n−iP_e = 1 - \sum_{i=0}^{n} \alpha_i p^i (1-p)^{n-i}, where αi\alpha_i is the number of coset leaders of weight ii.

Standard Array and Syndrome Decoding

  • Start with e1=0⃗e_1 = \vec{0}, each column is a codeword.
  • Select the next minimum-weight ee not yet in the array and add it to all the original codewords.
  • There are 2n−k2^{n-k} coset leaders, and a coset leader is an error vector. All vectors with weight at most tt can be coset leaders.

Syndrome decoding Compute the syndrome of every coset leader, get the syndrome of the received message, and add r+er + e.

Hamming Codes

The columns of HH are all nonzero vectors in F2m\mathbb{F}_2^m, m≥2m \ge 2.

n=2m−1,k=2m−m−1,n−k=m parity bits,dmin=3,t=1n = 2^m - 1, \qquad k = 2^m - m - 1, \qquad n - k = m \text{ parity bits}, \qquad d_{min} = 3, \qquad t = 1

Perfect Codes

A code is perfect if every vector is within distance tt of exactly one codeword, i.e. there are no coset leaders of weight above tt. Hamming codes are perfect.