I wrote following code in QASM editor on IBM Q web interface (note ccu1 is controlled-controlled U1 gate):
OPENQASM 2.0;
include "qelib1.inc";
gate ccu1 ( p ) c1, c2, t {
cu1 ( p / 2 ) c1, c2;
cx c2, t;
cu1 ( - p / 2 ) c1, t;
cx c2, t;
cu1 ( p / 2 ) c1, t;
}
qreg q[4];
creg c[4];
h q[0];
h q[1];
h q[2];
h q[3];
ccu1(pi) q[0],q[1],q[2];
id q[3];
measure q[3] -> c[3];
When I look to visualization of a state vector, everything is fine. However, when I tried to run the code on simulator I got error ERROR_RUNNING_JOB
. There is also a status message Error in transpilation process. [1003]
on results page.
I suspect that the issue is caused by subroutine (a gate
statement at the beginning of the code).
Could anyone please help me solve the issue?
Note, I know that it is possible to use subroutine in Qiskit, but I am interested in QASM.