Skip to content

Add some utilities for T-rex error mitigation#8095

Merged
ddddddanni merged 7 commits into
quantumlib:mainfrom
ddddddanni:trex
Jun 25, 2026
Merged

Add some utilities for T-rex error mitigation#8095
ddddddanni merged 7 commits into
quantumlib:mainfrom
ddddddanni:trex

Conversation

@ddddddanni

@ddddddanni ddddddanni commented May 27, 2026

Copy link
Copy Markdown
Collaborator

This PR introduces the initial building blocks and helper functions required to support T-REX error mitigation in
pauli expectation calculation.

The change includes:
Implement _get_trex_twirled_basis_gate to fetch the appropriate rotation gates (Rx, Ry, X, I) based on the target Pauli basis and flip state.
Implement _generate_random_boolean_choices to generate randomized 2D boolean arrays for twirling operations.
Implement _build_trex_twirled_pauli_circuits to append the appropriate basis twirling gates and joint measurements to a base circuit.

@github-actions github-actions Bot added the size: M 50< lines changed <250 label May 27, 2026

@obriente obriente left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for submitting! The code seems ok, but I'm worried about some forward-compatibility issues, as well as making the workflow as easy as possible to combine with other error mitigation techniques. Would defer to other people on the team whether this is a significant issue or something that we can deal with later.

@ddddddanni ddddddanni marked this pull request as ready for review June 3, 2026 21:36
@ddddddanni ddddddanni requested a review from a team as a code owner June 3, 2026 21:36
@mhucka

mhucka commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

@obriente Would you be willing to act as reviewer for this PR? I mean, you basically have been already :-). Can we assign you to this PR?

@pavoljuhas pavoljuhas added the priority/before-1.7 Finish before the Cirq 1.7 release label Jun 11, 2026

@obriente obriente left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

All of my comments were addressed, LGTM

@mhucka mhucka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Spotted some possible minor issues.

@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.60%. Comparing base (74abd87) to head (76fe571).
⚠️ Report is 22 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #8095    +/-   ##
========================================
  Coverage   99.60%   99.60%            
========================================
  Files        1118     1118            
  Lines      100951   101213   +262     
========================================
+ Hits       100551   100812   +261     
- Misses        400      401     +1     

☔ View full report in Codecov by Harness.
📢 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.

@ddddddanni ddddddanni requested a review from mhucka June 24, 2026 03:29
@mhucka

mhucka commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

@ddddddanni Thank you for working on this!

I hate to be a nag, but could you click on the "Resolve conversation" button for those review items that are, in fact, resolved? I think they all are, but can't be 100% sure myself.

@ddddddanni

Copy link
Copy Markdown
Collaborator Author

@ddddddanni Thank you for working on this!

I hate to be a nag, but could you click on the "Resolve conversation" button for those review items that are, in fact, resolved? I think they all are, but can't be 100% sure myself.

Sure! I think this is resolved since Tom has approved the PR.

@mhucka mhucka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for working on this, and I'm sorry to make more requests …

@ddddddanni ddddddanni requested a review from mhucka June 24, 2026 17:09

@mhucka mhucka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ddddddanni Thank you for all the hard work on this and addressing my comments! LGTM.

@ddddddanni ddddddanni added this pull request to the merge queue Jun 25, 2026
Merged via the queue into quantumlib:main with commit 498d35e Jun 25, 2026
49 checks passed
@ddddddanni ddddddanni deleted the trex branch June 25, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority/before-1.7 Finish before the Cirq 1.7 release size: M 50< lines changed <250

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants