docs: tutorial reproducing Fig. 4a - codes under global rotations (closes #119)#160
Open
Ronit-Raj9 wants to merge 1 commit into
Open
docs: tutorial reproducing Fig. 4a - codes under global rotations (closes #119)#160Ronit-Raj9 wants to merge 1 commit into
Ronit-Raj9 wants to merge 1 commit into
Conversation
8de4157 to
d85a548
Compare
d85a548 to
7311905
Compare
Add docs/demos/global_rotations.ipynb reproducing Fig. 4a of Bluvstein
et al. (Nature 649, 39, 2026): quantum Reed-Muller codes of various
dimensionality under a global Z-rotation, computed with tsim.
- [[7,1,3]] Steane (2D colour), [[15,1,3]] Reed-Muller (3D colour) and a
single unentangled qubit, plus the paper's negative-stabilizer control
(the four tetrahedron corners flipped) that removes the 45-degree
transversal-T plateau.
- Builds the literal hypercube encoding circuit of Extended Data Fig. 10a
(E = ((1,0),(1,1))^{otimes m} with the QRM input pattern, punctured at
the 0...0 corner) and verifies by statevector overlap (= 1.0) that it
prepares the same |+_L> as the stabilizer encoder.
- tsim's stabilizer-rank sampler runs the 15-rotation 3D code; an exact
Clifford-statevector reference cross-checks every curve; tcount() and a
ZX timeline diagram surface the non-Clifford content.
- adds postselection with acceptance fractions, and a pytest
(test/unit/demos/test_global_rotations.py) guarding the encoders, the
hypercube equivalence and the transversal-T plateau.
- self-contained notebook, outputs stripped like the other demos, builds
clean under mkdocs-jupyter (execute: true, allow_errors: false); ruff,
black, isort, pyright and pytest all pass.
Closes QuEraComputing#119.
7311905 to
543dcb3
Compare
Ronit-Raj9
added a commit
to Ronit-Raj9/tsim
that referenced
this pull request
Jun 10, 2026
4 tasks
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
Adds
docs/demos/global_rotations.ipynb, a tutorial that reproduces Fig. 4a of the linked Nature paper (Bluvstein et al., Nature 649, 39, 2026) using tsim, and wires it into the Tutorials nav.A logical qubit is prepared in
|+_L>, every physical qubit is rotated by the sameR_Z(φ), and we track the logical-X projection and the X-stabilizer revival versusφ, for all four configurations of the figure:[[7,1,3]](Steane) - decoded logical Clifford plateaus at multiples of 90° (S,S†,Z).[[15,1,3]](Reed-Muller) - an additional plateau at multiples of 45° (T,T†,TS,(TS)†), the signature of its transversal non-CliffordTgate, with the stabilizers reviving there too.|+>^15read out with the same Reed-Muller operators:<X_L> = cos^15(φ)collapses away from 0°/±180° and the stabilizers revive only at multiples of 180°.Reproduced figure
Following the paper's analysis: the encoded curves show the decoded (syndrome-postselected) logical projection, the two control curves are raw, and the bottom panel is the raw stabilizer revival - so the panels reproduce the published figure point for point (plateau positions, stabilizer revivals, and the green/grey controls hugging each other).
What's inside
E = ((1,0),(1,1))^⊗mwith the quantum-Reed-Muller input pattern (|+>on low-weight rows,|0>on high-weight rows), punctured at the0…0corner - and verifies by statevector overlap (= 1.000000) that it prepares the same|+_L>as the stabilizer-defined encoder, for both[[7,1,3]](3-cube) and[[15,1,3]](4-cube).[[16,6,4]]is the same circuit without puncturing.stim.Circuit.flow_generators(), as the issue suggests.tcount()and a ZX timeline diagram make that explicit, and tsim's stabilizer-rank sampler produces the data points on the decoded curves (open markers), including the ±45° transversal-Tangles. A dense2^15statevector of the rotated diagram is out of reach, so an exact Clifford-statevector reference (stim + analytic diagonal rotation) cross-checks every curve, with aφ = 0assertion guarding correctness.Tplateau, Eastin-Knill and how logical measurement circumvents it, and why logical magic requires in-block entanglement (CHSH1.99(3)×√2in the paper).Tests & CI
test/unit/demos/test_global_rotations.py(7 tests): encoderflow_generators, the hypercube ↔ stabilizer-encoder equivalence, theφ = 0state, the Reed-Muller transversal-Tplateau (and its absence for Steane), the negative-stabilizer control, and a tsim-sampler-vs-exact check on the 15-qubit code.mkdocs-jupyter(execute: true,allow_errors: false) in ~6 min on CPU, so CI re-executes and guards it.Notes for review
src/.Tangles (cheap even at 15 qubits);SAMPLE_SHOTSand the marker grids are exposed for heavier runs.Closes #119.