Skip to content

Document store directive#5129

Merged
beckykd merged 33 commits into
mainfrom
bd-store-directive
May 28, 2026
Merged

Document store directive#5129
beckykd merged 33 commits into
mainfrom
bd-store-directive

Conversation

@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@beckykd beckykd marked this pull request as ready for review May 22, 2026 17:56
@beckykd beckykd requested a review from a team May 22, 2026 17:56
@qiskit-bot

Copy link
Copy Markdown
Contributor

One or more of the following people are relevant to this code:

abbycross
abbycross previously approved these changes May 22, 2026

@abbycross abbycross 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 did a copyedit scan. Does anyone need to look with a technical eye? I know Becky's already been working closely with the SMEs on this

@beckykd

beckykd commented May 22, 2026

Copy link
Copy Markdown
Collaborator Author

Does anyone need to look with a technical eye

I'll share it with some experts!

@francabrera francabrera left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@beckykd we should update the code example to:

from qiskit.circuit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit.circuit.classical import expr

qregs = QuantumRegister(4, "q")
creg  = ClassicalRegister(3, "c")
# temp is a plain ClassicalRegister used as the store target
temp  = ClassicalRegister(3, "temp")
qc  = QuantumCircuit(qregs, creg, temp)

qc.h([0, 1, 2])
qc.measure([0, 1, 2], creg)

# Store bit-NOT of the full 3-bit register into temp
qc.store(temp, expr.bit_not(creg))

# Compute parity of temp using bit-indexed XOR
parity = expr.bit_xor(
    expr.bit_xor(expr.index(temp, 0), expr.index(temp, 1)),
    expr.index(temp, 2),
)

# Flip q3 if parity of ~creg is 1
with qc.if_test(parity):
    qc.x(3)

qc.measure([0, 1, 2], creg)

qc.draw("mpl")

due to an internal issue with the compiler. We can update it later in a separate issue once that's fixed.


just a reminder to update https://qiskit.github.io/documentation/pr-5129/docs/guides/execute-dynamic-circuits#store as per the discussion

Comment thread docs/guides/execute-dynamic-circuits.ipynb Outdated
@beckykd beckykd added this pull request to the merge queue May 28, 2026
Merged via the queue into main with commit d6958e9 May 28, 2026
5 checks passed
@beckykd beckykd deleted the bd-store-directive branch May 28, 2026 18:47
@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs Planning May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants