Skip to content

Fix mutable_pauli_string.inplace_after() and inplace_before() #7507

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
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

babacry
Copy link
Collaborator

@babacry babacry commented Jul 18, 2025

Similar to the fix for PauliString.after() #7065, this is the fix for MutablePauliString.

Also deleted the culprit _decompose_into_cliffords helper function that was used by PauliString.after() and MutablePauliString.inplace_after().

Issue: #6946.

@github-actions github-actions bot added the size: M 50< lines changed <250 label Jul 18, 2025
Copy link

codecov bot commented Jul 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.63%. Comparing base (e7636e0) to head (1791560).
Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7507      +/-   ##
==========================================
- Coverage   98.68%   98.63%   -0.06%     
==========================================
  Files        1091     1091              
  Lines       96945    96938       -7     
==========================================
- Hits        95671    95612      -59     
- Misses       1274     1326      +52     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@babacry babacry marked this pull request as ready for review July 18, 2025 21:40
@babacry babacry requested review from vtomole and a team as code owners July 18, 2025 21:40
@babacry babacry requested a review from viathor July 18, 2025 21:40
@babacry
Copy link
Collaborator Author

babacry commented Jul 18, 2025

Hey Nour @NoureldinYosri , could you help take a look at this PR? This is the last pr in fixing #6946.

@babacry babacry requested a review from NoureldinYosri July 18, 2025 21:48
@NoureldinYosri NoureldinYosri self-assigned this Jul 18, 2025
Copy link
Collaborator

@NoureldinYosri NoureldinYosri left a comment

Choose a reason for hiding this comment

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

overall looks good ... but you can use a simpler logic to construct the conjugated object

flattened_ops = list(op_tree.flatten_to_ops(ops))

for op in flattened_ops[::-1]:
conjugated: cirq.DensePauliString = dense_pauli_string.DensePauliString(
Copy link
Collaborator

@NoureldinYosri NoureldinYosri Jul 18, 2025

Choose a reason for hiding this comment

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

maybe conjugates = self.dense(self.qubits) * dense_pauli_string.DensePauliString('I'*len(self.qubits)) should do the trick? ... no need for the logic below

@pavoljuhas pavoljuhas added the priority/after-1.6 Leave for after the Cirq 1.6 release label Jul 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/after-1.6 Leave for after the Cirq 1.6 release size: M 50< lines changed <250
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants