Skip to content

Commit

Permalink
Reverse ordering to read out error in sampling measure (Qiskit#2003)
Browse files Browse the repository at this point in the history
* reverse ordering of read out error in sampling measure

* fix batch check

---------

Co-authored-by: Hiroshi Horii <[email protected]>
  • Loading branch information
doichanj and hhorii committed Nov 22, 2023
1 parent a261af2 commit e30bedb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion src/simulators/batch_shots_executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ template <class state_t>
void BatchShotsExecutor<state_t>::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<state_t>::run_circuit_with_sampling(circ, config, init_rng,
result_it);
}
Expand Down
2 changes: 1 addition & 1 deletion src/simulators/circuit_executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ void Executor<state_t>::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
Expand Down
2 changes: 1 addition & 1 deletion src/simulators/multi_state_executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ void MultiStateExecutor<state_t>::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
Expand Down

0 comments on commit e30bedb

Please sign in to comment.