Cirq Explained

Cirq
Programming Language:Python
Developers:quantumlib
License:Apache license
Website:GitHub

Cirq is an open-source framework for noisy intermediate scale quantum (NISQ) computers.[1]

History

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. A demo by QC Ware showed an implementation of QAOA solving an example of the maximum cut problem being solved on a Cirq simulator.[2]

Usage

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.[3] The programs can be executed on local simulators[4] or against hardware supplied by IonQ, Pasqal,[5] Rigetti, and Alpine Quantum Technologies[6]

The following example shows how to create and measure a Bell state in Cirq.import cirq

  1. Pick qubits

qubit0 = cirq.GridQubit(0, 0)qubit1 = cirq.GridQubit(0, 1)

  1. Create a circuit

circuit = cirq.Circuit.from_ops(cirq.H(qubit0), cirq.CNOT(qubit0, qubit1), cirq.measure(qubit0, key="m0"), cirq.measure(qubit1, key="m1"))

Printing the circuit displays its diagramprint(circuit)

  1. prints
  2. (0, 0): ───H───@───M('m0')───
  3. (0, 1): ───────X───M('m1')───

Simulating the circuit repeatedly shows that the measurements of the qubits are correlated. simulator = cirq.Simulatorresult = simulator.run(circuit, repetitions=5)print(result)

  1. prints
  2. m0=11010
  3. m1=11010

Projects

OpenFermion

OpenFermion is a library that compiles quantum simulation algorithms to Cirq.[7]

TensorFlow Quantum

TensorFlow Quantum is an extension of TensorFlow that allows TensorFlow to be used to explore hybrid classical-quantum machine learning algorithms.[8]

ReCirq

ReCirq is a repository of research projects done using Cirq.[9]

Qsim Cirq

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]

Notes and References

  1. 1812.09167 . Fingerhuth. Mark . Babej . Tomáš . Wittek . Peter . Open source software in quantum computing. PLOS ONE. 2018. 13. 12. e0208561. 10.1371/journal.pone.0208561. 30571700. 6301779. 2018PLoSO..1308561F. free.
  2. Web site: public_demos/max_cut_cirq.py at master · qcware/public_demos · GitHub . . https://web.archive.org/web/20180720153354/https://github.com/qcware/public_demos/blob/master/max_cut/max_cut_cirq.py . dead . 20 July 2018 . 29 October 2019 . 20 July 2018.
  3. Web site: Cirq Circuits . Google Quantum AI website . Google AI Quantum Team . 2022-07-06 .
  4. Web site: Cirq Simulation . Google Quantum AI website . 2022-07-06.
  5. Web site: Pasqal.
  6. Web site: AQT.
  7. Web site: Announcing Cirq: An Open Source Framework for NISQ Algorithms . Ho . Alan. Bacon . Dave . 2018-07-18 . Google AI Blog . Google AI Quantum Team . 2019-03-06 .
  8. Web site: TensorFlow Quantum. TensorFlow. 2022-07-06.
  9. Web site: ReCirq. Google Quantum Github. 2022-07-06.
  10. Web site: qsimcirq. 2022-07-06.