-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Update RB to reduce the size of the generated circuits #7411
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7411 +/- ##
==========================================
- Coverage 98.69% 98.68% -0.01%
==========================================
Files 1112 1112
Lines 97748 97765 +17
==========================================
+ Hits 96470 96481 +11
- Misses 1278 1284 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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, Nour!! I tested this, and it works!
Could we also change the default value for use_xy_basis
in cirq.experiments.parallel_single_qubit_randomized_benchmarking
to False, since that is the default value internally? 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.
Please replace _CliffordGateSequence
with a simple conversion.
Otherwise LGTM.
c1_in_xy: _CliffordGateSequence = attrs.field(converter=_CliffordGateSequence) | ||
c1_in_xz: _CliffordGateSequence = attrs.field(converter=_CliffordGateSequence) | ||
s1: _CliffordGateSequence = attrs.field(converter=_CliffordGateSequence) | ||
s1_x: _CliffordGateSequence = attrs.field(converter=_CliffordGateSequence) | ||
s1_y: _CliffordGateSequence = attrs.field(converter=_CliffordGateSequence) |
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.
If possible, we should avoid the _CliffordGateSequence
wrapper.
How about just keeping the original list type and using converter=_canonize_clifford_sequences
?
Current unit test expands all fields so there is no time saved on their delayed conversion through _CliffordGateSequence
.
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.
that was the first version of the code, but I needed to add the class to keep the tests the explicitly check the content of the lists ... that is some tests check that the clifford are written in terms of X/Z or X/Y which wouldn't be possible if all they see is the merged gate
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.
Then perhaps we can add some canonized: bool
flag for the _single_qubit_cliffords
factory which will return old Cliffords for the X/Z, X/Y test and canonized elsewhere. Would that work?
return len(self._reduced_gate_sequence) | ||
|
||
|
||
@attrs.frozen | ||
class Cliffords: | ||
"""The single-qubit Clifford group, decomposed into elementary gates. | ||
|
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.
Please add a short note to docstring saying the arguments are converted to a reduced gate sequence.
This class wraps around a list of sequences of clifford gates and re-exposes them as | ||
a list of tuple where each tuple contains a single clifford gates. |
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.
Nit - clifford
--> Clifford
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.
Before merging, see b/422636519
the cirq RB sequences were often 2-3 times bigger than they should, this is because for historical reasons the cliffords were written as products of X/Z or X/Y gates. In this PR I merge these gates into a single PhasedXZGate which is the same as we do internally.