-
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
str(GridQubit) too similar to str(tuple) #2405
Comments
This can be a bit of a nasty change to make, because it affects circuit diagrams. We may want to separate the circuit representation of a qubit from its |
Yes, I find it surprising that the circuit representation relies on |
One suggestion is |
Agree that |
Are we okay with doing that change if it breaks circuit diagrams and other things that depend on str representations? |
My initial preference is for keeping circuit diagrams the same. Context is clear in circuit diagram anyways. Changing the |
Qubits could have their own version of |
Resurfacing this as a discuss item, so we can figure out if this is really needed or not. |
I like @dabacon's suggestion about |
From cirq sync: We should do this! |
|
- Changes grid qubit string representation from (x, y) to q(x, y) and line qubit from 1 to q1. - This will make the string representation more distinctive. - Added _circuit_diagram_info_ for Qid objects to make circuit diagrams customizable for qubits. This allows us to keep circuit diagrams largely unchanged. - Other components such as pauli strings, that rely on qubit str representation for formatting are changed. This is a BREAKING CHANGE for anyone relying on string representation of qubits. Fixes: quantumlib#2405
* Change qubit str representation - Changes grid qubit string representation from (x, y) to q(x, y) and line qubit from 1 to q1. - This will make the string representation more distinctive. - Added _circuit_diagram_info_ for Qid objects to make circuit diagrams customizable for qubits. This allows us to keep circuit diagrams largely unchanged. - Other components such as pauli strings, that rely on qubit str representation for formatting are changed. This is a BREAKING CHANGE for anyone relying on string representation of qubits. Fixes: #2405 * Fix a bunch of tests. * A few more errors. * Switch to q(0) and fix a bunch of tests. * Formatting and more tests fixed. * Fix more tests. * Fix two last tests. * Fix bb84 example. * Fix contrib and notebook tests. * Update cirq-core/cirq/sim/simulator_test.py Co-authored-by: Matthew Neeley <[email protected]> * Update cirq-core/cirq/circuits/circuit.py Co-authored-by: Matthew Neeley <[email protected]> * Revert Grid Device to use circuit diagram names instead. Co-authored-by: Matthew Neeley <[email protected]>
* Change qubit str representation - Changes grid qubit string representation from (x, y) to q(x, y) and line qubit from 1 to q1. - This will make the string representation more distinctive. - Added _circuit_diagram_info_ for Qid objects to make circuit diagrams customizable for qubits. This allows us to keep circuit diagrams largely unchanged. - Other components such as pauli strings, that rely on qubit str representation for formatting are changed. This is a BREAKING CHANGE for anyone relying on string representation of qubits. Fixes: quantumlib#2405 * Fix a bunch of tests. * A few more errors. * Switch to q(0) and fix a bunch of tests. * Formatting and more tests fixed. * Fix more tests. * Fix two last tests. * Fix bb84 example. * Fix contrib and notebook tests. * Update cirq-core/cirq/sim/simulator_test.py Co-authored-by: Matthew Neeley <[email protected]> * Update cirq-core/cirq/circuits/circuit.py Co-authored-by: Matthew Neeley <[email protected]> * Revert Grid Device to use circuit diagram names instead. Co-authored-by: Matthew Neeley <[email protected]>
* Change qubit str representation - Changes grid qubit string representation from (x, y) to q(x, y) and line qubit from 1 to q1. - This will make the string representation more distinctive. - Added _circuit_diagram_info_ for Qid objects to make circuit diagrams customizable for qubits. This allows us to keep circuit diagrams largely unchanged. - Other components such as pauli strings, that rely on qubit str representation for formatting are changed. This is a BREAKING CHANGE for anyone relying on string representation of qubits. Fixes: quantumlib#2405 * Fix a bunch of tests. * A few more errors. * Switch to q(0) and fix a bunch of tests. * Formatting and more tests fixed. * Fix more tests. * Fix two last tests. * Fix bb84 example. * Fix contrib and notebook tests. * Update cirq-core/cirq/sim/simulator_test.py Co-authored-by: Matthew Neeley <[email protected]> * Update cirq-core/cirq/circuits/circuit.py Co-authored-by: Matthew Neeley <[email protected]> * Revert Grid Device to use circuit diagram names instead. Co-authored-by: Matthew Neeley <[email protected]>
Was just waylaid in debugging an issue because I thought I was dealing with two-tuples but it was actually a
GridQubit
. Theirstr
representation is indistinguishable. I suggest adding a subtle hint that it's different.The closest analogy I can think of is the difference between a python list and a numpy array
The text was updated successfully, but these errors were encountered: