Skip to content

Commit 85275c1

Browse files
committed
Support parameterized QASM3 export
1 parent 1c8e1ca commit 85275c1

5 files changed

Lines changed: 1523 additions & 411 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
features:
3+
- |
4+
`QuantumCircuit::to_qasm3()` now uses a dedicated OpenQASM 3 exporter and
5+
declares symbolic circuit parameters as OpenQASM 3 `input float[64]`
6+
values before emitting parameterized gate operations. Generated input and
7+
register names are adjusted when needed to avoid OpenQASM 3 global symbol
8+
conflicts, including conflicts with custom gate definitions emitted by the
9+
exporter. The exporter also emits valid OpenQASM 3 for controlled-U1,
10+
controlled-U3, and global phase operations.
11+
- |
12+
Added `QuantumCircuit::parameter_symbols()`, which returns the sorted list
13+
of unique parameter symbol names used in the circuit. The OpenQASM 3
14+
exporter consumes this list instead of collecting parameters on its own.
15+
This is currently a stub: the authoritative parameter table lives on the
16+
Rust side and there is no C-API yet to enumerate the symbols (only
17+
`qk_circuit_num_param_symbols`, the count), so the names are derived from
18+
the parameter expressions and the implementation is expected to be replaced
19+
by a C-API when one becomes available. Until then, parameter names must be
20+
recoverable as OpenQASM identifier tokens; the stub raises an exception if
21+
the harvested names do not match the Rust-side parameter count.
22+
fixes:
23+
- |
24+
Fixed `QuantumCircuit::compose()` reading each instruction's operation kind
25+
from the destination circuit instead of the source circuit. Composing into a
26+
circuit that has fewer instructions than the source could read past the end
27+
of the destination, and otherwise mis-classified instructions. This also
28+
ensures composed parameterized circuits export correctly with
29+
`to_qasm3()`.
30+
- |
31+
Parameterized gate insertion now raises `std::invalid_argument` when the
32+
Qiskit C API reports `QkExitCode_ParameterNameConflict`, so distinct
33+
`Parameter` objects with the same symbol name are rejected before the C++
34+
circuit is mutated.
35+
issues:
36+
- |
37+
`QuantumCircuit::parameter_symbols()` (and therefore the OpenQASM 3
38+
exporter) identifies parameters by their original symbol name. Distinct
39+
`Parameter` objects that share a name are not supported, because qiskit-cpp
40+
cannot yet disambiguate parameters by UUID through the C-API. The original
41+
symbol name is used for the exported input name and for the
42+
`parameter_symbols()` list.

0 commit comments

Comments
 (0)