Hi,
I have an issue when using qml.poly_to_angles(poly, “GQSP”).
The code is okay for num = 10 or below but it doesn’t work when num is greater than 10. I need to have num = 30.
import pennylane as qml
import numpy as np
from sympy import *
num=30 # at least 30
fac=5
def taylor(num):
taylor=np.ones(num+1)
for i in range(1,num+1):
taylor[i]=(-1)**i * 1/factorial(i)
return taylor
taylor(num)
poly = taylor(num)/fac
poly
angles = qml.poly_to_angles(poly, "GQSP")
angles
If you want help with diagnosing an error, please put the full error message below:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[111], line 1
----> 1 angles = qml.poly_to_angles(poly, "GQSP")
2 angles
File /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pennylane/templates/subroutines/qsvt.py:1117, in poly_to_angles(poly, routine, angle_solver)
1115 if not np.isclose(poly[-1], 0.0):
1116 break
-> 1117 poly.pop()
1119 if len(poly) == 1:
1120 raise AssertionError("The polynomial must have at least degree 1.")
AttributeError: 'numpy.ndarray' object has no attribute 'pop'
And, finally, make sure to include the versions of your packages. Specifically, show us the output of qml.about().
Name: PennyLane
Version: 0.40.0
Thanks,
HYW


