microsoft/qdk
Publicmirrored fromhttps://github.com/microsoft/qdkAvailable
samples/python_interop/teleportation_project/src/RunTeleport.qs
21lines · modecode
| 1 | namespace RunTeleport { |
| 2 | |
| 3 | open TeleportLib; // references the TeleportLib namespace in Teleport.qs |
| 4 | |
| 5 | @EntryPoint() // @EntryPoint() not necessary for Python or Jupyter Notebook programs |
| 6 | operation RunTeleportationExample() : Unit { |
| 7 | use msg = Qubit(); |
| 8 | use target = Qubit(); |
| 9 | |
| 10 | H(msg); |
| 11 | Teleport(msg, target); // calls the Teleport() operation from Teleport.qs |
| 12 | H(target); |
| 13 | |
| 14 | if M(target) == Zero { |
| 15 | Message("Teleported successfully!"); |
| 16 | |
| 17 | Reset(msg); |
| 18 | Reset(target); |
| 19 | } |
| 20 | } |
| 21 | } |
| 22 | |