Skip to content
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

feat: Add tket2.rotation.from_halfturns_unchecked op #640

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

aborgna-q
Copy link
Collaborator

This is an operation that we are able to process while encoding pytket circuits.
We expect guppy to emit this instead of adding explicit panics to unwrap the fallible result.

The pytket encoder should now support float wires.

Closes #630
I'll open a followup issue on guppy

@aborgna-q aborgna-q requested a review from a team as a code owner October 8, 2024 10:49
@aborgna-q aborgna-q requested a review from ss2165 October 8, 2024 10:49
@aborgna-q
Copy link
Collaborator Author

aborgna-q commented Oct 8, 2024

Note: hugr's int ops use a _checked for the fallible ops, and no-suffix for the panicking ones.
We could do the same here, but it would be a breaking change to the extension.

Copy link

codecov bot commented Oct 8, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 81.85%. Comparing base (2cf79fd) to head (5adb7fa).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
tket2/src/extension/rotation.rs 90.00% 0 Missing and 1 partial ⚠️
tket2/src/serialize/pytket/encoder.rs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #640      +/-   ##
==========================================
+ Coverage   81.71%   81.85%   +0.14%     
==========================================
  Files          48       48              
  Lines        6606     6615       +9     
  Branches     6606     6615       +9     
==========================================
+ Hits         5398     5415      +17     
+ Misses        849      842       -7     
+ Partials      359      358       -1     
Flag Coverage Δ
rust 81.85% <83.33%> (+0.14%) ⬆️

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.

Copy link
Member

@ss2165 ss2165 left a comment

Choose a reason for hiding this comment

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

👍

@aborgna-q aborgna-q added this pull request to the merge queue Oct 8, 2024
Merged via the queue into main with commit 86ffe64 Oct 8, 2024
16 checks passed
@aborgna-q aborgna-q deleted the ab/infallible-fromrots branch October 8, 2024 10:57
@hugrbot hugrbot mentioned this pull request Oct 7, 2024
github-merge-queue bot pushed a commit that referenced this pull request Oct 10, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.4.1](tket2-py-v0.4.0...tket2-py-v0.4.1)
(2024-10-10)


### Features

* Add `tket2.rotation.from_halfturns_unchecked` op
([#640](#640))
([86ffe64](86ffe64))

---
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 <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Oct 15, 2024
## 🤖 New release
* `tket2`: 0.5.0 -> 0.6.0 (⚠️ API breaking changes)
* `tket2-hseries`: 0.5.0 -> 0.6.0 (✓ API compatible changes)

### ⚠️ `tket2` breaking changes

```
--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.35.0/src/lints/inherent_method_missing.ron

Failed in:
  LexicographicCostFunction::default_cx, previously in file /private/var/folders/3j/ktpgz6yj0gn05q3x3d0qqndw0000gn/T/.tmpwozYGu/tket2/src/rewrite/strategy.rs:349

--- failure pub_module_level_const_missing: pub module-level const is missing ---

Description:
A public const is missing, renamed, or changed from const to static.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.35.0/src/lints/pub_module_level_const_missing.ron

Failed in:
  SYM_OP_ID in file /private/var/folders/3j/ktpgz6yj0gn05q3x3d0qqndw0000gn/T/.tmpwozYGu/tket2/src/extension/sympy.rs:27
  SYM_EXPR_NAME in file /private/var/folders/3j/ktpgz6yj0gn05q3x3d0qqndw0000gn/T/.tmpwozYGu/tket2/src/extension/sympy.rs:24

--- failure struct_missing: pub struct removed or renamed ---

Description:
A publicly-visible struct cannot be imported by its prior path. A `pub use` may have been removed, or the struct itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.35.0/src/lints/struct_missing.ron

Failed in:
  struct tket2::extension::SYM_EXPR_T, previously in file /private/var/folders/3j/ktpgz6yj0gn05q3x3d0qqndw0000gn/T/.tmpwozYGu/tket2/src/extension/sympy.rs:140
```

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

## `tket2`
<blockquote>

##
[0.6.0](tket2-v0.5.0...tket2-v0.6.0)
- 2024-10-15

### New Features

- *(badger)* `cx` and `rz` const functions and strategies for
`LexicographicCostFunction`
([#625](#625))
- Add `tket2.rotation.from_halfturns_unchecked` op
([#640](#640))
- [**breaking**] update to hugr 0.13.0
([#645](#645))
- Decode pytket op parameters
([#644](#644))
- re-export hugr crate ([#652](#652))
- Extract pytket parameters to input wires
([#661](#661))

### Refactor

- [**breaking**] Remove deprecated exports
([#662](#662))
</blockquote>

## `tket2-hseries`
<blockquote>

##
[0.4.0](tket2-hseries-v0.3.0...tket2-hseries-v0.4.0)
- 2024-09-16

### New Features

- [**breaking**] `HSeriesPass` lowers `Tk2Op`s into `HSeriesOp`s
([#602](#602))
- [**breaking**] simplify angle extension in to a half turns rotation
type ([#611](#611))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).

Co-authored-by: Agustín Borgna <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Oct 15, 2024
## 🤖 New release
* `tket2`: 0.5.0 -> 0.6.0 (⚠️ API breaking changes)
* `tket2-hseries`: 0.5.0 -> 0.6.0 (✓ API compatible changes)

### ⚠️ `tket2` breaking changes

```
--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.35.0/src/lints/inherent_method_missing.ron

Failed in:
  LexicographicCostFunction::default_cx, previously in file /private/var/folders/3j/ktpgz6yj0gn05q3x3d0qqndw0000gn/T/.tmpwozYGu/tket2/src/rewrite/strategy.rs:349

--- failure pub_module_level_const_missing: pub module-level const is missing ---

Description:
A public const is missing, renamed, or changed from const to static.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.35.0/src/lints/pub_module_level_const_missing.ron

Failed in:
  SYM_OP_ID in file /private/var/folders/3j/ktpgz6yj0gn05q3x3d0qqndw0000gn/T/.tmpwozYGu/tket2/src/extension/sympy.rs:27
  SYM_EXPR_NAME in file /private/var/folders/3j/ktpgz6yj0gn05q3x3d0qqndw0000gn/T/.tmpwozYGu/tket2/src/extension/sympy.rs:24

--- failure struct_missing: pub struct removed or renamed ---

Description:
A publicly-visible struct cannot be imported by its prior path. A `pub use` may have been removed, or the struct itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.35.0/src/lints/struct_missing.ron

Failed in:
  struct tket2::extension::SYM_EXPR_T, previously in file /private/var/folders/3j/ktpgz6yj0gn05q3x3d0qqndw0000gn/T/.tmpwozYGu/tket2/src/extension/sympy.rs:140
```

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

## `tket2`
<blockquote>

##
[0.6.0](tket2-v0.5.0...tket2-v0.6.0)
- 2024-10-15

### New Features

- *(badger)* `cx` and `rz` const functions and strategies for
`LexicographicCostFunction`
([#625](#625))
- Add `tket2.rotation.from_halfturns_unchecked` op
([#640](#640))
- [**breaking**] update to hugr 0.13.0
([#645](#645))
- Decode pytket op parameters
([#644](#644))
- re-export hugr crate ([#652](#652))
- Extract pytket parameters to input wires
([#661](#661))

### Refactor

- [**breaking**] Remove deprecated exports
([#662](#662))
</blockquote>

## `tket2-hseries`
<blockquote>

##
[0.4.0](tket2-hseries-v0.3.0...tket2-hseries-v0.4.0)
- 2024-09-16

### New Features

- [**breaking**] `HSeriesPass` lowers `Tk2Op`s into `HSeriesOp`s
([#602](#602))
- [**breaking**] simplify angle extension in to a half turns rotation
type ([#611](#611))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).

Co-authored-by: Agustín Borgna <[email protected]>
@hugrbot hugrbot mentioned this pull request Oct 21, 2024
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.

Rewrite to_halfturns with unsafe (infallible) op
2 participants