Skip to content

Fix #168: Remove Pauli measurements#498

Merged
thierry-martinez merged 48 commits into
TeamGraphix:masterfrom
thierry-martinez:fix/168-remove-pauli-measurements
May 20, 2026
Merged

Fix #168: Remove Pauli measurements#498
thierry-martinez merged 48 commits into
TeamGraphix:masterfrom
thierry-martinez:fix/168-remove-pauli-measurements

Conversation

@thierry-martinez
Copy link
Copy Markdown
Collaborator

This commit implements the algorithm described in [BMBdF+21], Theorem 4.12 in Section 4.3: Removing Clifford vertices.

The new method Pattern.remove_pauli_measurements removes almost all Pauli measurements on non-input nodes, and all of them if the pattern has flow, fixing #168.

[BMBdF+21] Miriam Backens, Hector Miller-Bakewell, Giovanni de Felice, Leo Lobski, and John van de Wetering, There and back again: A circuit extraction tale, Quantum, 2021,
https://doi.org/10.22331/q-2021-03-25-421

This commit implements the algorithm described in [BMBdF+21], Theorem
4.12 in Section 4.3: Removing Clifford vertices.

The new method `Pattern.remove_pauli_measurements` removes almost all
Pauli measurements on non-input nodes, and all of them if the pattern
has flow, fixing TeamGraphix#168.

[BMBdF+21] Miriam Backens, Hector Miller-Bakewell, Giovanni de Felice,
Leo Lobski, and John van de Wetering, There and back again: A circuit
extraction tale, Quantum, 2021,
https://doi.org/10.22331/q-2021-03-25-421
@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

❌ Patch coverage is 98.93238% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.91%. Comparing base (febb4bf) to head (1f0ad56).

Files with missing lines Patch % Lines
graphix/optimization.py 82.35% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #498      +/-   ##
==========================================
- Coverage   89.57%   88.91%   -0.66%     
==========================================
  Files          48       49       +1     
  Lines        7039     7111      +72     
==========================================
+ Hits         6305     6323      +18     
- Misses        734      788      +54     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@matulni matulni left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this nice piece of work @thierry-martinez ! Code is super clear and new tool very useful!

Now that remove_pauli_nodes will become a fundamental part of the workflow, I'm even more unhappy that the transformation Pattern -> OpenGraph or Pattern -> XZCorrections does not preserve information about the LC fragment. Maybe it may be worth thinking about this...

Comment thread graphix/optimization.py Outdated
Comment thread graphix/pattern.py Outdated
Comment thread graphix/pattern.py Outdated
Comment thread graphix/remove_pauli_measurements.py Outdated
Comment thread graphix/remove_pauli_measurements.py
Comment thread graphix/remove_pauli_measurements.py Outdated
Comment thread graphix/remove_pauli_measurements.py Outdated
Comment thread graphix/pattern.py
Comment thread graphix/pattern.py
Comment thread tests/test_remove_pauli_measurements.py
Comment thread tests/test_pattern.py Outdated
Comment thread CHANGELOG.md Outdated
Comment thread tests/test_graphsim.py
Comment thread graphix/remove_pauli_measurements.py Outdated
Comment thread graphix/remove_pauli_measurements.py
thierry-martinez added a commit to thierry-martinez/graphix-stim-backend that referenced this pull request May 12, 2026
Copy link
Copy Markdown
Contributor

@matulni matulni left a comment

Choose a reason for hiding this comment

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

LGTM!
Thanks for the nice work

Copy link
Copy Markdown
Contributor

@mgarnier59 mgarnier59 left a comment

Choose a reason for hiding this comment

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

Overall it looks very good. The code is extremely clean. I have a couple of questions concerning the exact procedure but it looks ready to merge!

Comment thread graphix/remove_pauli_measurements.py
Comment thread graphix/remove_pauli_measurements.py Outdated
Comment thread graphix/remove_pauli_measurements.py Outdated
Comment thread graphix/remove_pauli_measurements.py
Comment thread graphix/remove_pauli_measurements.py Outdated
Comment thread graphix/remove_pauli_measurements.py
Comment thread graphix/remove_pauli_measurements.py
Comment thread graphix/remove_pauli_measurements.py
Comment thread graphix/remove_pauli_measurements.py
@thierry-martinez thierry-martinez merged commit 0512be7 into TeamGraphix:master May 20, 2026
24 checks passed
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.

3 participants