Skip to content

(1/2) Combine Pauli measurements and postselection#7746

Merged
ddddddanni merged 13 commits intoquantumlib:mainfrom
ddddddanni:add_new_parameter
Feb 25, 2026
Merged

(1/2) Combine Pauli measurements and postselection#7746
ddddddanni merged 13 commits intoquantumlib:mainfrom
ddddddanni:add_new_parameter

Conversation

@ddddddanni
Copy link
Collaborator

I split this #7492 giant PR into smaller pieces for easier review.
This PR:

  1. Adds a CircuitToPauliStringsParameters class which supports postselection_symmetries.
  2. Modify the validation method
  3. Allows measure_pauli_strings to take CircuitToPauliStringsParameters as a input.

@ddddddanni ddddddanni requested review from a team and vtomole as code owners November 11, 2025 19:50
@github-actions github-actions bot added the size: L 250< lines changed <1000 label Nov 11, 2025
Copy link
Collaborator

@eliottrosenberg eliottrosenberg left a comment

Choose a reason for hiding this comment

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

This PR doesn't actually apply the postselection, correct? If so, we should raise a NotImplementedError if the user tries to use postselection symmetries.

@ddddddanni ddddddanni marked this pull request as ready for review November 19, 2025 01:10
@ddddddanni
Copy link
Collaborator Author

This PR doesn't actually apply the postselection, correct? If so, we should raise a NotImplementedError if the user tries to use postselection symmetries.

Done!

Copy link
Collaborator

@eliottrosenberg eliottrosenberg left a comment

Choose a reason for hiding this comment

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

One small nit, otherwise LGTM. Thanks!


circuit: circuits.FrozenCircuit
pauli_strings: list[list[ops.PauliString]]
postselection_symmetries: list[tuple[ops.PauliString | ops.PauliSum, int]]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we have this default to an empty list? That way users don't need to enter anything for postselection_symmetries if they don't want to postselect.

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.

LGTM%nits

"""

circuit: circuits.FrozenCircuit
pauli_strings: list[list[ops.PauliString]]
Copy link
Collaborator

Choose a reason for hiding this comment

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

since this is a frozen class, use tuple instead

@mhucka
Copy link
Contributor

mhucka commented Jan 21, 2026

@ddddddanni Thank you for this work. For planning purposes, could you let us know what the status of this is? It looks like it was approved and what remains is resolving some conflicts and minor nits. Is that correct?

@ddddddanni
Copy link
Collaborator Author

@ddddddanni Thank you for this work. For planning purposes, could you let us know what the status of this is? It looks like it was approved and what remains is resolving some conflicts and minor nits. Is that correct?

Hey Mike, thanks for checking!! I’m actually holding off on this until #7760 is merged. Since #7760 adds more support for calculating Pauli expectations, I want to land that first to keep the sequence of changes logical. Once that is submitted, I will immediately resolve the conflicts and nits here.

@mhucka
Copy link
Contributor

mhucka commented Jan 21, 2026

Got it. Thanks!

@mhucka
Copy link
Contributor

mhucka commented Feb 18, 2026

@ddddddanni Thanks for your patience! #7760 was merged recently, so it sounds like we may be ready for this PR too, whenever you get a chance to look at the pesky merge conflicts. (No pressure; just going around and checking on all PRs.)

@ddddddanni
Copy link
Collaborator Author

@ddddddanni Thanks for your patience! #7760 was merged recently, so it sounds like we may be ready for this PR too, whenever you get a chance to look at the pesky merge conflicts. (No pressure; just going around and checking on all PRs.)

Sure!!! There are lots of conflicts I need to resolve ORZ, I will have it ready by this week!

@ddddddanni ddddddanni added this pull request to the merge queue Feb 25, 2026
Merged via the queue into quantumlib:main with commit b8bfd90 Feb 25, 2026
41 checks passed
@ddddddanni ddddddanni deleted the add_new_parameter branch February 25, 2026 22:31
@github-project-automation github-project-automation bot moved this from Nudged to Resolved in Follow-up tracker Feb 25, 2026
@codecov
Copy link

codecov bot commented Feb 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.62%. Comparing base (e5173b7) to head (bb68a8d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7746   +/-   ##
=======================================
  Coverage   99.62%   99.62%           
=======================================
  Files        1104     1104           
  Lines       99325    99374   +49     
=======================================
+ Hits        98949    98999   +50     
+ Misses        376      375    -1     

☔ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: L 250< lines changed <1000

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants