Difference between revisions of "FourierMatrix"
Jump to navigation
Jump to search
(Created page with "{{Function |name=FourierMatrix |desc=Generates the unitary matrix that implements the quantum Fourier transform |upd=November 30, 2012 |v=1.00}} <tt>'''FourierMatrix''...") |
|||
| Line 1: | Line 1: | ||
{{Function | {{Function | ||
|name=FourierMatrix | |name=FourierMatrix | ||
| + | |cat=[[List of functions#Special_states,_vectors,_and_operators|Special states, vectors, and operators]] | ||
|desc=Generates the [[unitary matrix]] that implements the [[quantum Fourier transform]] | |desc=Generates the [[unitary matrix]] that implements the [[quantum Fourier transform]] | ||
|upd=November 30, 2012 | |upd=November 30, 2012 | ||
| − | |v= | + | |v=0.50}} |
<tt>'''FourierMatrix'''</tt> is a [[List of functions|function]] that returns the [[unitary matrix]] that implements the [[quantum Fourier transform]]. | <tt>'''FourierMatrix'''</tt> is a [[List of functions|function]] that returns the [[unitary matrix]] that implements the [[quantum Fourier transform]]. | ||
| Line 15: | Line 16: | ||
===The qubit Fourier matrix=== | ===The qubit Fourier matrix=== | ||
The qubit Fourier matrix is simply the usual [[Hadamard gate]]: | The qubit Fourier matrix is simply the usual [[Hadamard gate]]: | ||
| − | < | + | <syntaxhighlight> |
>> FourierMatrix(2) | >> FourierMatrix(2) | ||
| Line 22: | Line 23: | ||
0.7071 0.7071 | 0.7071 0.7071 | ||
0.7071 -0.7071 + 0.0000i | 0.7071 -0.7071 + 0.0000i | ||
| − | </ | + | </syntaxhighlight> |
===The three-qubit Fourier matrix=== | ===The three-qubit Fourier matrix=== | ||
The following line of code generates the three-qubit (i.e., <tt>DIM = 8</tt>) Fourier matrix, which can be seen [http://en.wikipedia.org/wiki/Quantum_Fourier_transform here]. The multiplication by <tt>sqrt(8)</tt> is just there to make the output easier to read. | The following line of code generates the three-qubit (i.e., <tt>DIM = 8</tt>) Fourier matrix, which can be seen [http://en.wikipedia.org/wiki/Quantum_Fourier_transform here]. The multiplication by <tt>sqrt(8)</tt> is just there to make the output easier to read. | ||
| − | < | + | <syntaxhighlight> |
>> FourierMatrix(8)*sqrt(8) | >> FourierMatrix(8)*sqrt(8) | ||
| Line 39: | Line 40: | ||
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.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 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 | ||
| − | </ | + | </syntaxhighlight> |
| + | |||
| + | {{SourceCode|name=FourierMatrix}} | ||
Revision as of 15:12, 29 September 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.
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.