-
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
Add a new gauge for SqrtCZ and support SqrtCZ† and fix and improve spin inversion gauge #6571
Conversation
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!
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6571 +/- ##
==========================================
- Coverage 97.79% 97.78% -0.01%
==========================================
Files 1124 1124
Lines 95659 95699 +40
==========================================
+ Hits 93550 93580 +30
- Misses 2109 2119 +10 ☔ View full report in Codecov by Sentry. |
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.
LGTM! Thanks, Nour!!
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.
The swap_qubits
field and logic seem unnecessary at this time.
return 5.0 | ||
|
||
def sample(self, gate: ops.Gate, prng: np.random.Generator) -> ConstantGauge: | ||
if prng.choice([True, False]): |
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 this can be called many times, consider using prng.integers(2)
here and at other places.
prng.integers
is about 5 times faster as it does not deal with a throw-away list.
@pavoljuhas when I use
|
This seems to happen because Do we need to import If optional, we may save ourselves some headaches with circular imports or strange typechecking errors down the line. |
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.
Few small tweaks, otherwise LGTM.
class TestSpinInversionGauge_3(GaugeTester): | ||
two_qubit_gate = cirq.ZZ**0.3 | ||
gauge_transformer = SpinInversionGaugeTransformer |
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.
Is this test qualitatively different (ie testing different code paths) from TestSpinInversionGauge_1
?
If not please remove.
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.
this is a correctness test, making sure that the transformer works for all rotation angles. The reason that I create several is that I can't do pytest.mark.parametrize
on the test class
this transfomer should work on Ising models where the strength of two qubit interactions g Z_i Z_j
are encoded in the angels of ZZ(q[i], q[j])**g
post_q1=X, | ||
post_q0=S if gate == _SQRT_CZ else _ADJ_S, | ||
two_qubit_gate=gate**-1, | ||
swap_qubits=True, |
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.
A bit perplexed - the swap_qubits
should have no effect as the gate**-1
will be symmetric for the q0, q1 swap.
@eliottrosenberg - is this functionality for simulation / execution of circuits that may have imperfect (ie asymmetric), SQRT_CZ, INV_SQRT_CZ 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.
gauge compiling is done because the two qubit gate is assumed to be imperfect
…in inversion gauge (quantumlib#6571)
…in inversion gauge (quantumlib#6571)
…in inversion gauge (quantumlib#6571)
No description provided.