Tutorials and examples

Cirq comes with a collection of example implementations of beginner, intermediate, and advanced quantum algorithms that demonstrate the main features of the library.

Beginner

Explore Cirq through introductory quantum information examples.
Learn the basics of Cirq.

Intermediate

Use Cirq for intermediate-level subroutines and algorithms.
Use the variational quantum eigensolver to find the ground state of the Ising model.
Use a quantum computer to find approximately optimal cuts in a graph.
Demonstration of classical and quantum random walks on a graph.

Advanced

Utilize Cirq features to implement advanced quantum algorithms.
Find a hidden vector with a constant depth quantum circuit.
Example of using sweeps and symbols to show rotation of a qubit by different angles.
Factor numbers using a quantum computer.

GitHub

See more examples on the Cirq GitHub.

Beginner

Simple first program showing how to create a quantum circuit.
Textbook example of the simplest quantum advantage.
Textbook algorithm determining a global property of a function with surprisingly few calls to it.
Demonstration of a Bell inequality which shows impossibility of local hidden variable theories.
Textbook algorithm for Quantum Key Distribution.
How to use a noisy simulator to execute quantum circuits.
How to find a line of adjacent qubits on a device.
A demonstration of using 2 classical bits to transport a quantum state from one qubit to another.
Transmit 2 classical bits using one quantum bit.

Intermediate

Algorithms for adding and multiplying numbers represented by quantum states.
Use a quantum computer to find a needle in a haystack.
Quantum error correction with Shor's nine-qubit code.
Change from the computational basis to the frequency basis and vice versa.
Find the eigenvalues of a unitary operator.
Algorithm for efficiently emulating full connectivity on a limited connectivity grid of qubits.

Advanced

Direct fidelity estimation to distinguish a desired state fromt he actual state using few Pauli measurements.
Fidelity estimation using cross-entropy benchmarking (XEB).
Algorithm for solving linear systems using quantum phase estimation.