Skip to content

moved 2 assign statments into depth for loop after averaging loop#509

Open
sam-vizvary-QM wants to merge 2 commits intomainfrom
2Q_RB_fix
Open

moved 2 assign statments into depth for loop after averaging loop#509
sam-vizvary-QM wants to merge 2 commits intomainfrom
2Q_RB_fix

Conversation

@sam-vizvary-QM
Copy link
Copy Markdown

The bug: These two lines are inside the n (averaging) loop but should be inside the depth loop:

assign(start, start + len_list_qua[run])
assign(run, run + 1)They advance the sequence pointer on every averaging shot instead of once per (sequence, depth) pair. This means each averaging shot plays a different circuit, and run quickly exceeds the len_list array bounds, producing bad data.

The fix: Move those two assign statements out of the for_(n, ...) loop into the for_(depth, ...) loop, and save/restore start so the same sequence replays for all averaging shots:

with for_(depth, 0, depth < len(depth_list), depth + 1):
assign(saved_start, start) # new variable, declared at program level
with for_(n, 0, n < n_avg_, n + 1):
...
play_sequence(sequence_qua, saved_start, len_list_qua[run])
...
assign(start, start + len_list_qua[run])
assign(run, run + 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants