Skip to content

feat(qsystem): native gateset decomposition improvements #1059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 21, 2025

Conversation

ss2165
Copy link
Member

@ss2165 ss2165 commented Aug 21, 2025

  1. Fix CY decomposition Closes qsystem: incorrect cy decomposition #1058

Found using

from pytket import Circuit, OpType
from pytket.passes import AutoSquash


c = Circuit(2).CY(0, 1)
AutoRebase({OpType.PhasedX, OpType.Rz, OpType.ZZPhase}).apply(c)
AutoSquash({OpType.PhasedX, OpType.Rz}).apply(c)
[PhasedX(3, 1) q[0]; PhasedX(1.5, 1) q[1]; ZZPhase(0.5) q[0], q[1]; PhasedX(3, 0.5) q[0]; PhasedX(3.5, 1.5) q[1]; Rz(3.5) q[0]; Rz(2.5) q[1]; ]
  1. Remove unnecessary PhasedX in build_cz

BEGIN_COMMIT_OVERRIDE
fix(qsystem): correct CY decomposition to hardware gateset

feat(qsystem): remove unecessary phasedx wrappers in CZ
END_COMMIT_OVERRIDE

@ss2165 ss2165 requested a review from tatiana-s August 21, 2025 12:49
@ss2165 ss2165 requested a review from a team as a code owner August 21, 2025 12:49
@ss2165 ss2165 requested a review from aborgna-q August 21, 2025 12:49
Copy link

codecov bot commented Aug 21, 2025

Codecov Report

❌ Patch coverage is 14.28571% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.24%. Comparing base (f1ee0a4) to head (8c76709).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
tket-qsystem/src/extension/qsystem.rs 14.28% 0 Missing and 6 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1059      +/-   ##
==========================================
- Coverage   78.24%   78.24%   -0.01%     
==========================================
  Files         102      102              
  Lines       12785    12783       -2     
  Branches    12506    12504       -2     
==========================================
- Hits        10004    10002       -2     
  Misses       2125     2125              
  Partials      656      656              
Flag Coverage Δ
rust 78.18% <14.28%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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
Collaborator

@aborgna-q aborgna-q left a comment

Choose a reason for hiding this comment

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

Ouch.

Any way we could test these?

@ss2165
Copy link
Member Author

ss2165 commented Aug 21, 2025

theorem provers? execution dependency on selene? run pytket and compare?

@ss2165
Copy link
Member Author

ss2165 commented Aug 21, 2025

I will add a test in selene (passing locally)

ss2165 added 2 commits August 21, 2025 16:25
Closes #1058

Found using
```python
from pytket import Circuit, OpType
from pytket.passes import AutoSquash


c = Circuit(2).CY(0, 1)
AutoRebase({OpType.PhasedX, OpType.Rz, OpType.ZZPhase}).apply(c)
AutoSquash({OpType.PhasedX, OpType.Rz}).apply(c)
```

```
[PhasedX(3, 1) q[0]; PhasedX(1.5, 1) q[1]; ZZPhase(0.5) q[0], q[1]; PhasedX(3, 0.5) q[0]; PhasedX(3.5, 1.5) q[1]; Rz(3.5) q[0]; Rz(2.5) q[1]; ]
```
@ss2165 ss2165 force-pushed the ss/push-rnymnsszrpyk branch from 6f1c44b to 8c76709 Compare August 21, 2025 15:39
@ss2165 ss2165 changed the title fix(qsystem): correct CY decomposition to hardware gateset feat(qsystem): native gateset decomposition improvements Aug 21, 2025
@ss2165 ss2165 requested a review from CalMacCQ August 21, 2025 16:06
@ss2165 ss2165 added this pull request to the merge queue Aug 21, 2025
@ss2165 ss2165 removed this pull request from the merge queue due to a manual request Aug 21, 2025
@ss2165 ss2165 added this pull request to the merge queue Aug 21, 2025
@ss2165 ss2165 removed this pull request from the merge queue due to a manual request Aug 21, 2025
@ss2165 ss2165 added this pull request to the merge queue Aug 21, 2025
Merged via the queue into main with commit 126771a Aug 21, 2025
22 of 23 checks passed
@ss2165 ss2165 deleted the ss/push-rnymnsszrpyk branch August 21, 2025 17:52
github-merge-queue bot pushed a commit that referenced this pull request Aug 21, 2025
## 🤖 New release

* `tket-qsystem`: 0.19.0 -> 0.20.0 (✓ API compatible changes)

<details><summary><i><b>Changelog</b></i></summary><p>

<blockquote>

##
[0.20.0](tket-qsystem-v0.19.0...tket-qsystem-v0.20.0)
- 2025-08-21

### New Features

- [**breaking**] Update WASM extension
([#1047](#1047))
- *(qsystem)* native gateset decomposition improvements
([#1059](#1059))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).
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.

qsystem: incorrect cy decomposition
3 participants