amazon-braket / amazon-braket/qirtoqasm
Optional emission of OpenQASM 3 physical qubits
- Vorherrschende Sprache
- Rust
- Sterne
- 2
- Forks
- 1
- Ø Merge
- 3 T. 21 Std.
- Gemergte PRs (30 T.)
- 5
Beschreibung
**Describe the feature you'd like**
Currently the translator emits a single virtual register `qubit[N] q;` with `q[i]` indexed references everywhere a qubit is named. Add an opt-in mode that emits OpenQASM 3 physical qubits (`$0`, `$1`, …) instead, controlled by a new field on `TranslateOptions`.
**How would this feature be used? Please describe.**
Workflows that have already mapped a circuit to specific hardware qubits and want the OpenQASM 3 output to reflect that mapping — rather than re-stating it at the consumer — would set the option and receive `$N`-style references. A user-supplied permutation (or the identity mapping by default) would decide which physical qubit each QIR `%Qubit*` index maps to.
**Describe alternatives you've considered**
Post-processing the emitted OpenQASM 3 to substitute `q[i]` with `$N` is straightforward today and is the reasonable workaround. The reason to do it inside qirtoqasm is to keep the output canonical and to centralize the mapping decision.
**Additional context**
Implementing this would require: a new `Options` field, an AST variant distinct from the indexed-identifier shape used everywhere else (physical qubits are bare `$N` tokens, not `name[idx]`), printer routing, and a mapping-source decision (identity, caller-supplied table, future calibration integration). It is purely additive — the default behavior would not change.
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.