Skip to content

Non-Clifford implementation of sparsification framework, sum over clifford and enhanced magic states#645

Open
riteshbhirud wants to merge 17 commits intoQuantumSavory:masterfrom
riteshbhirud:master
Open

Non-Clifford implementation of sparsification framework, sum over clifford and enhanced magic states#645
riteshbhirud wants to merge 17 commits intoQuantumSavory:masterfrom
riteshbhirud:master

Conversation

@riteshbhirud
Copy link
Contributor

This implements sparsification framework, sum over clifford and enhanced magic states

1. Sparsification Framework (Section 5.2)

  • Implements Sparsification Lemma (Lemma 6) for reducing dense stabilizer decompositions
  • Achieves χ_δ(ψ) ≤ 1 + ||c||₁²/δ² bound (Theorem 1)
  • Controllable approximation error via δ parameter

2. Enhanced Magic State Library (Section 5.3)

  • T-gate: Optimal decomposition with ξ(T) ≈ 1.172
  • CCZ gate: Optimal 8-term group decomposition with ξ(CCZ) = 16/9 ≈ 1.778
  • R(θ) rotations: Parametric decomposition with ξ(R(θ)) = (cos(θ/2) + tan(π/8)sin(θ/2))²
  • Implements Lifting Lemma for converting magic states to gate decompositions

3. Sum-over-Cliffords Simulation (Section 2.3.2)

  • Decomposes circuits as U = Σⱼ cⱼKⱼ where Kⱼ are Clifford operations
  • Multiplicative cost scaling: O(δ⁻² ∏ᵐⱼ₌₁ ξ(Vⱼ))
  • Handles arbitrary mixed Clifford/non-Clifford circuits

4. Fast Metropolis Sampling (Section 4.2)

  • O(kn) complexity per sample (vs naive O(k²n³))
  • Auto-tuned burn-in and thinning parameters

@riteshbhirud
Copy link
Contributor Author

opened a new PR due to merging issues with previous one. This also addresses the following comments (except for updating docs and tests based on QuantumOpticsBase) from the prev discussion: "Move everything to a module called LowRankNonClifford or a similar name
in a subfolder

Keep these public:

TGate
CCZGate
simulate_non_clifford_circuit
estimate_simulation_cost
QuantumSimulationResults
potentially will rename them

Keep consistent names and APIs with the style of use in Pauli Frame simulations, e.g. pftrajectories and getters related to extracting samples information

Rename or restructure
BitString -> Just a normal Vector{Bool} or even just a BitVector
MagicStateDecomposition -> MagicStateDecompositionCache
remove CliffordGateDecomposition if not used (and anything else not used anymore)
Use existing types and multimethods instead of building an independent type system
We can introduce a isunitary and isclifford and similar methods.

display_results should be a show method (see other existing ones)

add to this page of the docs

https://qc.quantumsavory.org/stable/allops/

have a tests that relies on purely clifford circuits and compares against mctrajectories (using Register and explicit measurements)

have a test that relies on QuantumOpticsBase (for very few qubits so it can run efficiently)"

Copy link
Member

@Krastanov Krastanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome!!! I have a few organiziational and docstring-related comments, otherwise basically ready for merging.

Some of the docstringhelper related comments are find for skipping, just posted them for completeness.

Copy link
Member

@Krastanov Krastanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@riteshbhirud , the test failures seem to be in the newly added tests

@riteshbhirud
Copy link
Contributor Author

@riteshbhirud , the test failures seem to be in the newly added tests

@Krastanov Thanks for the message, it seems I forgot to reflect some changes I did in the actual code in the tests. Will do that soon.

@Krastanov Krastanov marked this pull request as draft December 31, 2025 20:30
@Krastanov
Copy link
Member

feel free to convert to non-draft when it is ready for review

@riteshbhirud riteshbhirud marked this pull request as ready for review January 1, 2026 10:45
@riteshbhirud riteshbhirud marked this pull request as draft January 1, 2026 11:25
@riteshbhirud riteshbhirud marked this pull request as ready for review January 1, 2026 11:46
@riteshbhirud riteshbhirud marked this pull request as draft January 1, 2026 12:30
@riteshbhirud riteshbhirud marked this pull request as ready for review January 1, 2026 21:01
@riteshbhirud riteshbhirud requested a review from Krastanov January 1, 2026 21:03
@riteshbhirud
Copy link
Contributor Author

riteshbhirud commented Jan 1, 2026

@Krastanov Ready for review! I addressed all points from our discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants