Skip to content
A python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Python Other
  1. Python 99.1%
  2. Other 0.9%
Branch: master
Clone or download
Strilanc and CirqBot Add CircuitDiagramInfoArgs.format_real (#2569)
- Also fix the qasm UGate not having a decomposition or a correct repr
Latest commit 907f990 Nov 18, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
check Add check/pytest-changed-files-and-incremental-coverage (#2510) Nov 13, 2019
cirq Add CircuitDiagramInfoArgs.format_real (#2569) Nov 19, 2019
dev_tools Add developer doc explaining serialization (#2548) Nov 15, 2019
docs Add Gate and Operation Guidelines dev docs (#2558) Nov 19, 2019
examples Use sum instead of einsum in QAOA example (#2507) Nov 12, 2019
.gitignore Update protobuf version (#2239) Oct 10, 2019
.readthedocs.yml Add `install: requirements` section to .readthedocs.yml (#1969) Aug 27, 2019
.travis.yml Turn off flaky build-protos check (#2571) Nov 19, 2019
AUTHORS Fixes the copyright notice and adds AUTHORS Apr 27, 2018
CONTRIBUTING.md Remove `@cirq.testing.only_test_in_python3` (#1579) Apr 30, 2019
Dockerfile Added docker installation instructions and Dockerfile. (#1234) Dec 20, 2018
LICENSE Restores the generic apache 2 license file Mar 28, 2018
MANIFEST.in Make it clearer dev-requirements does not contain dependencies by mov… Aug 8, 2018
README.rst Fixes "Mention the difference between stable docs and latest docs." (#… Nov 15, 2019
WORKSPACE Update protobuf version (#2239) Oct 10, 2019
apt-system-requirements.txt Restore python3-tk as an apt requirement (#1876) Jul 26, 2019
release.md Add versioning notes to release.md (#629) Jul 12, 2018
requirements.txt Fix dataclasses package being installed for python 3.7+ (#2450) Oct 30, 2019
setup.cfg Fix setup.py requirements and add setup.cfg (#73) Feb 7, 2018
setup.py Rename cirq-dev to cirq-unstable (#2444) Oct 30, 2019
style.md Reorder travis tests (#2236) Sep 30, 2019

README.rst

Cirq

Cirq is a Python library for writing, manipulating, and optimizing quantum circuits and running them against quantum computers and simulators.

Build Status Documentation Status

Installation and Documentation

Cirq documentation is available at cirq.readthedocs.io.

Documentation for the latest unstable version of cirq (tracks the repository's master branch; what you get if you pip install cirq-unstable), is available at cirq.readthedocs.io/latest.

Documentation for the latest stable version of cirq (what you get if you pip install cirq) is available at cirq.readthedocs.io/stable.

Hello Qubit

A simple example to get you up and running:

import cirq

# 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)

Example output:

Circuit:
(0, 0): ───X^0.5───M('m')───
Results:
m=11000111111011001000

Contributing

We welcome contributions. Please follow these guidelines.

We use Github issues for tracking requests and bugs. Please post questions to the Quantum Computing Stack Exchange with the cirq tag. For informal discussions about Cirq, join our cirqdev Gitter channel.

See Also

For those interested in using quantum computers to solve problems in chemistry and materials science, we encourage exploring OpenFermion and its sister library for compiling quantum simulation algorithms in Cirq, OpenFermion-Cirq.

Alpha Disclaimer

Cirq is currently in alpha. We are still making breaking changes. We will break your code when we make new releases. We recommend that you target a specific version of Cirq, and periodically bump to the latest release. That way you have control over when a breaking change affects you.

Cirq is not an official Google product. Copyright 2019 The Cirq Developers

You can’t perform that action at this time.