Release News: Qiskit v0.44 is here!

Qiskit
Qiskit
Published in
7 min readAug 2, 2023

--

By Abby Mitchell, Luciano Bello, Jake Lishman and Shelly Garion.

Today, we’re excited to announce the release of Qiskit v0.44 (and it’s a doozy)! Read on for a summary of the key highlights, and as always, you can see the full release notes here.

Nick presents the 0.44 news in Breaking Changes.

The TL;DR

The biggest updates we’re going to cover in this article include the following:

  • Dynamic circuit support for transpiler optimization levels 2 and 3
  • Classical expressions for control flow operations
  • New synthesis algorithm based on this paper
  • New Matplotlib visualisations to improve control flow representation
  • Performance improvements for parameter binding and ConsolidateBlocks
  • qiskit.algorithms moved to external package
  • Python 3.7 support dropped

An Important Notice about Qiskit Packaging

With some older versions of Qiskit, if you ran pip install qiskit, you would get Qiskit (Terra), IBMQ Provider, Qiskit Aer and some applications modules installed by default. We have slowly been trimming down this “metapackage” architecture over the last few releases, and from this release onwards pip install qiskit will mean only installing Qiskit (i.e. qiskit-terra). This is part of a longer roadmap to simplify the packaging architecture, with the qiskit-terra repository due to be renamed to qiskit later this year. For more details on this migration, you can check out the RFC here.

Top New Features

In this section we’ll cover some of the most important new features and enhancements included in this release. If you want to know more about these, or other features that didn’t make it into this article, you can find the full list of new features here.

Additional support for Dynamic Circuits in the Transpiler

In Qiskit v0.39 we announced initial support of control flow operations for optimization levels 0 and 1, and with this release we are thrilled to announce support for levels 2 and 3 as well 🎉

For example, the following code example previously would only have worked with optimization_level set to 0 or 1, but now works with it set to 2 or 3 as well:

from qiskit import QuantumCircuit
from qiskit import transpile
from qiskit_aer import AerSimulator

qc = QuantumCircuit(2, 1)
qc.h(0)
qc.measure(0, 0)

# if classical bit is True, add an X and Y gate on q1, if False add
# a Y gate on q0
with qc.if_test((0, True)) as else_:
qc.x(1)
qc.y(1)
with else_:
qc.y(0)

transpile(qc, AerSimulator(), optimization_level=3)

In addition, all optimization levels will now use the more performant SabreLayout and SabreSwap under the hood (previously only available for non-control flow circuits).

Initial Support for Classical Expressions

With the addition of a new module qiskit.circuit.classical in this release, users are now able to implement a range of classical bit operations with dynamic circuits. The addition of this feature allows users to take greater advantage of the classical processing capabilities of IBM systems with dynamic circuits, which were previously impossible to represent with Qiskit.

Until this release, users could only perform minimal equality checks as part of their dynamic circuit computation. For example, the following code checks if the bitstring output of the circuit equals 5 (i.e. 101 was measured), and if true then adds an X gate:

from qiskit import QuantumCircuit
from qiskit.circuit import QuantumRegister, ClassicalRegister, Clbit

cr1 = ClassicalRegister(3, "cr1")
cr2 = ClassicalRegister(3, "cr2")
qc1 = QuantumCircuit(QuantumRegister(3), cr1, cr2)

with qc1.if_test((cr1, 5)):
qc1.x(0)

Using the new classical expressions available in the latest release, we can now implement a broader range of logical operations, such as checking equality between two different classical registers:

from qiskit.circuit.classical import expr

with qc1.if_test(expr.equal(cr1, cr2)):
qc1.x(0)

The classical expressions included in this new module are:

  • Bitwise “and”, implemented with expr.bit_and()
  • Bitwise “or”, implemented with expr.bit_or()
  • Bitwise “exclusive or”, implemented with expr.bit_xor()
  • Logical “and”, implemented with expr.logic_and()
  • Logical “or”, implemented with expr.logic_or()
  • Equal, implemented with expr.equal()
  • Not equal, implemented with expr.not_equal()
  • Less than, implemented with expr.less()
  • Less than or equal to, implemented with expr.less_equal()
  • Greater than, implemented with expr.greater()
  • Greater than or equal to, implemented with expr.greater_equal()

Users can employ these classical expressions with the if_test, while_loop and switch control flow operations.

Note: At the time of release not all the classical expressions listed above are fully implementable with IBM backends. IBM’s hardware is in rapid development, and we want to ensure users can access these advancements as soon as possible without having to wait for the next Qiskit release. Hence, we have made some functionality available in Qiskit in preparation for future hardware advancements, as well as current capabilities. You can find more details on the classical computation currently supported by IBM here.

Control Flow Representation for the mpl Circuit Drawer

More dynamic circuit functionality! With all these new control flow operations coming out in recent releases, the big question is how can we represent these different capabilities visually with circuits? Until now we have been using a basic black box representation which, we know, doesn’t communicate much:


┌───┐┌─┐┌──────────┐
q_0: ┤ H ├┤M├┤0 ├
└───┘└╥┘│ │
q_1: ──────╫─┤1 If_else ├
║ │ │
c: ══════╩═╡0 ╞
└──────────┘

So as part of this release we’ve included functionality for clearer representation of these operations with our mpl drawer! 🎉

For example, the following conditional if/else statement and mpl output would look like this:

qr = QuantumRegister(4, "q")
cr = ClassicalRegister(2, "cr")
circuit = QuantumCircuit(qr, cr)

with circuit.if_test((cr[1], 1)) as _else:
circuit.h(0)
circuit.cx(0, 1)
with _else:
circuit.cx(0, 1)

(Special shoutout to Ed Navarro for his significant contributions to this feature 🎉)

New Synthesis Algorithm

A new algorithm for linear nearest neighbor connectivity synthesis has been added, based on this paper from Maslov and Yang. This is a synthesis algorithm for CX-CZ circuits on linear nearest neighbor connectivity, and is now the default synthesis method for .synth_clifford_depth_lnn(). This algorithm can reduce the circuit depth of a Clifford decomposition from 9n+4 to 7n+2.

Users can initialise this algorithm like so, using a binary invertible matrix (mat_x) representing the CX-circuit, and a binary symmetric matrix mat_z representing the CZ-circuit:

import numpy as np
from qiskit.synthesis.linear_phase import synth_cx_cz_depth_line_my

mat_x = np.array([[0, 1], [1, 1]])
mat_z = np.array([[0, 1], [1, 0]])
qc = synth_cx_cz_depth_line_my(mat_x, mat_z)

Performance Improvements

In this section we’ll cover the most significant performance improvements that users will gain with this release.

Parameter Binding

Using QuantumCircuit.assign_parameters and QuantumCircuit.bind_parameters is now much faster for certain workflows, particularly those commonly used for applications development. Additionally, users can leverage 2 new keyword arguments, flat_input and strict , when using the assign_parameters method for additional speedups when using dictionary format parameters.

For example, the following code would demonstrate a noticeable speedup from switching to the latest version of Qiskit:

import math
from qiskit.circuit.library import EfficientSU2

qc = EfficientSU2(100, entanglement="linear", reps=100)
qc.measure_all()
ps = {x: math.pi / 2 for x in qc.parameters}

qc.assign_parameters(ps)
performance analysis for transpile() using EfficientSU2 circuits, comparing Qiskit 0.44 with previous release.

ConsolidateBlocks

The internals of the ConsolidateBlocks transpiler pass has been refactored, resulting in a speedup in transpilation time. Users do not need to change their implementations, but should notice a speedup particularly when using .transpile() with optimization_level=3.

New Deprecations

In this section we’ll cover some of the most important new deprecations in this release. This section aims to highlight things that will now start throwing deprecation warnings and which will be removed in a later release, following Qiskit’s Deprecation Policy (documented in full here). For guidance on how to deal with deprecation warnings, check out the deprecations section in our previous article here. You can see more detail about the deprecations specific to this release here.

qiskit.algorithms

The algorithms module has been migrated to a standalone package called qiskit-algorithms. The migration of this module will follow the normal Qiskit deprecation procedure, with the current import path being deprecated and the actual removal scheduled for no sooner than 3 months after the release date. Users can start using the separate algorithms package straight away by doing the following:

pip install qiskit_algorithms

...

import <algorithm> from qiskit_algorithms

...

The migration of the algorithms module is part of the ongoing process to simplify the Qiskit packaging architecture, making the core codebase leaner and easier to integrate with other packages in future. For more details on this you can check out the RFC here.

qiskit.__qiskit_version__

In previous versions of Qiskit, users could use this method to get the version information for the multiple packages included in the Qiskit metapackage installation. As mentioned above, the Qiskit metapackage architecture will be adjusted in the coming months, so this version function will no longer be required. Users will be able to check which version of Qiskit they have installed using qiskit.__version__ instead.

Breaking Changes

In this section we’ll highlight any changes that could cause user’s existing code to break when updating to this latest version, such as deprecated classes/functions that have now been removed.

Python 3.7 support

As Python 3.7 reached end-of-life in June 2023, support for it was deprecated in Qiskit v0.40 and has now been fully removed in this release. Going forward, users should ensure they are using Qiskit in a Python environment that has Python 3.8 or later installed.

And there you have it! The most important details of the latest release. Remember that if you want to put ideas forward for future versions of Qiskit, you can always open a GitHub issue to request a feature or report a bug! And if you want to follow what’s coming up in the next release (as well as releases for other packages in the Qiskit Ecosystem) you can take a look at the Qiskit Release Planning Wiki.

Many people contributed to this release, special thanks to (in alphabetical order): Abby Mitchell, Adenilton Silva, Alberto Maldonado, Alexander Ivrii, Alexandre, Ali Javadi, Amol Deshmukh, Angelo Danducci, anisha-bopardikar, Artemiy Burov, artemiyburov, atharva-satpute, Blesso Abraham, Caleb Johnson, chriseclectic, Christopher Zachow, Cristian Emiliano Godinez Ramirez, Daniel Egger, daniel-fry, danielleodigie, derwind, Diego Emilio Serrano, Edwin Navarro, Elena Peña Tapia, Eric Arellano, Erick Winston, Etienne Wodey, Evan McKinney, Evgenii Zheltonozhskii, ewinston, Frank Harkins, Giacomo Ranieri, Guillermo-Mijares-Vilarino, Ian Hincks, Isaac Cilia Attard, IsmaelCesar, Israel F. Araujo, Jake Lishman, James R. Garrison, John Lapeyre, jsmallz333, Julien Gacon, Junya Nakamura, Junye Huang, Kazuki Tsuoka, Kento Ueda, Kevin Hartman, Kevin J. Sung, Kevin Krsulich, Lev S. Bishop, Luciano Bello, Matthew Treinish, Mirko Amico, Mu-Te, Joshua Lau, Naoki Kanazawa, Paul Schweigert, Payal D. Solanki, Pranay, Barkataki, Rafaella Vale, Raghav, Raynel Sanchez, Shelly Garion, Simone Gasperini, Slope, Soolu Thomas, Steve Wood, Takashi Imamichi, thiagom123, thspreetham98, Tommy Chu, Toshinari Itoko, TsafrirA, Vicente P. Soloviev, Will Shanks, Willers Yang, Zain Mughal.

--

--

Qiskit
Qiskit

An open source quantum computing framework for writing quantum experiments and applications