Quantum Fourier Transform with PennyLane
Overview
Quantum Fourier Transform with PennyLane
This PennyLane demo introduces the Quantum Fourier Transform (QFT), the quantum analogue of the discrete Fourier transform and one of the most consequential primitives in quantum computing, providing the exponential speedups behind Shor's algorithm and quantum phase estimation. The tutorial explains how the QFT acts on the amplitudes of an n-qubit state and how it is built from a regular pattern of Hadamard gates and controlled phase rotations followed by qubit-order-reversal swaps, using only about n-squared gates to transform the 2-to-the-n amplitudes, an exponential saving over the classical fast Fourier transform. It constructs the QFT circuit explicitly in PennyLane to make the structure transparent, and also shows PennyLane's built-in QFT template for convenient reuse. The demo applies the transform to concrete input states, inspects the resulting amplitudes to confirm the expected Fourier relationship, and discusses the inverse QFT that appears as a subroutine in phase estimation and beyond. By presenting both the gate-level construction and the high-level template, the tutorial gives a clear, foundational understanding of the primitive that powers many of quantum computing's most celebrated algorithms, in PennyLane.
Run it
pip install -r requirements.txt
python demo.py
Source and license
Imported from demonstrations_v2/tutorial_qft/demo.py in PennyLaneAI/demos at c52c0abeb5122218aa96b38eea848864cce7323f, under the Apache License 2.0. Original authors: Xanadu and the PennyLane community. The upstream LICENSE is included alongside this example.
This entry was created automatically from publicly available records. QCR links to public sources and only stores repository content where the license permits redistribution.
Versions
Cite all versions? Use the base QCR ID to always reference the latest version of this entry.
Join the Discussion
Comments (0)
No comments yet. Be the first to share your thoughts!