5

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?

Sanchayan Dutta
  • 17,497
  • 7
  • 48
  • 110
Martin Vesely
  • 13,891
  • 4
  • 28
  • 65
  • 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. – met927 Jan 06 '20 at 17:40
  • @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. – Martin Vesely Jan 06 '20 at 17:45
  • 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. – met927 Jan 06 '20 at 17:59
  • @met927: And what about IBM Q composer? Try to put CH gate and start e.g. simulation. – Martin Vesely Jan 06 '20 at 18:01
  • 1
    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. – met927 Jan 06 '20 at 18:04
  • 1
    @met927: I see, just tried also on real quantum processor. Thanks for clues. – Martin Vesely Jan 06 '20 at 19:01

1 Answers1

4

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.

met927
  • 3,251
  • 1
  • 9
  • 22
Martin Vesely
  • 13,891
  • 4
  • 28
  • 65