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

Reject multiplication of cirq.PauliSum inside in cirq.PauliString #5010

Merged
merged 8 commits into from
Feb 22, 2022

Conversation

vtomole
Copy link
Collaborator

@vtomole vtomole commented Feb 22, 2022

Fixes: #5009

@vtomole vtomole requested a review from Strilanc February 22, 2022 19:58
@vtomole vtomole requested review from a team and cduck as code owners February 22, 2022 19:58
@CirqBot CirqBot added the size: M 50< lines changed <250 label Feb 22, 2022
@vtomole vtomole changed the title Reject multiplying cirq.PauliSum inside of cirq.PauliString Reject multiplying cirq.PauliSum inside of cirq.PauliString Feb 22, 2022
@vtomole vtomole changed the title Reject multiplying cirq.PauliSum inside of cirq.PauliString Reject multiplication of cirq.PauliSum inside in cirq.PauliString Feb 22, 2022
@MichaelBroughton MichaelBroughton self-assigned this Feb 22, 2022
Copy link
Collaborator

@MichaelBroughton MichaelBroughton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Feel free to merge after the imports are moved to the top.

@@ -1237,6 +1237,7 @@ def _imul_helper(self, other: 'cirq.PAULI_STRING_LIKE', sign: int):
Returns:
self on success, NotImplemented given an unknown type of value.
"""
from cirq.ops.linear_combinations import PauliSum
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: can we move this to a module level import at the top ? (even if it means wrapping in LazyLoader)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally forgot about LazyLoader. Thank you. Done.

@vtomole vtomole merged commit 3177647 into master Feb 22, 2022
@vtomole vtomole deleted the illegal_pauli_string branch February 22, 2022 23:30
95-martin-orion pushed a commit to 95-martin-orion/Cirq that referenced this pull request Mar 2, 2022
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: M 50< lines changed <250
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cirq.PauliString misinterprets cirq.PauliSum inputs instead of rejecting them
3 participants