QFT
QuICT.algorithm.qft.QFT ¶
Bases: CompositeGate
Implement the Quantum Fourier Transform without the swap gates.
\[
\vert{j}\rangle \mapsto \frac{1}{2^{n/2}} \bigotimes_{l=n}^{1}[\vert{0}\rangle + e^{2\pi ij2^{-l}}\vert{1}\rangle]
\]
Reference
Nielsen, M.A., & Chuang, I.L. (2010). Quantum Computation and Quantum Information (10th Anniversary edition).
Examples:
from QuICT.core import Circuit
from QuICT.algorithm.qft import QFT
circuit = Circuit(3)
QFT(3) | circuit
circuit.draw(method="command", flatten=True)
┌───┐┌─────┐┌─────┐
q_0: |0>┤ h ├┤ cu1 ├┤ cu1 ├─────────────────
└───┘└──┬──┘└──┬──┘┌───┐┌─────┐
q_1: |0>────────■──────┼───┤ h ├┤ cu1 ├─────
│ └───┘└──┬──┘┌───┐
q_2: |0>───────────────■───────────■───┤ h ├
└───┘
Parameters:
-
targets(int) –The qubits' number.
-
with_swap(bool, default:False) –If
True, will include the swap gates in QFT. -
name(str, default:'QFT') –Name of the QFT gate.
Raises:
GateParametersAssignedError: If targets is smaller than 2.
Source code in QuICT/algorithm/qft/quantum_frourier_transform.py
QuICT.algorithm.qft.IQFT ¶
Bases: CompositeGate
Implement inverse of the Quantum Fourier Transform without the swap gates.
\[
\frac{1}{2^{n/2}} \bigotimes_{l=n}^{1}[\vert{0}\rangle + e^{2\pi ij2^{-l}}\vert{1}\rangle] \mapsto \vert{j}\rangle
\]
Examples:
from QuICT.core import Circuit
from QuICT.algorithm.qft import IQFT
circuit = Circuit(3)
IQFT(3) | circuit
circuit.draw(method="command", flatten=True)
┌─────┐┌─────┐┌───┐
q_0: |0>─────────────────┤ cu1 ├┤ cu1 ├┤ h ├
┌─────┐┌───┐└──┬──┘└──┬──┘└───┘
q_1: |0>─────┤ cu1 ├┤ h ├───┼──────■────────
┌───┐└──┬──┘└───┘ │
q_2: |0>┤ h ├───■───────────■───────────────
└───┘
Parameters:
-
targets(int) –The qubits' number.
-
with_swap(bool, default:False) –If
True, will include the swap gates in IQFT. -
name(str, default:'IQFT') –Name of the IQFT gate.
Raises:
GateParametersAssignedError: If targets is smaller than 2.