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