PennyLane
Install
Install
  1. Blog/
  2. Algorithms/
  3. Fast and Efficient QSP/QSVT Angle Computation with JIT and Optax

December 02, 2026

Fast and Efficient QSP/QSVT Angle Computation with JIT and Optax

Oumarou Oumarou

Oumarou Oumarou

Catalina Albornoz

Catalina Albornoz

Ben Lau

Ben Lau

The PennyLane team believes that breakthrough research is powered by having state-of-the-art tools available to the researchers that use them. With these latest & greatest tools at your disposal, PennyLane paves a path from inspiration to implementation, quickly. In this blog, we walk you through the recent collaboration with Oumarou Oumarou, a PennyLane power-user and Quantum Scientist at Covestro, alongside their latest contribution of bringing a powerful feature to the rest of the community.

Open-source development is meant for collaboration. With PennyLane, we want users to have state-of-the-art tools right at their fingertips, when they really need it. Enabling breakthrough research and accelerating the path from inspiration to implementation is what PennyLane excels at. However, we do not achieve this alone; we achieve this in close collaboration with the researchers themselves.

In the era of Fault Tolerant Quantum Computers (FTQC), we’re likely to see a few ‘killer’ algorithms based on a set of key algorithmic primitives. Quantum Signal Processing (QSP) and Quantum Singular Value Transformation (QSVT) are versatile quantum algorithmic frameworks that underpin a wide range of applications, including quantum chemistry, quantum physics, and condensed matter physics. In this blog post we’ll show how an iterative-optax method for calculating the angles in QSP/QSVT runs about 7x faster than the existing iterative solver for high-degree polynomials. Follow along to learn more about this method and how to use it with PennyLane’s qp.poly_to_angles and qp.qsvt functions.

Computing the angles with non-iterative and iterative methods

For an admissible polynomial function f and a Hermitian operator A represented in block-encoded form, these techniques enable the construction of a block-encoding of f(A). This transformation is implemented through a parameterized quantum circuit whose depth, in terms of units of the block-encoding of A, scales linearly with the degree of the polynomial f. For an introduction to how to implement QSP/QSVT circuits in PennyLane the reader is advised to consult the Intro to QSVT demo.

The computation of the corresponding phase parameters is performed entirely through classical preprocessing and can be broadly categorized into two classes: non-iterative and iterative methods. Non-iterative approaches are generally well suited for small and medium polynomial degrees (up to approximately 1000). Their primary computational bottleneck arises from the need to compute the roots of auxiliary polynomials whose degrees are comparable to that of the target polynomial f, making them increasingly challenging to apply at higher degrees.

In contrast, iterative methods determine the phase parameters by progressively minimizing a cost function that quantifies the distance between the parameterized QSP/QSVT transformation and the target polynomial over a discretized set of points \{x_k\}. When employing the L-BFGS-B optimization algorithm, each iteration exhibits at most linear complexity with respect to the polynomial degree, rendering the iterative approach computationally less demanding and more scalable for high-degree polynomials.

The "iterative" option of the angle_solver keyword argument implements this optimization-based procedure using SciPy’s L-BFGS-B optimizer, leveraging JAX’s Just-In-Time (JIT) compilation for the functions responsible for computing intermediate quantities during the optimization process. The "iterative-optax" option instead uses the L-BFGS optimizer from Optax, which allows the optimization loop itself to be JIT-compiled, further reducing execution time. A performance comparison between the two approaches is presented in Figure 1, which shows an execution-time improvement of about 7x for polynomial degrees of 1000 and above.

Performance benchmarks

To benchmark the iterative method implemented with both "iterative" and "iterative-optax", we generated random polynomials with degrees ranging from d = 100 to d = 5000, hence going beyond the limit of the direct "root-finding" approach. Both solvers were run with their default settings: "iterative-optax" performs at most M = 100 L-BFGS iterations with a cost-function tolerance of 10^{-30}, while "iterative" uses SciPy's L-BFGS-B with a tolerance of 10^{-15}.

Both solvers reproduce the target polynomials to high accuracy, and "iterative-optax" is about 7x faster at degrees 1000, 2000, and 5000. These times exclude the one-time JIT compilation of "iterative-optax" at each degree. The benchmarks were conducted using JAX on a CPU-based platform. Consequently, the performance gains reported here may represent a conservative estimate, as execution on GPU hardware could further amplify the observed improvements.

Runtime of qp.poly_to_angles versus polynomial degree for the iterative and iterative-optax angle solvers

Figure 1: Runtime of qp.poly_to_angles as a function of polynomial degree for the "iterative" and "iterative-optax" angle solvers. Each point is the mean over 5 random polynomials, with error bars showing one standard deviation. Times exclude the one-time JIT compilation at each degree.

The code used to generate Figure 1 is available in the appendix at the end of this post.

Using the iterative Optax solver with PennyLane

For polynomials of degree up to roughly 1000, the default "root-finding" solver is usually the fastest option. Beyond that, its accuracy degrades, and an iterative solver is the better choice. Between the two iterative solvers, "iterative-optax" is the faster one, as Figure 1 shows.

If you want to obtain the QSP/QSVT angles, you can use the PennyLane qp.poly_to_angles function. As shown in the code below, you can specify the polynomial’s coefficients as a NumPy array, and then specify angle_solver="iterative-optax" in the function. Note that this solver requires jax and optax to be installed, with JAX running in 64-bit mode.

import jax
jax.config.update("jax_enable_x64", True)

import pennylane as qp
import numpy as np

# P(x) = x - 0.5 x^3 + 0.25 x^5
poly = np.array([0, 1.0, 0, -1/2, 0, 1/4])

qsvt_angles = qp.poly_to_angles(poly, "QSVT", angle_solver="iterative-optax")

>>> print(qsvt_angles)
[-4.72195181  1.59759041  1.12953403  1.12953403  1.59759041 -0.00956283]

If you don’t need the angles but instead want to prepare a QSVT circuit in PennyLane, you can use the qp.qsvt function. As shown in the code below, you can specify the Hamiltonian as well as a few keyword arguments, including angle_solver="iterative-optax".

hamiltonian = qp.dot([0.3, 0.7], [qp.Z(1), qp.X(1) @ qp.Z(2)])

dev = qp.device("default.qubit")

@qp.qnode(dev)
def circuit():
    qp.qsvt(
        hamiltonian,
        poly,
        encoding_wires=[0],
        block_encoding="prepselprep",
        angle_solver="iterative-optax",
    )
    return qp.state()

matrix = qp.matrix(circuit, wire_order=[0, 1, 2])()
>>> with np.printoptions(precision=3, suppress=True, linewidth=150): 
>>>     print(np.asarray(matrix))
[[ 0.238-0.264j  0.   +0.j     0.556-0.616j  0.   +0.j    -0.   -0.304j  0.   +0.j     0.   +0.304j  0.   +0.j   ]
 [ 0.   +0.j     0.238-0.264j  0.   +0.j    -0.556+0.616j  0.   +0.j    -0.   -0.304j  0.   +0.j    -0.   -0.304j]
 [ 0.556-0.616j  0.   +0.j    -0.238+0.264j  0.   +0.j     0.   +0.304j  0.   +0.j     0.   +0.304j  0.   +0.j   ]
 [ 0.   +0.j    -0.556+0.616j  0.   +0.j    -0.238+0.264j  0.   +0.j    -0.   -0.304j  0.   +0.j     0.   +0.304j]
 [-0.   +0.304j  0.   +0.j     0.   -0.304j  0.   +0.j     0.556+0.616j  0.   +0.j     0.238+0.264j  0.   +0.j   ]
 [ 0.   +0.j    -0.   +0.304j  0.   +0.j    -0.   +0.304j  0.   +0.j     0.556+0.616j  0.   +0.j    -0.238-0.264j]
 [ 0.   -0.304j  0.   +0.j     0.   -0.304j  0.   +0.j     0.238+0.264j  0.   +0.j    -0.556-0.616j  0.   +0.j   ]
 [ 0.   +0.j    -0.   +0.304j  0.   +0.j     0.   -0.304j  0.   +0.j    -0.238-0.264j  0.   +0.j    -0.556-0.616j]]

Just like that, in a single function, you can use state-of-the-art functionality that is powering new quantum computing research today!

Conclusion

PennyLane’s "iterative-optax" option, contributed to PennyLane by Oumarou Oumarou at Covestro, and available on qp.poly_to_angles and qp.qsvt, is a powerful way to scale QSP and QSVT workflows for polynomials with degrees over 1000. Use the examples above to test on your own workflows and leave a comment below to share how this scaled with your own workflows!

Stay up-to-date with all things PennyLane by signing up to our newsletter, or get the news directly in your feed on X (formerly Twitter) and LinkedIn!

Appendix: benchmark code

The code below reproduces Figure 1. It times qp.poly_to_angles with both solvers on random even polynomials, and averages over n_samples polynomials per degree. Each solver is called once per degree before timing starts, so that JIT compilation is not included. The degree-5000 runs take up most of the total runtime, so reduce degrees for a quick test.

import time
import matplotlib.pyplot as plt


def random_even_poly(degree, rng):
    """Random even polynomial with |P(x)| <= 0.9 on [-1, 1]."""
    coeffs = np.zeros(degree + 1)
    coeffs[0::2] = rng.uniform(-1, 1, size=degree // 2 + 1)
    return 0.9 * coeffs / np.sum(np.abs(coeffs))


degrees = [100, 1000, 2000, 5000]
n_samples = 5  # random polynomials per degree
solvers = ["iterative", "iterative-optax"]
rng = np.random.default_rng(seed=42)
runtimes = {solver: np.zeros((len(degrees), n_samples)) for solver in solvers}

for i, degree in enumerate(degrees):
    # Warm-up: JIT-compile once per degree, so compilation is not included in the timings
    for solver in solvers:
        jax.block_until_ready(
            qp.poly_to_angles(random_even_poly(degree, rng), "QSVT", angle_solver=solver)
        )
    for j in range(n_samples):
        poly = random_even_poly(degree, rng)
        for solver in solvers:
            start = time.perf_counter()
            angles = qp.poly_to_angles(poly, "QSVT", angle_solver=solver)
            jax.block_until_ready(angles)  # JAX runs asynchronously; wait for the result
            runtimes[solver][i, j] = time.perf_counter() - start
    print(f"degree {degree}: " + ", ".join(
        f"{s} {runtimes[s][i].mean():.1f} s" for s in solvers))

fig, ax = plt.subplots()
for solver, marker in zip(solvers, ["o", "s"]):
    ax.errorbar(degrees, runtimes[solver].mean(axis=1), yerr=runtimes[solver].std(axis=1),
                marker=marker, capsize=3, label=f'"{solver}"')
ax.set_xlabel("Polynomial degree")
ax.set_ylabel("Runtime (s)")
ax.grid(alpha=0.3)
ax.legend(frameon=False)

About the authors

Oumarou Oumarou
Oumarou Oumarou

Oumarou Oumarou

Quantum Computing scientist focusing on its application in Quantum Chemistry problems

Catalina Albornoz
Catalina Albornoz

Catalina Albornoz

Senior Research Engagement Manager at Xanadu

Ben Lau
Ben Lau

Ben Lau

Technical engagement manager at Xanadu

Last modified: December 02, 2026

Related Blog Posts

Never miss a milestone

Get the latest quantum updates delivered to your inbox.

Join the list
PennyLane

PennyLane is an open-source quantum software platform for quantum computing, quantum machine learning, and quantum chemistry. Create meaningful quantum algorithms, from inspiration to implementation.

Created with ❤️ by Xanadu.

Research

  • Research

  • Performance

  • Hardware and simulators

  • Demos library

  • Compilation hub

  • Quantum datasets

Education

  • Teach

  • Learn

  • Codebook

  • Coding challenges

  • Videos

  • Glossary

Software

  • Install

  • Features

  • PennyLane documentation

  • Catalyst documentation

  • Development guide

  • How-to guides

  • API

  • GitHub


Xanadu

© Copyright 2026 | Xanadu | All rights reserved

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

Privacy policyTerms of serviceCookies policyCode of conduct