Add Pauli-flow extraction from pattern corrections#539
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #539 +/- ##
==========================================
+ Coverage 88.85% 88.90% +0.04%
==========================================
Files 49 49
Lines 7135 7246 +111
==========================================
+ Hits 6340 6442 +102
- Misses 795 804 +9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thank you for your contribution. As you may have noticed, two other pull requests (#526 and #534) already address the same issue. The overall approach of your PR is very similar to the others: the Pauli‑flow definition yields a system of GF(2) equations, where the anachronical corrections are the unknowns, and solving this system provides the correction sets. Could you clarify how your contribution differs from, or improves upon, the previous works? Specifically, please explain why you consider your approach to be better. |
Summary
Adds
XZCorrections.to_pauli_flow()andPattern.extract_pauli_flow()so Pauli flow can be extracted directly from pattern X/Z corrections without rerunning Pauli-flow extraction on the underlying open graph. The converter reconstructs compatible correction sets by solving the Pauli-flow parity constraints over GF(2), then validates with the existingPauliFlow.check_well_formed()checks.Closes #432.
Tests
uv run --with pytest --with pytest-benchmark pytest tests/test_flow_core.py::TestFlowPatternConversion::test_corrections_to_pauli_flow tests/test_pattern.py::TestPattern::test_extract_pauli_flowuv run --with pytest --with pytest-benchmark pytest tests/test_flow_core.py tests/test_pattern.pyuv run --with pytest --with pytest-benchmark pytest(3162 passed, 151 skipped, 2 xfailed)uv run --with ruff==0.15.16 ruff check graphix/flow/core.py graphix/flow/exceptions.py graphix/pattern.py tests/test_flow_core.py tests/test_pattern.pyuv run --with ruff==0.15.16 ruff format --check graphix/flow/core.py graphix/flow/exceptions.py graphix/pattern.py tests/test_flow_core.py tests/test_pattern.pyuv run --with pyright --with pytest pyright graphix/flow/core.py graphix/pattern.py tests/test_flow_core.py tests/test_pattern.py(0 errors, 0 warnings)uv run --with mypy==2.1.0 --with pytest --with pytest-benchmark --with types-networkx==3.6.1.20260518 --with types-setuptools --with scipy-stubs mypy graphix/flow/core.py graphix/flow/exceptions.py graphix/pattern.py tests/test_flow_core.py tests/test_pattern.pyDisclosure
Travis Crew (CrewRiz) used AI-assisted coding support while preparing this PR.