munich-quantum-toolkit / munich-quantum-toolkit/core
✨ Support register-wide Qiskit classical initialization
@simon1hofmann is already working on this.
Since Sep 3, 2026.
- Dominant language
- C++
- Stars
- 133
- Forks
- 73
- Avg merge
- 17h 34m
- Merged PRs (30d)
- 261
Description
🤖 This response was generated with AI assistance.
Problem Statement
Qiskit classical bits start at zero, whereas an uninitialized OpenQASM 3 bit[n] declaration has undefined contents. The Qiskit serializer therefore currently prepends one explicit store(false) operation per classical bit to preserve Qiskit semantics.
Qiskit can instead store zero into a complete ClassicalRegister, which its OpenQASM 3 exporter writes as:
bit[n] c;
c = 0;
The MQT OpenQASM frontend currently rejects that RHS because whole-register assignments require a bit-register value. This prevents replacing the per-bit initialization with one register-wide operation.
Proposed Solution
Support a well-defined whole-register initialization path for the OpenQASM emitted by Qiskit, then simplify the serializer to initialize each classical register once.
Before implementation, determine whether c = 0 is handled as a standard OpenQASM assignment conversion or as an explicitly documented Qiskit-compatibility form. In either case:
- define width and nonzero-value behavior precisely;
- preserve undefined initialization for OpenQASM declarations that have no assignment;
- cover single- and multi-bit registers, multiple registers, and partially measured registers;
- replace the per-bit serializer loop only after the frontend accepts the exported program;
- coordinate with #2289, which tracks bit-register-to-integer casts in the opposite direction.
Follow-up to #2288 and discussion https://github.com/munich-quantum-toolkit/core/pull/2288#discussion_r3908878547.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.