In Experiment-1, we provided a brief introduction to block codes and also defined a class of block codes, linear block codes. For rest of the experiments in this virtual lab we shall now focus on linear block codes. In Experiment-1, we also introduced two simple classes of linear block codes, repetition and single parity check codes. In this experiment, we shall focus on the theory general linear block codes. We shall study two important matrices associated with the given linear block code, generator matrix (denoted by G) and parity check matrix (denoted by H).
The theory associated with Experiment-2 is divided into two parts:
(1) Generator Matrix
(2) Parity Check Matrix
1 Generator matrix
Recall that a linear block code C(n,k) is a k-dimensional subspace of the vector space F2n (see Experiment-1, Part-2 Theory).
For any linear block code, there exists a matrix G∈F2k×n such that the codeword v∈F2n corresponding to the message m∈F2k is given by
mG=v, i.e.,
This matrix G is called as a generator matrix of
the given linear block code. Note that the given code is completely
described the generator matrix since by considering all possible message
vectors in F2k, one can obtain the entire codebook.
Let us consider some examples.
Example-1: For example for REP-3 code, the codewords corresponding to messages
0 and 1 can be obtained as
[000][111]=[0]×[111]=[1]×[111],
where it can be seen that the matrix
G=[111] is a generator matrix.
Example-2: For (3,2) SPC code, the messages and the
corresponding codewords are given below:
These codeword can be written as
[000]=[00]×[100111]
[011]=[01]×[100111]
[101]=[10]×[100111][110]=[11]×[100111],
where the matrix
G=[100111]
is a generator matrix of (3,2) SPC code.
Example-3: Consider the following generator matrix.
G=[10010111]
One can obtain the linear block code generated by this generator matrix by obtaining all possible codewords corresponding to all possible messages in F22 as follows.
[00]×[10010111]=[0000]
[01]×[10010111]=[0000]
[00]×[10010111]=[1001]
[10]×[10010111]=[0111]
[11]×[10010111]=[1110]
Thus the linear block code C(4,2) generated by this generator matrix will be
C(4,2)=⎩⎨⎧0000,1001,0111,1110⎭⎬⎫.
Example-4: Consider the following generator matrix.
G=100010100111011
It can be verified that the linear block code C(5,3) generated by this generator matrix will be
C(5,3)=⎩⎨⎧00000,10110,01011,00011,11101,01000,11110⎭⎬⎫.
1.1 Obtaining a generator matrix from the given codebook
In Examples-3 and 4, we illustrated how to obtain linear block code corresponding to the given generator matrix. Let us now discuss how to obtain a generator matrix from the given linear block code C(n,k). Recall that a linear block code C(n,k) is a k-dimensional subspace of the vector space F2n. Let g1,g2,…,gk be a basis of this subspace (preliminaries about basis of a vector space are discussed in Experiment-1, Part-1 Theory).
Obtain a matrix G∈F2k×n corresponding to this basis as follows
G=←←←g1g2⋮gk→→→.
Note that the given code C(n,k)=span{g1,g2,…,gk}, i.e., the rows of the matrix G defined in Eq. (1) generate (span) the linear block code C(n,k). Hence this matrix G is termed as a generator matrix. Note that different bases of the vector space C(n,k) will correspond to a different generator matrix and hence a generator matrix for the given code is not unique. For Examples-3 and 4 it can be verified that the rows corresponding to the respective generator matrices does form a basis for the respective linear block codes.
1.2 Systematic generator matrix
A linear block code C(n,k) is said to be systematic if every codeword v∈C(n,k) can be written as
v=[mp],
where m∈F2k is the message corresponding to the codeword v and p∈F2n−k is the vector corresponding to parity bits. It can be seen that Examples-1, 2, and 3 are systematic codes whereas Example-4 is not a systematic code.
For a systematic code, it is possible to obtain a generator matrix that can be written as
G=[IkP],
where P is some matrix in F2k×n−k and Ik∈F2k×k is
an identity matrix given by
Ik=10⋮001⋮0…………00⋮1.
Note that an identity matrix Ik is a diagonal matrix with 1 as diagonal entries.
It can be verified that the generator matrices corresponding to Examples-1, 2, and 3 can be written as G=[IkP]. For example, generator matrix of Example-2 can be written as
G=[100111]=[I2P]whereI2=[1001]andP=[11].
A linear block code can also be defined using a parity check matrix H∈F2n−k×n as follows.
Definition 1 Linear block code C(n,k)): For the given parity check matrix H∈F2n−k×n, the linear block corresponding to it is defined as the collection of all possible vectors v∈F2n that satisfy the condition vHT=0, i.e.,
C(n,k)={v∈F2nsuchthatvHT=0}.
It can be seen from Definition 1 that, one can verify whether the given vector is a codeword or not using a parity check matrix.
Similar to generator matrix, a parity check matrix also need not be unique. We shall next define the dual code
C⊥(n,n−k) of the linear block code C(n,k).
Definition 2 Dual code: Consider a linear block code C(n,k) with parity check matrix H. Let C⊥(n,n−k) be the linear block obtained by choosing H as its generator matrix. Then C⊥(n,n−k) is said to be the dual code of C(n,k), i.e., for any v∈C⊥(n,k) and w∈C⊥(n,n−k) we have vwT=0.
For the systematic code with generator matrix G=[IkP], parity check matrix H can be obtained as
H=[In−kPT],
where In−k denotes an identity matrix with n−k rows and columns. For Example-2, parity check matrix can be obtained as (see Eq. (2))
H=[In−kPT]=[111],
where P is defined in Eq. (2). For Example-3, parity check matrix can be obtained as (see Eq. (3))
H=[In−kP′T]=[10010111],
where P′ is defined in Eq. (3).
We shall now summarize some properties of parity check matrices.
A generator matrix G∈F2k×n and parity check matrix H∈F2n−k×n associated with the given linear block code satisfy the following condition
GHT=0.
Consider a linear block code C(n,k) with parity check matrix H. Then a vector v∈F2n is a codeword in C(n,k) if and only if vHT=0.
Consider a linear block code C(n,k) with parity check matrix H. Then the minimum distance dmin (see Experiment-1 Theory, Definition 13) of C(n,k) is equal to the smallest number of columns of H that sum to 0. It can be verified using this property that the minimum distance dmin of code in Example-3 is equal to 2 (see Eq. (3)).