Cirq is an open-source framework for noisy intermediate scale quantum (NISQ) computers.[1]
Developers | quantumlib |
---|---|
Implementation language | Python |
License | Apache license |
Website | GitHub |
Cirq was developed by the Google AI Quantum Team, and the public alpha was announced at the International Workshop on Quantum Software and Quantum Machine Learning on July 18, 2018.[2] A demo by QC Ware showed an implementation of QAOA solving an example of the maximum cut problem being solved on a Cirq simulator.[3]
Quantum programs in Cirq are represented by "Circuit" which is made up of a series of "Moments" representing slices of quantum gates that should be applied at the same time.[4] The programs can be executed on local simulators[5] or against hardware supplied by IonQ, Pasqal,[6] Rigetti, and Alpine Quantum Technologies[7]
The following example shows how to create and measure a Bell state in Cirq.
import cirq
# Pick qubits
qubit0 = cirq.GridQubit(0, 0)
qubit1 = cirq.GridQubit(0, 1)
# Create a circuit
circuit = cirq.Circuit(
cirq.H(qubit0),
cirq.CNOT(qubit0, qubit1),
cirq.measure(qubit0, key="m0"),
cirq.measure(qubit1, key="m1")
)
Printing the circuit displays its diagram
print(circuit)
# prints
# (0, 0): ───H───@───M('m0')───
# │
# (0, 1): ───────X───M('m1')───
Simulating the circuit repeatedly shows that the measurements of the qubits are correlated.
simulator = cirq.Simulator()
result = simulator.run(circuit, repetitions=5)
print(result)
# prints
# m0=11010
# m1=11010
OpenFermion is a library that compiles quantum simulation algorithms to Cirq.[2]
TensorFlow Quantum is an extension of TensorFlow that allows TensorFlow to be used to explore hybrid classical-quantum machine learning algorithms.[8]
ReCirq is a repository of research projects done using Cirq.[9]
Qsim is a high performance wave function simulator that leverages gate fusing, AVS/FMA instructions, and OpenMP to achieve fast simulation rates. Qsimcirq allows one to use qsim from within Cirq.[10]