2
$\begingroup$

With reference to question how to implement CCH gate I easily realized that CH gate can be implemented with $\mathrm{Ry}$ gates and $\mathrm{CNOT}$ followingly:

My circuit

Note $\theta = \frac{\pi}{4}$ for first $Ry$ gate and $\theta = -\frac{\pi}{4}$ for second one.

However, when I put $\mathrm{CH}$ gate implemented on IBM Q to circuit, a transpiled circuit has this form: Transpiled circuit

So, the first circuit has only two one qubit gates whereas the second one has six such gates. If I understand it correctly, any single qubit gate is on IBM Q eventually replaced by $\mathrm{U3}$ gate with respective parameters.

It seems to me that the second circuit is unnecessary complex.

Is there any reason why to implement $\mathrm{CH}$ gate in such way or am I missing something?

$\endgroup$
  • $\begingroup$ Where are you getting this transpiled circuit from? When I run your initial circuit against the IBMQ simulator, the transpiled circuit contains 2 U3 gates, as expected. $\endgroup$ – met927 Jan 6 at 17:40
  • $\begingroup$ @met927: Yes, I see the same in this case. But try to put controlled Hadamard (CH gate) instead and run the code. The transpiled code will be as in the second figure. $\endgroup$ – Martin Vesely Jan 6 at 17:45
  • $\begingroup$ I think this is most likely to do with the way the transpilation is being done rather than the way the gate is implemented on the hardware. I imagine in that scenario they are unrolling to a basis that is not the standard u1, u2 and u3 gates, rather it contains those gates shown. I am not sure why this would be though. $\endgroup$ – met927 Jan 6 at 17:59
  • 1
    $\begingroup$ I think this is also to do with how things are transpiled for the simulator, if you execute the circuit on a real device it is transpiled to u2 gates. $\endgroup$ – met927 Jan 6 at 18:04
  • 1
    $\begingroup$ @met927: I see, just tried also on real quantum processor. Thanks for clues. $\endgroup$ – Martin Vesely Jan 6 at 19:01
2
$\begingroup$

Summarization based on discussion with user met927:

  • Transpiled circuit form depends on used backend - it is different for simulator and real quantum processor:
    • On simulator, the $\mathrm{CH}$ gate is transpiled to the circuit shown above
    • On real quantum processor, the gate is implemented with two $\mathrm{U2}$ gates and $\mathrm{CNOT}$ (i.e. like in the first figure in the answer)

Overall, the $\mathrm{CH}$ gate implementation on IBM Quantum is efficient.

|improve this answer|||||
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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