feat: add RotatedSurfaceCode and RotatedSurfaceCodeLoom to simulator utilities#57
feat: add RotatedSurfaceCode and RotatedSurfaceCodeLoom to simulator utilities#57Cherie000 wants to merge 25 commits into
Conversation
romanwixinger
left a comment
There was a problem hiding this comment.
Great work @Cherie000 ! Let us discuss how we can test the surface code. Maybe you have ideas from your own experiments that we can tap into.
There was a problem hiding this comment.
Todo: Check if we still need this full list after the changes I did to the docs in https://github.com/CERN-QTI/quantum-gates/pull/55/changes. I guess the dependencies for the build process of the docs should now come from the setup.cfg.
| @@ -0,0 +1,285 @@ | |||
|
|
|||
There was a problem hiding this comment.
Todo: Cleanup the formatting of the imports. No extra lines on top and two lines between the last import and the class definition.
| matcher = pymatching.Matching(dem) | ||
| return matcher, converter | ||
|
|
||
| def MrAnderson_run_circ_backend(self): |
There was a problem hiding this comment.
Todo: Make method names lowercase. I know that we have the gates uppercase but this is just for legacy reasons and because it is easier to read.
| self.noise = noise | ||
| self.p = p | ||
|
|
||
| # ── Build experiment and interpret ─────────────────────────────────── |
There was a problem hiding this comment.
Todo: Cleanup comments, no extra "─".
There was a problem hiding this comment.
Todo: Name the file in lowercase.
| noise_model = NoiseModel() | ||
|
|
||
| # Single-qubit gate depolarizing noise | ||
| #single_qubit_error = depolarizing_error(p, 1) |
There was a problem hiding this comment.
Todo: Check if still needed.
| device_param_lookup['p_int'][i, i+1] = found_p_int | ||
| device_param_lookup['p_int'][i+1, i] = found_p_int | ||
| return device_param_lookup | ||
| def _transpile_circ(self): |
There was a problem hiding this comment.
Todo: Format the methods, one line between methods.
| from qiskit_aer import AerSimulator | ||
| from qiskit_aer.noise import NoiseModel, depolarizing_error | ||
|
|
||
| from loom.eka import Eka, Lattice |
There was a problem hiding this comment.
I like how you organized the imports!
| @@ -0,0 +1,14 @@ | |||
| # tests/test_rotated_surface_code.py | |||
| from quantum_gates._utility.RotatedSurfaceCodeLoom import RotatedSurfaceCodeLoom | |||
There was a problem hiding this comment.
Todo: Make sure to expose the new functionality to the outside. The imports in the future should not have to use ._utility "private underscore" for functionality that should be public.
There was a problem hiding this comment.
Todo: Move to the docs.
|
Since the SC both rotated and planar implement "large" circuits it would be good to also run a profiler on the classes and see what speed-ups we could apply! |
…ered and fixed optimizer issue
Summary
This PR adds two new files to
src/quantum_gates/_utility/implementingend-to-end rotated surface code simulations using the MrAnderson simulator.
New Files
RotatedSurfaceCodeLoom.pyA surface code simulation pipeline built on top of the
loomframework.Uses
EkaToQasmConverterto generate a Qiskit circuit from a declarativesurface code description, runs it through MrAnderson, and decodes the logical error rate via PyMatching,
using Stim to construct the detector error model.
Key features:
MrAnderson(custom statevector) andAER(Qiskit stabilizer)RotatedSurfaceCode.pyA self-contained rotated surface code implementation built directly in Qiskit,
without the loom framework.
Key features:
errorparameterdecoding per cycle, and Z-correction of data qubits
CustomNoiseChannelsGates) and Aer backendsDependencies added (
docs/requirements.txt)pymatchingstimel-loomNotes
simulator on a fault-tolerant quantum error correction protocol
RotatedSurfaceCodeLoom.pydepends on theloomecosystem;RotatedSurfaceCode.pyis standalonesrc/quantum_gates/_utility/