Quantum Error Correction · Memory experiments
Repetition code memory (bit-flip)
Monte Carlo logical error rate of the n-qubit bit-flip repetition code under i.i.d. bit flips, beside the exact binomial value.
Enumerate every single-qubit Pauli error on the Steane code, verify its syndrome and correction, and show where distance 3 stops.
Officially provided by KetQat — method by Steane (1996), Steane (1996) and others. KetQat prepares, verifies and maintains this product; it does not claim to have invented the method. Read the origin statement.
Checks the Steane [[7,1,3]] code exhaustively on your machine. Weight-1 Pauli errors on 7 qubits number exactly 21, so the product enumerates all of them: it builds the syndrome table from binary symplectic arithmetic (each error commutes or anticommutes with each of the six stabiliser generators) and confirms that every syndrome is non-zero and unique. Independently, it encodes |0_L> as a 128-amplitude state vector by projecting onto the stabiliser eigenspace, applies each error, measures the syndrome by projection, applies the table's correction and requires fidelity 1 with the original. It then classifies all 189 weight-2 errors: every one is detected, those whose syndrome coincides with a weight-1 error are miscorrected into a logical error, and the rest are flagged as uncorrectable -- which is what distance 3 means.
You can also apply one Pauli error of your choice to |0_L>, |1_L> or |+_L> and see the syndrome, the decoder's correction, the residual operator and the fidelity afterwards.
Installs the KetQat SDK from commit 2cedabbd814f, the exact version whose product definition this page shows. The SDK is not on PyPI yet, so pip install ketqat alone will not work.
pip install "ketqat[qinfo] @ git+https://github.com/ketqat/ketqat-sdk@2cedabbd814fd199b1989c8ceb1e9efa1744c2c0#subdirectory=python"Save it as example.py and run python example.py. Or use the CLI: ketqat catalog run [email protected].
import json
from ketqat_runner import catalog
record = catalog.run("[email protected]", logical_state="zero", error="XXIIIII")
result = record.result
single, two, applied = result["single_qubit_errors"], result["weight_two_errors"], result["applied_error"]
print(json.dumps({
"status": record.status,
"single_qubit_errors_checked": single["count"],
"distinct_syndromes": single["distinct_syndromes"],
"all_recovered": single["all_recovered"],
"weight_two_detected": two["detected"],
"weight_two_miscorrected": two["miscorrected_to_a_logical_error"],
"weight_two_flagged": two["flagged_uncorrectable"],
"chosen_error_corrected": applied["corrected"],
"chosen_error_residual_action": applied["residual_logical_action"],
}))
{
"status": "succeeded",
"all_recovered": true,
"distinct_syndromes": 21,
"weight_two_flagged": 126,
"weight_two_detected": 189,
"chosen_error_corrected": false,
"weight_two_miscorrected": 63,
"single_qubit_errors_checked": 21,
"chosen_error_residual_action": "X"
}Verified with
ketqat report RUN_ID sends an opt-in usage report: product, version, succeeded/failed, time and SDK version only. It shows you the exact payload first and needs an API token from Settings. Nothing is sent unless you run it.
| Name | Type | Default | Allowed values | Description |
|---|---|---|---|---|
| logical_state | string | zero | enum: zero, one, plus | Logical state the chosen error is applied to: zero (|0_L>), one (|1_L> = X_L|0_L>) or plus ((|0_L> + |1_L>)/sqrt 2). |
| error | string | null | — | A 7-letter Pauli string over I, X, Y, Z to apply to the logical state, e.g. IIXIIII or XXIIIII. null applies no chosen error. |
| exhaustive | boolean | true | — | Run the full enumeration of weight-1 and weight-2 errors. false runs only the chosen error (which is then required). |
| Name | Type | Description |
|---|---|---|
| single_qubit_errors | object | Count (21), distinct syndromes (21), all detected and uniquely identified, and the independent state-level count recovered with fidelity 1. |
| weight_two_errors | object | Count (189), how many are detected, how many have a syndrome matching a weight-1 error (and are miscorrected into a logical error), how many are flagged uncorrectable, and an example. |
| syndrome_table | object | The 21 syndromes (six bits, one per stabiliser generator) and the weight-1 error each identifies. |
| applied_error | object | For a chosen error: its syndrome by commutation and by projection, the correction applied (or that it was flagged), the residual operator and its logical action, and the fidelity after correction. |
All 21 weight-1 Pauli errors have distinct non-zero syndromes and all 21 are recovered at the state level with fidelity 1. All 189 weight-2 errors are detected: 63 share a syndrome with a weight-1 error and are miscorrected into a logical error (for example XXIIIII becomes XXXIIII), 126 are flagged uncorrectable.
Generated with
{"error":null,"exhaustive":true,"logical_state":"zero"}{
"code": "Steane [[7,1,3]] CSS code",
"execution": "syndromes by binary symplectic arithmetic; state-level checks on a 128-amplitude state vector",
"stabilizers": [
"IIIXXXX",
"IXXIIXX",
"XIXIXIX",
"IIIZZZZ",
"IZZIIZZ",
"ZIZIZIZ"
],
"distance_limit": {
"claim": "Weight-2 errors exist whose syndrome matches a weight-1 error, so the decoder applies the wrong correction. This is what distance 3 means: correct one, detect two. The code does not correct two, and reporting otherwise would misdescribe it.",
"example": {
"actual": "XXIIIII",
"syndrome": "(0, 0, 0, 0, 1, 1)",
"decoder_applies": "IIXIIII"
},
"miscorrected_ordered_pairs": 126
},
"syndrome_table": {
"100000": "IIIZIII",
"100100": "IIIYIII",
"101000": "IIIIZII",
"101101": "IIIIYII",
"110000": "IIIIIZI",
"110110": "IIIIIYI",
"111000": "IIIIIIZ",
"111111": "IIIIIIY",
"000001": "XIIIIII",
"000010": "IXIIIII",
"000011": "IIXIIII",
"000100": "IIIXIII",
"000101": "IIIIXII",
"000110": "IIIIIXI",
"000111": "IIIIIIX",
"001000": "ZIIIIII",
"001001": "YIIIIII",
"010000": "IZIIIII",
"010010": "IYIIIII",
"011000": "IIZIIII",
"011011": "IIYIIII"
},
"errors_enumerated": 21,
"logical_operators": {
"X": "XXXXXXX",
"Z": "ZZZZZZZ"
},
"weight_two_errors": {
"note": "Distance 3: every weight-2 error is detected. When its syndrome coincides with a weight-1 error's the decoder applies that weight-1 correction and the residual is a weight-3 logical operator; when it matches no weight-1 error the decoder applies nothing and reports an uncorrectable error.",
"count": 189,
"detected": 189,
"all_detected": true,
"example_miscorrection": {
"error": "XXIIIII",
"residual": "XXXIIII",
"decoder_applies": "IIXIIII"
},
"flagged_uncorrectable": 126,
"miscorrected_to_a_logical_error": 63,
"syndrome_matches_a_single_qubit_error": 63
},
"single_qubit_errors": {
"claim": "All 21 weight-1 Pauli errors produce distinct non-zero syndromes. Weight-1 errors are finite, so this is a complete enumeration -- a proof, not a sample.",
"count": 21,
"all_detected": true,
"all_recovered": true,
"distinct_syndromes": 21,
"state_level_method": "128-amplitude statevector, syndrome by projection, independent of the commutation table",
"state_level_recovered": 21,
"all_uniquely_identified": true
}
}exhaustive single errors
All 21 weight-1 Pauli errors have distinct non-zero syndromes, recomputed independently in the test by matrix commutation (S E = -E S) rather than string arithmetic, and the product reports all 21 recovered at the state level with fidelity 1.
distance limit
All 189 weight-2 errors are detected; exactly 63 have a syndrome matching a weight-1 error and are miscorrected, and for the example XXIIIII the product's chosen-error trace on |0_L> shows residual XXXIIII acting as logical X with fidelity 0, while Z-type residuals leave |0_L> intact and damage |+_L>.
python/tests/test_catalog_products.py::test_steane_some_weight_two_error_is_miscorrected
state level independence
For every weight-1 error the syndrome measured by projection on the 128-amplitude state equals the commutation syndrome, and the logical states |0_L>, |1_L>, |+_L> are normalised, stabilised by every generator and mutually consistent (|1_L> orthogonal to |0_L>).
python/tests/test_catalog_products.py::test_steane_projection_syndromes_agree_with_commutation
example execution
The example code is executed verbatim in a clean virtual environment with only the qinfo extra installed.
1.0.01 Nov 2026currentShown on this page
Needs SDK 0.3.0 or later with extras: qinfo.
KetQat implementation of published methods
The [[7,1,3]] code was invented by Steane (1996) as the first CSS code built from the classical Hamming code, with the general CSS construction due to Calderbank and Shor (1996) and the stabiliser formalism to Gottesman (1997). KetQat wrote this NumPy implementation (steane.py), the syndrome and state-level checks, the weight-2 classification, the validation tests and this catalog entry. KetQat did not invent the code.
Apache-2.0 — see Licensing.
People credited for this product. KetQat publishes and maintains it; contributors are credited for their work and are not sellers.
No usage reports yet
Distinct signed-in accounts that chose to send at least one usage report (ketqat report) for this product in the last 90 days. KetQat staff, test and bot accounts are excluded. Reports are opt-in, so this is not a count of all users.
Computed 10 Nov 2026, 17:34 UTC.
Not yet rated
Be the first to rate this product after you run it.
Mean of visible reviews. Hidden reviews and reviews by KetQat staff, test and bot accounts are excluded. Pro status gives no extra weight.
Sign in to review this product. One review per person; you can edit it later.
No reviews yet.