microsoft/qdk

Public

mirrored from https://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v1.1.1

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

katas/content/multi_qubit_systems/common.qs

22lines · modecode

1namespace Kata.Verification {
2 open Microsoft.Quantum.Katas;
3
4 operation CheckEqualOnZeroState(
5 testImpl : (Qubit[] => Unit is Adj + Ctl),
6 refImpl : (Qubit[] => Unit is Adj + Ctl)) : Bool {
7
8 let isCorrect = CheckOperationsEquivalenceOnZeroStateStrict(testImpl, refImpl, 2);
9
10 // Output different feedback to the user depending on whether the exercise was correct.
11 if isCorrect {
12 Message("Correct!");
13 } else {
14 Message("Incorrect.");
15 use target = Qubit[2]; // |00〉
16 ShowQuantumStateComparison(target, testImpl, refImpl);
17 ResetAll(target);
18 }
19 isCorrect
20 }
21
22}
23