-
Notifications
You must be signed in to change notification settings - Fork 382
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
Fix multi-controlled gates in name mapping #2326
base: main
Are you sure you want to change the base?
Conversation
These gates could not be instantiated due to a mismatch in the number of qubits with the base gate.
Unit test is failing because it needs #2327 to support the new Qiskit version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks fine to me, but do we need any unit tests here to validate that these classes work, and more importantly don't regress in the future?
I have just changed some existing tests to use the |
All gates from |
Summary
MCSXGate
,MCYGate
,MCZGate
,MCRXGate
,MCRYGate
,MCRZGate
,MCU3Gate
,MCUGate
, andMCSwapGate
can not be instantiated due to a mismatch in the number of qubits with the base gate:Details and comments
I came across this issue while writing a unit test for Qiskit/qiskit#13952.
Commit doichanj@4587384 (pull #1995) changed the base gates of these gates from non-controlled gates into singly controlled gates, which means there is one qubit too much in the base gate.
An alternative solution would be to reduce
num_ctrl_qubits
by one when callingControlledGate.__init__()
, but then the multi-controlled gates can only be created for two or more control qubits and one would need to extract the last qubit from the control state to pass it to the base gate.