-
Notifications
You must be signed in to change notification settings - Fork 8
feat!: Use qsystem encoder/decoders in tket-py #1041
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
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1041 +/- ##
==========================================
- Coverage 78.41% 78.28% -0.13%
==========================================
Files 102 102
Lines 12641 12667 +26
Branches 12362 12388 +26
==========================================
+ Hits 9912 9916 +4
- Misses 2077 2099 +22
Partials 652 652
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Testing anything with the |
# Check that we didn't use the opaque tk1 op fallback. | ||
# TODO: There's no way to traverse the circuit nodes?? | ||
assert "TKET1.tk1op" not in tk1_dot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
x.x
At least we can check that we're doing the right thing in the render
graph LR
subgraph 0 ["(0) Module"]
direction LR
subgraph 1 ["(1) [**FuncDefn: #quot;#quot;**]"]
direction LR
style 1 stroke:#832561,stroke-width:3px
2["(2) Input"]
3["(3) Output"]
4["(4) const:custom:f64(0.75)"]
5["(5) LoadConstant"]
6["(6) tket.qsystem.ZZPhase"]
7["(7) const:custom:f64(0.25)"]
8["(8) LoadConstant"]
9["(9) const:custom:f64(0.33)"]
10["(10) LoadConstant"]
11["(11) tket.qsystem.PhasedX"]
2--"0:0<br>qubit"-->6
2--"1:1<br>qubit"-->6
4--"0:0<br>float64"-->5
5--"0:2<br>float64"-->6
6--"0:0<br>qubit"-->3
6--"1:0<br>qubit"-->11
7--"0:0<br>float64"-->8
8--"0:1<br>float64"-->11
9--"0:0<br>float64"-->10
10--"0:2<br>float64"-->11
11--"0:1<br>qubit"-->3
end
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yikes
5f16398
to
40e1fb9
Compare
40e1fb9
to
6ee9aa6
Compare
This PR contains breaking changes to the public Rust API. cargo-semver-checks summary
|
# Check that we didn't use the opaque tk1 op fallback. | ||
# TODO: There's no way to traverse the circuit nodes?? | ||
assert "TKET1.tk1op" not in tk1_dot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yikes
|
||
|
||
def test_conversion_qsystem(): | ||
tk1 = Circuit(2).ZZPhase(0.75, 0, 1).PhasedX(0.25, 0.33, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add zzmax as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ZZMax is a bit annoying, because the roundtrip is not the identity.
We convert ZZMax
to the equivalent ZZPhase(1/2)
during decoding, and we extract it as is.
@@ -636,7 +626,7 @@ impl<H: HugrView> PytketEncoderContext<H> { | |||
let config = Arc::clone(&self.config); | |||
|
|||
// Recursively encode the sub-graph. | |||
let mut subencoder = PytketEncoderContext::new_arc(circ, node, config)?; | |||
let mut subencoder = PytketEncoderContext::new(circ, node, config)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be nice to have coverage of this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a simple change—adding a decoder for CircBox
es—but not part of this PR. See #44
## 🤖 New release * `tket`: 0.13.2 -> 0.14.0 (✓ API compatible changes) * `tket-qsystem`: 0.18.1 -> 0.19.0 (✓ API compatible changes) <details><summary><i><b>Changelog</b></i></summary><p> ## `tket` <blockquote> ## [0.14.0](tket-v0.13.2...tket-v0.14.0) - 2025-08-18 ### New Features - [**breaking**] Allow PytketTypeTranslators to translate nested types ([#1038](#1038)) - Define a wire tracker for the new pytket decoder ([#1036](#1036)) - [**breaking**] Reworked pytket decoder framework ([#1030](#1030)) - [**breaking**] Use qsystem encoder/decoders in tket-py ([#1041](#1041)) - [**breaking**] Avoid eagerly cloning SerialCircuits when decoding from pytket ([#1048](#1048)) ### Refactor - [**breaking**] Rename tk2 encoder names to tket ([#1037](#1037)) </blockquote> ## `tket-qsystem` <blockquote> ## [0.19.0](tket-qsystem-v0.18.1...tket-qsystem-v0.19.0) - 2025-08-18 ### New Features - Add emitters for tket-qsystem ([#1039](#1039)) - [**breaking**] Avoid eagerly cloning SerialCircuits when decoding from pytket ([#1048](#1048)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/).
🤖 I have created a release *beep* *boop* --- ## [0.12.2](tket-py-v0.12.1...tket-py-v0.12.2) (2025-08-19) ### Features * Define a wire tracker for the new pytket decoder ([#1036](#1036)) ([2466ee2](2466ee2)) * Support qsystem native operations when loading pytket circuits ([#1041](#1041)) ([88c5c79](88c5c79)) * **tket-py:** Create BadgerOptimiser from arbitrary Rewriters ([#1022](#1022)) ([a975c1d](a975c1d)), closes [#1021](#1021) ### Documentation * Update README badges ([#1004](#1004)) ([d609bf5](d609bf5)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: Agustín Borgna <agustin.borgna@quantinuum.com>
🤖 I have created a release *beep* *boop* --- ## [0.12.2](tket-py-v0.12.1...tket-py-v0.12.2) (2025-08-19) ### Features * Define a wire tracker for the new pytket decoder ([#1036](#1036)) ([2466ee2](2466ee2)) * Support qsystem native operations when loading pytket circuits ([#1041](#1041)) ([88c5c79](88c5c79)) * **tket-py:** Create BadgerOptimiser from arbitrary Rewriters ([#1022](#1022)) ([a975c1d](a975c1d)), closes [#1021](#1021) ### Documentation * Update README badges ([#1004](#1004)) ([d609bf5](d609bf5)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: Agustín Borgna <agustin.borgna@quantinuum.com>
Depends on #1039
load_tk1
/save_tk1
utilities, so we don't use the default by mistake.tket-py
, so now we can loadZZMax
/ZZPhase
/PhasedX
BREAKING CHANGE: Added encode/decode config arguments to pytket load/store utilities
This is not a breaking change for the python lib, so I'll override the flag for release-please:
BEGIN_COMMIT_OVERRIDE
feat: Support qsystem native operations when loading pytket circuits (#1041)
END_COMMIT_OVERRIDE