Simulators behave differently when not resetting qubit array #1115
Description
Describe the bug
When running the following program, SparseSimulator and ResourcesEstimator do not throw ReleasedQubitsAreNotInZeroState as QuantumSimulator and ToffoliSimulator do, although we do not use the ResetAll operation. The related code snippet is the within-apply block in ApplyTransposition. The link of code is here:
https://github.com/microsoft/QuantumLibraries/blob/987a2670e852ae77965b4b0b6873d2c5d3bcac69/Standard/src/Synthesis/Transposition.qs#L55
Does this an incomplete implementation of the within-apply block in two simulators?
To Reproduce
namespace TestPattern {
open Microsoft.Quantum.Diagnostics;
open Microsoft.Quantum.Arithmetic;
open Microsoft.Quantum.Synthesis;
@Test("QuantumSimulator")
@Test("SparseSimulator")
@Test("ResourcesEstimator")
@Test("ToffoliSimulator")
operation TestCorrect() : Unit {
use QubitArray0 = Qubit[4];
mutable qubits = LittleEndian(QubitArray0);
mutable b = 15;
mutable a = 0;
mutable NISLResult = ApplyTransposition(a, b, qubits);
// ResetAll(QubitArray0);
}
}
Expected behavior
The four simulators should all throw the ReleasedQubitsAreNotInZeroState exception.
##Actual behavior
[xUnit.net 00:00:01.12] TestPattern.TestCorrect+QuantumSimulator.TestCorrect [FAIL]
[xUnit.net 00:00:01.12] TestPattern.TestCorrect+ToffoliSimulator.TestCorrect [FAIL]
System information
operating system:Windows 10
dotnet version:6.0.400
QDK:v0.27.244707