forked from Qiskit/qiskit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
- Loading branch information
Showing
3 changed files
with
36 additions
and
14 deletions.
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
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
11 changes: 11 additions & 0 deletions
11
releasenotes/notes/add-skip_check-option-UnitaryGate-fb3fad8a9ac3c156.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,11 @@ | ||
--- | ||
features: | ||
- | | ||
Added a new argument, ``check_input``, to the constructor for the | ||
:class:`~.UnitaryGate` class. This flag is used to disable the default | ||
initialization checks that input object represents a unitary matrix. | ||
This can be used to speed up the creation of :class:`~.UnitaryGate` | ||
objects if you know the input is already a unitary matrix. This new option | ||
should only be used in these cases because if it's set to ``False`` and | ||
the input is not unitary this will result in an invalid ``UnitaryGate`` | ||
object. |