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
When using SymEngine, sometimes a ParameterExpression wraps a SymEngine expression that is equivalent to a float. But trying to convert the ParameterExpression to a float fails with an error claiming that there are unbound parameters, when in fact all parameters are bound.
jlapeyre
changed the title
Incorrect error message when conversion of ParameterExpression to floatfails.
Incorrect error message when conversion of ParameterExpression to float fails.
Aug 15, 2023
Environment
What is happening?
When using SymEngine, sometimes a
ParameterExpression
wraps a SymEngine expression that is equivalent to a float. But trying to convert theParameterExpression
to a float fails with an error claiming that there are unbound parameters, when in fact all parameters are bound.How can we reproduce the issue?
The following prints
True
three times.But this fails:
The error message is misleading. The attempt made to cast to a float failed, but for a different reason.
What should happen?
Maybe
float
on the wrapped expression. Trap the attempt and print or forward the underlying reason (not implemented)complex
instead, check if the result is a float. If so return it, else raise error. This is the approach in Assign values directly to fully bound parameters in quantum circuits #10183Any suggestions?
No response
The text was updated successfully, but these errors were encountered: