-
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
Support ActOnStabilizerCHFormArgs in the common gates and testing #3203
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.
Hey @smitsanghavi, thanks for submitting this! I started reviewing it! I will need to dig deeper in the next couple of days but I found some nits to cleanup in the meantime.
assert all( | ||
gate._act_on_(args) # type: ignore | ||
for gate in [ZPowGate(), HPowGate()]) | ||
state.omega *= (1 + 1j) / (2**0.5) # type: ignore |
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.
Why is the type ignore needed?
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.
mypy assumes state.omega is an int since it was initialized by an int. It complains when I try to assign a complex value to it. Maybe adding + 0j
to the initialization will fix it. Let me know if you think that's better.
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.
Left a bunch of comments!
Also, I'm a bit worried about the fact that phases just go unnoticed...
In assert_all_implemented_act_on_effects_match_unitary
shouldn't we use
np.testing.assert_allclose(np.reshape(
stabilizer_ch_form.state_vector(), protocols.qid_shape(qubits)),
state_vector,
atol=1e-07, err_msg="inconsistent stabilizer ch form")
instead of
testing.assert_allclose_up_to_global_phase(np.reshape(
stabilizer_ch_form.state_vector(), protocols.qid_shape(qubits)),
state_vector,
atol=1e-07)
?
One of the benefits of the CH-form is that it is phase sensitive. Why are we checking unitary consistency in a phase insensitive way?
That makes sense. There were some tests adding extra global phases that were breaking it previously. Added support for |
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, thank you for all the hard work on this!!! Can you just address the two last nits? Thank you!
Also some minor bug fixes and refactoring in StabilizerStateCHForm, ActOnCliffordTableauArgs and consistent_act_on.
#2948 #2423