-
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
Gate.control(num_ctrl_qubits)
is not working when num_ctrl_qubits
> 1
#10311
Comments
can you pls assign me I would like to try it out! |
@shivalee12 Thanks! |
@ewinston @SimoneGasperini can you pls explain in detail what exactly is the issue |
@shivalee12 @ewinston Any update on this? I noticed that the same error occurs also for the multi-controlled from qiskit.circuit import Parameter
from qiskit.circuit.library import RZGate
p = Parameter('p')
mcrz = RZGate(p).control(2) Same happens calling directly the from qiskit.circuit import Parameter
from qiskit import QuantumCircuit
p = Parameter('p')
qc = QuantumCircuit(3)
qc.mcrz(p, q_controls=[0, 1], q_target=2) |
Gate.control(num_ctrl_qubits)
is not working for 2-qubit interaction gates and num_ctrl_qubits
> 1Gate.control(num_ctrl_qubits)
is not working when num_ctrl_qubits
> 1
I think that the problem is in the following code: multi_control_rotation_gates.py, lines:370-385. Notice that the same occurs for It's still not 100% clear to me how the implementation of these multi-control rotation gates works but I would like to work on this if possible. Maybe @jakelishman can give more details about the issue or any general idea on a potential fix? |
I don't have any immediate ideas about the best way to go about fixing the synthesis in these cases, because the majority of our controlled-gate synthesis routines work by numeric matrix decomposition. There's presumably abstract, matrix-free methods out there that we can use for these symbolic cases, but off the top of my head I don't know them, so I'd have to go search the literature a little for a sensible default algorithm. I know @alexanderivrii is reworking the organisation and structure of a lot of our controlled-gate synthesis code, so he's most likely to have ideas about a new strategy here. |
Symbolic decompositions could exist but the matrix elements could quickly become complex which may unreasonably slow things down. I'm not sure if there is a clean way to enable the user to make that determination so maybe the easiest thing to do is just raise with a message about requiring parameter binding or similar message. |
We're going to need to find a way to do symbolic decompositions in some form or another as we move to support more runtime parametrisation of circuits; longer term, we'll need to be able to compile (for example) a |
Another solution would be to use the |
Environment
What is happening?
The call
gate.control(num_ctrl_qubits)
is raising an unexpected error whengate
is one of the 2-qubit interactionRXXGate
,RYYGate
,RZZGate
,RZXGate
andnum_ctrl_qubits
is greater than 1.How can we reproduce the issue?
What should happen?
The code above should work and return a multi-controlled parametric
RXXGate
.The text was updated successfully, but these errors were encountered: