This repository has been archived by the owner on Dec 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 376
Make ListOp.num_qubits check all ops for same num_qubits #1189
Merged
woodsp-ibm
merged 4 commits into
qiskit-community:master
from
jlapeyre:listop-check-num-qubits
Aug 21, 2020
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
fcaf075
Make ListOp.num_qubits check all ops for same num_qubits
jlapeyre 72e0bb6
Merge branch 'master' into listop-check-num-qubits
jlapeyre a3e829a
Add release note for listop-check-num-qubits
jlapeyre f166f99
Merge branch 'master' into listop-check-num-qubits
manoelmarques 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 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
7 changes: 7 additions & 0 deletions
7
releasenotes/notes/listop-check-num-qubits-ce3a02fcc862771a.yaml
This file contains 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,7 @@ | ||
--- | ||
fixes: | ||
- | | ||
Make ListOp.num_qubits check that all ops in list have the same num_qubits | ||
Previously, the number of qubits in the first operator in the ListOp | ||
was returned. With this change, an additional check is made that all | ||
other operators also have the same number of qubits. |
This file contains 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.
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.
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.
self.oplist[1:]
is likely less efficient thanself.oplist
because the former allocates and makes a copy of the list, whereas the latter adds one dereference and integer comparison... On the other hand, efficiency is not a design criterion for aqua, and using the slice signals algorithmic intent.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.
The fact that it ends up checking itself is fine - what we care about is that they are all the same, whichever one we pick as some reference.