-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Enable serialization of non-GridQubits. #2966
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
Enable serialization of non-GridQubits. #2966
Conversation
Does the simulator accept arbitrary strings right now? |
Yes - it populates a map of qubits to string IDs with no parsing/validation on the IDs. This will probably misbehave if you mix e.g. |
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
* Enable serialization of non-GridQubits. * Lint fixes for serializer. * LineQubit proto IDs must be digits-only. * Add coverage. * named_qubit_* -> qubit_* * Fix lint error.
Fixes #1325.
Most of the work was already done here - the only remaining effort was to remove checks and add a mux for the deserialize methods. This does have a noticeable side-effect: this code now accepts any proto ID as a valid qubit, since NamedQubit has no restrictions on the strings allowed as names.
As an aside, it's a little odd that we use
x_y
notation for GridQubits, whenint('1_2')
returns12
. This makes parsing strings as different qubit types order-dependent.