feat: add compute_output_permutation utility#63
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new utility to read the qubit output permutation left behind by PyZX extraction when using up_to_perm=True, along with unit tests intended to validate the behavior.
Changes:
- Add
compute_output_permutation(g)utility inzxpass/zxpass.py. - Add tests for basic permutation properties, identity case, and a “matches swaps” scenario.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
zxpass/zxpass.py |
Introduces compute_output_permutation to derive output→input mapping from a post-extraction graph. |
test/test_zxpass.py |
Adds new tests covering the new permutation utility and extraction behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e7683ce to
58b8971
Compare
There was a problem hiding this comment.
Pull request overview
Adds a small utility to interpret PyZX’s post-extraction boundary connectivity as an explicit qubit permutation, with accompanying unit tests to validate behavior against extract_circuit(up_to_perm=...).
Changes:
- Add
compute_output_permutation()to derive an output→input qubit index mapping from a post-extraction PyZX graph. - Add tests exercising the utility on reduced/extracted graphs and cross-checking against SWAP insertion behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
zxpass/zxpass.py |
Introduces compute_output_permutation() with validation and error reporting. |
test/test_zxpass.py |
Adds tests for the new permutation utility, including an equivalence check via SWAP reconstruction. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
58b8971 to
73f1710
Compare
There was a problem hiding this comment.
Pull request overview
Adds a small helper utility to interpret PyZX’s post-extraction boundary graph connectivity and expose the resulting output-to-input qubit permutation, with accompanying tests to validate expected behavior and error handling.
Changes:
- Add
compute_output_permutation(g)to derive{output_qubit_index: input_qubit_index}from a post-extraction graph (up_to_perm=True). - Add unit tests covering normal operation, identity cases, SWAP equivalence, and several invalid-graph error branches.
- Update test module imports/lint settings to support the expanded test suite.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
zxpass/zxpass.py |
Introduces compute_output_permutation utility for reading boundary connectivity after PyZX extraction. |
test/test_zxpass.py |
Adds a comprehensive test suite for the new utility, including error-case validation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Relates to #18.