Skip to content

feat: add parameterized QASM3 exporter#150

Open
nathandelcid wants to merge 1 commit into
Qiskit:mainfrom
nathandelcid:feat/qasm3exporter
Open

feat: add parameterized QASM3 exporter#150
nathandelcid wants to merge 1 commit into
Qiskit:mainfrom
nathandelcid:feat/qasm3exporter

Conversation

@nathandelcid
Copy link
Copy Markdown

Closes #146.

Summary

Moves OpenQASM 3 export out of QuantumCircuit into the header-only Qiskit::qasm3::dumps API. The existing exporter already serialized symbolic parameter expressions using qk_param_str, but the generated OpenQASM was invalid because free parameters were not declared. Parameterized exports can now supply ordered parameter names, which are emitted as input float[64] declarations. The parameter names must be supplied explicitly because the current Qiskit C API exposes the number of free symbols but cannot enumerate their names.

Details and comments

  • Adds Qiskit::qasm3::dumps(circuit) for circuits without free parameters.
  • Adds Qiskit::qasm3::dumps(circuit, input_parameters) for parameterized circuits.
  • Removes QuantumCircuit::to_qasm3().
  • Preserves existing unparameterized QASM output.
  • Validates missing, extra, empty, and duplicate parameter names.
  • Uses RAII wrappers to clear C API instruction and operation-count allocations.
  • Updates existing samples, providers, primitives, tests, tutorial, and release notes.
  • Keeps the exporter header-only and requires no CMake changes.

Testing

  • CTest: 3/3 tests passed on Windows with MSVC.
  • All locally configured sample targets built successfully with MSVC.
  • GCC C++11 syntax checks passed for the exporter test translation units.
  • Tutorial notebook JSON validation passed.
  • Doxygen was not run because it is not installed locally.

  • I have added the tests to cover my changes.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.

Portions of this pull request were generated or modified with the help of OpenAI Codex (GPT-5.5). Changes were reviewed and validated by human developer @nathandelcid

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jun 4, 2026

CLA assistant check
All committers have signed the CLA.

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.

QASM3 exporter with parameterized circuit support

3 participants