qbraid_algorithms.iqft
Inverse Quantum Fourier Transform (IQFT)
Inverse Quantum Fourier Transform (IQFT)
This module provides an implementation of the Inverse Quantum Fourier Transform (IQFT), the inverse operation of the Quantum Fourier Transform. The IQFT is essential for extracting information from quantum algorithms, particularly in quantum phase estimation, Shor’s algorithm, and other quantum algorithms that require converting from the frequency domain back to the computational basis. The IQFT transforms quantum states from Fourier basis back to computational basis, enabling measurement and classical post-processing of quantum algorithm results.
FORMULATION
Transformation: The IQFT is the inverse of the QFT, transforming an \(n\)-qubit state from the Fourier basis back to the computational basis:
\(\text{IQFT}|j\rangle = \frac{1}{\sqrt{2^n}} \sum_{k=0}^{2^n-1} \omega_n^{-jk} |k\rangle\)
where \(\omega_n = e^{2\pi i/2^n}\) is the primitive \(2^n\)-th root of unity.
Circuit Implementation: The IQFT circuit consists of:
Swap Operations: Reverse the qubit order from QFT
Inverse Controlled Rotations: Apply \(R_k^{\dagger}\) gates where:
\(R_k^{\dagger} = \begin{pmatrix} 1 & 0 \\ 0 & e^{-2\pi i/2^k} \end{pmatrix}\)
Inverse Hadamard Gates: Apply \(H^{\dagger} = H\) to each qubit
Matrix Form: For \(n\) qubits, the IQFT matrix is:
\(\text{IQFT} = \frac{1}{\sqrt{2^n}} \begin{pmatrix} 1 & 1 & 1 & \cdots & 1 \\ 1 & \omega_n^{-1} & \omega_n^{-2} & \cdots & \omega_n^{-(2^n-1)} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 1 & \omega_n^{-(2^n-1)} & \omega_n^{-2(2^n-1)} & \cdots & \omega_n^{-(2^n-1)(2^n-1)} \end{pmatrix}\)
Functions
generate_program(num_qubits)Load the Inverse Quantum Fourier Transform circuit as a pyqasm module.
save_to_qasm(num_qubits[, quiet, path])Creates an IQFT subroutine module with user-defined number of qubits.