microsoft/qdk
Publicmirrored from https://github.com/microsoft/qdkAvailable
katas/content/multi_qubit_systems/prepare_superposition/verification.qs
17lines · modecode
| 1 | namespace Kata.Verification { |
| 2 | operation PrepareSuperposition_Reference(qs : Qubit[]) : Unit is Adj + Ctl { |
| 3 | X(qs[1]); |
| 4 | H(qs[1]); |
| 5 | } |
| 6 | |
| 7 | @EntryPoint() |
| 8 | operation CheckSolution() : Bool { |
| 9 | let isCorrect = AssertEqualOnZeroState(Kata.PrepareSuperposition, PrepareSuperposition_Reference); |
| 10 | if isCorrect { |
| 11 | Message("Correct!"); |
| 12 | } else { |
| 13 | Message("Incorrect."); |
| 14 | } |
| 15 | return isCorrect; |
| 16 | } |
| 17 | } |
| 18 | |