Skip to content

fix: Correct qubit count for MCM with noncontiguous qubits#378

Open
speller26 wants to merge 2 commits into
dmfrom
noncontiguous
Open

fix: Correct qubit count for MCM with noncontiguous qubits#378
speller26 wants to merge 2 commits into
dmfrom
noncontiguous

Conversation

@speller26
Copy link
Copy Markdown
Member

Issue #, if available:

Description of changes:

Testing done:

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have checked that my tests are not configured for a specific region or account (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@speller26 speller26 requested a review from a team as a code owner May 14, 2026 19:01
@yitchen-tim
Copy link
Copy Markdown
Contributor

from braket.devices import LocalSimulator
from braket.ir.openqasm import Program

qasm = """
OPENQASM 3.0;
qubit q;

x q[0];
measure q[0];
x q[0];
measure q[0];
x q[0];
measure q[0];
"""

program = Program(source=qasm)

res0 = LocalSimulator().run(program, shots=100).result()
print(res0.measurement_counts)

Expected "101" but got all counts as "111"

@speller26
Copy link
Copy Markdown
Member Author

We don't have output variables, so only every subsequent measurement overwrites the previous value. I'll work on this in a subsequent PR

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.

MCM simulation returns measurement strings padded to total qubit count instead of bit[N] size

2 participants