Skip to content

Commit

Permalink
Fix sparse matrix conversion for SciPy<Real/Imaginary>Evolver (#9598)
Browse files Browse the repository at this point in the history
* Fix missing indent

* add reno

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit e8bfdda)
  • Loading branch information
Cryoris authored and mergify[bot] committed Feb 16, 2023
1 parent 1f12ffa commit 3703dc3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 4 additions & 4 deletions qiskit/algorithms/time_evolvers/classical_methods/evolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ def _operator_to_matrix(operator: BaseOperator | PauliSumOp):
"Trying dense computation",
type(operator),
)
try:
op_matrix = operator.to_matrix()
except AttributeError as ex:
raise AlgorithmError(f"Unsupported operator type `{type(operator)}`.") from ex
try:
op_matrix = operator.to_matrix()
except AttributeError as ex:
raise AlgorithmError(f"Unsupported operator type `{type(operator)}`.") from ex
return op_matrix


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

0 comments on commit 3703dc3

Please sign in to comment.