Skip to content

feat: add mid-circuit measurement, feed-forward, and qubit reset#4

Merged
splch merged 2 commits intomainfrom
feat/mid-circuit-measurement
Mar 12, 2026
Merged

feat: add mid-circuit measurement, feed-forward, and qubit reset#4
splch merged 2 commits intomainfrom
feat/mid-circuit-measurement

Conversation

@splch
Copy link
Copy Markdown
Owner

@splch splch commented Mar 12, 2026

Enable dynamic quantum circuits with projective measurement, classical conditioning, and reset in both statevector and density matrix simulators.

  • gate.Reset shared pseudo-gate singleton
  • ir.Condition gains Clbit field for simulator-authoritative bit index
  • ir.IsDynamic() detects mid-circuit measurement/conditions/reset
  • Builder: Reset(), If(), IfBlock() methods
  • Statevector RunDynamic: per-shot sim with stride-based collapse
  • Density matrix RunDynamic: per-shot sim with noise channel support
  • Run() auto-dispatches via IsDynamic(), preserving fast path
  • QASM parser resolves Condition.Clbit from register+index
  • QASM emitter handles new Condition format
  • Draw: reset "|0>" label, "c:" prefix for conditioned ops
  • Transpile: condition propagation through decomposition, cancel/merge respect measurement/reset boundaries
  • Stats: Measurements, Resets, ConditionalGates, Dynamic fields
  • Tests: teleportation, conditional, reset+reuse, IsDynamic (14 new)

Enable dynamic quantum circuits with projective measurement, classical
conditioning, and reset in both statevector and density matrix simulators.

- gate.Reset shared pseudo-gate singleton
- ir.Condition gains Clbit field for simulator-authoritative bit index
- ir.IsDynamic() detects mid-circuit measurement/conditions/reset
- Builder: Reset(), If(), IfBlock() methods
- Statevector RunDynamic: per-shot sim with stride-based collapse
- Density matrix RunDynamic: per-shot sim with noise channel support
- Run() auto-dispatches via IsDynamic(), preserving fast path
- QASM parser resolves Condition.Clbit from register+index
- QASM emitter handles new Condition format
- Draw: reset "|0>" label, "c:" prefix for conditioned ops
- Transpile: condition propagation through decomposition,
  cancel/merge respect measurement/reset boundaries
- Stats: Measurements, Resets, ConditionalGates, Dynamic fields
- Tests: teleportation, conditional, reset+reuse, IsDynamic (14 new)
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@splch splch merged commit d33a0c0 into main Mar 12, 2026
6 checks passed
@splch splch deleted the feat/mid-circuit-measurement branch March 12, 2026 16:39
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.

1 participant