Hadamard transform
of a Boolean function and a Hadamard matrix is its Walsh spectrum: (1, 0, 1, 0, 0, 1, 1, 0) × H(8) = (4, 2, 0, −2, 0, 2, 0, 2) , a faster way to calculate the Walsh spectrum of (1, 0, 1, 0, 0, 1, 1, 0). The Hadamard transform (also known as the Walsh–Hadamard transform, Hadamard–Rademacher–Walsh transform, Walsh transform, or Walsh–Fourier transform) is an example of a generalized class of Fourier transforms. It performs an orthogonal, symmetric, involutive, linear operation on a tuple of numbers. The Hadamard transform can be regarded as being built out of size-2 discrete Fourier transforms (DFTs), and is in fact equivalent to a multidimensional DFT of size . It decomposes an arbitrary... Source: e01 Encyclopedia. Licence: CC BY-SA 4.0.
of a Boolean function and a Hadamard matrix is its Walsh spectrum: (1, 0, 1, 0, 0, 1, 1, 0) × H(8) = (4, 2, 0, −2, 0, 2, 0, 2)]] , a faster way to calculate the Walsh spectrum of (1, 0, 1, 0, 0, 1, 1, 0).]] The Hadamard transform (also known as the Walsh–Hadamard transform, Hadamard–Rademacher–Walsh transform, Walsh transform, or Walsh–Fourier transform) is an example of a generalized class of Fourier transforms. It performs an orthogonal, symmetric, involutive, linear operation on a tuple of numbers. The Hadamard transform can be regarded as being built out of size-2 discrete Fourier transforms (DFTs), and is in fact equivalent to a multidimensional DFT of size . It decomposes an arbitrary input vector into a superposition of Walsh functions. The transform is named for the French mathematician Jacques Hadamard ( ), the German-American mathematician Hans Rademacher, and the American mathematician Joseph L. Walsh. ==Definition== The Hadamard transform H m is a 2 m × 2 m matrix, the Hadamard matrix (scaled by a normalization factor), that transforms 2 m real numbers x n into 2 m real numbers X k . The Hadamard transform can be defined in two ways: recursively, or by using the binary (base-2) representation of the indices n and k. Recursively, we define the 1 × 1 Hadamard transform H 0 by the identity H 0 = 1, and then define H m for m > 0 by: H_m = \frac{1}{2^{1/2}} \begin{pmatrix} H_{m-1} & H_{m-1} \\ H_{m-1} & -H_{m-1} \end{pmatrix} where the division by 2 m/2 is a normalization that is sometimes omitted. For m > 1, we can also define H m by: H_m = H_{1} \otimes H_{m-1} where \otimes represents the Kronecker product. Thus, other than this normalization factor, the Hadamard matrices are made up entirely of 1 and −1. Equivalently, we can define the Hadamard matrix by its (k, n)-th entry by writing \begin{align} k &= \sum^{m-1}_{i=0} {k_i 2^i} = k_{m-1} 2^{m-1} + k_{m-2} 2^{m-2} + \dots + k_1 2 + k_0 \\ n &= \sum^{m-1}_{i=0} {n_i 2^i} = n_{m-1} 2^{m-1} + n_{m-2} 2^{m-2} + \dots + n_1 2 + n_0 \end{align} where the k j and n j are the bit elements (0 or 1) of k and n, respectively. Note that for the element in the top left corner, we define: k = n = 0 . In this case, we have: (H_m)_{k,n} = \frac{1}{2^{m/2}} (-1)^{\sum_j k_j n_j} This is exactly the multidimensional 2 \times 2 \times \cdots \times 2 \times 2 DFT, normalized to be unitary, if the inputs and outputs are regarded as multidimensional arrays indexed by the n j and k j , respectively. Some examples of the Hadamard matrices follow. \begin{align} H_0 & = +\begin{pmatrix}1\end{pmatrix}\\[5pt] H_1 & = \frac{1}{\sqrt2} \left(\begin{array}{rr} 1 & 1\\ 1 & -1 \end{array}\right)\\[5pt] H_2 & = \frac{1}{2} \left(\begin{array}{rrrr} 1 & 1 & 1 & 1\\ 1 & -1 & 1 & -1\\ 1 & 1 & -1 & -1\\ 1 & -1 & -1 & 1 \end{array}\right)\\[5pt] H_3 & = \frac{1}{2^{3/2}} \left(\begin{array}{rrrrrrrr} 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1\\ 1 & -1 & 1 & -1 & 1 & -1 & 1 & -1\\ 1 & 1 & -1 & -1 & 1 & 1 & -1 & -1\\ 1 & -1 & -1 & 1 & 1 & -1 & -1 & 1\\ 1 & 1 & 1 & 1 & -1 & -1 & -1 & -1\\ 1 & -1 & 1 & -1 & -1 & 1 & -1 & 1\\ 1 & 1 & -1 & -1 & -1 & -1 & 1 & 1\\ 1 & -1 & -1 & 1 & -1 & 1 & 1 & -1 \end{array}\right)\\[5pt] (H_n)_{i,j} & = \frac{1}{2^{n/2}} (-1)^{i \cdot j} \end{align} where i \cdot j is the bitwise dot product of the binary representations of the numbers i and j. For example, if n \;\geq\; 2 , then (H_n)_{3,2} \;=\; (-1)^{3 \cdot 2} \;=\; (-1)^{(1,1) \cdot (1,0)} \;=\; (-1)^{1+0} \;=\; (-1)^1 \;=\; -1 , agreeing with the above (ignoring the overall constant). Note that the first row, first column element of the matrix is denoted by (H_n)_{0,0} . H 1 is precisely the size-2 DFT. It can also be regarded as the Fourier transform on the two-element additive group of Z/(2). The rows of the Hadamard matrices are the Walsh functions. ==Relation to Fourier transform== The Hadamard transform is equivalent to a multidimensional DFT of size . Formally, the Hadamard transform is a Fourier transform on the Boolean group (\Z / 2\Z)^n . Using the Fourier transform on finite (abelian) groups, the Fourier transform of a function f \colon (\Z/2\Z)^n \to \Complex is the function \widehat f defined by \widehat{f}(\chi) = \sum_{a \in (\Z/2\Z)^n} f(a) \bar{\chi}(a) where \chi is a character of (\Z/2\Z)^n . Each character has the form \chi_r(a) = (-1)^{a \cdot r} for some r \in (\Z/2\Z)^n , where the multiplication is the boolean dot product on bit strings, so we can identify the input to \widehat{f} with r \in (\Z/2\Z)^n (Pontryagin duality) and define \widehat f \colon (\Z/2\Z)^n \to \Complex by \widehat{f}(r) = \sum_{a \in (\Z/2\Z)^n} f(a) (-1)^{r \cdot a} This is the Hadamard transform of f , considering the input to f and \widehat{f} as boolean strings. In terms of the above formulation where the Hadamard transform multiplies a vector of 2^n complex numbers v on the left by the Hadamard matrix H_n the equivalence is seen by taking f to take as input the bit string corresponding to the index of an element of v , and having f output the corresponding element of v . The usual discrete Fourier transform, applied to a vector v of 2^n complex numbers, instead uses characters of the cyclic group \Z / 2^n \Z . Consequently the DFT requires substantially more complicated arithmetic than the Hadamard transform. Unlike the DFT, the Hadamard transform is purely real, and in fact requires no multiplication, only sign flips. ==Computational complexity== In the classical domain, the Hadamard transform can be computed in n \log n operations ( n = 2^m ), using the fast Hadamard transform algorithm. In the quantum domain, the Hadamard transform can be computed in O(1) time, as it is a quantum logic gate that can be parallelized. ==Quantum computing applications== The Hadamard transform is used extensively in quantum computing. The 2 × 2 Hadamard transform H_1 is the quantum logic gate known as the Hadamard gate, and the application of a Hadamard gate to each qubit of an register in parallel is equivalent to the Hadamard transform ===Hadamard gate=== In quantum computing, the Hadamard gate is a one-qubit rotation, mapping the qubit-basis states |0 \rangle and |1 \rangle to two superposition states with equal weight of the computational basis states |0 \rangle and |1 \rangle . Usually the phases are chosen so that H=\frac{|0\rangle+|1\rangle}{\sqrt{2}}\langle0|+\frac{|0\rangle-|1\rangle}{\sqrt{2}}\langle1| in Dirac notation. This corresponds to the transformation matrix H_1=\frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix} in the |0 \rangle , |1 \rangle basis, also known as the computational basis. The states \frac{\left|0\right\rangle + \left|1\right\rangle}{\sqrt{2}} and \frac{\left|0\right\rangle - \left|1\right\rangle}{\sqrt{2}} are known as \left|\boldsymbol{+}\right\rangle and \left|\boldsymbol{-}\right\rangle respectively, and together constitute the polar basis in quantum computing. ===Hadamard gate operations=== \begin{align} H(|0\rangle) &= \frac{1}{\sqrt 2}|0\rangle + \frac{1}{\sqrt{2}}|1\rangle =: |+\rangle\\ H(|1\rangle) &= \frac{1}{\sqrt 2}|0\rangle - \frac{1}{\sqrt{2}}|1\rangle =: |-\rangle\\ H(|+\rangle) &= H\left( \frac{1}{\sqrt 2}|0\rangle + \frac{1}{\sqrt{2}}|1\rangle \right) = \frac{1}{2}\Big( |0\rangle + |1\rangle\Big) + \frac{1}{2}\Big(|0\rangle - |1\rangle\Big) = |0\rangle\\ H(|-\rangle) &= H\left( \frac{1}{\sqrt 2}|0\rangle - \frac{1}{\sqrt{2}}|1\rangle \right) = \frac{1}{2}\Big( |0\rangle + |1\rangle\Big) - \frac{1}{2}\Big(|0\rangle - |1\rangle\Big) = |1\rangle \end{align} One application of the Hadamard gate to either a 0 or 1 qubit will produce a quantum state that, if observed, will be a 0 or 1 with equal probability (as seen in the first two operations). This is exactly like flipping a fair coin in the standard probabilistic model of computation. However, if the Hadamard gate is applied twice in succession (as is effectively being done in the last two operations), then the final state is always the same as the initial state. ===Hadamard transform in quantum algorithms=== Computing the quantum Hadamard transform is simply the application of a Hadamard gate to each qubit individually because of the tensor product structure of the Hadamard transform. This simple result means the quantum Hadamard transform requires \log_2 N operations, compared to the classical case of N \log_2 N operations. For an n -qubit system, Hadamard gates acting on each of the n qubits (each initialized to the |0\rangle ) can be used to prepare uniform quantum superposition states when N is of the form N = 2^n . In this case with n qubits, the combined Hadamard gate H_n is expressed as the tensor product of n Hadamard gates: H_n = \underbrace{H \otimes H \otimes \ldots \otimes H}_{n \text{ times}} The resulting uniform quantum superposition state is then: H_{n} |0\rangle^{\otimes n} = \frac{1}{\sqrt{2^n}} \sum_{j=0}^{2^n-1} |j\rangle This generalizes the preparation of uniform quantum states using Hadamard gates for any N = 2^n . Measurement of this uniform quantum state results in a random state between |0\rangle and Many quantum algorithms use the Hadamard transform as an initial step, since as explained earlier, it maps n qubits initialized with |0 \rangle to a superposition of all 2 n orthogonal states in the |0 \rangle , |1 \rangle basis with equal weight. For example, this is used in the Deutsch–Jozsa algorithm, Simon's algorithm, the Bernstein–Vazirani algorithm, and in Grover's algorithm. Note that Shor's algorithm uses both an initial Hadamard transform, as well as the quantum Fourier transform, which are both types of Fourier transforms on finite groups; the first on (\Z / 2 \Z)^n and the second on \Z /2^n \Z . Preparation of uniform quantum superposition states in the general case, when N ≠ 2^n is non-trivial and requires more work. An efficient and deterministic approach for preparing the superposition state |\Psi\rangle = \frac{1}{\sqrt{N}} \sum_{j=0}^{N-1} |j\rangle with a gate complexity and circuit depth of only O(\log_2 N) for all N was recently presented. This approach requires only n = \lceil \log_2 N \rceil qubits. Importantly, neither ancilla qubits nor any quantum gates with multiple controls are needed in this approach for creating the uniform superposition state |\Psi\rangle . ===Convolutional neural networks=== The Hadamard transform has found applications in quantum machine learning, particularly in hybrid quantum-classical neural networks. Dyadic convolution between two vectors is equivalent to element-wise multiplication of their Hadamard transform representations; thus convolutional layers can be performed efficiently by taking the Hadamard transform, multiplying, and then inverting the Hadamard transform. While classical computation of the Hadamard transform requires O(n log n) operations using the fast Hadamard transform algorithm, the quantum implementation can compute the transform in O(1) time by applying Hadamard gates to all qubits simultaneously. ==See also== Fast Walsh–Hadamard transform Pseudo-Hadamard transform Haar transform Generalized distributive law ==External links== Pan, Jeng-shyang Data Encryption Method Using Discrete Fractional Hadamard Transformation (May 28, 2009) Lachowicz, Dr. Pawel. Walsh–Hadamard Transform and Tests for Randomness of Financial Return-Series (April 7, 2015) ==References==
Cite this
"Hadamard transform". 1790559276. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1377160867 JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy