8
$\begingroup$

I'm trying to program a controlled gate as the figure below in Qiskit. Should it be sufficient to separate and control individually the Hadamard gates?

enter image description here

$\endgroup$
5
$\begingroup$

It seems like this gate is controlled on the top qubit (which I will call qubit 0) and performs a hadamard on both the other qubits (qubits 1 and 2) when the control is in state $|1\rangle$. In this case it is equivalent to separte two controlled-hadamards: each controlled on qubit 0, with qubit 1 as the target for one and qubit 2 as the target for the other.

The controlled-hadamard can be implemented with ch. The entire three qubit gate is then as follows.

qc = QuantumCircuit(3)
qc.ch(0,1)
qc.ch(0,2)
$\endgroup$
  • $\begingroup$ Thank you sir, this is part of a bigger question here. I really appreciate your response. $\endgroup$ – German Alamilla Jun 16 at 21:00
7
$\begingroup$

Yes, that notation means the Hadamard on the second qubit depends on the first qubit and the Hadamard on the third qubit depends on the first qubit. The gates aren't connected to each other in any way.

$\endgroup$
  • 2
    $\begingroup$ Also notice that these two gates commute, so you can separate in either order. $\endgroup$ – AHusain Jun 13 at 6:24

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.