-
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.
Fix compatibility issues with SciPy 1.14
The main change here is that SciPy 1.14 on macOS now uses the system Accelerate rather than a bundled OpenBLAS by default. These have different characteristics for several LAPACK drivers, which caused numerical instability in our test suite. Fundamentally, these problems existed before; it was always possible to switch out the BLAS/LAPACK implementation that SciPy used, but in practice, the vast majority of users (and our CI) use the system defaults. The modification to `Operator.power` to shift the branch cut was suggested by Lev. As a side-effect of how it's implemented, it fixes an issue with `Operator.power` on non-unitary matrices, which Sasha had been looking at. The modification to the Choi-to-Kraus conversion reverts back from a Schur-based decomposition to an `eigh`-based one. This was noted in a code comment that it was causing instability, and tracing the git history through to fdd5603 (gh-3884) suggests that this was around the time of Scipy 1.1 to 1.3, with OpenBLASes around 0.3.6. The bundled version of OpenBLAS with SciPy 1.13 was 0.3.27, so several releases on. If `eigh` problems re-appear, we can look at changing the decomposition back to something else, but the current `eigh` seems to be more stable than the Schur form for a wider range of inputs now. Co-authored-by: Lev S. Bishop <[email protected]> Co-authored-by: Alexander Ivrii <[email protected]>
- Loading branch information
1 parent
9a1d8d3
commit 87e9971
Showing
6 changed files
with
83 additions
and
36 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
fixes: | ||
- | | ||
Fixed :meth:`.Operator.power` when called with non-integer powers on a matrix whose Schur form | ||
is not diagonal (for example, most non-unitary matrices). | ||
- | | ||
:meth:`.Operator.power` will now more reliably return the expected principal value from a | ||
fractional matrix power of a unitary matrix with a :math:`-1` eigenvalue. This is tricky in | ||
general, because floating-point rounding effects can cause a matrix to _truly_ have an eigenvalue | ||
on the negative side of the branch cut (even if its exact mathematical relation would not), and | ||
imprecision in various BLAS calls can falsely find the wrong side of the branch cut. | ||
:meth:`.Operator.power` now shifts the branch-cut location for matrix powers to be a small | ||
complex rotation away from :math:`-1`. This does not solve the problem, it just shifts it to a | ||
place where it is far less likely to be noticeable for the types of operators that usually | ||
appear. | ||
See `#13305 <https://github.com/Qiskit/qiskit/issues/13305>`__. |
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