Quantum Algorithms

Complete implementations of textbook quantum algorithms and circuits, from Bell states up to quantum phase estimation and the surface code. Consult them while working and adapt them to your own code.

Note

Looking to apply an algorithm to a concrete problem (QSCI, statistical phase estimation, and more)? See Applying Algorithms in the how-to guides.

Contents

Generate a Bell State

Build a Bell state circuit and visualize sampling results.

Toffoli Truth Table by Sampling

Build a Toffoli (CCX) gate circuit and reconstruct its truth table by sampling.

Deutsch-Jozsa Algorithm

Determine whether an oracle is constant or balanced, deterministically.

Bernstein-Vazirani Algorithm

Recover a secret bit string with a single oracle query.

Simon’s Algorithm

Solve Simon’s problem with a quantum computer.

Quantum Fourier Transform

Implement the quantum Fourier transform and algorithms built on it.

Quantum Phase Estimation

Estimate the eigenvalue (phase) of a unitary operator for one of its eigenstates.

Surface Code and Quantum Error Correction

The planar surface code: definitions, terminology and a hands-on implementation.