I have a two-qubit gate with below unitary:
def _unitary_(self): st = np.sin(self.theta) ct = np.cos(self.theta) ei = np.exp(1j*self.phi) emi = np.exp(-1j*self.phi) return np.array([ [1., 0, 0, 0], [0, ct, ei*st, 0], [0, emi*st, -ct, 0], [0, 0, 0, 1.] ] )
I want to build a three-qubit gate in which one qubit serves as the control qubit on the above two-qubit gate while the gate is applied on the other two qubits.
Here is an example of such gate: Say the gate is applied on q0, q1, and q2 where q0 is the control qubit. The above 4*4 unitary should be applied to q1 and q2 if and only if q0 is 0.
How would the unitary of such three-qubit gate look like? (I'm doing this in Cirq)