Enhance CompiledDetectorSampler.sample with postselection support#157
Enhance CompiledDetectorSampler.sample with postselection support#157axif0 wants to merge 2 commits into
CompiledDetectorSampler.sample with postselection support#157Conversation
…selected QEC simulations
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 37c180c842
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| discarded = (det_cols & postselect_direct).any(axis=1) | ||
|
|
||
| result[shot_idx : shot_idx + chunk] = direct_full |
There was a problem hiding this comment.
Zero direct observables on skipped discarded rows
When a masked direct detector discards a shot, this copies direct_full into the entire output row before skipping JAX, so any independent direct observable columns are returned with their sampled values even though the documented partial-row contract says discarded rows retain direct detector columns and fill all other columns with False. This shows up with append_observables/separate_observables on circuits where one direct detector is postselected and a different observable is also direct; the observable bits for rows that callers are told are partial can be nonzero and are not later reference-XORed.
Useful? React with 👍 / 👎.
Added an optional
postselection_maskargument toCompiledDetectorSampler.samplefor improved simulation efficiency. This allows for the discarding of shots based on masked detectors, optimizing performance by skipping the JAX autoregressive loop for direct discarded shots.Closes: #41