FourierMatrix: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Removed red links and expanded intro |
||
| Line 2: | Line 2: | ||
|name=FourierMatrix | |name=FourierMatrix | ||
|cat=[[List of functions#Special_states,_vectors,_and_operators|Special states, vectors, and operators]] | |cat=[[List of functions#Special_states,_vectors,_and_operators|Special states, vectors, and operators]] | ||
|desc=Generates the | |desc=Generates the unitary matrix that implements the quantum Fourier transform | ||
|upd=November 30, 2012 | |upd=November 30, 2012}} | ||
<tt>'''FourierMatrix'''</tt> is a [[List of functions|function]] that returns the unitary matrix that implements the [http://en.wikipedia.org/wiki/Quantum_Fourier_transform quantum Fourier transform]. That is, it returns the $d \times d$ matrix | |||
<tt>'''FourierMatrix'''</tt> is a [[List of functions|function]] that returns the | : <math>\frac{1}{\sqrt{d}}\begin{bmatrix}1 & 1 & 1 & \cdots & 1 \\ 1 & \omega & \omega^2 & \cdots & \omega^{d-1} \\ 1 & \omega^2 & \omega^4 & \cdots & \omega^{2(d-1)} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 1 & \omega^{d-1} & \omega^{2(d-1)} & \cdots & \omega^{(d-1)(d-1)} \end{bmatrix},</math> | ||
where $\omega := \exp(2\pi i/d)$ is a [http://en.wikipedia.org/wiki/Root_of_unity primitive $d$-th root of unity]. | |||
==Syntax== | ==Syntax== | ||
* <tt>F = FourierMatrix(DIM)</tt> | * <tt>F = FourierMatrix(DIM)</tt> | ||
| Line 15: | Line 15: | ||
==Examples== | ==Examples== | ||
===The qubit Fourier matrix=== | ===The qubit Fourier matrix=== | ||
The qubit Fourier matrix is simply the usual | The qubit Fourier matrix is simply the usual Hadamard gate: | ||
<syntaxhighlight> | <syntaxhighlight> | ||
>> FourierMatrix(2) | >> FourierMatrix(2) | ||
Revision as of 04:14, 20 December 2014
| FourierMatrix | |
| Generates the unitary matrix that implements the quantum Fourier transform | |
| Other toolboxes required | none |
|---|---|
| Function category | Special states, vectors, and operators |
FourierMatrix is a function that returns the unitary matrix that implements the quantum Fourier transform. That is, it returns the $d \times d$ matrix
- <math>\frac{1}{\sqrt{d}}\begin{bmatrix}1 & 1 & 1 & \cdots & 1 \\ 1 & \omega & \omega^2 & \cdots & \omega^{d-1} \\ 1 & \omega^2 & \omega^4 & \cdots & \omega^{2(d-1)} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 1 & \omega^{d-1} & \omega^{2(d-1)} & \cdots & \omega^{(d-1)(d-1)} \end{bmatrix},</math>
where $\omega := \exp(2\pi i/d)$ is a primitive $d$-th root of unity.
Syntax
- F = FourierMatrix(DIM)
Argument descriptions
- DIM: The dimension of the system. In other words, F will be a DIM-by-DIM matrix.
Examples
The qubit Fourier matrix
The qubit Fourier matrix is simply the usual Hadamard gate:
>> FourierMatrix(2)
ans =
0.7071 0.7071
0.7071 -0.7071 + 0.0000iThe three-qubit Fourier matrix
The following line of code generates the three-qubit (i.e., DIM = 8) Fourier matrix, which can be seen here. The multiplication by sqrt(8) is just there to make the output easier to read.
>> FourierMatrix(8)*sqrt(8)
ans =
1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
1.0000 0.7071 + 0.7071i 0.0000 + 1.0000i -0.7071 + 0.7071i -1.0000 + 0.0000i -0.7071 - 0.7071i -0.0000 - 1.0000i 0.7071 - 0.7071i
1.0000 0.0000 + 1.0000i -1.0000 + 0.0000i -0.0000 - 1.0000i 1.0000 - 0.0000i 0.0000 + 1.0000i -1.0000 + 0.0000i -0.0000 - 1.0000i
1.0000 -0.7071 + 0.7071i -0.0000 - 1.0000i 0.7071 + 0.7071i -1.0000 + 0.0000i 0.7071 - 0.7071i 0.0000 + 1.0000i -0.7071 - 0.7071i
1.0000 -1.0000 + 0.0000i 1.0000 - 0.0000i -1.0000 + 0.0000i 1.0000 - 0.0000i -1.0000 + 0.0000i 1.0000 - 0.0000i -1.0000 + 0.0000i
1.0000 -0.7071 - 0.7071i 0.0000 + 1.0000i 0.7071 - 0.7071i -1.0000 + 0.0000i 0.7071 + 0.7071i -0.0000 - 1.0000i -0.7071 + 0.7071i
1.0000 -0.0000 - 1.0000i -1.0000 + 0.0000i 0.0000 + 1.0000i 1.0000 - 0.0000i -0.0000 - 1.0000i -1.0000 + 0.0000i 0.0000 + 1.0000i
1.0000 0.7071 - 0.7071i -0.0000 - 1.0000i -0.7071 - 0.7071i -1.0000 + 0.0000i -0.7071 + 0.7071i 0.0000 + 1.0000i 0.7071 + 0.7071iSource code
Click here to view this function's source code on github.