-
Notifications
You must be signed in to change notification settings - Fork 2.9k
add_control: check for predefined gates by type instead of name #3853
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
Closed
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
609dda5
add_control: check for predefined gates by type instead of name
willhbang b814cc7
Merge branch 'master' into gate-check
ewinston a1cabb8
handle controlled gates with empty definitions
willhbang 30c9fae
control(): check for u1 and u3 before unrolling
willhbang 4556eda
Merge remote-tracking branch 'upstream/master' into gate-check
willhbang ba1dc81
avoid unrolling standard controlled rotation gates
willhbang 8865cd8
revert handling for mcrz gates
willhbang 8bcd1a1
Merge branch 'master' into gate-check
willhbang 3e99934
drop dependency on dict preserving order for python3.5
willhbang a11bff7
Merge remote-tracking branch 'upstream/master' into gate-check
willhbang 2a46dc8
Merge branch 'master' into gate-check
ewinston File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| fixes: | ||
| - | | ||
| Fixes cases in add_control(). Non-standard gates that were unfortunately named | ||
| identically to some standard ones (in particular, X, RX, RY, RZ) would be | ||
| identified as those gates, and the control would be applied erroneously. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
@ewinston looks like a change in #3739, specifically here:
https://github.com/Qiskit/qiskit-terra/blob/025f6f9e73572a4aa608ac6e90bb1d7bc557e51f/qiskit/circuit/controlledgate.py#L85
is causing the definition get in this test to throw with
TypeError: can only concatenate list (not "NoneType") to listbecause the gate generated from this circuit has no definition.
Is that ok/expected, since the gate here is degenerate? I originally added no operations to the test circuit, since it wouldn't be relevant to the testing the name bug. If so i'll add some arbitrary gate to the circuit.
Uh oh!
There was an error while loading. Please reload this page.
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.
I think in this special case, where the controlled gate has an empty
_definition, thedefinitionmethod of ControlledGate should perhaps also return the same. Could you add anto
ControlledGate.definitionafter theelifclause to see if that resolves it?