diff --git a/releasenotes/notes/fix_sample_measure_roerr-747b955aa2bf778c.yaml b/releasenotes/notes/fix_sample_measure_roerr-747b955aa2bf778c.yaml new file mode 100644 index 0000000000..a36e891c3d --- /dev/null +++ b/releasenotes/notes/fix_sample_measure_roerr-747b955aa2bf778c.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Fixes order of applying read out error in sampling measure + in circuit executors. Ordering is reversed to fit to the older verison + of Aer. + Also fixed check of bacth execution. diff --git a/src/simulators/batch_shots_executor.hpp b/src/simulators/batch_shots_executor.hpp index ec98965846..6776bb26de 100644 --- a/src/simulators/batch_shots_executor.hpp +++ b/src/simulators/batch_shots_executor.hpp @@ -150,7 +150,7 @@ template void BatchShotsExecutor::run_circuit_with_sampling( Circuit &circ, const Config &config, RngEngine &init_rng, ResultItr result_it) { - if (circ.num_bind_params == 1 || !enable_batch_multi_shots_) { + if (!enable_batch_multi_shots_) { return Executor::run_circuit_with_sampling(circ, config, init_rng, result_it); } diff --git a/src/simulators/circuit_executor.hpp b/src/simulators/circuit_executor.hpp index 02f00224a6..aa8d70d761 100644 --- a/src/simulators/circuit_executor.hpp +++ b/src/simulators/circuit_executor.hpp @@ -1073,7 +1073,7 @@ void Executor::measure_sampler(InputIterator first_meas, uint_t num_registers = (register_map.empty()) ? 0ULL : 1 + register_map.rbegin()->first; ClassicalRegister creg; - for (int_t i = 0; i < all_samples.size(); i++) { + for (int_t i = all_samples.size() - 1; i >= 0; i--) { creg.initialize(num_memory, num_registers); // process memory bit measurements diff --git a/src/simulators/multi_state_executor.hpp b/src/simulators/multi_state_executor.hpp index 27e533c702..be578c0da3 100644 --- a/src/simulators/multi_state_executor.hpp +++ b/src/simulators/multi_state_executor.hpp @@ -863,7 +863,7 @@ void MultiStateExecutor::measure_sampler(InputIterator first_meas, (memory_map.empty()) ? 0ULL : 1 + memory_map.rbegin()->first; uint_t num_registers = (register_map.empty()) ? 0ULL : 1 + register_map.rbegin()->first; - for (int_t i = 0; i < all_samples.size(); i++) { + for (int_t i = all_samples.size() - 1; i >= 0; i--) { ClassicalRegister creg = state.creg(); // process memory bit measurements