Skip to content
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

eval(repr(op)) fails for cirq.SingleQubitCliffordGate. #5641

Closed
tanujkhattar opened this issue Jun 29, 2022 · 1 comment · Fixed by #5664
Closed

eval(repr(op)) fails for cirq.SingleQubitCliffordGate. #5641

tanujkhattar opened this issue Jun 29, 2022 · 1 comment · Fixed by #5664
Assignees
Labels
area/paulis kind/bug-report Something doesn't seem to work. triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on

Comments

@tanujkhattar
Copy link
Collaborator

Description of the issue
See title.

How to reproduce the issue

>>> z_clifford = cirq.SingleQubitCliffordGate.from_pauli(cirq.Z).on(cirq.LineQubit(2))
>>> repr(z_clifford)
cirq.SingleQubitCliffordGate(X:-X, Y:-Y, Z:+Z).on(cirq.LineQubit(2))
>>> eval(repr(z_clifford))
Traceback (most recent call last):

  File "/usr/local/google/home/tanujkhattar/anaconda3/envs/cirq/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3457, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  File "<ipython-input-14-99e3d364586d>", line 1, in <module>
    eval(repr(z_clifford))

  File "<string>", line 1
    cirq.SingleQubitCliffordGate(X:-X, Y:-Y, Z:+Z).on(cirq.LineQubit(2))
                                  ^
SyntaxError: invalid syntax

Cirq version
0.16dev

@vtomole
Copy link
Collaborator

vtomole commented Jul 3, 2022

Taking this.

@vtomole vtomole self-assigned this Jul 3, 2022
@viathor viathor added the triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on label Jul 6, 2022
CirqBot pushed a commit that referenced this issue Jul 7, 2022
…ordGate` and `cirq.CliffordTableau` (#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: #5641
rht pushed a commit to rht/Cirq that referenced this issue May 1, 2023
…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
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this issue Oct 31, 2024
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/paulis kind/bug-report Something doesn't seem to work. triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on
Projects
None yet
3 participants