Closed felicitysplatt closed 2 months ago
Thanks for the report. We have logic that does this in the OpenQASM 2 exporter, so I think we must have forgotten to port over similar behaviour to the OpenQASM 3 exporter.
I believe this should be fixed by #12776, but since I can't generate the exact initial circuit to check, I'm not absolutely 100% sure. I'll mark it as "being fixed", and if I'm wrong, feel free to re-open (if it closes).
Environment
What is happening?
I submit a job to the IBM Platform, a max cut using QAOA, for very simple circuits (less than 10 nodes, few edges). This will produce a parameterized circuit. The OpenQASM 3 string created cannot be drawn - there's something wrong with the string, likely not correctly escaping the names of custom gates it's defining.
Jake Lishman has requested I submit this bug report.
Here's an example of a string it produces:
""" OPENQASM 3; include "stdgates.inc"; input float[64] _β0; input float[64] _γ0; gate exp(it IZ)(_γ0) _gate_q_0, _gate_q_1 { rz(5.0_γ0) _gate_q_0; } gate rzz_140434630696240(_γ0) _gate_q_0, _gate_q_1 { cx _gate_q_0, _gate_q_1; rz(1.0_γ0) _gate_q_1; cx _gate_q_0, _gate_q_1; } gate exp(it ZZ)(_γ0) _gate_q_0, _gate_q_1 { rzz_140434630696240(1.0*_γ0) _gate_q_0, _gate_q_1; } gate PauliEvolution(_γ0) _gate_q_0, _gate_q_1 { exp(it IZ)(_γ0) _gate_q_0, _gate_q_1; exp(it ZZ)(_γ0) _gate_q_0, _gate_q_1; } bit[2] meas; qubit[2] q; h q[0]; h q[1]; PauliEvolution(_γ0) q[0], q[1]; PauliEvolution(_β0) q[0], q[1]; barrier q[0], q[1]; meas[0] = measure q[0]; meas[1] = measure q[1]; """
How can we reproduce the issue?
This code will not run for you as it depends on some custom functions and config files.
However, the problem should be reproducible from the concept - we are creating a really straightforward QAOA / maxcut problem.
What should happen?
The code above will run - that is not the problem.
The problem is the OpenQASM 3 string that qiskit generates on the IBM Quantum Platform - this string has a bug in it. A circuit cannot be drawn from that string.
Any suggestions?
No response