News

Cirq 0.4.0 released for writing quantum circuits

2 min read

Cirq is a Python library for writing quantum circuits and running them against quantum computers created by Google. Cirq 0.4.0 is now released and is available on GitHub.

Changes in Cirq 0.4.0 themes

The API is now more pythonic and more consistent with respect to breaking changes and refactoring. The simulation is faster.

New functionality in Cirq 0.4.0

The following functions, parameters are added.

  • cirq.Rx, cirq.Ry, and cirq.Rz
  • cirq.XX, cirq.YY, cirq.ZZ, and cirq.MS related to the Mølmer–Sørensen gate
  • cirq.Simulator
  • cirq.SupportsApplyUnitary protocol is added to specify fast simulation methods
  • cirq.Circuit.reachable_frontier_from and cirq.Circuit.findall_operations_between
  • cirq.decompose
  • sorted(qubits) and cirq.QubitOrder.DEFAULT.order_for(qubits) are now equivalent
  • cirq.experiments.generate_supremacy_circuit_[…]
  • dtype parameters are added to control the precision versus speed of simulations
  • cirq.TrialResult helper methods (dirac_notation / bloch_vector / density_matrix)
  • cirq.TOFFOLI and cirq.CCZ can be raised to powers

Breaking changes in Cirq 0.4.0

  • Most of the gate classes have been standardized. They can now take an exponent argument and have a name which is of the form NamePowGate. For example, RotXGate is now XPowGate and it no longer takes rads, degs, or half_turns.
  • The xmon gate set has now been merged into the common gate set.
  • The capability marker classes have been replaced by magic method protocols. As an example, gates now just implement a _unitary_ method as opposed to inheriting from KnownMatrix.
  • cirq.Extensions and cirq.PotentialImplementation are removed.
  • Many decomposition classes and methods have been moved from cirq.google.* to cirq.*. Example: cirq.google.EjectFullW is now cirq.EjectPhasedPaulis.
  • The classes and methods related to line placement are moved into cirq.google.

Notable bug fixes

  • A two-qubit gate decomposition will no longer produce a glut of single qubit gates.
  • When multi-line entries are given, circuit diagrams stay aligned. They now include “same moment” indicators.
  • The false-positives and false-negatives are fixed in cirq.testing.assert_circuits_with_terminal_measurements_are_equivalent.
  • Many repr methods returning code are fixed that assumed from cirq import * instead of import cirq.
  • Example code now runs in both Python 2 and Python 3 without the need for transpilation.

Notable dev changes

  • The test files now import cirq instead of just specific modules.
  • There is better testing and packaging of scripts.
  • The package versions for Python 2 and Python 3 are no longer different.
  • cirq.value_equality decorator is added.
  • New cirq.testing methods and classes are added.

Additions to contrib

  • cirq.contrib.acquaintance: New utilities for defining permutation gates
  • cirq.contrib.paulistring: Utilities for optimizing non-Clifford operations which are separated by Clifford operations
  • cirq.contrib.tpu: Utilities for converting circuits into an executable form to be used on cloud TPUs. This requires TensorFlow.

Read next

Google AdaNet, TensorFlow-based AutoML framework

Graph Nets – DeepMind’s library for graph networks in Tensorflow and Sonnet

A new Model optimization Toolkit for TensorFlow can make models 3x faster

Prasad Ramesh

Data science enthusiast. Cycling, music, food, movies. Likes FPS and strategy games.

Share
Published by
Prasad Ramesh

Recent Posts

Top life hacks for prepping for your IT certification exam

I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…

3 years ago

Learn Transformers for Natural Language Processing with Denis Rothman

Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…

3 years ago

Learning Essential Linux Commands for Navigating the Shell Effectively

Once we learn how to deploy an Ubuntu server, how to manage users, and how…

3 years ago

Clean Coding in Python with Mariano Anaya

Key-takeaways:   Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…

3 years ago

Exploring Forms in Angular – types, benefits and differences   

While developing a web application, or setting dynamic pages and meta tags we need to deal with…

3 years ago

Gain Practical Expertise with the Latest Edition of Software Architecture with C# 9 and .NET 5

Software architecture is one of the most discussed topics in the software industry today, and…

3 years ago