Catalyst v0.8.1
New features
-
The
catalyst.mitigate_with_zne
error mitigation compilation pass now supports the option to fold gates locally as well as the existing method of globally. (#1006) (#1129)While global folding applies the scale factor by forming the inverse of the entire quantum circuit (without measurements) and repeating the circuit with its inverse, local folding instead inserts per-gate folding sequences directly in place of each gate in the original circuit.
For example,
import jax import pennylane as qml from catalyst import qjit, mitigate_with_zne from pennylane.transforms import exponential_extrapolate dev = qml.device("lightning.qubit", wires=4, shots=5) @qml.qnode(dev) def circuit(): qml.Hadamard(wires=0) qml.CNOT(wires=[0, 1]) return qml.expval(qml.PauliY(wires=0)) @qjit(keep_intermediate=True) def mitigated_circuit(): s = jax.numpy.array([1, 2, 3]) return mitigate_with_zne( circuit, scale_factors=s, extrapolate=exponential_extrapolate, folding="local-all" # "local-all" for local on all gates or "global" for the original method (default being "global") )()
>>> circuit() >>> mitigated_circuit()
Improvements
-
Fixes an issue where certain JAX linear algebra functions from
jax.scipy.linalg
gave incorrect results when invoked from within a qjit block, and adds full support for otherjax.scipy.linalg
functions. (#1097)The supported linear algebra functions include, but are not limited to:
Breaking changes
- The argument
scale_factors
ofmitigate_with_zne
function now follows the proper literature definition. It now needs to be a list of positive odd integers, as we don't support the fractional part. (#1120)
Bug fixes
- Those functions calling the
gather_p
primitive (likejax.scipy.linalg.expm
) can now be used in multiple qjits in a single program. (#1096)
Contributors
This release contains contributions from (in alphabetical order):
Joey Carter,
Alessandro Cosentino,
Paul Haochen Wang,
David Ittah,
Romain Moyard,
Daniel Strano,
Raul Torres.