-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add a projector observable to CirqDevice #62
Add a projector observable to CirqDevice #62
Conversation
Codecov Report
@@ Coverage Diff @@
## master #62 +/- ##
=======================================
Coverage 99.14% 99.14%
=======================================
Files 8 8
Lines 349 349
=======================================
Hits 346 346
Misses 3 3
Continue to review full report at Codecov.
|
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.
Thanks @wongwsvincent! Before I can approve, would you be able to add a small test for the projector observable, to make sure that it works correctly? Since it will be using Cirq
directly to compute the expectation, rather than using the logic you added to QubitDevice
(I believe).
I think there are two options here:
-
Add a small unit test using the device methods directly
-
Write an integration test using a QNode (this would require modifying the
requirements.txt
file so that the latest master of PennyLane is installed instead, e.g.git+https://github.com/PennyLaneAI/pennylane.git
Thank you for adding this!
Co-authored-by: Josh Izaac <josh146@gmail.com>
@josh146, I have only added a P.S. It would be great if there's any suggestion on how to install |
Thanks @wongwsvincent!
This is perfectly fine 🙂 If you want to run the test suite locally, you can explicitly ignore the
or by using pytest's test selector command line argument:
Unfortunately I am not sure - I know that |
Awesome! Thanks @josh146 , something like |
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.
Thanks @wongwsvincent for the extra push with the tests!
The integration tests are still failing, but this is not the fault of your PR, rather, it looks like another bug in the Cirq plugin has been uncovered. Since that is out of scope here, I may override that failing CI check.
@@ -10,7 +10,7 @@ jobs: | |||
runs-on: ubuntu-latest | |||
strategy: | |||
matrix: | |||
python-version: [3.6, 3.7, 3.8] | |||
python-version: [3.7, 3.8] |
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.
I removed 3.6, since PL no longer supports it!
@@ -1,3 +1,3 @@ | |||
pennylane>=0.15 | |||
git+https://github.com/PennyLaneAI/pennylane.git |
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.
I also updated this to point to PL master, since qml.Projector
is not present in the stable v0.15 release
Thanks @josh146 for fixing some of the test errors! |
Yep, they are orthogonal :) I will merge this PR now @wongwsvincent, which allows us to fix these bugs in a separate PR. I have to admit, off the top of my head I'm unsure what the bug is, it will require some investigation. |
Context:
Adding a projector observable to CirqDevice.
Description of the Change:
Implementing projector observable with Cirq's own
cirq.ProductState.projector
method.Related GitHub PR:
Work coherently with PR #1356