Skip to content

Support "input" modifier in QASM3 parser #7933

@pavoljuhas

Description

@pavoljuhas

Is your feature request related to a use case or problem? Please explain

This is a limited-scope follow-up to #7908 - the PR which initially intended to enhance QASM parser with a support for parameterized gates.

Describe the solution you would prefer

OpenQASM3 allows parameterized gates with the input modifier. Here is a minimum example that imports as parameterized circuit in Qiskit:

qasm = "OPENQASM 3.0; qreg q[1]; input float[64] phi; U(phi, 0, 0) q[0];"
circuit = qiskit.qasm3.loads(q1)

It would be nice to have it working in Cirq too and produce gates with appropriately named symbolic parameter(s):

from cirq.contrib.qasm_import import circuit_from_qasm
circuit = circuit_from_qasm(qasm)  # fails

The QasmParser needs to learn float, angle, and input keywords as appropriate for QASM3 vs QASM2 language versions. This should be done with a minimum intrusion to the QasmParser code and with care to keep, if possible, existing API interfaces unchanged.

How urgent is this for you? Is it blocking important work?

P3 – I'm not really blocked by it; it's an idea I'm proposing based on principle

PS: I am not sure how much need is there for this feature. The priority can be increased if we get upvotes here.

Metadata

Metadata

Assignees

Labels

area/qasmhelp wantedContributors welcomekind/feature-requestDescribes new functionalitytriage/acceptedA consensus emerged that this bug report, feature request, or other action should be worked on

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions