Hi,
First of all, thank you for your excellent study materials and codexercises, they really thoughtful and engaging. My issue might be a duplicate of something, if so – sorry for that.
Was recently solving Codexercise I.13.5, tried this solution:
def four_qubit_mcx_only_tofs():
# We will initialize the control qubits in state |1> so you can see
# how the output state gets changed.
qp.PauliX(wires=0)
qp.PauliX(wires=1)
qp.PauliX(wires=2)
##################
# YOUR CODE HERE #
##################
# IMPLEMENT A 3-CONTROLLED NOT WITH TOFFOLIS
qp.Toffoli(wires=[1,2,3])
qp.Toffoli(wires=[0,3,4])
qp.Toffoli(wires=[1,2,3])
return qp.state()
and the scoring system outputed the following error:
Error: Your gates are not applied to the correct wires
While I have found the correct implementation, the one I’ve shown above seem to provide with the same result. Is this error done intentionally (and if so, what was the intention), or is it a scoring system bug?
PS: I guess this order should work too:
qp.Toffoli(wires=[0,2,3])
qp.Toffoli(wires=[1,3,4])
qp.Toffoli(wires=[0,2,3])