-
Notifications
You must be signed in to change notification settings - Fork 171
Add support for dict[int, Iterable[str | int]] and dict[str | int, int] to stim.PauliString.__init__`
#994
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
Add support for dict[int, Iterable[str | int]] and dict[str | int, int] to stim.PauliString.__init__`
#994
Conversation
…to_int for reusability
Not working yet
+ some of the errors
All tests pass. Removed debugging logs
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
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.
Thanks! This is nearly mergeable.
Mainly, I think the dict[int, int] case needs to be guaranteed to be int->pauli (rather than pauli->int) to avoid ambiguity.
Secondarily, there's a few places the code is being inefficient by having a quadratic check or potential unnecessary copies.
Stylistically, the method is getting so long that this case should be extracted.
dict[int, Iterable[str | int]] and dict[str | int, int] to stim.PauliString.__init__`
…ue, not on key.
Added proper test.
Added TODOs for deciding on whether to allow {1: [0,1]}
- allow collision between "I" and other Pauli strings. - Optimized collision verification by using a map; thus fixing quadratic overhead.
|
@Strilanc Fixed all your comments. PR is ready for merging as far as I'm concerned. |
Strilanc
left a comment
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.
Looks great! Thanks!
Added support for constructing stim.PauliString using a Dict with keys as either int (for qubit indices) or str (for Pauli).
e.g.:
Resolves #852