Incoding theory, alinear code is anerror-correcting code for which anylinear combination ofcodewords is also a codeword. Linear codes are traditionally partitioned intoblock codes andconvolutional codes, althoughturbo codes can be seen as a hybrid of these two types.[1] Linear codes allow for more efficient encoding and decoding algorithms than other codes (cf.syndrome decoding).[citation needed]
Linear codes are used inforward error correction and are applied in methods for transmitting symbols (e.g.,bits) on acommunications channel so that, if errors occur in the communication, some errors can be corrected or detected by the recipient of a message block. The codewords in a linear block code are blocks of symbols that are encoded using more symbols than the original value to be sent.[2] A linear code of lengthn transmits blocks containingn symbols. For example, the [7,4,3]Hamming code is a linearbinary code which represents 4-bit messages using 7-bit codewords. Two distinct codewords differ in at least three bits. As a consequence, up to two errors per codeword can be detected while a single error can be corrected.[3] This code contains 24 = 16 codewords.
Alinear code of lengthn and dimensionk is alinear subspaceC withdimensionk of thevector space where is thefinite field withq elements. Such a code is called aq-ary code. Ifq = 2 orq = 3, the code is described as abinary code, or aternary code respectively. The vectors inC are calledcodewords. Thesize of a code is the number of codewords and equalsqk.
Theweight of a codeword is the number of its elements that are nonzero and thedistance between two codewords is theHamming distance between them, that is, the number of elements in which they differ. The distanced of the linear code is the minimum weight of its nonzero codewords, or equivalently, the minimum distance between distinct codewords. A linear code of lengthn, dimensionk, and distanced is called an [n,k,d] code (or, more precisely, code).
We want to give the standard basis because each coordinate represents a "bit" that is transmitted across a "noisy channel" with some small probability of transmission error (abinary symmetric channel). If some other basis is used then this model cannot be used and the Hamming metric does not measure the number of errors in transmission, as we want it to.
As alinear subspace of, the entire codeC (which may be very large) may be represented as thespan of a set of codewords (known as abasis inlinear algebra). These basis codewords are often collated in the rows of a matrix G known as agenerating matrix for the codeC. When G has the block matrix form, where denotes the identity matrix and P is some matrix, then we say G is instandard form.
A matrixH representing a linear function whosekernel isC is called acheck matrix ofC (or sometimes a parity check matrix). Equivalently,H is a matrix whosenull space isC. IfC is a code with a generating matrixG in standard form,, then is a check matrix for C. The code generated byH is called thedual code of C. It can be verified that G is a matrix, while H is a matrix.
Linearity guarantees that the minimumHamming distanced between a codewordc0 and any of the other codewordsc ≠ c0 is independent ofc0. This follows from the property that the differencec − c0 of two codewords inC is also a codeword (i.e., anelement of the subspaceC), and the property thatd(c, c0) = d(c − c0, 0). These properties imply that
In other words, in order to find out the minimum distance between the codewords of a linear code, one would only need to look at the non-zero codewords. The non-zero codeword with the smallest weight has then the minimum distance to the zero codeword, and hence determines the minimum distance of the code.
The distanced of a linear codeC also equals the minimum number of linearly dependent columns of the check matrixH.
Proof: Because, which is equivalent to, where is the column of. Remove those items with, those with are linearly dependent. Therefore, is at least the minimum number of linearly dependent columns. On another hand, consider the minimum set of linearly dependent columns where is the column index set.. Now consider the vector such that if. Note because . Therefore, we have, which is the minimum number of linearly dependent columns in. The claimed property is therefore proven.
As the first class of linear codes developed for error correction purpose,Hamming codes have been widely used in digital communication systems. For any positive integer, there exists a Hamming code. Since, this Hamming code can correct a 1-bit error.
Example : The linear block code with the following generator matrix and parity check matrix is a Hamming code.
Hadamard code is a linear code and is capable of correcting many errors. Hadamard code could be constructed column by column : the column is the bits of the binary representation of integer, as shown in the following example. Hadamard code has minimum distance and therefore can correct errors.
Example: The linear block code with the following generator matrix is a Hadamard code:.
Hadamard code is a special case ofReed–Muller code. If we take the first column (the all-zero column) out from, we getsimplex code, which is thedual code of Hamming code.
The parameter d is closely related to the error correcting ability of the code. The following construction/algorithm illustrates this (called the nearest neighbor decoding algorithm):
Input: Areceived vector v in
Output: A codeword in closest to, if any.
We say that a linear is-error correcting if there is at most one codeword in, for each in.
Codes in general are often denoted by the letterC, and a code of lengthn and ofrankk (i.e., havingn code words in its basis andk rows in itsgenerating matrix) is generally referred to as an (n, k) code. Linear block codes are frequently denoted as [n, k, d] codes, whered refers to the code's minimum Hamming distance between any two code words.
(The [n, k, d] notation should not be confused with the (n, M, d) notation used to denote anon-linear code of lengthn, sizeM (i.e., havingM code words), and minimum Hamming distanced.)
Lemma (Singleton bound): Every linear [n,k,d] code C satisfies.
A codeC whose parameters satisfyk +d = n + 1 is calledmaximum distance separable orMDS. Such codes, when they exist, are in some sense best possible.
IfC1 andC2 are two codes of lengthn and if there is a permutationp in thesymmetric groupSn for which (c1,...,cn) inC1 if and only if (cp(1),...,cp(n)) inC2, then we sayC1 andC2 arepermutation equivalent. In more generality, if there is anmonomial matrix which sendsC1 isomorphically toC2 then we sayC1 andC2 areequivalent.
Lemma: Any linear code is permutation equivalent to a code which is in standard form.
A code is defined to beequidistant if and only if there exists some constantd such that the distance between any two of the code's distinct codewords is equal tod.[4] In 1984 Arrigo Bonisoli determined the structure of linear one-weight codes over finite fields and proved that every equidistant linear code is a sequence ofdualHamming codes.[5]
Some examples of linear codes include:
Hamming spaces over non-field alphabets have also been considered, especially overfinite rings, most notablyGalois rings overZ4. This gives rise tomodules instead of vector spaces andring-linear codes (identified withsubmodules) instead of linear codes. The typical metric used in this case theLee distance. There exist aGray isometry between (i.e. GF(22m)) with the Hamming distance and (also denoted as GR(4,m)) with the Lee distance; its main attraction is that it establishes a correspondence between some "good" codes that are not linear over as images of ring-linear codes from.[6][7][8]
Some authors have referred to such codes over rings simply as linear codes as well.[9]
In alinear block code, the extra bits are linear functions of the original bits; these extra bits are calledparity-check bits
{{cite book}}: CS1 maint: multiple names: authors list (link)