I am creating the following circuit with Qiskit (2Toffoli gates controlled with coins)
And to set the coins for one iteration of the circuit i do the following :
qsubnodes = QuantumRegister(2)
qsubnodes = QuantumRegister(2)
qc.h(subnode[0])
qc.h(subnode[1])
and then for the first Toffoli gate:
qc.ccx(subnode[0], subnode[1], *q)
and the second toffoli gate (which is the issue) :
qc.h(subnode[0])
qc.h(subnode[1])
qc.x(subnode[1]) // to invert the coin to control for 0 (as shown in the circuit)
qc.ccx(subnode[0], subnode[1], *q)
Is it the right way of inverting the coin for the second toffoli ?
Thank you,