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

Rewrite to_halfturns with unsafe (infallible) op #630

Closed
aborgna-q opened this issue Oct 1, 2024 · 1 comment · Fixed by #640
Closed

Rewrite to_halfturns with unsafe (infallible) op #630

aborgna-q opened this issue Oct 1, 2024 · 1 comment · Fixed by #640
Assignees

Comments

@aborgna-q
Copy link
Collaborator

aborgna-q commented Oct 1, 2024

This may be required to extract pytket circuits from hugrs with float/rotation parameter manipulation.

We should be able to match on the to_halfturns op followed by a conditional to unwrap or panic emitted by guppy.
The general case is harder, as it may require type changing rewrites (as the Option<float> may be passed around).

The alternative to this is to track option<float> as parameters in the pytket encoder, and have a constant folding that interprets panics as undefined behaviour (so the failing branch can be ignored).

@aborgna-q aborgna-q changed the title Replace to_halfturns with unsafe (infallible) op Rewrite to_halfturns with unsafe (infallible) op Oct 1, 2024
@aborgna-q aborgna-q self-assigned this Oct 1, 2024
@doug-q
Copy link
Contributor

doug-q commented Oct 2, 2024

We should add to_halfturns_unsafe or similar which does the panic for you.

github-merge-queue bot pushed a commit that referenced this issue Oct 8, 2024
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
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 a pull request may close this issue.

2 participants