You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from qiskit.circuit import Parameter
a = Parameter('a')
a**2
will raise a TypeError: unsupported operand type(s) for ** or pow(): 'Parameter' and 'int' (tested with qiskit 0.44.1, qiskit-terra 0.25.1).
On the other hand, a**2 can be easily constructed as (2 * a.log()).exp() which yields ParameterExpression(a**2)
It seems reasonable to also implement Paramater.__pow__ at least for int or float powers? Or is there a reason why this is not implemented that I am missing?
The text was updated successfully, but these errors were encountered:
What should we add?
will raise a
TypeError
: unsupported operand type(s) for ** or pow(): 'Parameter' and 'int' (tested with qiskit 0.44.1, qiskit-terra 0.25.1).On the other hand, a**2 can be easily constructed as
(2 * a.log()).exp()
which yieldsParameterExpression(a**2)
It seems reasonable to also implement
Paramater.__pow__
at least for int or float powers? Or is there a reason why this is not implemented that I am missing?The text was updated successfully, but these errors were encountered: