Skip to content

Add support for confusion map to PauliMeasurementGate - #8181

Merged
arettig merged 6 commits into
quantumlib:mainfrom
arettig:my_pr7373
Jul 21, 2026
Merged

Add support for confusion map to PauliMeasurementGate#8181
arettig merged 6 commits into
quantumlib:mainfrom
arettig:my_pr7373

Conversation

@arettig

@arettig arettig commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Closes #5571, building off a previous PR #7373.

This adds support for a confusion matrix to PauliMeasurementGate.
It also updates measure_single_paulistring() to accept a confusion matrix.

Akshita07 and others added 2 commits July 1, 2026 20:58
The methods of PauliMeasurementGate have been updated to account
for the inclusion of a confusion map. Tests are added to ensure these
updated methods work with a confusion map. The measure_single_paulistring
function and test are also updated.
@arettig
arettig requested a review from pavoljuhas July 1, 2026 22:00
@arettig
arettig requested a review from a team as a code owner July 1, 2026 22:00
@github-actions github-actions Bot added the size: M 50< lines changed <250 label Jul 1, 2026
@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.59%. Comparing base (13f6065) to head (7986562).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8181      +/-   ##
==========================================
- Coverage   99.60%   99.59%   -0.01%     
==========================================
  Files        1118     1118              
  Lines      101356   101657     +301     
==========================================
+ Hits       100952   101250     +298     
- Misses        404      407       +3     

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

@pavoljuhas pavoljuhas self-assigned this Jul 2, 2026

@pavoljuhas pavoljuhas 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.

I agree we should use an optional confusion_matrix argument/property instead of confusion_map with a known mandatory index.

Otherwise LGTM with a few inline suggestions.

I am adding @mhucka as a reviewer since I'll be OOO.

PS: If there is no rush, feel free to hold on until I am back.

Comment thread cirq-core/cirq/ops/measure_util.py Outdated
Comment thread cirq-core/cirq/ops/pauli_measurement_gate_test.py Outdated
Comment thread cirq-core/cirq/ops/pauli_measurement_gate_test.py Outdated
@pavoljuhas
pavoljuhas requested a review from mhucka July 7, 2026 00:49
arettig added 3 commits July 7, 2026 20:44
In a PauliMeasurementGate, the actual measurement is only performed on a
single qubit so there is no need to pass in confusion matrices for multiple
qubits. The confusion matrix is now handled as a 2x2 numpy matrix.
Adds new tests covering two-qubit gates as well as a confusion matrix
that mixes 0 an 1 measurements.
Removed the json serialization test in pauli_measurement_gate_test.py. Instead,
another test case is added to PauliMeasurementGate.json
@arettig

arettig commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Fixed the comments. I'm happy to wait until Pavol is back - this issue has been open 3 years so I think another couple weeks won't hurt :)

@pavoljuhas pavoljuhas 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.

LGTM after addressing a few minor cleanups.

Comment thread cirq-core/cirq/ops/pauli_measurement_gate.py Outdated
Comment thread cirq-core/cirq/ops/pauli_measurement_gate.py Outdated
Comment thread cirq-core/cirq/ops/pauli_measurement_gate_test.py Outdated
Comment thread cirq-core/cirq/protocols/json_test_data/PauliMeasurementGate.repr Outdated
Comment thread cirq-core/cirq/ops/measure_util.py Outdated
Comment thread cirq-core/cirq/ops/pauli_measurement_gate.py Outdated
Comment thread cirq-core/cirq/ops/pauli_measurement_gate_test.py Outdated
Comment thread cirq-core/cirq/ops/pauli_measurement_gate_test.py Outdated
Fixes some minor problems caught in code review.
@arettig
arettig requested a review from pavoljuhas July 21, 2026 15:46

@pavoljuhas pavoljuhas 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 taking care of this! Before merging please update the PR description so it is suitable as a git commit message.

@arettig
arettig added this pull request to the merge queue Jul 21, 2026
Merged via the queue into quantumlib:main with commit 806dc60 Jul 21, 2026
49 checks passed
@arettig
arettig deleted the my_pr7373 branch July 21, 2026 21:01
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.

Add confusion maps support to PauliMeasurementGate

3 participants