Closed isaacdevlugt closed 1 year ago
Long story short, v0.26
is correct. Even though we are now getting the right answer, the bug still existed and would have shown up in decompositions and other devices.
Basically, the method _controlled
returns a controlled version of the operator. That method did not consider control values.
You can easily see this by changing the control_values
of the ControlledQubitUnitary
:
U = qml.PauliX.compute_matrix() * (1.0j)
def subcircuit():
qml.ControlledQubitUnitary(U @ U, control_wires=1, wires=2, control_values='1')
dev = qml.device("default.qubit", wires=3)
@qml.qnode(dev)
def circuit():
qml.ctrl(subcircuit, control = 0, control_values=0)()
return qml.state()
In v0.25, you would get the same value independent of control value.
Thanks @albi3ro! 🚀
Expected behavior
Here is a minimal example with
v0.26
:Actual behavior
Differing outputs with
0.25
and0.26
and not sure why 🤔Additional information
No response
Source code
Tracebacks
No response
System information
Existing GitHub issues