Skip to content

fix(qasm2): preserve qubit order and define exported gates - #73

Merged
jianjian01 merged 1 commit into
cq-lib:release/2.0from
jianjian01:release/2.0
Oct 29, 2026
Merged

jianjian01 merged 1 commit into
cq-lib:release/2.0from
jianjian01:release/2.0

Conversation

@jianjian01

Copy link
Copy Markdown
Collaborator

Fix circuit state corruption during composition, parameter binding, and failed control-flow construction. Correct stabilizer half-rotation signs, QASM handling, and missing native gate lowering paths.

Changes

  • Correct stabilizer Y2P/Y2M conjugation signs to match Ry(±π/2).
  • Fix QASM2 serialization of X/Y/XY half rotations, including instruction terminators and ASCII pi formatting.
  • Reject unsupported QASM3 end statements before lowering discards unreachable branches or expands loops.
  • Complete single-qubit lowering paths into U, RXY, and RZ with same-polarity X/Y half rotations, preserving symbolic parameters and global phase.
  • Make compose reject duplicate target qubits and preserve destination identity, existing classical handles, and state on failure.
  • Remap classical references to the new circuit identity during parameter binding.
  • Restore appended qubits and the previous global phase when control-flow construction rolls back, preventing dangling phase indices.
  • Stage only newly introduced parameter expressions during composition, eliminating repeated copies of the existing parameter table.

@jianjian01
jianjian01 merged commit 55fb8f2 into cq-lib:release/2.0 Oct 29, 2026
4 checks passed
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