-
Notifications
You must be signed in to change notification settings - Fork 121
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
feature: added controlled-sqrt-not gate #297
Conversation
This makes certain circuits, like CHSH, more straightforward. This commit works in line with the following branches (also committed, separately): https://github.com/unprovable/amazon-braket-schemas-python.git@ctrl-v-gate https://github.com/unprovable/amazon-braket-default-simulator-python.git@ctrl-v-gate
I'm guessing given this was submitted over two weeks ago and no comments have been forthcoming that this probably isn't going anywhere? This gate makes a lot of the research I'm currently doing much more workable, hence the code was sent up. Can someone close this (and the other related PR's) if it's not going to be used? Thanks :) M. |
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 for this PR @unprovable and apologies for missing this earlier. Could you please run tox -e linters
for fixing the file formatting ?
Hello! No worries - and yes, sorry, forgot to run that. Ran it on all the repos to be sure, but only changes made to the |
Codecov Report
@@ Coverage Diff @@
## main #297 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 63 63
Lines 4221 4236 +15
Branches 581 581
=========================================
+ Hits 4221 4236 +15
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.
Let's revert tox.ini here as well before we merge. Thanks!
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.
Thank you for contributing to enhance the Braket SDK and being patient as we worked through the PRs, @unprovable! Great work!
Thank you for all your help! :D Very nice experience doing these PR's for sure! |
* feature: added controlled-sqrt-not gate This makes certain circuits, like CHSH, more straightforward. This commit works in line with the following branches (also committed, separately): https://github.com/unprovable/amazon-braket-schemas-python.git@ctrl-v-gate https://github.com/unprovable/amazon-braket-default-simulator-python.git@ctrl-v-gate * fix: ran tox linters * fix: reverted tox.ini Co-authored-by: Mark C <[email protected]> Co-authored-by: Mark C <[email protected]> Co-authored-by: Cody Wang <[email protected]>
* infra: Pin docutils<0.18 in doc requirements (#283) docutils 0.18 was released on October 26, 2021, and with it came some [breaking changes](readthedocs/readthedocs.org#8616) for sphinx, and in turn [readthedocs builds](https://readthedocs.org/projects/amazon-braket-sdk-python/builds/15168485/). To keep doc builds working, docutils will be constrained to versions below 0.18. * prepare release v1.9.5.post0 * update development version to v1.9.6.dev0 * feature: Add support for jobs (#287) Co-authored-by: Viraj Chaudhari <[email protected]> Co-authored-by: Milan Krneta <[email protected]> Co-authored-by: Aaron Berdy <[email protected]> Co-authored-by: Lin <[email protected]> Co-authored-by: Roald Bradley Severtson <[email protected]> Co-authored-by: Christian Madsen <[email protected]> * fix: Skip jobs integration tests (#288) * prepare release v1.10.0 * update development version to v1.10.1.dev0 * feature: Adding integration tests for DM1 (#286) * feature: Adding integration tests for DM1 * Moved many_layers to test_quantum_task * formatting changes only Co-authored-by: Cody Wang <[email protected]> * prepare release v1.11.0 * update development version to v1.11.1.dev0 * fix: remove extraneous reference from local job container setup (#292) * prepare release v1.11.1 * update development version to v1.11.2.dev0 * feature: optimize IAM role retrieval (#299) * fix: Enable jobs integration tests (#289) * feature: Added is_available property to AwsDevice (#290) Added is_available property to AwsDevice that parses the availability window and current device status to return a boolean flag if the device is currently available. * prepare release v1.12.0 * update development version to v1.12.1.dev0 * feature: added controlled-sqrt-not gate (#297) * feature: added controlled-sqrt-not gate This makes certain circuits, like CHSH, more straightforward. This commit works in line with the following branches (also committed, separately): https://github.com/unprovable/amazon-braket-schemas-python.git@ctrl-v-gate https://github.com/unprovable/amazon-braket-default-simulator-python.git@ctrl-v-gate * fix: ran tox linters * fix: reverted tox.ini Co-authored-by: Mark C <[email protected]> Co-authored-by: Mark C <[email protected]> Co-authored-by: Cody Wang <[email protected]> * prepare release v1.13.0 * update development version to v1.13.1.dev0 * feature: adding TwoQubitPauliChannel (#300) * prepare release v1.14.0 * update development version to v1.14.1.dev0 Co-authored-by: Cody Wang <[email protected]> Co-authored-by: ci <ci> Co-authored-by: Kshitij Chhabra <[email protected]> Co-authored-by: Milan Krneta <[email protected]> Co-authored-by: Aaron Berdy <[email protected]> Co-authored-by: Lin <[email protected]> Co-authored-by: Roald Bradley Severtson <[email protected]> Co-authored-by: Christian Madsen <[email protected]> Co-authored-by: Jacob Feldman <[email protected]> Co-authored-by: Mark Sweat <[email protected]> Co-authored-by: Mark C <[email protected]> Co-authored-by: Mark C <[email protected]> Co-authored-by: Mark C <[email protected]> Co-authored-by: mbeach-aws <[email protected]>
* infra: Pin docutils<0.18 in doc requirements (#283) docutils 0.18 was released on October 26, 2021, and with it came some [breaking changes](readthedocs/readthedocs.org#8616) for sphinx, and in turn [readthedocs builds](https://readthedocs.org/projects/amazon-braket-sdk-python/builds/15168485/). To keep doc builds working, docutils will be constrained to versions below 0.18. * prepare release v1.9.5.post0 * update development version to v1.9.6.dev0 * feature: Add support for jobs (#287) Co-authored-by: Viraj Chaudhari <[email protected]> Co-authored-by: Milan Krneta <[email protected]> Co-authored-by: Aaron Berdy <[email protected]> Co-authored-by: Lin <[email protected]> Co-authored-by: Roald Bradley Severtson <[email protected]> Co-authored-by: Christian Madsen <[email protected]> * fix: Skip jobs integration tests (#288) * prepare release v1.10.0 * update development version to v1.10.1.dev0 * feature: Adding integration tests for DM1 (#286) * feature: Adding integration tests for DM1 * Moved many_layers to test_quantum_task * formatting changes only Co-authored-by: Cody Wang <[email protected]> * prepare release v1.11.0 * update development version to v1.11.1.dev0 * fix: remove extraneous reference from local job container setup (#292) * prepare release v1.11.1 * update development version to v1.11.2.dev0 * feature: optimize IAM role retrieval (#299) * fix: Enable jobs integration tests (#289) * feature: Added is_available property to AwsDevice (#290) Added is_available property to AwsDevice that parses the availability window and current device status to return a boolean flag if the device is currently available. * prepare release v1.12.0 * update development version to v1.12.1.dev0 * feature: added controlled-sqrt-not gate (#297) * feature: added controlled-sqrt-not gate This makes certain circuits, like CHSH, more straightforward. This commit works in line with the following branches (also committed, separately): https://github.com/unprovable/amazon-braket-schemas-python.git@ctrl-v-gate https://github.com/unprovable/amazon-braket-default-simulator-python.git@ctrl-v-gate * fix: ran tox linters * fix: reverted tox.ini Co-authored-by: Mark C <[email protected]> Co-authored-by: Mark C <[email protected]> Co-authored-by: Cody Wang <[email protected]> * prepare release v1.13.0 * update development version to v1.13.1.dev0 * feature: adding TwoQubitPauliChannel (#300) * prepare release v1.14.0 * update development version to v1.14.1.dev0 * documentation: fix documentation on environment variable to match the code. (#302) * prepare release v1.14.0.post0 * update development version to v1.14.1.dev0 * feat: Update region switching for regional device arns (#169) (#303) * prepare release v1.15.0 * update development version to v1.15.1.dev0 Co-authored-by: Cody Wang <[email protected]> Co-authored-by: ci <ci> Co-authored-by: Viraj Chaudhari <[email protected]> Co-authored-by: Milan Krneta <[email protected]> Co-authored-by: Aaron Berdy <[email protected]> Co-authored-by: Lin <[email protected]> Co-authored-by: Roald Bradley Severtson <[email protected]> Co-authored-by: Christian Madsen <[email protected]> Co-authored-by: Jacob Feldman <[email protected]> Co-authored-by: Mark Sweat <[email protected]> Co-authored-by: Mark C <[email protected]> Co-authored-by: Mark C <[email protected]> Co-authored-by: Mark C <[email protected]> Co-authored-by: mbeach-aws <[email protected]> Co-authored-by: Yiheng Duan <[email protected]>
* Added integration tests and LHR region to device configuration (#174) * fix: Add LHR to the list of device regions * test updates * fix: Add integration tests * formatting changes * fix: Return DiGraph for device.topology_graph (#175) * sync: Merge from public repository (#176) * infra: Pin docutils<0.18 in doc requirements (#283) docutils 0.18 was released on October 26, 2021, and with it came some [breaking changes](readthedocs/readthedocs.org#8616) for sphinx, and in turn [readthedocs builds](https://readthedocs.org/projects/amazon-braket-sdk-python/builds/15168485/). To keep doc builds working, docutils will be constrained to versions below 0.18. * prepare release v1.9.5.post0 * update development version to v1.9.6.dev0 * feature: Add support for jobs (#287) Co-authored-by: Viraj Chaudhari <[email protected]> Co-authored-by: Milan Krneta <[email protected]> Co-authored-by: Aaron Berdy <[email protected]> Co-authored-by: Lin <[email protected]> Co-authored-by: Roald Bradley Severtson <[email protected]> Co-authored-by: Christian Madsen <[email protected]> * fix: Skip jobs integration tests (#288) * prepare release v1.10.0 * update development version to v1.10.1.dev0 * feature: Adding integration tests for DM1 (#286) * feature: Adding integration tests for DM1 * Moved many_layers to test_quantum_task * formatting changes only Co-authored-by: Cody Wang <[email protected]> * prepare release v1.11.0 * update development version to v1.11.1.dev0 * fix: remove extraneous reference from local job container setup (#292) * prepare release v1.11.1 * update development version to v1.11.2.dev0 * feature: optimize IAM role retrieval (#299) * fix: Enable jobs integration tests (#289) * feature: Added is_available property to AwsDevice (#290) Added is_available property to AwsDevice that parses the availability window and current device status to return a boolean flag if the device is currently available. * prepare release v1.12.0 * update development version to v1.12.1.dev0 * feature: added controlled-sqrt-not gate (#297) * feature: added controlled-sqrt-not gate This makes certain circuits, like CHSH, more straightforward. This commit works in line with the following branches (also committed, separately): https://github.com/unprovable/amazon-braket-schemas-python.git@ctrl-v-gate https://github.com/unprovable/amazon-braket-default-simulator-python.git@ctrl-v-gate * fix: ran tox linters * fix: reverted tox.ini Co-authored-by: Mark C <[email protected]> Co-authored-by: Mark C <[email protected]> Co-authored-by: Cody Wang <[email protected]> * prepare release v1.13.0 * update development version to v1.13.1.dev0 * feature: adding TwoQubitPauliChannel (#300) * prepare release v1.14.0 * update development version to v1.14.1.dev0 * documentation: fix documentation on environment variable to match the code. (#302) * prepare release v1.14.0.post0 * update development version to v1.14.1.dev0 * feat: Update region switching for regional device arns (#169) (#303) * prepare release v1.15.0 * update development version to v1.15.1.dev0 Co-authored-by: Cody Wang <[email protected]> Co-authored-by: ci <ci> Co-authored-by: Viraj Chaudhari <[email protected]> Co-authored-by: Milan Krneta <[email protected]> Co-authored-by: Aaron Berdy <[email protected]> Co-authored-by: Lin <[email protected]> Co-authored-by: Roald Bradley Severtson <[email protected]> Co-authored-by: Christian Madsen <[email protected]> Co-authored-by: Jacob Feldman <[email protected]> Co-authored-by: Mark Sweat <[email protected]> Co-authored-by: Mark C <[email protected]> Co-authored-by: Mark C <[email protected]> Co-authored-by: Mark C <[email protected]> Co-authored-by: mbeach-aws <[email protected]> Co-authored-by: Yiheng Duan <[email protected]> Co-authored-by: Cody Wang <[email protected]> Co-authored-by: Viraj Chaudhari <[email protected]> Co-authored-by: Milan Krneta <[email protected]> Co-authored-by: Aaron Berdy <[email protected]> Co-authored-by: Lin <[email protected]> Co-authored-by: Roald Bradley Severtson <[email protected]> Co-authored-by: Christian Madsen <[email protected]> Co-authored-by: Jacob Feldman <[email protected]> Co-authored-by: Mark Sweat <[email protected]> Co-authored-by: Mark C <[email protected]> Co-authored-by: Mark C <[email protected]> Co-authored-by: Mark C <[email protected]> Co-authored-by: mbeach-aws <[email protected]> Co-authored-by: Yiheng Duan <[email protected]>
This makes certain circuits, like CHSH, more straightforward. This commit works in line with the following branches (also committed, separately):
https://github.com/unprovable/amazon-braket-schemas-python.git@ctrl-v-gate
https://github.com/unprovable/amazon-braket-default-simulator-python.git@ctrl-v-gate
Issue #, if available:
Description of changes:
Added the controlled version of the sqrt(NOT) gate, in Braket's parlance this is the V-gate, and so it is named the 'CV-gate' in this PR. I have also made the relevant changes on similarly named branches in the
schemas
anddefault-simulator
repos. These are located:(I'll include this PR number in the PRs for those repositories).
The main motivation for this change is to make circuits a little easier to construct in the simulator, and hopefully later on devices. For example, the CHSH form of the Bell inequality test has a very straightforward form using this gate. (See the 'testing' section for the code that demonstrates this).
Testing done:
I wrote some unit tests and included them in the PR. Also, to check this point the following code was used, based on section 16.2 in https://arxiv.org/abs/1907.09415 -
This circuit produces the correct results using a modified version of the
amazon-braket-sdk
library. The code has been copied into this (and related) PR's to enable these simulations in the main AWS braket repo.Merge Checklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.General
Tests
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.