quantum_fourier_transform#
Functionality#
Quantum Fourier Transform Circuit.
qft.py#
Callee: QFT
With inverse=False, the Quantum Fourier Transform (QFT) on \(n\) qubits is the operation:
The circuit that implements this transformation can be implemented using Hadamard gates on each qubit, a series of controlled-U1 (or Z, depending on the phase) gates and a layer of Swap gates. The layer of Swap gates can in principle be dropped if the QFT appears at the end of the circuit, since then the re-ordering can be done classically. They can be turned off using the do_swaps attribute.
Setting the inverse attribute to True creates the inverse QFT circuit, i.e., the unitary \(U_{\text{QFT}}^\dagger\).
Test expectations:
QFT
All basis states \(\ket{k}\) appears with equal magnitude \(\frac{1}{2^{n/2}}\) and relative phase \(e^{2\pi ijk / 2^n}\).
If
do_swaps=True, the basis states \(\ket{k}\) correspond to the standard qubit order.If
do_swaps=False, they are in bit-reversed order. The magnitude of each basis state can be verified by measurement, while the phase can be verified by a state-vector backend.
Inverse QFT
The inverse QFT applies the conjugate phases, satisfying \(U_{\text{QFT}}^\dagger U_{\text{QFT}}=I\). By applying it to the state transformed by QFT, the output state should return to the original \(\ket{j}_n\).
API#
qolumbina.programs.quantum_fourier_transform.qft#
Define a Quantum Fourier Transform circuit (QFT)
- class QFT(num_qubits, do_swaps=True, approximation_degree=0, insert_barriers=False, inverse=False, name=None)[source]#
Bases:
QuantumCircuitQuantum Fourier Transform (QFT) Circuit.
- Parameters:
num_qubits (int) – Number of input qubits \(n\).
do_swaps (bool) – Whether to include the final layer of Swap gates. This is True by default.
approximation_degree (int) – The number of controlled rotations to omit from the circuit. Default: 0, i.e., no approximations.
insert_barriers (bool) – If True, barriers are inserted for improved visualization.
inverse (bool) – Whether to create the inverse QFT circuit \(U_{\text{QFT}}^\dagger\). Default: False.
name (str | None) – Optional name of the circuit.