PennyLane
  • Why PennyLane
  • Getting Started
  • Documentation
  • Ecosystem
Install
Install
  1. Blog/
  2. Releases/
  3. PennyLane v0.39 and Catalyst v0.9 released

November 05, 2024

PennyLane v0.39 and Catalyst v0.9 released

Isaac De Vlugt

Isaac De Vlugt

Josh Izaac

Josh Izaac

Diego Guala

Diego Guala

Anton Naim Ibrahim

Anton Naim Ibrahim

v0.39

Fall in love with PennyLane v0.39 and Catalyst v0.9 🍁😍!

Contents

  • Spin Hamiltonians πŸ’ž
  • The Lightning-tensor device ⚑️
  • Lightning-GPU is qjit-compatible 🦾
  • Catalyst peephole compilation passes πŸ“ˆ
  • Improvements πŸ› οΈ
  • Deprecations and breaking changes πŸ’”
  • Contributors ✍️

Spin Hamiltonians πŸ’ž

Quantum computing + spin Hamiltonians = easy as pie πŸ₯§

Spin Hamiltonians

Custom Hamiltonians beyond the available boiler-plate ones in the qml.spin module can be created with the addition of three new functions:

  • qml.spin.Lattice: a new object for instantiating customized lattices via primitive translation vectors and unit cell parameters,
    • qml.spin.generate_lattice: a utility function for creating standard Lattice objects, including 'chain', 'square', 'rectangle', 'triangle', 'honeycomb', 'kagome', 'lieb', 'cubic', 'bcc', 'fcc', and 'diamond',
    • qml.spin.spin_hamiltonian: generates a spin Hamiltonian object given a Lattice object with custom edges/nodes.

For example, consider a 3 \times 3 triangular lattice with open boundary conditions:

lattice = qml.spin.Lattice( n_cells=[3, 3], vectors=[[1, 0], [np.cos(np.pi/3), np.sin(np.pi/3)]], positions=[[0, 0]], boundary_condition=False )

We can validate this lattice against qml.spin.generate_lattice('triangle', ...) by checking the lattice_points (the (x, y) coordinates of all sites in the lattice):

>>> lp = lattice.lattice_points >>> triangular_lattice = qml.spin.generate_lattice('triangle', n_cells=[3, 3]) >>> np.allclose(lp, triangular_lattice.lattice_points) True

The edges of the Lattice object are nearest-neighbour by default, where we can add edges by using its add_edge method.

Additionally, three new industry-standard spin Hamiltonians are now available with PennyLane v0.39:

  • qml.spin.emery: the Emery model
  • qml.spin.haldane: the Haldane model
  • qml.spin.kitaev: the Kitaev model

These additions accompany qml.spin.heisenberg, qml.spin.transverse_ising, and qml.spin.fermi_hubbard, which were introduced in v0.38.

Stay tuned for a how-to demonstration on these new features in the days after the release!

The Lightning-tensor device ⚑️

A powerhouse simulator ready for hefty computations 🦾

Lightning-tensor

PennyLane v0.37 saw the addition of default.tensor, which is our simple simulator device meant for performing tensor network (TN) and matrix product state (MPS) simulations of wide quantum circuits. With PennyLane v0.39, we've brought MPS-backend simulations to lightning, our performance suite of simulator devices 😎, allowing you to perform simulations of circuits with hundreds of qubits 😱!

The lightning.tensor device is built on top of cuTensorNet, enabling GPU-accelerated simulation of quantum tensor network evolution. Lightning-tensor can be used like any other device in PennyLane:

dev = qml.device("lightning.tensor", wires=100, method="mps", max_bond_dim=64, cutoff=1e-10)

For a full list of features, consult the Lightning-tensor device documentation. To get started, install Lightning-tensor with

pip install cutensornet-cu12 pip install pennylane-lightning[tensor]

or check out the Lightning-tensor installation guide

Lightning-GPU is qjit-compatible 🦾

Bring the power of qjit to lightning.gpu 🀩

Lightning-GPU and qjit

Lightning-GPU is the latest device to now work with Catalyst, joining a growing list of simulators and hardware devices! Simply create the device with qml.device("lightning.gpu", wires=n_wires) and you're off to the races.

@qml.qjit @qml.qnode(qml.device("lightning.gpu", wires=2)) def circuit(theta): qml.Hadamard(wires=0) qml.RX(theta, wires=1) qml.CNOT(wires=[0,1]) return qml.expval(qml.PauliZ(wires=1))
>>> circuit(0.7) Array(0., dtype=float64)

To get started, make sure to install Lightning-GPU and visit the Lightning-GPU documentation for usage details.

Catalyst peephole compilation passes πŸ“ˆ

Peep this new Catalyst feature πŸ‘€

Peephole optimization

A "peephole optimization" involves replacing parts of compiler instructions with logically equivalent ones that have better performance. In this instance, a merge-rotations pass (which acts similarly to PennyLane's merge rotations transform), is now available at the MLIR level and can be applied to QNodes within a qjit-compiled function.

The merge_rotations pass can be provided to the catalyst.pipeline decorator:

from catalyst import pipeline, qjit my_passes = { "merge_rotations": {} } dev = qml.device("lightning.qubit", wires=1) @qjit @pipeline(my_passes) @qml.qnode(dev) def g(x: float): qml.RX(x, wires=0) qml.RX(x, wires=0) qml.Hadamard(wires=0) return qml.expval(qml.PauliX(0))

Improvements πŸ› οΈ

In addition to the new features listed above, this release contains a wide array of improvements and optimizations:

  • A new transform called qml.transforms.decompose has been added to better facilitate the custom decomposition of operators in PennyLane circuits.

    from functools import partial dev = qml.device('default.qubit') allowed_gates = {qml.Toffoli, qml.RX, qml.RZ} @partial(qml.transforms.decompose, gate_set=allowed_gates) @qml.qnode(dev) def circuit(): qml.Hadamard(wires=[0]) qml.Toffoli(wires=[0, 1, 2]) return qml.expval(qml.Z(0))
    >>> print(qml.draw(circuit)()) 0: ──RZ(1.57)──RX(1.57)──RZ(1.57)─╭●── <Z> 1: β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”œβ—β”€β”€ 2: ───────────────────────────────╰X──

    For more details, visit the documentation for qml.transforms.decompose.

  • Readout/measurement errors can now be included in qml.NoiseModel and qml.add_noise with the new qml.noise.meas_eq function. Readout errors can be specified in a similar fashion to regular gate noise in PennyLane: use qml.noise.meas_eq to specify a measurement function (e.g., qml.expval, qml.sample, or any other function that can be returned from a QNode) such that, when present in the QNode, a noisy operation is inserted. Readout noise in PennyLane also follows the insertion convention, where the specified noise is inserted before the measurement.

  • Polynomial functions can now be easily encoded into quantum circuits with qml.OutPoly.

  • PennyLane is now compatible with numpy==2.0 and jax==0.4.28.

Deprecations and breaking changes πŸ’”

As new things are added, outdated features are removed. To keep track of things in the deprecation pipeline, check out the deprecations page.

Here's a summary of what has changed in this release:

  • Python 3.9 is no longer supported. Please update to 3.10 or newer.

  • The qml.qinfo module has been deprecated. Please see the respective functions in the qml.math and qml.measurements modules instead.

  • default.qubit.tf, default.qubit.torch, default.qubit.jax, and default.qubit.autograd have been removed. Please use default.qubit for all interfaces.


These highlights are just scratching the surface β€” check out the full release notes for PennyLane and Catalyst for more details.

Contributors ✍️

As always, this release would not have been possible without the hard work of our development team and contributors:

Guillermo Alonso, Ali Asadi, Utkarsh Azad, Oleksandr Borysenko, Astral Cai, Joey Carter, Yushao Chen, Spencer Comin, Isaac De Vlugt, Diksha Dhawan, Amintor Dusko, Tarik El-Khateeb, Lillian M. A. Frederiksen, Pietropaolo Frisoni, Emiliano Godinez, Diego Guala, Anthony Hayes, Sengthai Heng, Austin Huang, Ivana KurečiΔ‡, Anton Naim Ibrahim, David Ittah, Josh Izaac, Soran Jahangiri, Jacob Kitchen, Korbinian Kottmann, Christina Lee, Mehrdad Malekmohammadi, William Maxwell, Luis Alfredo NuΓ±ez Meneses, Vincent Michaud-Rioux, Romain Moyard, Erick Ochoa Lopez, Lee J. O'Riordan, Mudit Pandey, Andrija Paurevic, Alex Preciado, Shuli Shu, Ashish Kanwar Singh, Daniel Strano, Raul Torres, Paul Haochen Wang, David Wierichs

About the authors

Isaac De Vlugt
Isaac De Vlugt

Isaac De Vlugt

My job is to help manage the PennyLane and Catalyst feature roadmap... and spam lots of emojis in the chat 🀠

Josh Izaac
Josh Izaac

Josh Izaac

Josh is a theoretical physicist, software tinkerer, and occasional baker. At Xanadu, he contributes to the development and growth of Xanadu’s open-source quantum software products.

Diego Guala
Diego Guala

Diego Guala

Diego is a quantum scientist at Xanadu. His work is focused on supporting the development of the datasets service and PennyLane features.

Anton Naim Ibrahim
Anton Naim Ibrahim

Anton Naim Ibrahim

Exploring uncharted territory.

Last modified:Β November 05, 2024

Related Blog Posts

PennyLane

PennyLane is an open-source software framework for quantum machine learning, quantum chemistry, and quantum computing, with the ability to run on all hardware. Built with ❀️ by Xanadu.

Stay updated with our newsletter

For researchers

  • Research
  • Features
  • Demos
  • Compilation
  • Datasets
  • Performance
  • Learn
  • Videos
  • Documentation
  • Teach

For learners

  • Learn
  • Codebook
  • Teach
  • Videos
  • Challenges
  • Demos
  • Compilation
  • Glossary

For developers

  • Features
  • Documentation
  • API
  • GitHub
  • Datasets
  • Demos
  • Compilation
  • Performance
  • Devices
  • Catalyst

Β© Copyright 2025 | Xanadu | All rights reserved

TensorFlow, the TensorFlow logo and any related marks are trademarks of Google Inc.

Privacy Policy|Terms of Service|Cookie Policy|Code of Conduct