Skip to content

Conversation

@thierry-martinez
Copy link

This commit introduces an OpenQASM 3 exporter for Graphix circuits. The functionality was originally proposed in TeamGraphix#245 but has not yet been merged.

The added tests verify that a round-trip through the OpenQASM 3 representation preserves Graphix circuits, using the graphix-qasm3-parser plugin. These tests are executed by CI when the reverse-dependency is checked.

In the long term the qasm3_exporter module will also host the pattern exporter, but that feature is intentionally omitted from this PR to keep the change focused.

matulni and others added 2 commits October 2, 2025 10:00
Introduce the `O(N^3)` Pauli flow-finding algorithm presented in [1] which improves the previous version with `O(N^5)`
complexity [2]. Since a Pauli flow in an open graph without Pauli measurements defines a gflow, this algorithm also improves the previous implementation of the gflow-finding algorithm with `O(N^4)` complexity [3].

The implementation proposed here considers the suggestion in [1] to eliminate the rows that are identically 0 in the order-demand matrix to accelerate the flow-finding routine in open graphs with nI ≠ n O.

Finally, the new algorithm solves the issue discussed in qat-inria#17 , whereby the previous flow-finding functions could return a correction function containing input nodes in the codomain, which is not allowed by the definition of gflow or Pauli flow.

In summary:

- The core functions of the algorithm are encapsulated in the new module `graphix.find_pflow`, while `graphix.gflow` and related modules are adapted accordingly to avoid modifying the current API in this PR.
- The module `graphix.linalg` has been renamed `graphix._linalg` and updated with more efficient functions for gaussian elimination, back substitution, kernel-finding and right-inverse. New implementation is GF2-specialized and, where appropriate, just-in-time compiled with numba. The dependence on `sympy` and `galois` is dropped. Tests are simplified and updated accordingly, and module is now typed.
- `pytest-benchmark` is incorporated to allow for easier benchmarking between different commits (courtesy of @thierry-martinez).

Additional comments
---------------------
- This PR addresses the same issue as TeamGraphix#294, but is otherwise unrelated.
- The module `graphix.gflow` will be restructured in a future PR.

The implementation exhibits the cubic scaling as described in [1]. See https://gitlab.inria.fr/muldemol/pflow-on3-scaling.git for a benchmarking code.

References
-----------
[1] Mitosek and Backens, 2024 (arXiv:2410.23439)
[2] Simmons, 2021 (arXiv:2109.05654)
[3] Backens et al., Quantum 5, 421 (2021)

---------

Co-authored-by: Thierry Martinez <[email protected]>
This commit introduces an OpenQASM 3 exporter for Graphix
circuits. The functionality was originally proposed in TeamGraphix#245 but has
not yet been merged.

The added tests verify that a round-trip through the OpenQASM 3
representation preserves Graphix circuits, using the
graphix-qasm3-parser plugin.  This plugin is therefore
added as a `requirements-dev.txt` dependency.

CI is updated so that `pip install .` can detect the current version
number of Graphix, instead of the default `0.1`: to do so, the whole
history and the tags should be available.  We removed the "-e" option
from CI because it is useless in the CI context.

In the long term the `qasm3_exporter` module will also host the
pattern exporter, but that feature is intentionally omitted from this
PR to keep the change focused.
dependabot bot and others added 7 commits October 6, 2025 17:33
…Graphix#346)

* ⬆️ Bump ruff from 0.13.2 to 0.13.3 in the python-packages group

Bumps the python-packages group with 1 update: [ruff](https://github.com/astral-sh/ruff).


Updates `ruff` from 0.13.2 to 0.13.3
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ruff@0.13.2...0.13.3)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.13.3
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: python-packages
...

Signed-off-by: dependabot[bot] <[email protected]>

* Fix `compute_rank` result type

* Remove unused `import graphix`

* Revert "Fix `compute_rank` result type"

This reverts commit 36e09ea.

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Thierry Martinez <[email protected]>
…Graphix#348)

Bumps the python-packages group with 1 update: [ruff](https://github.com/astral-sh/ruff).


Updates `ruff` from 0.13.3 to 0.14.0
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ruff@0.13.3...0.14.0)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.14.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: python-packages
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…eamGraphix#345)

This commit restores the reverse‑dependency check against the main
branch of `graphix-symbolic`. The check will become functional once the
following pull request is approved and merged:
TeamGraphix/graphix-symbolic#4
Bumps the python-packages group with 2 updates: [ruff](https://github.com/astral-sh/ruff) and [nox](https://github.com/wntrblm/nox).


Updates `ruff` from 0.14.0 to 0.14.1
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ruff@0.14.0...0.14.1)

Updates `nox` from 2025.5.1 to 2025.10.16
- [Release notes](https://github.com/wntrblm/nox/releases)
- [Changelog](https://github.com/wntrblm/nox/blob/main/CHANGELOG.md)
- [Commits](wntrblm/nox@2025.05.01...2025.10.16)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.14.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: python-packages
- dependency-name: nox
  dependency-version: 2025.10.16
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: python-packages
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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