Linear Block Codes
Theory
The theory associated with Experiment-1 is divided into two parts:
(1) Preliminaries
(2) Linear block codes
1. Preliminaries
This section will introduce some preliminaries about finite fields, binary arithmetic, and vector spaces that are relevant to Experiment-1. For a detailed discussion of the topics, please refer [1, Ch. 2] and [2, Ch. 1]. We shall discuss the following topics:
Introduction to finite fields and binary arithmetic.
Vector space spanned by the given set of vectors.
1.1 Introduction to finite fields and binary arithmetic
For all the experiments considered in this virtual lab, we consider vectors and matrices that are defined over a finite field. In order to define a finite field, we need to first define a "binary operation", which is provided next.
Definition 1 (Binary operation): Let be a set of elements. A binary operation is a rule that assigns to each pair of elements a uniquely defined third element .
For example, consider the set of real numbers, denoted by . It can be verified that the addition operation defined for real numbers is a binary operation.
In order to define a field, consider a set on which two binary operations called addition and multiplication are defined. For the given ,
a definition of the field is given below.
Definition 2 (Field): is said to be a field if satisfies the following axioms:
Associativity of and : Elements satisfy and .
Commutativity of and : Elements satisfy and .
Distributivity of multiplication over addition: Elements satisfy .
Additive identity: There exist an element such that .
Multiplicative identity: There exist an element such that and .
Additive inverses: For every , there exists an element in , denoted by , called the additive inverse of , such that .
Multiplicative inverses: For every , there exists an element in , denoted by or , called the multiplicative inverse of , such that .
It can be verified that the set of real numbers along with the addition and multiplication defined over real numbers is a field. However the set of integers alongwith the addition and multiplication defined over integers is not a field, since for integers multiplication inverses are not integers.
Let us now consider an example of a field with finite number of elements. Consider a set = { 0, 1 } with the addition and multiplication operations for any defined as Equation (1)
It can be verified that the set alongwith the addition and multiplication operations defined in Eq. (1) is a field, since it satisfies the axioms of Definition 2. Such a field with finite number of elements is called as a finite field. For most of the experiments in this virtual lab, we will focus on the binary field . We shall study more about finite fields in Experiment-6.
Except for Experiments 6 and 7, we will consider vectors and matrices defined over the binary field . Vectors are denoted by boldface letters and the components of a vector are denoted by lower case letters, e.g. the components of a vector are denoted by , where each for . Vectors can either be considered as row vectors or columns vectors, depending on the context. Matrices are denoted by upper-case letters, e.g. consider a matrix M in with rows and columns. The component of the matrix M corresponding to the row and column, for and , is denoted by .
We shall next define addition and multiplication operations for vectors and matrices that are defined over :
- Addition of two vectors: The addition of two vectors consists of addition of their respective components defined according to Eq. (1), i.e.,
For example, .
Multiplication of a vector by a scalar: For a vector and a scalar , is given by where the operation for is performed according to Eq. (1).
Multiplication of a vector and a matrix: For a vector and a matrix , is given by
where note that each component wise addition and multiplication is performed according to Eq. (1). Consider the following example.
1.2 Vector space spanned by the given set of vectors
In this section, we shall provide preliminaries about vector space spanned the given set of finite number of vectors, subspace of a vector space, linearly independent vectors, basis of a vector space, dimension of a vector space. Towards defining the vector space spanned by the given set of vectors, we first define linear combination of the given set of vectors and scalars.
Definition 3 (Linear combination): The linear combination of the given set of vectors and the corresponding set of scalars is defined as a vector obtained as For example, the linear combination of and the corresponding set of scalars is equal to . We shall next provide the definition of a vector space spanned by the given set of vectors.
Definition 4 (Vector space spanned the given set of vectors):The vector space spanned by the vectors is defined as This vector space is also called as the span of the vectors , denoted by .
Note that a vector space is essentially the set of all possible linear combinations of the given set of vectors. Let us consider some examples for vector spaces.
Example-1: It can be verified that is a vector space spanned by the following set of vectors
Example-2: For any integer , it can be verified that is a vector space.
Example-3: The vector space spanned by the vectors and is given by Note that since it consists of all possible vectors in .
Example-4: Consider the vector space spanned by
the vectors and defined in Example-3. It is given by
We shall next define a subspace of a vector space.
Definition 5 (Subspace): A subspace of a vector space is a nonempty subset that satisfies the requirements for a vector space.
For the examples (Example-3 and 4) mentioned above, is a subspace of .
Definition 6 (Linear independence): A given set of vectors are said to be independent if and only if can happen only when .
For example, it can be verified that the vectors and are linearly independent since gives an all-zero vector only when we choose . Whereas the vectors and are linearly dependent since .
Finally, we shall define basis of a vector space and dimension of a vector space.
Definition 7 (Basis of a vector space): A basis for a vector space is a set of vectors having two properties at once:
- The vectors are linearly independent
- They span the space
For example consider the vector space . For this vector space, the set of vectors given in Example-3 is a basis. However the set of vectors , , , is not a basis for the vector space since they are not linearly independent. Further, the set of vectors is not a basis for since span .
Note that a basis is not unique. The given vector space can have more that one basis. Can you find one more basis for the vector space (Hint: See Eq (2))? Note that the number of vectors in any two bases will remain the same. This leads to the dimension of a vector space.
Definition 8 (Dimension of a vector space): The dimension of a space is the number of vectors in every basis.
For example, the dimension of the vector space is equal to since the set of vectors given in Example-3 is a basis for . Dimension of the vector space defined in Example-4 is equal to since is a basis of the vector space .
2. Linear block codes
Channel codes (or error correcting codes) are used in any digital communication system to provide a reliable communication over a noisy communication channel. Figure 1 shows a part of a digital communication system focusing on the channel encoder-decoder (refer [1, Ch. 1] for a detailed description of a digital communication system). Suppose the transmitter wants to send a bit-stream over a noisy communication channel. A communication channel may corrupt this bit-stream.
To combat these errors introduced by the channel, a channel encoder is used at the transmitter. The channel encoder adds redundant bits to this input bit-stream that help the receiver to recover (decode) the corrupted bit-stream.
In Part-2 of Experiment-1, we shall introduce binary block channel codes, referred to as block codes from now on. We shall provide the definition of block codes and then
consider a subclass of block codes, linear block codes, that satisfy the linearity property. We shall introduce two simple yet important families of block codes, repetition (REP) and single parity check (SPC) codes. Through examples of REP and SPC codes, we shall demonstrate how channel codes can be used to combat the errors introduced the noisy communication channel. For a detailed discussion of the topics, please refer [1,3].
In the remaining part, we shall discuss the following topics:
Introduction to linear block codes
Repetition (REP) codes
Single parity check (SPC) codes
2.1 Introduction to linear block codes
Recall that denotes the vector space of all -tuples over the finite field . Basics of finite fields and vector spaces are provided in Section 1.
For block codes, the input bit-stream is first divided into vectors of length . Thus the input to a channel encoder is a sequence of vectors of length , also termed as message sequence. Let denotes one such -length message vector. To each message , a block encoder assigns a vector of length , according to some rule. This vector is termed as the codeword corresponding to message . Suppose there are distinct messages. A definition of a block code is given below.
Definition 9 (Block code ): Consider any map (rule) that assigns a codeword vector to the given message vector , where . Then the set of codewords corresponding to the given set of distinct messages is termed as a block code (or a codebook). The parameter is called as the length of the code.
In general note that, the map associated with the a block code need not be one-to-one, i.e., the codewords corresponding to distinct messages need not be distinct. However for the purpose of this lab, we shall focus on the maps where there is a one-to-one correspondence between a message and codeword.
Let us consider an example for a block code. Let be the set of distinct messages that a transmitter wishes to transmit. Consider the map that assigns the vector to the message and the vector to the message . Then the vectors and are termed as the codewords corresponding to the messages and respectively and is the corresponding codebook or block code.
Note that a binary vector can take possible distinct values. For linear block codes, all possible vectors in comprises the set of distinct messages. However, for linear block codes the map assigning messages to codeword cannot be arbitrary. For linear block codes, as the name suggests, this map should be linear, i.e., it should satisfy the property that addition of any two codewords should also be a codeword. A definition of a linear block code is given below.
Definition 10 (Linear block code ): A block code of length and codewords is called as a linear block code if and only if its codewords form a -dimensional subspace of the vector space . The parameters and are called as the length and dimension of a linear block code respectively.
Let us consider an example for a linear block code for . For , the set of messages will be . Consider the map that assigns codewords to these messages respectively. It can be verified that that this map is a linear and the set of codewords form a -dimensional subspace of .
We shall next define the Hamming weight of a vector and the Hamming distance between any two vectors and in . These notions will be used to define the minimum distance of a block code.
Definition 11 (Hamming weight of a vector): The Hamming weight of a vector is defined as the number of non-zero components in it.
Definition 12 (Hamming distance between vectors and ): The Hamming distance between vectors and in is defined as the number of position these two vectors differ from each other.
For example, the Hamming weight of the vector is equal to . For the vectors , the Hamming distance . We shall next define the minimum distance of a block code.
Definition 13 (Minimum distance of a block code ): The minimum distance of the given block code is defined as the minimum Hamming distance between any two codewords of the code, i.e.,
For the linear blocks it can be proved that, the minimum distance is equal the minimum Hamming weight of a non-zero codeword. A linear block code of length , dimension , and minimum distance is denoted by .
We shall next discuss two families of linear block codes; repetition and single parity check codes.
2.2 Repetition codes
Repetition codes are one of the simplest yet important class of linear block codes. For repetition codes we have , i.e., a message can either be or . For the repetition code of length (REP- code), as the name suggests, the message to be transmitted is repeated times. Thus the codewords corresponding to the messages and are and respectively. For example, the codewords of REP- are given by . Typically the length of the repetition code is chosen to be an odd integer since an odd length is suitable for majority logic decoding of repetition codes when the noise is introduced a binary symmetric channel of cross-over probability , denoted by BSC(). A few preliminaries about the binary symmetric channel are summarized in Remark 1.
Remark 1 (Binary symmetric channel (BSC())): In this remark, we shall describe how noise is modeled according to the binary symmetric channel. As shown in Figure 2 for BSC(), a transmitted bit is flipped independently with probability .
Without loss of generality we assume that , since when , one can first flip the entire received bit sequence and use the decoding algorithms developed for the the case when . For example, when a vector is transmitted over BSC, the probability of receiving the vector is equal to since the first and the third bits are flipped, whereas the second bit is not flipped. Note that a transmitted vector can get flipped to any vector in .
We shall now describe majority logic decoding for repetition codes of odd lengths. First note that, a transmitted codeword can get flipped to any vector in (see Remark 1). According to majority logic decoding, the received vector is decoded as if the number of 's are in it are in majority, otherwise it is decoded as . For example, for REP- code, when received vector is , the decoded message is , since the bit is in majority in this .
We shall next illustrate how repetition codes can help to correct some of the errors introduced by the BSC. Suppose the codeword is transmitted and the received vector is such that at most one of the bit is flipped. Then according to majority logic decoding, the decoded codeword will be and receiver is able to correct such errors. However, note that if more than two bits are flipped then the decoded codeword will be incorrect and receiver is not able to correct such error patterns. In the Experiment-3 we shall see that REP- code is able to correct all possible error patterns of weight less than or equal to .
2.3 Single parity check codes
For the single parity check (SPC) codes of length we have . The codeword corresponding to the message is given by , where . For example for SPC code, the messages and the corresponding codewords are given below:
Let us now illustrate how SPC codes can be used for detection of some of the error patterns. If is a codeword of SPC then it satisfies the parity check equation given below The property of SPC codes given in Eq. (5) is used to for single bit error detection. Suppose the codeword of SPC code is transmitted and the received vector is such that one of the bit is flipped. Then the received vector will not satisfy the parity check equation of Eq. (5). This will indicate that that an error has occurred. Note that this will not help to identity the location of the error. Eq. (5) will just help us to detect whether one-bit is flipped or not.
Note that Eq. (5) will not be useful if two bits are flipped, since the received vector will satisfy Eq. (5) when exactly two bits are flipped.