- Notifications
You must be signed in to change notification settings - Fork1.2k
Python framework for creating, editing, and invoking Noisy Intermediate-Scale Quantum (NISQ) circuits.
License
quantumlib/Cirq
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Python package for writing, manipulating, and runningquantumcircuits on quantum computersand simulators.
Features –Installation –Quick Start –Documentation –Integrations –Community –Citing Cirq –Contact
Cirq provides useful abstractions for dealing with today’snoisyintermediate-scale quantum (NISQ) computers,where the details of quantum hardware are vital to achieving state-of-the-artresults. Some of its features include:
- Flexible gate definitions and custom gates
- Parameterized circuits with symbolic variables
- Circuit transformation, compilation and optimization
- Hardware device modeling
- Noise modeling
- Multiple built-in quantum circuit simulators
- Integration withqsim forhigh-performance simulation
- Interoperability withNumPy andSciPy
- Cross-platform compatibility
Cirq supports Python version 3.11 and later, and can be used on Linux, MacOS,and Windows, as well asGoogle Colab. For completeinstallation instructions, please refer to theInstall section of the onlineCirq documentation.
Here is a simple example to get you up and running with Cirq after you haveinstalled it. Start a Python interpreter, and then type the following:
importcirq# Pick a qubit.qubit=cirq.GridQubit(0,0)# Create a circuit.circuit=cirq.Circuit(cirq.X(qubit)**0.5,# Square root of NOT.cirq.measure(qubit,key='m')# Measurement.)print("Circuit:")print(circuit)# Simulate the circuit several times.simulator=cirq.Simulator()result=simulator.run(circuit,repetitions=20)print("Results:")print(result)
Python should then print output similar to this:
Circuit:(0, 0): ───X^0.5───M('m')───Results:m=11000111111011001000Congratulations! You have run your first quantum simulation in Cirq. You cancontinue to learn more by exploring themany Cirq tutorialsdescribed below.
The primary documentation site for Cirq is theCirq home page on the QuantumAI website. There and elsewhere, a variety ofdocumentation for Cirq is available.
- Video tutorials on YouTube are an engaging way to learn Cirq.
- Jupyter notebook-based tutorials let you learn Cirq from your browser – noinstallation needed.
- Text-based tutorials on the Cirq home page are great when combined with alocalinstallation of Cirq on your computer. After starting with thebasics, you'll be ready to dive into tutorials on circuit building andcircuit simulation under theBuild andSimulate tabs, respectively. Checkout the other tabs for more!
- Docs for thecurrent stable release correspond to what you get with
pip install cirq. - Docs for thepre-release correspond to what you get with
pip install --upgrade cirq~=1.0.dev.
- Theexamples subdirectory of the Cirq GitHub repo has manyprograms illustrating the application of Cirq to everything from commontextbook algorithms to more advanced methods.
- TheExperiments page on theCirq documentation site has yet more examples, from simple to advanced.
- TheCirq releases page onGitHub lists the changes in each release.
Google Quantum AI has a suite of open-source software that lets you do morewith Cirq. From high-performance simulators, to novel tools for expressing andanalyzing fault-tolerant quantum algorithms, our software stack lets youdevelop quantum programs for a variety of applications.
| Your interests | Software to explore |
|---|---|
| Quantum algorithms? Fault-tolerant quantum computing (FTQC)? | Qualtran |
| Large circuits and/or a lot of simulations? | qsim |
| Circuits with thousands of qubits and millions of Clifford operations? | Stim |
| Quantum error correction (QEC)? | Stim |
| Chemistry and/or material science? | OpenFermion OpenFermion-FQE OpenFermion-PySCF OpenFermion-Psi4 |
| Quantum machine learning (QML)? | TensorFlow Quantum |
| Real experiments using Cirq? | ReCirq |
Cirq has benefited fromcontributions by over 200 people andcounting. We are dedicated to cultivating an open and inclusive community tobuild software for quantum computers, and have a communitycode of conduct.
Stay on top of Cirq developments using the approach that best suits your needs:
- For releases and major announcements: sign up to the low-volume mailing list
cirq-announce. - For releases only:
- Via GitHub notifications: configurerepository notifications for Cirq.
- Via Atom/RSS from GitHub: subscribe to the GitHubCirq releases Atom feed.
- Via RSS from PyPI: subscribe to thePyPI releases RSS feed for Cirq.
Cirq releases take place approximately every quarter.
- Have questions about Cirq? Post them to theQuantum ComputingStack Exchange and tag them with
cirq. You can also search pastquestions using that tag – it's a great way to learn! - Want meet other Cirq developers and participate in discussions? JoinCirq Cynq, our biweekly virtual meeting of contributors. Sign uptocirq-dev to get an automatic meeting invitation!
- Have a feature request or bug report?Open an issue on GitHub!
- Want to develop Cirq code? Look at thelist of good first issues totackle, read ourcontribution guidelines, and then start openingpull requests!
When publishing articles or otherwise writing about Cirq, please cite the Cirqversion you use – it will help others reproduce your results. We use Zenodo topreserve releases. The following links let you download the bibliographicrecord for the latest stable release of Cirq in some popular formats:
For formatted citations and records in other formats, as well as records forall releases of Cirq past and present, please visit theCirq page onZenodo.
For any questions or concerns not addressed here, please emailquantum-oss-maintainers@google.com.
This is not an officially supported Google product. This project is noteligible for theGoogle Open Source Software Vulnerability RewardsProgram.
Copyright 2019 The Cirq Developers.
About
Python framework for creating, editing, and invoking Noisy Intermediate-Scale Quantum (NISQ) circuits.
Topics
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.