apply_bitflip_noise.m
Apply independent bit-flip noise to a 3-qubit state vector.
Source reference
Generated from repository source files and first-line comments during the Pages build.
Apply independent bit-flip noise to a 3-qubit state vector.
Deterministically apply a chosen error pattern [e1 e2 e3].
Apply an n-qubit Pauli string such as 'IXYZ' to a state vector.
Deterministically apply Z errors for a phase-flip pattern [e1 e2 e3].
Return the row-major 3x3 Bacon-Shor data-qubit layout.
Return true when Bacon-Shor residual X/Z chains have logical parity.
Stabilizer generators for the compact 3x3 Bacon-Shor subsystem code.
Syndrome for X errors in the 3x3 Bacon-Shor code.
Syndrome for Z errors in the 3x3 Bacon-Shor code.
Find the qubit whose parity-check column matches a syndrome row vector.
Number of physical qubits for a named code.
Monte Carlo tally of measured syndromes for N noisy trials.
Small triangular color-code layout metadata.
Return true for a residual color-code Pauli with logical support.
Stabilizer generators for the 7-qubit triangular color code.
Return computational basis vector |bits> for bits ordered q1...qn.
Build confusion matrix between true errors and inferred errors.
Apply single-qubit correction operator based on syndrome bits.
Correct any single-qubit Pauli error on the 7-qubit color code.
Correct any single-qubit Pauli error on the 5-qubit perfect code.
Apply single-qubit Z correction for the 3-qubit phase-flip code.
Correct any single-qubit Pauli error on the 9-qubit Shor code.
Correct any single-qubit Pauli error on the 7-qubit Steane code.
Minimum-weight single-qubit correction for a Pauli syndrome.
Decode a Bacon-Shor X-error syndrome to a representative X correction.
Decode a Bacon-Shor Z-error syndrome to a representative Z correction.
Decode logical bit by majority vote over 3 physical qubits.
Minimum-weight decoder for a 1D repetition-code syndrome.
Shared exhaustive minimum-weight decoder for compact surface-3 syndromes.
Minimum-weight decoder for X errors on the small distance-3 surface layout.
Minimum-weight decoder for Z errors on the small distance-3 surface layout.
Decode a generic surface-layout syndrome with a bounded syndrome-graph search.
Decode a generic surface-layout syndrome with a small-code-capacity decoder.
Decode a generic surface-layout syndrome with an MWPM-style decoder.
Lightweight peeling decoder for the generic surface layout.
Detect whether a state or Pauli error has nonzero [[4,2,2]] syndrome.
Encode |ψ> = α|0>+β|1> into 3-qubit repetition code.
Dispatch encoding for a named code.
Encode alpha|0>+beta|1> into the 7-qubit triangular color code.
Encode alpha|0>+beta|1> into the 5-qubit perfect code.
Encode two logical qubits into the [[4,2,2]] error-detecting code.
Encode alpha|0>+beta|1> into the 3-qubit phase-flip repetition code.
Encode alpha|0>+beta|1> into the 9-qubit Shor code.
Encode alpha|0>+beta|1> into the 7-qubit Steane code.
Monte Carlo histogram of number of flips under bit-flip channel.
Stabilizer generators for the 5-qubit perfect code.
Stabilizer generators for the [[4,2,2]] error-detecting code.
Map syndrome bits to most likely single-qubit error.
Iterated Kronecker product of all input matrices.
Projectively measure a Hermitian observable with eigenvalues +/-1.
Measure bit-flip syndrome and flip each reported syndrome bit with prob q.
Flip each reported surface-code syndrome bit with probability q.
Normalize a state vector and reject the zero vector.
Return standard single-qubit Pauli matrices I,X,Y,Z.
Return stabilizer syndrome bits for a Pauli error string.
Multiply Pauli strings, ignoring global phase.
Fast Pauli-error recovery check using stabilizer syndrome algebra.
Build an n-qubit Pauli string operator from characters I, X, Y, Z.
Print a short package summary.
Return the package version string.
Return computational basis states |0>,|1>.
Recover a Bacon-Shor Pauli-frame error string using row/column syndromes.
Correct the 3-qubit bit-flip code and preserve the encoded state.
Repeated noisy syndrome extraction for the 3-qubit bit-flip code.
Dispatch recovery for a named code.
Measure and correct a 7-qubit triangular color-code state.
Pauli-frame recovery for the 7-qubit triangular color code.
Measure and correct a 5-qubit perfect-code state.
Correct the 3-qubit phase-flip code and preserve the encoded state.
Measure and correct a 9-qubit Shor-code state.
Measure and correct a 7-qubit Steane-code state.
Decode X errors using repeated noisy Z-check syndrome measurements.
Decode Z errors using repeated noisy X-check syndrome measurements.
Randomly draw error pattern [e1 e2 e3] from bit-flip prob p.
Sample an n-qubit independent Pauli error string.
Simulate one Bacon-Shor Pauli-frame recovery trial under depolarizing noise.
End-to-end run: encode, apply noise, correct, decode.
Simulate one color-code Pauli-frame correction trial.
One depolarizing-noise recovery trial for a named code.
One bit-flip trial with noisy repeated syndrome measurements.
One circuit-level surface-3 trial with data, measurement, and hook faults.
One independent Pauli-noise decoding trial for the small surface-code model.
One X-noise trial with repeated noisy surface-code syndrome measurements.
One X-noise decoding trial for the small surface-code prototype.
One Z-noise trial with repeated noisy surface-code syndrome measurements.
One Z-noise decoding trial for the small surface-code prototype.
Simulate one generic surface-layout code-capacity Pauli correction trial.
Build an n-qubit operator with one non-identity Pauli at qubit q.
Return stabilizer generators for a named small code.
Fidelity between two pure state vectors, insensitive to global phase.
Parity-check matrix used by the 7-qubit Steane CSS code.
Directory for cached Monte Carlo sweep results.
Metadata stored with cached surface-3 Monte Carlo results.
Cache schema/model version for surface-3 Monte Carlo results.
Cached X/Z/Pauli surface-3 logical-failure sweep.
Cached repeated noisy-syndrome surface-3 sweep.
Return true when a residual chain has odd overlap with a logical set.
Logical-chain representatives for the compact 3x3 surface-code model.
Majority vote each syndrome bit across repeated measurement rounds.
Measurement schedule for the compact surface-3 circuit-level model.
X-check supports for the small distance-3 surface-code prototype.
Z-check syndrome caused by X errors on the small surface-code layout.
Z-check supports for a small distance-3 rotated surface-code layout.
X-check syndrome caused by Z errors on the small surface-code layout.
Read generic surface-layout benchmark defaults, environment, and CLI args.
Return generic surface-layout CSS check supports.
Cached bounded minimum-weight lookup for generic surface-layout syndromes.
Build a compact odd-distance surface-code-style square layout.
Return true when a residual chain has odd overlap with a logical line.
Syndrome of a binary data-qubit error against generic surface checks.
Estimate logical failure under independent depolarizing noise.
Estimate logical failure probability vs physical error p.
Compare repeated noisy syndrome rounds for the bit-flip code.
Exact logical failure by low Pauli-error weight for a named code.
Compare repeated noisy syndrome rounds for surface-3 X and Z channels.
Monte Carlo logical failure sweep for Pauli noise on the surface-code prototype.
Monte Carlo logical failure sweep for the small surface-code prototype.
Monte Carlo logical failure sweep for Z errors on the small surface-code prototype.
Compare generic surface-layout logical failure estimates across distances.
Projectively measure stabilizers Z1Z2, Z2Z3.
Measure triangular color-code CSS stabilizers.
Convert repeated syndrome measurements into detector-history differences.
Measure the four stabilizers of the 5-qubit perfect code.
Measure the two stabilizers of the [[4,2,2]] error-detecting code.
Projectively measure phase-flip code stabilizers X1X2, X2X3.
Measure Shor-code bit-flip and phase-flip stabilizer syndromes.
Measure Steane-code CSS stabilizers.
Print a compact benchmark table for the generic surface-layout decoder.
Check that selected plotting examples create their expected image files.
Generate a compact Markdown simulation report.
Minimal 3x3 Bacon-Shor Pauli-frame recovery example.
Minimal 3-qubit bit-flip recovery example.
Minimal 7-qubit triangular color-code recovery example.
Minimal 5-qubit perfect-code recovery example.
Minimal [[4,2,2]] error-detection example.
Minimal 3-qubit phase-flip recovery example.
Minimal variable-length repetition decoder example.
Minimal 9-qubit Shor-code recovery example.
Minimal 7-qubit Steane-code recovery example.
Minimal surface-3 circuit-level schedule example.
Minimal surface-3 syndrome and correction example.
Minimal variable-distance surface-layout decoder example.
Plot exact recovery failure by Pauli-error weight for several codes.
Plot confusion matrix (true vs inferred errors) as heatmap.
Plot depolarizing-noise logical failure for several QEC codes.
Plot distribution of error weights (0–3 flips).
Plot logical failure probability vs bit-flip probability p.
Plot effect of repeated noisy syndrome measurements.
Compare X-only, Z-only, and Pauli-noise logical failure for surface-3.
Plot logical failure for the small distance-3 surface-code prototype.
Plot effect of repeated noisy surface-3 syndrome measurements.
Plot generic surface-layout logical failure estimates across distances.
Plot histogram of measured syndromes at fixed p.
Regenerate all PNG figures under images/.
Simulate 3-qubit bit-flip code over range of p and plot fail rate.
Run non-plotting examples that print compact text output.
Longer walkthrough of the compact surface-3 prototype.
Octave-compatible test runner for the repository.
Compact 3x3 Bacon-Shor subsystem-code tests.
3-qubit bit-flip code tests.
7-qubit triangular color-code tests.
Decoder and simulator smoke tests.
3-qubit phase-flip code tests.
Single-qubit Pauli recovery tests for stabilizer codes.
Small surface-code prototype tests.
Generic odd-distance surface-layout tests.