Skip to content

Add MXX, MYY, MZZ instructions#96

Merged
rafaelha merged 5 commits into
mainfrom
rafaelha/mxx_myy_mzz_instructions
Apr 7, 2026
Merged

Add MXX, MYY, MZZ instructions#96
rafaelha merged 5 commits into
mainfrom
rafaelha/mxx_myy_mzz_instructions

Conversation

@rafaelha

@rafaelha rafaelha commented Apr 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Implement MXX, MYY, MZZ two-qubit parity measurement instructions by delegating to the existing MPP infrastructure
  • Supports inverted targets and multiple pairs per instruction

This PR also adds support for II_ERROR.

Closes #76

Test plan

  • Unit tests for parsing: single pairs, multiple pairs, mixed with other measurements
  • Integration tests for sampling: Bell state eigenvalues (XX, YY, ZZ), inverted targets, multiple pairs

🤖 Generated with Claude Code

rafaelha and others added 3 commits April 6, 2026 21:09
@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-04-07 02:06 UTC

@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
2169 2096 97% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
src/tsim/core/parse.py 94% 🟢
TOTAL 94% 🟢

updated for commit: aa1ab4c by action🐍

Copilot AI 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.

Pull request overview

Adds support for Stim’s two-qubit Pauli parity measurement instructions (MXX, MYY, MZZ) in Tsim by translating them into equivalent MPP measurements during parsing, and extends the parser to tolerate II_ERROR.

Changes:

  • Extend parse_stim_circuit to recognize MXX/MYY/MZZ and delegate each target-pair to mpp(...), including inverted-target parity handling.
  • Ignore II_ERROR (and I_ERROR) instructions during parsing.
  • Add unit/integration tests and update the overview demo notebook to mention and illustrate the new measurement instructions.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/tsim/core/parse.py Adds parsing support for MXX/MYY/MZZ (via MPP) and ignores II_ERROR.
test/unit/core/test_parse.py Adds parser-level record-length tests for MXX/MYY/MZZ.
test/integration/test_sampler_circuits.py Adds sampler integration tests validating deterministic outcomes for Bell/state parity cases, inversion, and multiple pairs.
docs/demos/overview.ipynb Updates measurement documentation/examples to include MXX/MYY/MZZ and tweaks an MPP example.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/tsim/core/parse.py
Comment thread docs/demos/overview.ipynb Outdated
Comment thread src/tsim/core/parse.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@rafaelha rafaelha merged commit f2c45e6 into main Apr 7, 2026
10 checks passed
@rafaelha rafaelha deleted the rafaelha/mxx_myy_mzz_instructions branch April 7, 2026 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add 'MXX', 'MYY', 'MZZ' instructions

2 participants