-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More conservative caching in the
CommutationChecker
(#13600)
* conservative commutation check * tests and reno * reno in the right location * more tests for custom gates (cherry picked from commit 93d796f)
- Loading branch information
1 parent
5c6cfe1
commit 7ea1f39
Showing
4 changed files
with
117 additions
and
31 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
18 changes: 18 additions & 0 deletions
18
releasenotes/notes/conservative-commutation-checking-b728e7b6e1645615.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,18 @@ | ||
--- | ||
fixes: | ||
- | | ||
Commutation relations of :class:`~.circuit.Instruction`\ s with float-only ``params`` | ||
were eagerly cached by the :class:`.CommutationChecker`, using the ``params`` as key to | ||
query the relation. This could lead to faulty results, if the instruction's definition | ||
depended on additional information that just the :attr:`~.circuit.Instruction.params` | ||
attribute, such as e.g. the case for :class:`.PauliEvolutionGate`. | ||
This behavior is now fixed, and the commutation checker only conservatively caches | ||
commutations for Qiskit-native standard gates. This can incur a performance cost if you were | ||
relying on your custom gates being cached, however, we cannot guarantee safe caching for | ||
custom gates, as they might rely on information beyond :attr:`~.circuit.Instruction.params`. | ||
- | | ||
Fixed a bug in the :class:`.CommmutationChecker`, where checking commutation of instruction | ||
with non-numeric values in the :attr:`~.circuit.Instruction.params` attribute (such as the | ||
:class:`.PauliGate`) could raise an error. | ||
Fixed `#13570 <https://github.com/Qiskit/qiskit/issues/13570>`__. | ||
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