✨ Add error correction module with Shor and Steane logical circuit transpilers#930
Open
Felix-Gundlach wants to merge 144 commits into
Open
Conversation
small formatting changes
…de' into feature/ErrorCorrection_Verification
+ Added logging functionality
Changed circuit structure tests to use hardcoded gate data, only for 3 qubits
structural tests now manually transpile circuits
…ilation of gates without modifying the error correction tests
Removed other tests and test_error_correction.py
…nic0909/MQT_Bench_ErrorCorrectionCodes into feature/ErrorCorrection_MergePrep
…nic0909/MQT_Bench_ErrorCorrectionCodes into feature/ErrorCorrection_MergePrep
Changed pre-processed transpilation to new target ["id", "x", "y", "z", "cx", "swap", "dcx", "t", "tdg"]
…r_circuit_structure()
Signed-off-by: Felix Gundlach <67263641+Felix-Gundlach@users.noreply.github.com>
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
This PR introduces a dedicated Error Correction Module for MQT Bench. It adds two high-level transpilers that encode standard benchmark circuits into fault-tolerant logical circuits using the 7-qubit Steane code and the 9-qubit Shor code, respectively. The module is designed to integrate cleanly with the existing
benchmark_generationAPI.Changes
New files
src/mqt/bench/error_correction/steane_transpiler.py—SteaneTranspilerclass: encodes logical qubits into 7-qubit Steane blocks, applies transversal Clifford gates (H, X, Z, S, CX, CZ), and handles T-gates via magic state injection with ancilla teleportation.src/mqt/bench/error_correction/shor_transpiler.py—ShorTranspilerclass: encodes logical qubits into 9-qubit Shor blocks, implements the full logical Clifford gate set (including the non-transversal H via bit-swap), and supports S- and T-gates via magic state teleportation gadgets.tests/test_error_correction.py— pytest suite covering gate-level equivalence (via MQT QCEC), correctness under injected bit- and phase-flip errors (via Hellinger fidelity with Aer), and circuit structure validation against pre-computed gate counts for GHZ, Bernstein–Vazirani, graph state, and QFT benchmarks.How it works
Both transpilers follow the same three-phase pipeline:
QFTGate) are first decomposed into the supported basis set{H, X, Z, S, T, CX, CZ}.if_testfeature.T-gates, which are non-transversal, are handled via a teleportation gadget: a magic state ancilla block is prepared, a logical CNOT is applied from the data qubit to the ancilla, the ancilla is decoded and measured, and a conditional logical S correction is applied on outcome 1.
Testing
mqt.qcecfor all single- and two-qubit Clifford gates.gate_counts.jsonfor qubit counts ranging from 3 to 9 across all supported algorithms.Notes
add_syndromes=Falsefor lightweight structural or equivalence checks.Checklist
If PR contains AI-assisted content:
Assisted-by: [Model Name] via [Tool Name]footer.