-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Initial draft of ConvertToSycamore #2516
Initial draft of ConvertToSycamore #2516
Conversation
dstrain115
commented
Nov 8, 2019
- Port of ConvertToSycamore from cirq_internal
- Cleaned up format, mypy, deprecated commands
- Refactored various functions to try to clean them up.
- Got rid of half-pi only rotations
- Port of ConvertToSycamore from cirq_internal - Cleaned up format, mypy, deprecated commands - Refactored various functions to try to clean them up. - Got rid of half-pi only rotations
yield (gate(q1) for gate in optimizers.single_qubit_matrix_to_gates(a_1)) | ||
|
||
|
||
def zztheta(theta: float, q0: ops.Qid, q1: ops.Qid) -> ops.OP_TREE: |
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 prefer the name rzz
.
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.
Done.
yield ops.Rz(theta / 2).on(q1) | ||
|
||
|
||
def swap_zztheta(theta: float, q0: ops.Qid, q1: ops.Qid) -> ops.OP_TREE: |
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 prefer the name swap_rzz
.
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.
Done.
Ping. Could I get a review of this? I would like to get this committed before the next import of google3 and to move away from the need for cirq_internal. 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.
Looks fine, as this is a port of code we've been using successfully internally.
I don't like the name textbook_gates_from_sycamore
and think it should just be merged into convert_to_sycamore_gates
. Maybe open a low-prio follow-up ticket?
Done. Also cleaned up a bunch of tests to make them parameterized and got rid of a bunch of unnecessary cruft. Want to take another look before I submit? |
…irq-1 into convert_to_sycamore
Sorry to be a diva, but is there any way we could keep some (most) of the functions as free functions (i.e. not methods on a class)? They're really helpful atoms for crafting one's own optimizer if one is not happy with how At present, the only usage of |
I have changed them all to class methods or staticmethods. That way you can call them without instantiating the class. That to me seems better than having a bunch of loose functions hanging around. What do you think? |