forked from Qiskit/qiskit
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix non-complex dtypes in OneQubitEulerDecomposer methods
This commit fixes a regression introduced in the rewrite of the internals of the OneQubitEulerDecomposer class to be in rust. Previously the angles() and angles_and_phase() methods of OneQubitEulerDecomposer would work with a non-complex dtype in the input, however because the rust component of the module is strictly typed to only work with a complex128 dtype passing the array to rust to compute the angles and phase of the unitary would fail. To address this limitation this commit casts the input matrix to be complex before passing it to the rust function. Fixes Qiskit#9827
- Loading branch information
Showing
3 changed files
with
52 additions
and
0 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
12 changes: 12 additions & 0 deletions
12
releasenotes/notes/fix-type-angles-euler-decompose-233e5cee7205ed03.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,12 @@ | ||
--- | ||
fixes: | ||
- | | ||
Fixed an issue with the :class:`~.OneQubitEulerDecomposer` class's methods | ||
:meth:`~.OneQubitEulerDecomposer.angles` and :meth:`~.OneQubitEulerDecomposer.angles_and_phase` | ||
would error if the input matrix was of a dtype other than ``complex``/``np.cdouble``. While | ||
only a complex matrix can be unitary if the imaginary component is 0 for | ||
all elements it could be represented by a different data type. In earlier | ||
releases this worked fine but this stopped working in Qiskit Terra 0.23.0 | ||
when the internals of :class:`~.OneQubitEulerDecomposer` were re-written | ||
in Rust. | ||
Fixed `#9827 <https://github.com/Qiskit/qiskit-terra/issues/9827>`__ |
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