Hi!
I have a question on the implementation of the control with 2 auxiliary qubits. The circuit we are asked to implement is this
I know there was a question here
But I can’t figure out why we need to add PauliX gates on wires=0? This is not in the circuit we are asked to implement. My code only succeeds if I add these two gates.
def exp_U_second(U, t):
"""Implement the second-order approximation of exp(tU).
Args:
U (array): A unitary matrix, stored as a complex array.
t (float): A time to evolve by.
"""
def subcircuit():
##################
# YOUR CODE HERE #
##################
qml.QubitUnitary(V(t/2), wires=aux[1])
qml.ControlledQubitUnitary(U@U, control_wires=aux[1], wires=main, control_values='0')
qml.ControlledQubitUnitary(U, control_wires=aux[1], wires=main, control_values='1')
qml.QubitUnitary(np.transpose(V(t/2)), wires=aux[1])
# ADD CONTROLLED OPERATION HERE
qml.QubitUnitary(V(t), wires=aux[0])
**qml.PauliX(wires=aux[0])**
ctrl_fn = qml.ctrl(subcircuit, aux[0], control_values='0')
ctrl_fn()
**qml.PauliX(wires=aux[0])**
qml.QubitUnitary(np.transpose(V(t)), wires=aux[0])