Skip to content

Commit 29ccca1

Browse files
Fix sparse matrix conversion for SciPy<Real/Imaginary>Evolver (#9598) (#9600)
* Fix missing indent * add reno --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit e8bfdda) Co-authored-by: Julien Gacon <gaconju@gmail.com>
1 parent 1f12ffa commit 29ccca1

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

qiskit/algorithms/time_evolvers/classical_methods/evolve.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ def _operator_to_matrix(operator: BaseOperator | PauliSumOp):
109109
"Trying dense computation",
110110
type(operator),
111111
)
112-
try:
113-
op_matrix = operator.to_matrix()
114-
except AttributeError as ex:
115-
raise AlgorithmError(f"Unsupported operator type `{type(operator)}`.") from ex
112+
try:
113+
op_matrix = operator.to_matrix()
114+
except AttributeError as ex:
115+
raise AlgorithmError(f"Unsupported operator type `{type(operator)}`.") from ex
116116
return op_matrix
117117

118118

Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
fixes:
33
- |
4-
Fixed a bug in :class:`~.minimum_eigensolvers.NumPyMinimumEigensolver` and
5-
:class:`~.eigensolvers.NumPyEigensolver` where operators that support conversion
4+
Fixed a bug in the NumPy-based eigensolvers
5+
(:class:`~.minimum_eigensolvers.NumPyMinimumEigensolver` /
6+
:class:`~.eigensolvers.NumPyEigensolver`)
7+
and in the SciPy-based time evolvers (:class:`.SciPyRealEvolver` /
8+
:class:`.SciPyImaginaryEvolver`), where operators that support conversion
69
to sparse matrices, such as :class:`.SparsePauliOp`, were converted to dense matrices anyways.

0 commit comments

Comments
 (0)