Addition of CZ instruction and related components, and removal of meas_index from R instructions#379
Addition of CZ instruction and related components, and removal of meas_index from R instructions#379
CZ instruction and related components, and removal of meas_index from R instructions#379Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #379 +/- ##
==========================================
+ Coverage 85.89% 86.09% +0.20%
==========================================
Files 45 45
Lines 6542 6565 +23
==========================================
+ Hits 5619 5652 +33
+ Misses 923 913 -10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
CZ instruction and related components, and removal of meas_index from RZZCZ instruction and related components, and removal of meas_index from R instructions
thierry-martinez
left a comment
There was a problem hiding this comment.
Nice job! I just wonder why we need to introduce requirements-no-deps.txt instead of just pinning graphix-qasm-parser in requirements-dev.txt.
Otherwise, the J-CZ transpiler would require to introduce a J gate in addition to the CZ gate. I suppose you plan to add that in a subsequent PR, is that right?
This commit adds type annotations to `random_objects.py`, along with its corresponding tests, enabling full type-checking with mypy while preserving existing functionality. The exclusion of `device_interface.py` is removed from `pyproject.toml` since this module was removed in #261. `scipy-stubs` is added to `requirements-dev.txt` since `scipy` is used in `random_objects.py`. Revealed bad type annotation for `unitary_group.rvs`: scipy/scipy-stubs#987 **Related issue:** This PR continues the work started in #302, #308, #312 and #347. --------- Co-authored-by: matulni <m.uldemolins@gmail.com>
This commit adapts the existing method `graphix.opengraph.OpenGraph.isclose` to the new API introduced in #358. Additionally, it introduces the new methods `graphix.opengraph.OpenGraph.is_equal_structurally` which compares the underlying structure of two open graphs, and `graphix.fundamentals.AbstractMeasurement.isclose` which defaults to `==` comparison.
This commit adapts the existing method `:func: OpenGraph.compose` to the new API introduced in #358.
This commit fixes domains in the transpiler so that every pattern transpiled from a circuit has a flow. Previously, some domains were incompatible with any flow, despite the patterns being deterministic, because some measurement angles were zero, causing the measurements to ignore certain signals. This commit also adds `optimization.remove_useless_domains` to remove the domains ignored by measurements with angle zero, to recover the same "optimized" patterns as before when needed. This commit also adds `rand_state_vector` to draw a random state vector.
|
Looks good. Maybe this is out of scope of this PR but why are all Once the issue of the extra |
|
Command routines can indeed be static methods, or even just plain functions, but I think the change in the structure of the transpiler can be postponed until a more global refactoring. |
|
I think we can now remove the version pinning for |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
|
Agree @thierry-martinez I think this is ready to go now. |
Context:
Up to now, Graphix has not explicitly included a
CZinstruction. This may be something users pass as a gate in a circuit. It is also a useful addition for using in alternative transpilers including JCZ.Description of the change:
A
CZgate has been added to the set of instructions ininstruction.py.Downstream changes have been made including:
InstructionKindenumerationtranspiler.pyfor circuit transpilation.This PR also updates other instructions. It removes an unused variable
meas_indexin theRZZ,RZ,RY,RXinstructions. Other minor typing fixes have also been made to some test suites where identified during testing.Related issue:
See parallel PR in graphix-qasm-parser.
Given parallel PR was required, some workarounds have been included to prevent dependency problems. These can be reverted when CI is shown to be passing in both repos.