Skip to content
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

disallow specifying controlled gate with zero controls. #4584

Merged
merged 7 commits into from
Jun 25, 2020

Conversation

ewinston
Copy link
Contributor

Summary

Previously, when calling a gate's control method it was possible to specify 0 controls in which case the original gate is returned.

Fixes #4576.

Details and comments

This pr requires that the number of control qubits be an integer in the range [1, num_qubits-1].

@ewinston ewinston requested a review from a team as a code owner June 16, 2020 09:57
kdk
kdk previously approved these changes Jun 18, 2020
qiskit/circuit/controlledgate.py Outdated Show resolved Hide resolved
Co-authored-by: Kevin Krsulich <kevin@krsulich.net>
kdk
kdk previously approved these changes Jun 18, 2020
@kdk kdk added automerge Changelog: Bugfix Include in the "Fixed" section of the changelog labels Jun 18, 2020
@kdk kdk removed the automerge label Jun 19, 2020
…250.yaml

Co-authored-by: Kevin Krsulich <kevin@krsulich.net>
@kdk kdk added the automerge label Jun 25, 2020
@mergify mergify bot merged commit a92cbfb into Qiskit:master Jun 25, 2020
faisaldebouni pushed a commit to faisaldebouni/qiskit-terra that referenced this pull request Aug 5, 2020
* disallow num_ctrl_qubits=0.

* update mcxgate

* doc typo in qiskit/circuit/controlledgate.py

Co-authored-by: Kevin Krsulich <kevin@krsulich.net>

* Update releasenotes/notes/disallow_num_ctrl_qubits_zero-eb102aa087f30250.yaml

Co-authored-by: Kevin Krsulich <kevin@krsulich.net>

Co-authored-by: Kevin Krsulich <kevin.krsulich@ibm.com>
Co-authored-by: Kevin Krsulich <kevin@krsulich.net>
@ewinston ewinston deleted the issue/4576 branch April 8, 2022 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When num_ctrl_qubits=0, creating controlled gates will produce an AttributeError
2 participants