QPE subroutine for 3 qubits generated successfully.
Unitary file: /path/to/gate.qasm
Output: /path/to/qpe.qasm
Generated QASM:
--------------------------------------------------
OPENQASM 3.0;
include "stdgates.inc";
include "iqft.qasm";
gate custom_t q {
p(pi / 4) q;
}
gate CU a, b {
ctrl @ custom_t a, b;
}
def qpe(qubit[3] q, qubit[1] psi) {
int n = 3;
for int i in [0:n-1] {
h q[i];
}
for int j in [0:n-1] {
int[16] k = 1 << j;
for int m in [0:k-1] {
CU q[j], psi[0];
}
}
iqft(q);
}
--------------------------------------------------