-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add check_input
option to UnitaryGate
#10660
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
Merged
Merged
Conversation
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 commit adds a new option to the unitary gate class's constructor, skip_check, which is used to skip the checking on the input unitary. When creating a unitary gates when you know the input is already unitary checking that the input matrix is unitary is wasted CPU time. This new option enables a user to assert the input is unitary and skip this checking (at their own risk). The primary use case for this is the consolidate blocks pass which is creating a large number of UnitaryGate objects and matrix is always going to be unitary. This new flag is used in ConsolidateBlocks to speed up the creation of gate objects.
One or more of the the following people are requested to review this:
|
Pull Request Test Coverage Report for Build 5894224571
💛 - Coveralls |
Cryoris
reviewed
Aug 18, 2023
check_input
option to UnitaryGate
jakelishman
reviewed
Sep 29, 2023
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.
This looks easy and sensible - only point is that I think a colon got lost by accident in a docstring.
mtreinish
commented
Oct 2, 2023
jakelishman
approved these changes
Oct 2, 2023
rupeshknn
pushed a commit
to rupeshknn/qiskit
that referenced
this pull request
Oct 9, 2023
* Add skip_check option to UnitaryGate This commit adds a new option to the unitary gate class's constructor, skip_check, which is used to skip the checking on the input unitary. When creating a unitary gates when you know the input is already unitary checking that the input matrix is unitary is wasted CPU time. This new option enables a user to assert the input is unitary and skip this checking (at their own risk). The primary use case for this is the consolidate blocks pass which is creating a large number of UnitaryGate objects and matrix is always going to be unitary. This new flag is used in ConsolidateBlocks to speed up the creation of gate objects. * Rename argument check_input * Fix rebase issues * Update qiskit/circuit/library/generalized_gates/unitary.py
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
Summary
This commit adds a new option to the unitary gate class's constructor, skip_check, which is used to skip the checking on the input unitary. When creating a unitary gates when you know the input is already unitary checking that the input matrix is unitary is wasted CPU time. This new option enables a user to assert the input is unitary and skip this checking (at their own risk). The primary use case for this is the consolidate blocks pass which is creating a large number of UnitaryGate objects and matrix is always going to be unitary. This new flag is used in ConsolidateBlocks to speed up the creation of gate objects.
Details and comments