microsoft/qdk

Public

mirrored fromhttps://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v1.28.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

katas/content/deutsch_jozsa/implement_bv/Solution.qs

13lines · modecode

1namespace Kata {
2 operation BernsteinVaziraniAlgorithm (N : Int, oracle : Qubit[] => Unit) : Int[] {
3 mutable s = [];
4 use x = Qubit[N];
5 ApplyToEach(H, x);
6 oracle(x);
7 ApplyToEach(H, x);
8 for xi in x {
9 set s += [MResetZ(xi) == Zero ? 0 | 1];
10 }
11 return s;
12 }
13}
14