Add composable qubit stochastic channels - #518
Draft
qciaran wants to merge 1 commit into
Draft
Conversation
qciaran
force-pushed
the
general-noise-transition-channels
branch
from
August 14, 2026 22:45
e3c2276 to
d0a346a
Compare
qciaran
force-pushed
the
general-noise-transition-channels
branch
from
August 17, 2026 15:58
d0a346a to
4acff9e
Compare
qciaran
force-pushed
the
general-noise-transition-channels
branch
2 times, most recently
from
August 17, 2026 17:13
3430cc7 to
2433b50
Compare
qciaran
force-pushed
the
general-noise-transition-channels
branch
from
August 17, 2026 17:52
2433b50 to
81a3534
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
QubitStochasticChannel, a reusable single-qubit stochastic channel over PECOS's effective{|0>, |1>, |L>}spaceX,Y,Z, reset-like0->1/1->0, wildcard leakage*->L(withLas an alias), state-selective leakage0->L/1->L, and recoveryL->0/L->1QubitStochasticChannel::leak_recovery(p, p_zero)for models such as 90% recovery per leaked qubit at every two-qubit gate*for state wildcards by replacing QECp2_weightsreplacement labels with compact~XXand explicit:replace:XXspellingsChannel probability model
Each channel has an overall component-selection probability
pand a map of non-negative relative event weights. The weights are normalized internally and do not need to sum to one. If the event coin fails, the effective-qutrit identity is implicit; users do not need to include a near-one identity weight.For event weight
w_i, componentiis selected with probabilityp * w_i / sum(w). A selected component can preserve some inputs: for example,L->0preserves computational inputs, while0->1is a reset-like map to|1>and therefore already preserves|1>. Consequently,pis the chance of selecting a component map, not necessarily the chance that every input changes.These are fixed stochastic mixtures of named CPTP component maps, not an arbitrary Kraus-operator interface. PECOS tracks computational-versus-leaked occupation classically and does not preserve coherence between those sectors. State-selective
0->Land1->Lcomponents use an internal Z measurement and leak only the matching population; the internal result is consumed by the noise model and never returned as a program measurement.The existing p1/p2 Pauli and emission models remain unchanged and are still the preferred APIs for ordinary gate-local Pauli noise. Stochastic channels are intended for leakage/recovery composition or explicit before/after placement. Channel application probabilities follow the existing global and p1/p2 scale factors;
*->Lalso follows the existingleakage_scalebehavior.Ordering
Before-gate stacks run before leakage suppression and ordinary gate noise, so recovery can allow an incoming leaked qubit to participate in the ideal gate and leakage can suppress it. After-gate stacks run after ideal-gate processing and ordinary Pauli/emission noise, so they can recover either incoming leakage or leakage generated at the same gate. All channels at a hook execute in insertion order and recompute leakage state between components. The p2 after-gate stack runs before configured after-2Q idle noise.
Existing
GeneralNoiseModelbehavior is unchanged when no stochastic channels are configured. Correlated pair components such asxy->wzremain a future extension.QEC replacement-label syntax
Plain
p2_weightslabels such asXXremain post-gate Pauli branches. Replacement branches now use either~XXor the equivalent:replace:XX;~II/:replace:IImeans omit the ideal gate without applying a Pauli. Providing both aliases for the same normalized branch is rejected. The former*XXspelling is deliberately rejected with a migration hint so that*has one consistent meaning: an input-state wildcard such as*->L.Validation
cargo fmt --all -- --checkcargo test -p pecos-engines --lib: 193 passedcargo test -p pecos-qec --lib: 637 passedcargo check -p pecos-rslib --testscargo clippy -p pecos-engines -p pecos-qec -p pecos-rslib --all-targets -- -D warningscargo test -p pecos-engines --doc: 24 passed, including compile-fail examplesgit diff --checkThe focused
pecos-rslibunit-test executable cannot link on this machine because its configured Xcode Python 3.9 library path is absent; the binding and its new parser tests do pass the test-target type check.Follow-up
The Selene PECOS wrapper does not yet expose
GeneralNoiseModelstochastic-channel stacks. That wrapper integration can follow once this core API is agreed.