-
Notifications
You must be signed in to change notification settings - Fork 169
Change how pauli_keys are represented in CummulativeObservableAnnotation #982
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
Open
AlexBourassa
wants to merge
7
commits into
main
Choose a base branch
from
u/ab/fix_qubit_id_pauli_keys
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d0edee1
Change how pauli_keys are represented in CummulativeObservableAnnotation
AlexBourassa 1d06580
backward compat
AlexBourassa b4d5c02
add TICK
AlexBourassa 814f013
review: maintain format for pauli_key while adding _qubit_to_pauli_keys
AlexBourassa 1bfb296
cirq diagram fix
AlexBourassa 879e4f9
mod
AlexBourassa 03dbe13
mod
AlexBourassa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
What if a user has code
for k in op.pauli_keys: if k.startswith("..."): ...? This would break that.Uh oh!
There was an error while loading. Please reload this page.
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.
I guess you mean that changing the type of
pauli_keysfromstrtotuple[cirq.QiD, str]is an issue? The problem I'm trying to solve is that there are no reference to the "stim qubit id" when we are in cirq, and there is no guarantee that these ids will mean anything useful when we convert the circuit back from stim to cirq.We could keep the type
strand do something likeX(1,1)and then interpret k[1:] as a tuple/Qid. That would not impact the snippet you showed, but we could certainly come up with another example snippet that would break (for example if the user has code that doesint(k[1:])it would break...). I think this kind of string interpretation might be worse, but I'm game if you prefer it? I don't really see a clean way to achieve this change... But if you have some preferred format, I'm happy to implement it. Fwiw, since this is a pretty recent addition to stimcirq, I don't think it's gotten too much adoption yet, so making a change now is unlikely to impact anyone at this point.Anyway, again I'm open to whatever you think is the best solution here. Let me know!
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.
The main thing is that you must make the changes in a way that doesn't break existing code. Existing code is likely to depend on the type of public fields, so you cannot change their type. You can add other fields, though.
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.
Ok, I tried a version of this. Let me know what you think!