Add native Clifford map compilation pass #476
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #476 +/- ##
==========================================
+ Coverage 89.34% 89.94% +0.60%
==========================================
Files 47 47
Lines 6891 6965 +74
==========================================
+ Hits 6157 6265 +108
+ Misses 734 700 -34 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: thierry-martinez <thierry.martinez@inria.fr>
|
Hi @thierry-martinez and @emlynsg. I concluded that it's not a good idea to remove the However, I took from the discussion that it's weird that Finally, in commit 5ef2fb2 I added a new field Ready for another round of review! Edit: This PR updates the stim compiler plugin to comply with the new field in |
|
Commit 57790dc updates the API to incorporate the changes discussed this morning: namely |
thierry-martinez
left a comment
There was a problem hiding this comment.
LGTM! I am still wondering if the type alias Qubit is needed (cf. my comment in compilation.py) but this looks very good overall.
You are right, I had forgotten about that. I removed the unnecessary type alias in 1b048f5 In df2aced, I renamed the class property I'll merge if CI passes! |
This commit updates the repository to make it compatible with the new `dim` field in `PauliString`. See TeamGraphix/graphix#476 --------- Co-authored-by: thierry-martinez <thierry.martinez@inria.fr>
This PR adds a new compilation pass to natively synthesise (unitary) Clifford maps. It subsumes the
stimcompilation pass recently introduced ingraphix-stim-compilerso that it is possible to do thePattern->Circuitconversion without external dependencies:Summary of changes
OpenGraph.extract_circuit,CliffordMap.to_tableauand new functiongraphix.circ_ext.compilation.cm_berg_pass.Further, some improvements in the existing circuit extraction API are made:
dimtoPauliStringto represent the dimension of the Hilbert space.PauliStringon qubit indices and remove allremapmethods.x_mapandz_mapattributes ofCliffordMapas sequences ofPauliStringinstead of mappings.Discussion
This PR implements a custom adaptation of van den Berg's sweeping algorithm introduced in Ref. [1]. We note that in this paper their objective is to sample random Clifford operators, so here have to be a bit more careful to obtain the correct Clifford operator. Namely, we have to:
The last point is crucial since the (naive) implementation in this PR may increase the reported$O(n^2)$ complexity. I list below some open questions beyond the scope of this PR:
What is the complexity scaling of this implementation and how does it compare to Stim's version ? (This should be easy to do, since the stim pass in
graphix-stim-compilerallows to make sensible comparisons between both methods without much glue code).Do we find an$O(n^2)$ complexity (which to my knowledge is the best-known bound)? If not, it may be worth exploring the algorithms in Ref. [2].
Explore Ref. [3] to synthesise Clifford isometries (corresponding to open graphs with larger number of outputs than inputs). This is particularly interesting since stim does not support these objects but it requires some prior work to represent circuit with ancillas in Graphix.
Explore Ref. [4] to synthesise Clifford unitaries on a given qubit topology. This should not be too complicated, since their algorithm is based on van den Berg's algorithm implemented here.
Finally, a vague idea: one of the virtues of the Pauli exponential DAG + Clifford map form in Simmon's paper is that it splits the Clifford and the non-Clifford part. Now, our compilation passes stitch both parts together in a single circuit. It would be more interesting to engineer an interface with stim (or some custom simulator), so that we can classically simulate the Clifford part, and somehow represent the output state as a stabilizer state that we pass to the PdDAG part.
References
[1] Van Den Berg, 2021. A simple method for sampling random Clifford operators (arXiv:2008.06011)
[2] Bravyi and Maslov, 2020, Hadamard-free circuits expose the structure of the Clifford group. (arXiv:2003.09412)
[3] Brugière et al., 2025, A graph-state based synthesis framework for Clifford isometries (arXiv:2212.06928)
[4] Winderl et al., 2024, Architecture-Aware Synthesis of Stabilizer Circuits from Clifford Tableaus (arXiv:2309.08972)