def teleport(msg: Qubit, here: Qubit, there: Qubit) -> None: # <1> here.h() # <2> here.cnot(there) # <3> # ... # <4> msg.cnot(here) # <5> msg.h() if msg.measure(): there.z() # <6> if here.measure(): there.x() msg.reset() # <7> here.reset()
def teleport(msg: Qubit, here: Qubit, there: Qubit) -> None: here.h() here.cnot(there) # ... msg.cnot(here) msg.h() if msg.measure(): there.z() if here.measure(): there.x() msg.reset() here.reset()