Since the new SDK does not use Driver.cs, the Bell state example needs to be rewritten without the C# part.
Now you only need to write Program.qs, and the example looks like,
Result is |00> 500, |01> 0, |10> 0, |11> 500. Looks still valid.
namespace QFT_naive {
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Convert;
@EntryPoint()
operation SayHello() : Unit {
Message("Hello quantum world!");
mutable n00 = 0;
mutable n01 = 0;
mutable n10 = 0;
mutable n11 = 0;
for(trian in 1..1000){
using ( (qubit0, qubit1) = (Qubit(), Qubit()) ){
H(qubit0);
CNOT(qubit0,qubit1);
let res0 = M(qubit0);
let res1 = M(qubit1);
if(res0 == Zero){
if(res1 == Zero){
set n00 += 1;
}else{
set n01 += 1;
}
}else{
if(res1 == Zero){
set n10 += 1;
}else{
set n11 += 1;
}
}
Reset(qubit0);
Reset(qubit1);
}
}
Message(IntAsString(n00));
Message(IntAsString(n01));
Message(IntAsString(n10));
Message(IntAsString(n11));
}
}
0 件のコメント:
コメントを投稿