qftGate
Installation Required: This functionality requires MATLAB Support Package for Quantum Computing.
Description
applies the quantum Fourier transform (QFT) to the target qubits and returns a cg
= qftGate(targetQubits
)quantum.gate.CompositeGate
object with a Name
property of
"qft"
.
Examples
Quantum Fourier Transform Gate Acting on Three Qubits
Create a quantum Fourier transform gate that acts on three qubits.
cg = qftGate(1:3)
cg = CompositeGate with properties: Name: "qft" ControlQubits: [1×0 double] TargetQubits: [3×1 double] Gates: [7×1 quantum.gate.SimpleGate]
Get the matrix representation of the gate.
M = getMatrix(cg)
M = Columns 1 through 5 0.3536 + 0.0000i 0.3536 + 0.0000i 0.3536 + 0.0000i 0.3536 + 0.0000i 0.3536 + 0.0000i 0.3536 + 0.0000i 0.2500 + 0.2500i 0.0000 + 0.3536i -0.2500 + 0.2500i -0.3536 + 0.0000i 0.3536 + 0.0000i 0.0000 + 0.3536i -0.3536 + 0.0000i -0.0000 - 0.3536i 0.3536 + 0.0000i 0.3536 + 0.0000i -0.2500 + 0.2500i -0.0000 - 0.3536i 0.2500 + 0.2500i -0.3536 + 0.0000i 0.3536 + 0.0000i -0.3536 + 0.0000i 0.3536 + 0.0000i -0.3536 + 0.0000i 0.3536 + 0.0000i 0.3536 + 0.0000i -0.2500 - 0.2500i 0.0000 + 0.3536i 0.2500 - 0.2500i -0.3536 + 0.0000i 0.3536 + 0.0000i -0.0000 - 0.3536i -0.3536 + 0.0000i 0.0000 + 0.3536i 0.3536 + 0.0000i 0.3536 + 0.0000i 0.2500 - 0.2500i -0.0000 - 0.3536i -0.2500 - 0.2500i -0.3536 + 0.0000i Columns 6 through 8 0.3536 + 0.0000i 0.3536 + 0.0000i 0.3536 + 0.0000i -0.2500 - 0.2500i -0.0000 - 0.3536i 0.2500 - 0.2500i 0.0000 + 0.3536i -0.3536 + 0.0000i -0.0000 - 0.3536i 0.2500 - 0.2500i 0.0000 + 0.3536i -0.2500 - 0.2500i -0.3536 + 0.0000i 0.3536 + 0.0000i -0.3536 + 0.0000i 0.2500 + 0.2500i -0.0000 - 0.3536i -0.2500 + 0.2500i -0.0000 - 0.3536i -0.3536 + 0.0000i 0.0000 + 0.3536i -0.2500 + 0.2500i 0.0000 + 0.3536i 0.2500 + 0.2500i
Plot the returned QFT gate to show its internal gates.
plot(cg)
Quantum Circuit with Two Quantum Fourier Transform Gates
Create a quantum circuit that consists of two QFT gates. The first gate acts on qubits with indices 2 to 4. The second gate acts on qubits with indices 1, 3, and 5.
gates = [qftGate(2:4); qftGate([1 3 5])]; c = quantumCircuit(gates)
c = quantumCircuit with properties: NumQubits: 5 Gates: [2×1 quantum.gate.CompositeGate] Name: ""
Plot the quantum circuit.
plot(c)
The plotted circuit consists of five qubits with indices 1 to 5. The plot shows that qubits 2 to 4 of the outer circuit are mapped to qubits 1 to 3 of the inner circuit of internal gates that construct the first QFT gate. For the second QFT gate, qubit 1 of the outer circuit is mapped to qubit 1 of the inner circuit, qubit 3 of the outer circuit is mapped to qubit 2 of the inner circuit, and qubit 5 of the outer circuit is mapped to qubit 3 of the inner circuit.
Click either QFT gate in the plot. A new figure showing the internal gates of the composite gate appears.
Input Arguments
targetQubits
— Target qubits to apply QFT
positive integer vector
Target qubits to apply QFT, specified as a positive integer vector of qubit indices.
More About
Quantum Fourier Transform
The quantum Fourier transform (QFT) acts on a quantum state and maps it to a quantum state according to the formula:
where and is an Nth root of unity.
Here, is the number of basis states for the n qubits that are quantum Fourier transformed. The state (or ) represents the binary notation of the possible basis states, where the value of m is . By this definition, the effect of the QFT on the state vector matches the inverse discrete Fourier transform, but with a difference in the scaling factor because QFT uses instead of .
In matrix representation, the QFT can also be expressed as
References
[1] Nielsen, Michael A., and Isaac L. Chuang. Quantum Computation and Quantum Information. 10th anniversary ed, Cambridge; New York: Cambridge University Press, 2010.
Version History
Introduced in R2023a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)