Develop Quantum Circuits with Cirq
Google's Python package for writing, transforming, and simulating quantum circuits on NISQ hardware and simulators.
Why it matters
Design, simulate, and execute quantum circuits using Python with Google's Cirq framework. Integrate with various quantum hardware providers and explore advanced noise modeling and experimental design.
Outcomes
What it gets done
Build basic and parameterized quantum circuits.
Simulate quantum circuits using state vector or density matrix methods.
Integrate with quantum hardware from Google, IonQ, Azure Quantum, AQT, and Pasqal.
Implement noise models and error mitigation techniques.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/ag-cirq | bash Overview
Cirq - Quantum Computing with Python
Python package for writing, transforming, and running quantum circuits, built for today's noisy intermediate-scale quantum (NISQ) hardware. Provides custom gate definitions, parameterized circuits, circuit optimization, hardware device and noise modeling, and multiple built-in simulators, with qsim integration for high-performance simulation. Use it when building, transforming, or simulating quantum circuits in Python where hardware-specific details (gate sets, noise, device topology) matter. Runs on Linux, macOS, Windows, and Google Colab with Python 3.11+.
What it does
Cirq is a Python package for writing, manipulating, and running quantum circuits on quantum computers and simulators, built for today's noisy intermediate-scale quantum (NISQ) hardware where hardware details matter to getting good results. It provides flexible and custom gate definitions, parameterized circuits with symbolic variables, circuit transformation/compilation/optimization, hardware device modeling, noise modeling, multiple built-in circuit simulators, integration with qsim for high-performance simulation, and interoperability with NumPy and SciPy.
When to use - and when NOT to
Use it when building, transforming, or simulating quantum circuits in Python, especially when NISQ-era hardware specifics (gate sets, noise, device topology) need to be modeled explicitly rather than abstracted away. It supports Linux, macOS, Windows, and Google Colab, requiring Python 3.11 or later. For fault-tolerant quantum computing algorithm research specifically, Google's broader Quantum AI stack offers complementary tools (e.g. Qualtran) rather than Cirq itself covering that need alone.
Inputs and outputs
Install via pip install cirq (or pip install --upgrade cirq~=1.0.dev for the pre-release). A minimal example: pick a qubit with cirq.GridQubit(0, 0), build a cirq.Circuit containing a gate (e.g. cirq.X(qubit)**0.5, square-root-of-NOT) and a cirq.measure operation, then run it with cirq.Simulator().run(circuit, repetitions=20) to get measurement results back as a bitstring. Circuits print as ASCII diagrams (e.g. (0, 0): ---X^0.5---M('m')---).
Integrations
Cirq is the base layer of a broader Google Quantum AI open-source stack, with tools chosen by interest area: Qualtran for quantum algorithms and fault-tolerant quantum computing (FTQC), qsim for large circuits and heavy simulation workloads, Stim for circuits with thousands of qubits and millions of Clifford operations or for quantum error correction (QEC), the OpenFermion family (OpenFermion, OpenFermion-FQE, OpenFermion-PySCF, OpenFermion-Psi4) for chemistry and materials science, TensorFlow Quantum for quantum machine learning, and ReCirq for real experiments run on Cirq. Documentation spans video tutorials, Jupyter-notebook tutorials runnable in Colab with no install, text-based tutorials on the Cirq site, a GitHub examples subdirectory, and a dedicated Experiments page. Separate reference docs exist for the current stable release (matching pip install cirq) and the pre-release build (matching pip install --upgrade cirq~=1.0.dev), and a GitHub releases page tracks the changelog for each version.
Cirq has drawn contributions from over 200 people, releases roughly every quarter, and is citable via a Zenodo-archived DOI for reproducibility in published research. It is explicitly not an officially supported Google product.
Who it's for
Researchers and developers writing, simulating, or running quantum circuits in Python - particularly for NISQ-era hardware where noise and device-specific gate behavior need to be modeled directly rather than assumed away.
FAQ
Common questions
Discussion
Questions & comments ยท 0
Sign In Sign in to leave a comment.