Code
qcr:2606.39573.1

Grover's Algorithm with PennyLane

This PennyLane demo implements Grover's algorithm, the canonical quantum search routine that finds a marked item in an unstructured space of N possibilities using only about sqrt(N) oracle queries, a quadratic speedup over the O(N) any classical search requires. The tutorial builds the algorithm from its components using PennyLane's circuit primitives: preparing a uniform superposition over all candidates with Hadamard gates, applying an oracle that flips the phase of the marked state, and applying the Grover diffusion (amplitude-amplification) operator that reflects the state about its mean to boost the marked amplitude. It shows how to repeat the oracle-plus-diffusion step the optimal number of times and how the success probability evolves with the number of iterations, then measures the register to recover the marked item. PennyLane's built-in GroverOperator makes the diffusion step concise, and the demo visualizes how the amplitude concentrates on the solution. Because amplitude amplification underlies many quantum speedups, it is a foundational example for understanding how interference is engineered to surface a desired answer, presented with PennyLane.
Optimization
Qubit
Circuit-based
Uploaded 2 days ago
46
Views
Citing this entry? Use this QCR ID
Uploaded by
QL
QCR Librarian

Overview

PennyLaneAI/demos
667238
README.md

Grover's Algorithm with PennyLane

This PennyLane demo implements Grover's algorithm, the canonical quantum search routine that finds a marked item in an unstructured space of N possibilities using only about sqrt(N) oracle queries, a quadratic speedup over the O(N) any classical search requires. The tutorial builds the algorithm from its components using PennyLane's circuit primitives: preparing a uniform superposition over all candidates with Hadamard gates, applying an oracle that flips the phase of the marked state, and applying the Grover diffusion (amplitude-amplification) operator that reflects the state about its mean to boost the marked amplitude. It shows how to repeat the oracle-plus-diffusion step the optimal number of times and how the success probability evolves with the number of iterations, then measures the register to recover the marked item. PennyLane's built-in GroverOperator makes the diffusion step concise, and the demo visualizes how the amplitude concentrates on the solution. Because amplitude amplification underlies many quantum speedups, it is a foundational example for understanding how interference is engineered to surface a desired answer, presented with PennyLane.

Run it

pip install -r requirements.txt
python demo.py

Source and license

Imported from demonstrations_v2/tutorial_grovers_algorithm/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.

Join the Discussion

Comments (0)

No comments yet. Be the first to share your thoughts!

Indexed by QCR Librarian

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

v1 Latest
Jun 17, 2026
qcr:2606.39573.1

Cite all versions? Use the base QCR ID to always reference the latest version of this entry.

Tools used

PennyLane

Keywords

grover
search
amplitude-amplification
pennylane
oracle

You may also like5