The Unitary Foundation 2025 Quantum Open Source Software Survey is now open. Share your voice before it closes on October 3, 2025! Take the survey!
This dataset contains phase angles to approximate the function 1/x via Quantum Signal Processing (QSP) and Quantum Singular Value Transformation (QSVT).
Description of the dataset
QSVT and QSP are powerful quantum algorithms that implement a large class of polynomial transformations. However, many of the operators in these algorithms depend on a series of phase angles that correspond to the desired polynomial. While calculating these angles can be done efficiently in practice, it is not always straightforward. This dataset provides phase angles to implement QSVT and QSP for an approximation of 1/x, making it easy to implement this polynomial without additional calculations.
More specifically, we approximate f(x)=2κx1 with a Chebyshev polynomial, P(x). The values κ and ϵ define the approximation:
Additional Details
dataset.poly[epsilon][kappa]
. This returns an array where, for example, [1,0,2] corresponds to the polynomial 1⋅T0(x)+0⋅T1(x)+2⋅T2(x), where Tn(x) denotes the n-th Chebyshev polynomial.dataset.angles[routine][epsilon][kappa]
Graphical Representation
The following figure illustrates the polynomial approximation of f(x)=2κx1 with κ=250 and ϵ=0.01:
The blue line represents the polynomial approximation, the orange dashed line corresponds to f(x), and the red dashed lines show x=±1/κ.
Example usage
The following example shows how to plot the output of the QSVT algorithm and compare to the original Chebyshev approximation.
import pennylane as qml
import numpy as np
import matplotlib.pyplot as plt
[dataset] = qml.data.load("other", name="inverse")
angles_qsvt = dataset.angles["qsvt"]["0.01"]["100"]
outputs_qsvt = []
points = np.arange(-1, 1, 1/300)
for x in points:
# Encode x in the top left of the matrix
block_encoding = qml.RX(2 * np.arccos(x), wires=0)
projectors = [qml.PCPhase(angle, dim=1, wires=0) for angle in angles_qsvt]
@qml.qnode(qml.device("default.qubit"))
def circuit_qsvt():
qml.QSVT(block_encoding, projectors)
return qml.state()
output = qml.matrix(circuit_qsvt, wire_order=[0])()[0, 0]
outputs_qsvt.append(output.real)
poly = np.polynomial.Chebyshev(dataset.poly['0.01']['100'])
outputs_poly = [poly(point) for point in points]
plt.plot(points, outputs_qsvt, '.')
plt.plot(points, outputs_poly)
plt.show()
Guillermo Alonso
version 0.1 : initial public release
Guillermo Alonso
Quantum Scientist specializing in quantum algorithms