You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
QASM3 exporter with parameterized circuit support #146
Qiskit C++ supports building parameterized circuits, but can not run them. One reason it does not support is QASM3 exporter implemented in QuantumCircuit class
(
Jun Doi (@doichanj) Hi, I am working on this issue. Does qiskit have a C-API to iterate over the parameters of a Quantum Circuit? The only implemented C-API I found was for number of parameters.
Also as a side note some operations currently supported in parameters like a**b are not valid QASM3 operations (should be pow(a,b)). There might be more such operations, is there a doc of all supported operations on parameters by qiskit or is it just Python operations?
Also as a side note some operations currently supported in parameters like a**b are not valid QASM3 operations (should be pow(a,b)). There might be more such operations, is there a doc of all supported operations on parameters by qiskit or is it just Python operations?
If you think there is an unrelated issue, please report it as a bug with a reproduction example.
Thank you to everyone who has submitted a PR for this issue! We currently have several promising fixes under review, so please hold off on submitting new PRs until the Qiskit team posts a follow-up comment here.
We will review the existing submissions in due course. Thank you for your patience!
I reviewed all the PRs related to this issue, and I noticed we do not have C-API to get a list of parameters used in the circuit (A list of the parameters is stored on rust side, so it is not good to have duplicate list on C++ side). So I would like to propose a stab function in QuantumCircuit class to get a list of parameters and replace the implementation of the function to C-API when it will be available.
std::vector<std::string> QuantumCircuit::parameter_symbols(void); // please implement this one
// std::vector<Parameter> QuantumCircuit::parameters(void); // this is not required currently, it is compatible to Qiskit
Then pass the list of parameter symbols to QASM3 exporter.
Also I would like to add a limitation, we do not accept the same symbols in a circuit, because we do not have C-API to identify by UUID of Parameters, for example the following should be different parameter, but we do not accept this in Qiskit C++ at this moment.
So please collect a list of parameter symbols using the original symbol name for a stab function. (The original symbol name will be also used in a list of parameter set for SamplerPub/EstimatorPub)
Thank you for review. I have implemented the #146 requested solution in #157.
Added QuantumCircuit::parameter_symbols() const
Updated the default QASM3 export path to use it
Added the temporary limitation that distinct Parameter objects with the same symbol name are rejected
Verified with the test suite: 100% tests passed, 0 tests failed out of 4
The implementation keeps a clean replacement point so parameter_symbols() can later be changed to use the C API once parameter-symbol enumeration is available from the Rust-side circuit data.
I tried to address the QASM3 exporter support for parameterized circuits. I would appreciate any guidance on whether this is going in the right direction.
Activity
1ucian0 commentedon Jun 3, 2026
If you want to participate, please follow these guidelines:
#unitaryhack-26in the Unitary Foundation DiscordThe winners will be announced on June 24th.
Happy hacking!
Mayank447 commentedon Jun 4, 2026
Jun Doi (@doichanj) Hi, I am working on this issue. Does qiskit have a C-API to iterate over the parameters of a Quantum Circuit? The only implemented C-API I found was for number of parameters.
Also as a side note some operations currently supported in parameters like a**b are not valid QASM3 operations (should be pow(a,b)). There might be more such operations, is there a doc of all supported operations on parameters by qiskit or is it just Python operations?
1ucian0 commentedon Jun 8, 2026
If you think there is an unrelated issue, please report it as a bug with a reproduction example.
1ucian0 commentedon Jun 8, 2026
Thank you to everyone who has submitted a PR for this issue! We currently have several promising fixes under review, so please hold off on submitting new PRs until the Qiskit team posts a follow-up comment here.
We will review the existing submissions in due course. Thank you for your patience!
doichanj commentedon Jun 11, 2026
I reviewed all the PRs related to this issue, and I noticed we do not have C-API to get a list of parameters used in the circuit (A list of the parameters is stored on rust side, so it is not good to have duplicate list on C++ side). So I would like to propose a stab function in
QuantumCircuitclass to get a list of parameters and replace the implementation of the function to C-API when it will be available.Then pass the list of parameter symbols to QASM3 exporter.
Also I would like to add a limitation, we do not accept the same symbols in a circuit, because we do not have C-API to identify by UUID of Parameters, for example the following should be different parameter, but we do not accept this in Qiskit C++ at this moment.
So please collect a list of parameter symbols using the original symbol name for a stab function. (The original symbol name will be also used in a list of parameter set for SamplerPub/EstimatorPub)
GoiBasia commentedon Jun 11, 2026
Thank you for review. I have implemented the #146 requested solution in #157.
QuantumCircuit::parameter_symbols() constParameterobjects with the same symbol name are rejected100% tests passed, 0 tests failed out of 4The implementation keeps a clean replacement point so
parameter_symbols()can later be changed to use the C API once parameter-symbol enumeration is available from the Rust-side circuit data.shiv152-arch commentedon Jun 11, 2026
Hi. I would like to contribute to this issue, if it's still available.
spital commentedon Jun 12, 2026
Hi, I opened a PR for this issue here: #159
I tried to address the QASM3 exporter support for parameterized circuits. I would appreciate any guidance on whether this is going in the right direction.
Thank you.