From 57d0b56435ea2b88f48d6af6ce279e9001ea9b8b Mon Sep 17 00:00:00 2001 From: Julien Gacon Date: Thu, 16 Feb 2023 10:59:38 +0100 Subject: [PATCH] Fix sparse matrix conversion for `SciPyEvolver` (Qiskit/qiskit-terra#9598) * Fix missing indent * add reno --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- .../time_evolvers/classical_methods/evolve.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qiskit_algorithms/time_evolvers/classical_methods/evolve.py b/qiskit_algorithms/time_evolvers/classical_methods/evolve.py index e0500266..c170a29e 100644 --- a/qiskit_algorithms/time_evolvers/classical_methods/evolve.py +++ b/qiskit_algorithms/time_evolvers/classical_methods/evolve.py @@ -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