-
Notifications
You must be signed in to change notification settings - Fork 615
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
Clifford+T decomposition for RZ gates #4678
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…nnylane into clifford-t-decomp
Hello. You may have forgotten to update the changelog!
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #4678 +/- ##
==========================================
- Coverage 99.64% 99.28% -0.36%
==========================================
Files 376 383 +7
Lines 33810 34995 +1185
==========================================
+ Hits 33689 34746 +1057
- Misses 121 249 +128
☔ View full report in Codecov by Sentry. |
trbromley
added
the
do not merge ⚠️
Do not merge the pull request until this label is removed
label
Oct 16, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context:
I implemented this paper in python. I just "copy-pasted" the author's implementation of it in Haskell. I kept function names and variable names as consistent as possible with the original to make it easier to cross-reference code in the future if bugs pop up. Some notes:
a'
. I named thosea_
instead to be accepted in pythontheta_to_gates
insynthesis.py
. Example below.The algorithm is effectively three parts.
u
value in thet
, the off-diagonal elements in the matrixFiles:
gridpoints.py
: solver for the first part of the algorithm. Its code creates a generator of possible solutions, which will be verified later. There are many, so the generator is key.diophantine.py
: solver for the second part of the algorithm. It raises aDiophantineError
if it got a bad result.newsynth.py
: entrypoint for the first two parts of the algorithm. It gets the generator fromgridpoints.py
and checks each candidate with code indiophantine.py
until it finds one that worksrings.py
: this file holds the different Ring type definitions. This part is most different from the Haskell. I only implemented the functions/dunders needed to make the code work, and I raise ValueErrors otherwise. This should help with bug reporting if it ever happens.shapes.py
: some shapes/objects that were useful to definesynthesis.py
: the third part of the algorithm. This part is a little overly sophisticated, because it works (mostly) for multi-qubit gates, even though I only needed an algorithm for single-qubit gates. I opted for this one because it was already implemented in Haskell, simple as that. It works : )Description of the Change:
Introduce the
gridsynth
Clifford+T decomposition algorithm! It takes a theta value (for an RZ rotation) and an epsilon value (tends to work down to 1e-8 from what I've seen, but maybe we can improve it).Benefits:
We can do Clifford+T decompositions!
Possible Drawbacks: