Description
When running the following Q# program, the result of each shots is different for two qubit arrays. But the measure operation used here should not have changed the state of qubits. Here are just one situation, it may be quite different in each time.
mid:
[Zero,Zero,Zero,Zero,Zero,Zero]
[One,Zero,Zero,Zero]
final:
[Zero,Zero,Zero,Zero,Zero,Zero]
[Zero,Zero,Zero,One]
mid:
[Zero,Zero,Zero,Zero,Zero,Zero]
[One,Zero,Zero,Zero]
final:
[Zero,Zero,Zero,Zero,Zero,Zero]
[One,Zero,Zero,Zero]
But if we comment the lines which tag with "// Codes that have an impact", the final state will be zero all the time.
final:
[Zero,Zero,Zero,Zero,Zero,Zero]
[Zero,Zero,Zero,Zero]
It is supposed that QsCompiler will execute some passes when get code block like op and adjoint op, but if there are some other operations between op and adjoint op, it will not work even when these operations do nothing.
Another probability is that MultiM operation does change the state here.
Testcase
namespace NISLNameSpace {
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Measurement;
open Microsoft.Quantum.ErrorCorrection;
operation NISLMeasure (q : Qubit[]) : Unit {
mutable result = MultiM (q);
Message($"{result}");
}
operation NISLOperation () : Unit {
use NISLVariable1 = Qubit[6];
use NISLVariable2 = Qubit[4];
FiveQubitCodeEncoderImpl(NISLVariable1,NISLVariable2);
Message("mid:"); // Codes that have an impact
NISLMeasure(NISLVariable1); // Codes that have an impact
NISLMeasure(NISLVariable2); // Codes that have an impact
Adjoint FiveQubitCodeEncoderImpl(NISLVariable1,NISLVariable2);
Message("final:");
NISLMeasure(NISLVariable1);
NISLMeasure(NISLVariable2);
ResetAll(NISLVariable1);
ResetAll(NISLVariable2);
}
@EntryPoint()
operation main() : Unit {
for i in 0..5{
mutable result = NISLOperation();
}
}
}
Environment
operating system : Windows 10
dotnet version : 6.0.301
QDK : 0.25.218240
文档详细信息
⚠ 请勿编辑此部分。 docs.microsoft.com ➟ GitHub 问题链接必须具有此部分。
Description
When running the following Q# program, the result of each shots is different for two qubit arrays. But the measure operation used here should not have changed the state of qubits. Here are just one situation, it may be quite different in each time.
But if we comment the lines which tag with "// Codes that have an impact", the final state will be zero all the time.
It is supposed that QsCompiler will execute some passes when get code block like
opandadjoint op, but if there are some other operations betweenopandadjoint op, it will not work even when these operations do nothing.Another probability is that
MultiMoperation does change the state here.Testcase
Environment
operating system : Windows 10
dotnet version : 6.0.301
QDK : 0.25.218240
文档详细信息
⚠ 请勿编辑此部分。 docs.microsoft.com ➟ GitHub 问题链接必须具有此部分。