0
$\begingroup$

I was playing with approximation of gates with Clifford+T group on IBM Q. Everything works well on simulator, however, when I tried to run my circuit on actual quantum processor, a transpiler optimized circuit so only one $U3$ gate remained. Hence, I was not able to run my original circuit and assess effect of decoherence etc based on depth of the circuit.

To given an example, my original circuit is

OPENQASM 2.0;
include "qelib1.inc";

qreg q[1];
creg c[1];

h q[0];
s q[0];
t q[0];
sdg q[0];
h q[0];
measure q[0] -> c[0];

After transpiling (on IBM Q Armonk), the resulting QASM code is as follows:

OPENQASM 2.0;
include "qelib1.inc";

qreg q[1];
creg c[1];

u3(-0.7853981633974483, 1.5707963267948966, 4.71238898038469) q[0];
measure q[0] -> c[0];

I tried to add barriers before first h q[0]; and after last h q[0]; to prevent optimizer from working, however, without success.

I understand that basic gates on IBM Q are $I$, $U1$, $U2$ and $U3$ and that $H$, $S$, $S^\dagger$ and $T$ are eventually impleted by these $U$ gates.

However, is it possible to avoid optimization so that the original number of gates is preserved? In other words, Hadamard will be presented by one $U3$ gate, phase gate and $T$ by one $U1$ gate each etc.

$\endgroup$

2 Answers 2

2
$\begingroup$

In the web based composer there is currently no way to adjust the optimization level. As a workaround, you can put a barrier before and after each gate. This will prevent them from being joined.

$\endgroup$
1
  • $\begingroup$ Thanks, it works as expected $\endgroup$ Jun 11, 2020 at 9:33
1
$\begingroup$

When you transpile (either when calling execute or transpile), you should be able to set optimization_level=0 so the transpiler only maps the qubits to the backend. You can see an example here.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.