Skip to content
Open
10 changes: 10 additions & 0 deletions releasenotes/notes/probabilities-0137851da6c25572.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
prelude: >
Fixed a crash that occurred when using the MPS simulator, but possibly in
other simulators as well, in AERState::probabilities().
fixes:
- |
The crash was generated by having op.qubits empty.
Refer to
`#2234 <https://github.com/Qiskit/qiskit-aer/issues/2234>` for more
information.
3 changes: 3 additions & 0 deletions src/controllers/state_controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,9 @@ std::vector<double> AerState::probabilities() {
op.string_params.push_back("s");
op.save_type = Operations::DataSubType::list;

for (uint_t i = 0; i < num_of_qubits_; ++i)
op.qubits.push_back(i);

last_result_ = ExperimentResult();
state_->apply_op(op, last_result_, rng_);

Expand Down
Loading