0
$\begingroup$

I'm trying to implement a doubly controlled phase gate using Qiskit. I'm aware of this proposed solution, but it's not working on my Google collab notebook. For some reason, I cannot import the "get_controlled_circuit" part. How can I implement the following doubly controlled phase gate using Qiskit? This gate appears on this paper, fig. 2.

Circuit showing the doubly controlled phase gate.

$\endgroup$

1 Answer 1

2
$\begingroup$

You can use control() method to create a controlled version for any gate. For example:

from qiskit import QuantumCircuit
from qiskit.circuit.library import RZGate
from numpy import pi

phi = pi / 4
gate = RZGate(phi)

circ = QuantumCircuit(5)
circ.append(gate.control(2), [1, 3, 4])
circ.draw('mpl')

The result: enter image description here

$\endgroup$

Your Answer

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

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