-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parameters in RXXGate #10697
Comments
This error is raised from the following method. qiskit/qiskit/circuit/parameterexpression.py Lines 474 to 482 in 57137ff
Check PR #10244 . |
I strongly suspect that this is the same root as #7326, because the internal definition of the multi-controlled |
Thanks for pointing out, hope to see the update soon! |
Sorry to come back to this after a long time with somewhat bad news: this isn't related to #9118, and the problem is that some of our controlled-gate synthesis code can't cope with parametrised gates in certain circumstances. In particular, we fail if asked to control a parametric from qiskit.circuit import QuantumCircuit, Parameter
a = Parameter("a")
qc = QuantumCircuit(1)
qc.rz(a, 0)
gate = qc.to_gate()
gate.control(2)
That example is the root cause of your bug. @ewinston, @alexanderivrii: do you two have any ideas of how we might go about modifying the synthesis to allow this? |
This is related to issue #10311. |
closing this issue as #12752 is merged |
Environment
python version 3.10.11
What is happening?
I'm trying to give
RXXGate
a parameterphi
when I encounter this error:ParameterExpression with unbound parameters ({Parameter(a)}) cannot be cast to a float.
Here is my codes:
However, it's interesting that everything works fine if the
control
method isn't used:which can give the result:
I'm wondering what I've done wrong and how to fix it?
Besides, is it possible for me to make this parameter trainable for optimization tasks like using gradient descend?
How can we reproduce the issue?
Perhaps making the Parameter class more flexible can help.
What should happen?
I suppose the gate should take this parameter and give it a random(or zero) initialization.
Any suggestions?
No response
The text was updated successfully, but these errors were encountered: