The Hadamard code is an
error-correcting code
In computing, telecommunication, information theory, and coding theory, an error correction code, sometimes error correcting code, (ECC) is used for controlling errors in data over unreliable or noisy communication channels. The central idea is ...
named after
Jacques Hadamard
Jacques Salomon Hadamard (; 8 December 1865 – 17 October 1963) was a French mathematician who made major contributions in number theory, complex analysis, differential geometry and partial differential equations.
Biography
The son of a teac ...
that is used for
error detection and correction
In information theory and coding theory with applications in computer science and telecommunication, error detection and correction (EDAC) or error control are techniques that enable reliable delivery of digital data over unreliable communi ...
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
Mariner 9 (Mariner Mars '71 / Mariner-I) was a robotic spacecraft that contributed greatly to the exploration of Mars and was part of the NASA Mariner program. Mariner 9 was launched toward Mars on May 30, 1971 from LC-36B at Cape Canaveral Air ...
.
Because of its unique mathematical properties, the Hadamard code is not only used by engineers, but also intensely studied in
coding theory
Coding theory is the study of the properties of codes and their respective fitness for specific applications. Codes are used for data compression, cryptography, error detection and correction, data transmission and data storage. Codes are stud ...
,
mathematics
Mathematics is an area of knowledge that includes the topics of numbers, formulas and related structures, shapes and the spaces in which they are contained, and quantities and their changes. These topics are represented in modern mathematics ...
, and
theoretical computer science
Theoretical computer science (TCS) is a subset of general computer science and mathematics that focuses on mathematical aspects of computer science such as the theory of computation, lambda calculus, and type theory.
It is difficult to circumsc ...
.
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
__NOTOC__
Joseph Leonard Walsh (September 21, 1895 – December 6, 1973) was an American mathematician who worked mainly in the field of analysis. The Walsh function and the Walsh–Hadamard code are named after him. The Grace–Walsh–Szegő ...
.
The Hadamard code is an example of a
linear code In coding theory, a linear code is an error-correcting code for which any linear combination of codewords is also a codeword. Linear codes are traditionally partitioned into block codes and convolutional codes, although turbo codes can be seen as ...
of length
over a
binary alphabet.
Unfortunately, this term is somewhat ambiguous as some references assume a message length
while others assume a message length of
.
In this article, the first case is called the Hadamard code while the second is called the augmented Hadamard code.
The Hadamard code is unique in that each non-zero codeword has a
Hamming weight
The Hamming weight of a string is the number of symbols that are different from the zero-symbol of the alphabet used. It is thus equivalent to the Hamming distance from the all-zero string of the same length. For the most typical case, a string o ...
of exactly
, which implies that the
distance
Distance is a numerical or occasionally qualitative measurement of how far apart objects or points are. In physics or everyday usage, distance may refer to a physical length or an estimation based on other criteria (e.g. "two counties over"). ...
of the code is also
.
In standard
coding theory notation for
block code
In coding theory, block codes are a large and important family of error-correcting codes that encode data in blocks.
There is a vast number of examples for block codes, many of which have a wide range of practical applications. The abstract definit ...
s, the Hadamard code is a
-code, that is, it is a
linear code In coding theory, a linear code is an error-correcting code for which any linear combination of codewords is also a codeword. Linear codes are traditionally partitioned into block codes and convolutional codes, although turbo codes can be seen as ...
over a
binary alphabet, has
block length ,
message length (or dimension)
, and
minimum distance .
The block length is very large compared to the message length, but on the other hand, errors can be corrected even in extremely noisy conditions.
The augmented Hadamard code is a slightly improved version of the Hadamard code; it is a
-code and thus has a slightly better
rate while maintaining the relative distance of
, and is thus preferred in practical applications.
In communication theory, this is simply called the Hadamard code and it is the same as the first order
Reed–Muller code
Reed–Muller codes are error-correcting codes that are used in wireless communications applications, particularly in deep-space communication. Moreover, the proposed 5G standard relies on the closely related polar codes for error correction in ...
over the binary alphabet.
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
In mathematics, a Hadamard matrix, named after the French mathematician Jacques Hadamard, is a square matrix whose entries are either +1 or −1 and whose rows are mutually orthogonal. In geometric terms, this means that each pair of rows in ...
, which are not necessarily of Sylvester type.
In general, such a code is not linear.
Such codes were first constructed by
Raj Chandra Bose
Raj Chandra Bose (19 June 1901 – 31 October 1987) was an Indian American mathematician and statistician best known for his work in design theory, finite geometry and the theory of error-correcting codes in which the class of BCH codes is par ...
and
Sharadchandra Shankar Shrikhande
Sharadchandra Shankar Shrikhande (19 October 1917 – 21 April 2020) was an Indian mathematician with notable achievements in combinatorial mathematics. He was notable for his breakthrough work along with R. C. Bose and E. T. Parker in their dis ...
in 1959.
If ''n'' is the size of the Hadamard matrix, the code has parameters
, meaning it is a not-necessarily-linear binary code with 2''n'' codewords of block length ''n'' and minimal distance ''n''/2. The construction and decoding scheme described below apply for general ''n'', but the property of linearity and the identification with Reed–Muller codes require that ''n'' be a power of 2 and that the Hadamard matrix be equivalent to the matrix constructed by Sylvester's method.
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
In theoretical computer science and mathematics, computational complexity theory focuses on classifying computational problems according to their resource usage, and relating these classes to each other. A computational problem is a task solved by ...
and particularly in the design of
probabilistically checkable proofs
In computational complexity theory, a probabilistically checkable proof (PCP) is a type of mathematical proof, proof that can be checked by a randomized algorithm using a bounded amount of randomness and reading a bounded number of bits of the pro ...
.
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
In coding theory, list decoding is an alternative to unique decoding of error-correcting codes for large error rates. The notion was proposed by Elias in the 1950s. The main idea behind list decoding is that the decoding algorithm instead of outpu ...
, however, it is possible to compute a short list of possible candidate messages as long as fewer than
of the bits in the received word have been corrupted.
In
code-division multiple access
Code-division multiple access (CDMA) is a channel access method used by various radio communication technologies. CDMA is an example of multiple access, where several transmitters can send information simultaneously over a single communication ...
(CDMA) communication, the Hadamard code is referred to as Walsh Code, and is used to define individual
communication channel
A communication channel refers either to a physical transmission medium such as a wire, or to a logical connection over a multiplexed medium such as a radio channel in telecommunications and computer networking. A channel is used for informa ...
s. 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
In mathematics, orthogonality is the generalization of the geometric notion of ''perpendicularity''.
By extension, orthogonality is also used to refer to the separation of specific features of a system. The term also has specialized meanings in ...
, a Walsh-encoded signal appears as
random noise
In electronics, noise is an unwanted disturbance in an electrical signal.
Noise generated by electronic devices varies greatly as it is produced by several different effects.
In particular, noise is inherent in physics, and central to the ...
to a CDMA capable mobile
terminal
Terminal may refer to:
Computing Hardware
* Terminal (electronics), a device for joining electrical circuits together
* Terminal (telecommunication), a device communicating over a line
* Computer terminal, a set of primary input and output dev ...
, unless that terminal uses the same codeword as the one used to encode the incoming
signal
In signal processing, a signal is a function that conveys information about a phenomenon. Any quantity that can vary over space or time can be used as a signal to share messages between observers. The ''IEEE Transactions on Signal Processing'' ...
.
History
''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
Jacques Salomon Hadamard (; 8 December 1865 – 17 October 1963) was a French mathematician who made major contributions in number theory, complex analysis, differential geometry and partial differential equations.
Biography
The son of a teac ...
did not invent the code himself, but he defined
Hadamard matrices
In mathematics, a Hadamard matrix, named after the French mathematician Jacques Hadamard, is a square matrix whose entries are either +1 or −1 and whose rows are mutually orthogonal. In geometric terms, this means that each pair of rows in ...
around 1893, long before the first
error-correcting code
In computing, telecommunication, information theory, and coding theory, an error correction code, sometimes error correcting code, (ECC) is used for controlling errors in data over unreliable or noisy communication channels. The central idea is ...
, the
Hamming code
In computer science and telecommunication, Hamming codes are a family of linear error-correcting codes. Hamming codes can detect one-bit and two-bit errors, or correct one-bit errors without detection of uncorrected errors. By contrast, the sim ...
, 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
James Joseph Sylvester (3 September 1814 – 15 March 1897) was an English mathematician. He made fundamental contributions to matrix theory, invariant theory, number theory, partition theory, and combinatorics. He played a leadership ro ...
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
__NOTOC__
Joseph Leonard Walsh (September 21, 1895 – December 6, 1973) was an American mathematician who worked mainly in the field of analysis. The Walsh function and the Walsh–Hadamard code are named after him. The Grace–Walsh–Szegő ...
.
An augmented Hadamard code was used during the 1971
Mariner 9
Mariner 9 (Mariner Mars '71 / Mariner-I) was a robotic spacecraft that contributed greatly to the exploration of Mars and was part of the NASA Mariner program. Mariner 9 was launched toward Mars on May 30, 1971 from LC-36B at Cape Canaveral Air ...
mission to correct for picture transmission errors. The data words used during this mission were 6 bits long, which represented 64
grayscale
In digital photography, computer-generated imagery, and colorimetry, a grayscale image is one in which the value of each pixel is a single sample representing only an ''amount'' of light; that is, it carries only intensity information. Graysca ...
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
In coding theory, the repetition code is one of the most basic error-correcting codes. In order to transmit a message over a noisy channel that may corrupt the transmission in a few places, the idea of the repetition code is to just repeat the mess ...
, a
2, 6, 16
The comma is a punctuation mark that appears in several variants in different languages. It has the same shape as an apostrophe or single closing quotation mark () in many typefaces, but it differs from them in being placed on the baseline (t ...
Hadamard code was used.
Errors of up to 7 bits per word could be corrected using this scheme. Compared to a 5-
repetition code
In coding theory, the repetition code is one of the most basic error-correcting codes. In order to transmit a message over a noisy channel that may corrupt the transmission in a few places, the idea of the repetition code is to just repeat the mess ...
, 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
A fast Fourier transform (FFT) is an algorithm that computes the discrete Fourier transform (DFT) of a sequence, or its inverse (IDFT). Fourier analysis converts a signal from its original domain (often time or space) to a representation in th ...
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
The NASA Deep Space Network (DSN) is a worldwide network of American spacecraft communication ground segment facilities, located in the United States (California), Spain (Madrid), and Australia (Canberra), that supports NASA's interplanetary ...
does not support this error correction scheme for its dishes that are greater than 26 m.
Constructions
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
Coding may refer to:
Computer science
* Computer programming, the process of creating and maintaining the source code of computer programs
* Line coding, in data storage
* Source coding, compression used in data transmission
* Coding theory
* Ch ...
, 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
Theoretical computer science (TCS) is a subset of general computer science and mathematics that focuses on mathematical aspects of computer science such as the theory of computation, lambda calculus, and type theory.
It is difficult to circumsc ...
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.
Construction using inner products
When given a binary message
of length
, the Hadamard code encodes the message into a codeword
using an encoding function
This function makes use of the
inner product
In mathematics, an inner product space (or, rarely, a Hausdorff space, Hausdorff pre-Hilbert space) is a real vector space or a complex vector space with an operation (mathematics), operation called an inner product. The inner product of two ve ...
of two vectors
, which is defined as follows:
:
Then the Hadamard encoding of
is defined as the sequence of ''all'' inner products with
:
:
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
is zero,
, then the inner product contains no information whatsoever about
, and hence, it is impossible to fully decode
from those positions of the codeword alone.
On the other hand, when the codeword is restricted to the positions where
, it is still possible to fully decode
.
Hence it makes sense to restrict the Hadamard code to these positions, which gives rise to the ''augmented'' Hadamard encoding of
; that is,
.
Construction using a generator matrix
The Hadamard code is a linear code, and all linear codes can be generated by a generator matrix
. This is a matrix such that
holds for all
, where the message
is viewed as a row vector and the vector-matrix product is understood in the
vector space
In mathematics and physics, a vector space (also called a linear space) is a set whose elements, often called ''vectors'', may be added together and multiplied ("scaled") by numbers called '' scalars''. Scalars are often real numbers, but can ...
over the
finite field
In mathematics, a finite field or Galois field (so-named in honor of Évariste Galois) is a field that contains a finite number of elements. As with any field, a finite field is a set on which the operations of multiplication, addition, subtr ...
. In particular, an equivalent way to write the inner product definition for the Hadamard code arises by using the generator matrix whose columns consist of ''all'' strings
of length
, that is,
:
where
is the
-th binary vector in
lexicographical order
In mathematics, the lexicographic or lexicographical order (also known as lexical order, or dictionary order) is a generalization of the alphabetical order of the dictionaries to sequences of ordered symbols or, more generally, of elements of a ...
.
For example, the generator matrix for the Hadamard code of dimension
is:
:
The matrix
is a
-matrix and gives rise to the
linear operator
In mathematics, and more specifically in linear algebra, a linear map (also called a linear mapping, linear transformation, vector space homomorphism, or in some contexts linear function) is a mapping V \to W between two vector spaces that pre ...
.
The generator matrix of the ''augmented'' Hadamard code is obtained by restricting the matrix
to the columns whose first entry is one.
For example, the generator matrix for the augmented Hadamard code of dimension
is:
:
Then
is a linear mapping with
.
For general
, the generator matrix of the augmented Hadamard code is a
parity-check matrix In coding theory, a parity-check matrix of a linear block code ''C'' is a matrix which describes the linear relations that the components of a codeword must satisfy. It can be used to decide whether a particular vector is a codeword and is also used ...
for the
extended Hamming code of length
and dimension
, which makes the augmented Hadamard code the
dual code
In coding theory, the dual code of a linear code
:C\subset\mathbb_q^n
is the linear code defined by
:C^\perp = \
where
:\langle x, c \rangle = \sum_^n x_i c_i
is a scalar product. In linear algebra terms, the dual code is the annihilator ...
of the extended Hamming code.
Hence an alternative way to define the Hadamard code is in terms of its parity-check matrix: the parity-check matrix of the Hadamard code is equal to the generator matrix of the Hamming code.
Construction using general Hadamard matrices
Hadamard codes are obtained from an ''n''-by-''n''
Hadamard matrix
In mathematics, a Hadamard matrix, named after the French mathematician Jacques Hadamard, is a square matrix whose entries are either +1 or −1 and whose rows are mutually orthogonal. In geometric terms, this means that each pair of rows ...
''H''. In particular, the 2''n'' 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
, the chosen Hadamard matrix ''H'' has to be of Sylvester type, which gives rise to a message length of
.
Distance
The distance of a code is the minimum
Hamming distance
In information theory, the Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. In other words, it measures the minimum number of ''substitutions'' required to chan ...
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 In coding theory, a linear code is an error-correcting code for which any linear combination of codewords is also a codeword. Linear codes are traditionally partitioned into block codes and convolutional codes, although turbo codes can be seen as ...
, the distance is equal to the minimum
Hamming weight
The Hamming weight of a string is the number of symbols that are different from the zero-symbol of the alphabet used. It is thus equivalent to the Hamming distance from the all-zero string of the same length. For the most typical case, a string o ...
among all of its non-zero codewords. All non-zero codewords of the Walsh–Hadamard code have a
Hamming weight
The Hamming weight of a string is the number of symbols that are different from the zero-symbol of the alphabet used. It is thus equivalent to the Hamming distance from the all-zero string of the same length. For the most typical case, a string o ...
of exactly
by the following argument.
Let
be a non-zero message. Then the following value is exactly equal to the fraction of positions in the codeword that are equal to one:
:
The fact that the latter value is exactly
is called the ''random subsum principle''. To see that it is true, assume without loss of generality that
.
Then, when conditioned on the values of
, the event is equivalent to
for some
depending on
and
. The probability that
happens is exactly
. Thus, in fact, ''all'' non-zero codewords of the Hadamard code have relative Hamming weight
, and thus, its relative distance is
.
The relative distance of the ''augmented'' Hadamard code is
as well, but it no longer has the property that every non-zero codeword has weight exactly
since the all
s vector
is a codeword of the augmented Hadamard code. This is because the vector
encodes to
. Furthermore, whenever
is non-zero and not the vector
, the random subsum principle applies again, and the relative weight of
is exactly
.
Local decodability
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
-query
locally decodable if a message bit,
, can be recovered by checking
bits of the received word. More formally, a code,
, is
-locally decodable, if there exists a probabilistic decoder,
, such that ''(Note:
represents the
Hamming distance
In information theory, the Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. In other words, it measures the minimum number of ''substitutions'' required to chan ...
between vectors
and
)'':
,
implies that