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

fix: hseries ops use floats instead of angles #483

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

aborgna-q
Copy link
Collaborator

Adds unit tests to generate and validate each operation in prelude.quantum.

Closes #477

@aborgna-q aborgna-q requested a review from a team as a code owner September 11, 2024 14:30
@aborgna-q aborgna-q requested a review from ss2165 September 11, 2024 14:30
@aborgna-q aborgna-q force-pushed the ab/fix-hseries-emitter branch from 3ba7e48 to 0eaf4fa Compare September 11, 2024 14:32
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 68.75000% with 5 lines in your changes missing coverage. Please review.

Project coverage is 91.94%. Comparing base (a89f225) to head (0eaf4fa).

Files with missing lines Patch % Lines
guppylang/prelude/quantum.py 68.75% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #483      +/-   ##
==========================================
- Coverage   91.99%   91.94%   -0.06%     
==========================================
  Files          58       58              
  Lines        5898     5910      +12     
==========================================
+ Hits         5426     5434       +8     
- Misses        472      476       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +28 to +29
rx,
rz,
Copy link
Member

Choose a reason for hiding this comment

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

see Tk2ops, we should add missing (I can see at least Ry, CRz, Toffoli missing)

Copy link
Member

Choose a reason for hiding this comment

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

I will create an issue and do as follow up

Comment on lines +55 to +57
# TODO: The tket1 conversion needs to be updated with all the hugr ops changes
# before we can test the translated ops
# ops = {g.op.type for g in tk1}
Copy link
Member

Choose a reason for hiding this comment

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

everything in tk2 ops should work as before, hseries ops won't work but that's ok imho

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think the conversion does not expect angles yet, and that ops set ends up being empty -.-

Copy link
Member

Choose a reason for hiding this comment

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

ah...angles not working is a bug, please raise issue

@guppy(quantum)
@typing.no_type_check
def phased_x(q: qubit, angle1: angle, angle2: angle) -> qubit:
f1 = float(angle1)
Copy link
Member

Choose a reason for hiding this comment

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

complete side thought but do we maybe have any way of telling code coverage to ignore guppy function definitions

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Was looking into it, doesn't seem likely

@aborgna-q aborgna-q added this pull request to the merge queue Sep 11, 2024
Merged via the queue into main with commit 7ed3853 Sep 11, 2024
3 checks passed
@aborgna-q aborgna-q deleted the ab/fix-hseries-emitter branch September 11, 2024 14:58
github-merge-queue bot pushed a commit that referenced this pull request Sep 11, 2024
🤖 I have created a release *beep* *boop*
---


## [0.11.0](v0.10.0...v0.11.0)
(2024-09-11)


### ⚠ BREAKING CHANGES

* `guppy.take_module` renamed to `guppy.get_module` and no longer
removes the module from the state.
* Quantum operations `rx`, `rz`, `phased_x`, and `zz_max` use the
`angle` type instead of floats.

### Features

* Add implicit importing of modules
([#461](#461))
([1b73032](1b73032))
* Use angle type in quantum operations
([#467](#467))
([ce0f746](ce0f746))


### Bug Fixes

* hseries ops use floats instead of angles
([#483](#483))
([7ed3853](7ed3853)),
closes [#477](#477)
* Keep track of definitions that are implicitly imported
([#481](#481))
([a89f225](a89f225)),
closes [#480](#480)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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.

Hseries op compilation is broken
3 participants