Hadamard code | |
Block Length: | n=2k |
Message Length: | k |
Rate: | k/2k |
Distance: | d=2k-1 |
Alphabet Size: | 2 |
Notation: | [2k,k,2k-1]2 |
Augmented Hadamard code | |
Block Length: | n=2k |
Message Length: | k+1 |
Rate: | (k+1)/2k |
Distance: | d=2k-1 |
Alphabet Size: | 2 |
Notation: | [2k,k+1,2k-1]2 |
The Hadamard code is an error-correcting code named after Jacques Hadamard that is used for error detection and correction when transmitting messages over very noisy or unreliable channels. In 1971, the code was used to transmit photos of Mars back to Earth from the NASA space probe Mariner 9. Because of its unique mathematical properties, the Hadamard code is not only used by engineers, but also intensely studied in coding theory, mathematics, and theoretical computer science.The Hadamard code is also known under the names Walsh code, Walsh family, and Walsh–Hadamard code in recognition of the American mathematician Joseph Leonard Walsh.
The Hadamard code is an example of a linear code of length
2m
k=m
k=m+1
The Hadamard code is unique in that each non-zero codeword has a Hamming weight of exactly
2k-1
2k-1
[2k,k,2k-1]2
2k
k
2k/2
The augmented Hadamard code is a slightly improved version of the Hadamard code; it is a
[2k,k+1,2k-1]2
1/2
Normally, Hadamard codes are based on Sylvester's construction of Hadamard matrices, but the term “Hadamard code” is also used to refer to codes constructed from arbitrary Hadamard matrices, which are not necessarily of Sylvester type.In general, such a code is not linear.Such codes were first constructed by Raj Chandra Bose and Sharadchandra Shankar Shrikhande in 1959.If n is the size of the Hadamard matrix, the code has parameters
(n,2n,n/2)2
The Hadamard code is a locally decodable code, which provides a way to recover parts of the original message with high probability, while only looking at a small fraction of the received word. This gives rise to applications in computational complexity theory and particularly in the design of probabilistically checkable proofs.Since the relative distance of the Hadamard code is 1/2, normally one can only hope to recover from at most a 1/4 fraction of error. Using list decoding, however, it is possible to compute a short list of possible candidate messages as long as fewer than
1 | |
2 |
-\epsilon
In code-division multiple access (CDMA) communication, the Hadamard code is referred to as Walsh Code, and is used to define individual communication channels. It is usual in the CDMA literature to refer to codewords as “codes”. Each user will use a different codeword, or “code”, to modulate their signal. Because Walsh codewords are mathematically orthogonal, a Walsh-encoded signal appears as random noise to a CDMA capable mobile terminal, unless that terminal uses the same codeword as the one used to encode the incoming signal.
Hadamard code is the name that is most commonly used for this code in the literature. However, in modern use these error correcting codes are referred to as Walsh–Hadamard codes.
There is a reason for this:
Jacques Hadamard did not invent the code himself, but he defined Hadamard matrices around 1893, long before the first error-correcting code, the Hamming code, was developed in the 1940s.
The Hadamard code is based on Hadamard matrices, and while there are many different Hadamard matrices that could be used here, normally only Sylvester's construction of Hadamard matrices is used to obtain the codewords of the Hadamard code.
James Joseph Sylvester developed his construction of Hadamard matrices in 1867, which actually predates Hadamard's work on Hadamard matrices. Hence the name Hadamard code is disputed and sometimes the code is called Walsh code, honoring the American mathematician Joseph Leonard Walsh.
An augmented Hadamard code was used during the 1971 Mariner 9 mission to correct for picture transmission errors. The binary values used during this mission were 6 bits long, which represented 64 grayscale values.
Because of limitations of the quality of the alignment of the transmitter at the time (due to Doppler Tracking Loop issues) the maximum useful data length was about 30 bits. Instead of using a repetition code, a [32, 6, 16] Hadamard code was used.
Errors of up to 7 bits per 32-bit word could be corrected using this scheme. Compared to a 5-repetition code, the error correcting properties of this Hadamard code are much better, yet its rate is comparable. The efficient decoding algorithm was an important factor in the decision to use this code.
The circuitry used was called the "Green Machine". It employed the fast Fourier transform which can increase the decoding speed by a factor of three. Since the 1990s use of this code by space programs has more or less ceased, and the NASA Deep Space Network does not support this error correction scheme for its dishes that are greater than 26 m.
While all Hadamard codes are based on Hadamard matrices, the constructions differ in subtle ways for different scientific fields, authors, and uses. Engineers, who use the codes for data transmission, and coding theorists, who analyse extremal properties of codes, typically want the rate of the code to be as high as possible, even if this means that the construction becomes mathematically slightly less elegant.
On the other hand, for many applications of Hadamard codes in theoretical computer science it is not so important to achieve the optimal rate, and hence simpler constructions of Hadamard codes are preferred since they can be analyzed more elegantly.
When given a binary message
x\in\{0,1\}k
k
Had(x)
Had:\{0,1\}k\to\{0,1\}
2k | |
.
\langlex,y\rangle
x,y\in\{0,1\}k
\langlex,y\rangle=
k | |
\sum | |
i=1 |
xiyi \bmod 2.
x
x
Had(x)=(\langlex,y
k} | |
\rangle) | |
y\in\{0,1\ |
As mentioned above, the augmented Hadamard code is used in practice since the Hadamard code itself is somewhat wasteful.This is because, if the first bit of
y
y1=0
x1
x
y1=1
x
x
pHad(x)=(\langlex,y\rangle)y\in\{1\ x \{0,1\}k-1
The Hadamard code is a linear code, and all linear codes can be generated by a generator matrix
G
Had(x)=x ⋅ G
x\in\{0,1\}k
x
F2
y
k
G=\begin{pmatrix} \uparrow&\uparrow&&\uparrow\ y1&y2&...&
y | |
2k |
\ \downarrow&\downarrow&&\downarrow \end{pmatrix}.
where
yi\in\{0,1\}k
i
k=3
G=\begin{bmatrix} 0&0&0&0&1&1&1&1\ 0&0&1&1&0&0&1&1\ 0&1&0&1&0&1&0&1\end{bmatrix}.
The matrix
G
(k x 2k)
Had:\{0,1\}k\to\{0,1\}
2k | |
The generator matrix of the augmented Hadamard code is obtained by restricting the matrix
G
k=3
G'=\begin{bmatrix} 1&1&1&1\ 0&0&1&1\ 0&1&0&1\end{bmatrix}.
pHad:\{0,1\}k\to\{0,1\}
2k-1 | |
pHad(x)=x ⋅ G'
For general
k
2k-1
2k-1-k
Hadamard codes are obtained from an n-by-n Hadamard matrix H. In particular, the 2n codewords of the code are the rows of H and the rows of −H. To obtain a code over the alphabet, the mapping −1 ↦ 1, 1 ↦ 0, or, equivalently, x ↦ (1 - x)/2, is applied to the matrix elements. That the minimum distance of the code is n/2 follows from the defining property of Hadamard matrices, namely that their rows are mutually orthogonal. This implies that two distinct rows of a Hadamard matrix differ in exactly n/2 positions, and, since negation of a row does not affect orthogonality, that any row of H differs from any row of −H in n/2 positions as well, except when the rows correspond, in which case they differ in n positions.
To get the augmented Hadamard code above with
n=2k-1
log2(2n)=k
The distance of a code is the minimum Hamming distance between any two distinct codewords, i.e., the minimum number of positions at which two distinct codewords differ. Since the Walsh–Hadamard code is a linear code, the distance is equal to the minimum Hamming weight among all of its non-zero codewords. All non-zero codewords of the Walsh–Hadamard code have a Hamming weight of exactly
2k-1
Let
x\in\{0,1\}k
k} | |
\Pr | |
y\in\{0,1\ |
[(Had(x))y=1]=
k} | |
\Pr | |
y\in\{0,1\ |
[\langlex,y\rangle=1].
The fact that the latter value is exactly
1/2
x1=1
y2,...,yk
y1 ⋅ x1=b
b\in\{0,1\}
x2,...,xk
y2,...,yk
y1=b
1/2
1/2
1/2
The relative distance of the augmented Hadamard code is
1/2
1/2
1
2k-1 | |
1 |
x=10k-1
pHad(10k-1)=
2k-1 | |
1 |
x
10k-1
Had(x)
1/2
A locally decodable code is a code that allows a single bit of the original message to be recovered with high probability by only looking at a small portion of the received word.
A code is
q
xi
q
C:\{0,1\}k → \{0,1\}n
(q,\delta\geq0,\epsilon\geq0)
D:\{0,1\}n → \{0,1\}k
\Delta(x,y)
x
y
\forallx\in\{0,1\}k,\forally\in\{0,1\}n
\Delta(y,C(x))\leq\deltan
Pr[D(y)i=xi]\geq
1 | |
2 |
+\epsilon,\foralli\in[k]
Theorem 1: The Walsh–Hadamard code is
(2,\delta,
1 | |
2 |
-2\delta)
0\leq\delta\leq
1 | |
4 |
Lemma 1: For all codewords,
c
C
ci+cj=ci+j
ci,cj
c
i
j
ci+j
(i+j)
----Let
C(x)=c=(c0,...,c
2n-1 |
)
C
x
Let
G=\begin{pmatrix} \uparrow&\uparrow&&\uparrow\ g0&g1&...&
g | |
2n-1 |
\ \downarrow&\downarrow&&\downarrow \end{pmatrix}
C
By definition,
ci=x ⋅ gi
ci+cj=x ⋅ gi+x ⋅ gj=x ⋅ (gi+gj)
G
gi+gj=gi+j
ci+cj=x ⋅ gi+j=ci+j
----To prove theorem 1 we will construct a decoding algorithm and prove its correctness.
Input: Received word
y=(y0,...,
y | |
2n-1 |
)
For each
i\in\{1,...,n\}
j\in\{0,...,2n-1\}
k\in\{0,...,2n-1\}
j+k=ei
ei
i
j+k
j
k
xi\getsyj+yk
Output: Message
x=(x1,...,xn)
For any message,
x
y
y
c=C(x)
\delta
xi
1 | +( | |
2 |
1 | |
2 |
-2\delta)
By lemma 1,
cj+ck=cj+k=x ⋅ gj+k=x ⋅ ei=xi
j
k
yj\not=cj
\delta
yk\not=ck
\delta
yj
yk
c
2\delta
yj
yk
c
xi
xi
1-2\delta
\epsilon=
1 | |
2 |
-2\delta
\epsilon
0\leq\delta\leq
1 | |
4 |
Therefore, the Walsh–Hadamard code is
(2,\delta,
1 | |
2 |
-2\delta)
0\leq\delta\leq
1 | |
4 |
For k ≤ 7 the linear Hadamard codes have been proven optimal in the sense of minimum distance.