A good four years after the presentation of the first alpha, Google released Cirq 1.0 for programming quantum computers. The Python framework can be used to create quantum circuits for systems of the NISQ (Noisy Intermediate Scale Quantum Computer) era. At the same time, Google releases its Quantum Virtual Machine, which simulates calculations on quantum computers.
Google made Cirq available on GitHub at the end of 2017 and publicly presented it as an open source project in summer 2018. Since then, numerous developers have contributed to the development with a total of over 3,200 commits up to the release of version 1.0. For the past four years, the weekly “Cirq Cync” meeting has been held, where members of the community discuss their work on the project, fixing bugs, and, as the blog post puts it, “tell terrifying but amusing quantum programming jokes.”
Circuits, moments and operations
The programming of quantum computers works with calculation instructions in the form of quantum circuits or quantum circuits (quantum circuit). Initially, the code initializes a qubit, which contains a series of gates that transform the qubit. A “Hello Qubit” from Cirq’s GitHub repository shows a simple implementation:
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)
In Cirq represents the class
circuit the quantum circuits. It consists of a collection of
Moments, which in turn is a collection of
Operations are. The latter perform the actual processing on the qubits, and a typical representative is the
The qubits run through the circuit via moments, which in turn consist of operations.
simulate Finally, in the code example above, it calculates a state vector or the probability of the absolute value. The result consists of a 20-digit sequence of ones and zeros and could look like this:
Circuit: (0, 0): ---X^0.5---M('m')--- Results: m=11000111111011001000
Own hardware and research
Google uses Cirq as the default language for programs on its own quantum computing hardware. The company provides the test programs in the separate GitHub repository ReCirq. For some research there are also papers such as “Realizing topologically ordered states on a quantum processor” with the associated code on GitHub.
In addition, Cirq can be used on various cloud services for quantum computing such as AQT, IonQ, Pascal, Rigetti, and IQM. Another target platform is Microsoft’s Azure Quantum.
John Preskill wrote a paper about quantum computing in the NISQ era in 2018. She describes quantum computers that have between 50 and 100 qubits and outperform classic computers, but “are not yet going to change the world directly”.
Interested parties can try Cirq on the Quantum Virtual Machine (QVM), which Google officially launched in parallel with the release of Cirq 1.0. It emulates a quantum computer and can be integrated into a Colab notebook. Google feeds the measurements of the Sycamore processors into the emulation to make them as realistic as possible. There is a treatise on the simulation of quantum circuits on Arxiv.
The Colab notebook template contains the code to create a QVM, create a quantum circuit, and run the circuit on the virtual machine.
Libraries for Cirq
A number of open source libraries for the programming language were already created during the Cirq beta phase, including TensorFlow Quantum, which is based on Google’s TensorFlow machine learning framework. pytket-cirq is a Python tool for optimizing and adjusting the quantum circuits, and OpenFermion aims at chemical simulations.
The Quantum Chess tutorial shows how the theoretical quantum algorithms can be translated into code for NISQ devices. Quantum chess is a special variant of the board game that supplements chess with the principles of quantum mechanics. The game featured prominently in a match between Stephen Hawking and Paul Rudd in a highly amusing video narrated by Keanu Reeves.
Stephen Hawking plays quantum chess against Paul Rudd
More details on the Cirq 1.0 release can be found on the Google open source blog. The programming language relies on semantic versioning. The following 1.x point releases will thus be backwards compatible with the first major version. There is a tutorial on the project page to get you started. The source code and other documentation are stored in the GitHub repository.
To home page