Skip to content

Commit

Permalink
raise_error
Browse files Browse the repository at this point in the history
  • Loading branch information
renatomello committed Oct 9, 2024
1 parent 4eab7bc commit d1046ba
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/qibo/backends/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,12 @@ def execute_circuit(self, circuit, initial_state=None, nshots=1000):
if circuit.measurements or circuit.has_collapse:
return self.execute_circuit_repeated(circuit, nshots, initial_state)
else:
raise RuntimeError(
"Attempting to perform noisy simulation with `density_matrix=False` and no Measurement gate in the Circuit. If you wish to retrieve the statistics of the outcomes please include measurements in the circuit, otherwise set `density_matrix=True` to recover the final state."
raise_error(
RuntimeError,
"Attempting to perform noisy simulation with `density_matrix=False` "
+ "and no Measurement gate in the Circuit. If you wish to retrieve the "
+ "statistics of the outcomes please include measurements in the circuit, "
+ "otherwise set `density_matrix=True` to recover the final state.",
)

if circuit.accelerators: # pragma: no cover
Expand Down

0 comments on commit d1046ba

Please sign in to comment.