Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sparse matrix conversion for SciPy<Real/Imaginary>Evolver (backport #9598) #9600

Merged
merged 1 commit into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.