-
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
Call cirq.testing.assert_equivalent_repr
for cirq.SingleQubitCliffordGate
and cirq.CliffordTableau
#5664
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.
LGTM! Thanks!
@@ -55,6 +55,21 @@ def test_tableau_initial_state_string(num_qubits): | |||
assert splitted_represent_string[n] == expected_string | |||
|
|||
|
|||
def test_tableau_ivalid_initial_state(): |
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.
ivalid -> invalid
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.
else: | ||
raise ValueError( | ||
f"The value you passed for rs is not the correct shape and/or type. " | ||
f"Please confirm that it's 1 row, of even length and of type bool." |
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.
It isn't enough for the length to be even. It actually needs to be twice the number of qubits. Suggestion:
f"Please ensure that it's a single row with two bool entries per qubit."
(The message in your other exception, raised on line 197, already reflects this.)
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.
…ordGate` and `cirq.CliffordTableau` (quantumlib#5664) `cirq.CliffordTableau` is represented by `rs`, `xs` and `zs` yet these can't be passed into the `__init__` but are instead calculated and/or set in the class. This PR adds `xs`, `xs`, and `zs` as `Optional` arguments so that the `CliffordTableau` can be reconstructed from the `__repr__`. Fixes: quantumlib#5641
…ordGate` and `cirq.CliffordTableau` (quantumlib#5664) `cirq.CliffordTableau` is represented by `rs`, `xs` and `zs` yet these can't be passed into the `__init__` but are instead calculated and/or set in the class. This PR adds `xs`, `xs`, and `zs` as `Optional` arguments so that the `CliffordTableau` can be reconstructed from the `__repr__`. Fixes: quantumlib#5641
cirq.CliffordTableau
is represented byrs
,xs
andzs
yet these can't be passed into the__init__
but are instead calculated and/or set in the class. This PR addsxs
,xs
, andzs
asOptional
arguments so that theCliffordTableau
can be reconstructed from the__repr__
.Fixes: #5641