From 21b8f2a86c5cffc43a0c923909a4044312d0b369 Mon Sep 17 00:00:00 2001 From: "Stefan J. Wernli" Date: Wed, 12 Aug 2020 22:07:36 -0700 Subject: [PATCH 1/2] Fix asserts in QubitManager --- src/Simulation/Common/QubitManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Simulation/Common/QubitManager.cs b/src/Simulation/Common/QubitManager.cs index a70651f5059..a39a46d8bfb 100644 --- a/src/Simulation/Common/QubitManager.cs +++ b/src/Simulation/Common/QubitManager.cs @@ -104,7 +104,7 @@ private void ExtendQubitArray() { if (oldQubitsArray[i] == oldNone) { // Point to the first new (free) element - Debug.Assert(false,"Why do we extend an array, when we still have available slots?"); + Debug.Assert(!EncourageReuse,"Why do we extend an array, when we still have available slots?"); this.qubits[i] = oldNumQubits; } else if (oldQubitsArray[i] == oldAllocated) { // Allocated qubits are marked differently now. @@ -133,7 +133,7 @@ private void ExtendQubitArray() freeTail = NumQubits - 1; } else { - Debug.Assert(false, "Why do we extend an array, when we still have available slots?"); + Debug.Assert(!EncourageReuse, "Why do we extend an array, when we still have available slots?"); } } From 504fddccb4bc69630f3a3b6c0e1c0592d10f0e11 Mon Sep 17 00:00:00 2001 From: "Stefan J. Wernli" Date: Wed, 12 Aug 2020 22:40:54 -0700 Subject: [PATCH 2/2] Remove asserts from QubitManager --- src/Simulation/Common/QubitManager.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Simulation/Common/QubitManager.cs b/src/Simulation/Common/QubitManager.cs index a39a46d8bfb..9bc54dfce3d 100644 --- a/src/Simulation/Common/QubitManager.cs +++ b/src/Simulation/Common/QubitManager.cs @@ -104,7 +104,6 @@ private void ExtendQubitArray() { if (oldQubitsArray[i] == oldNone) { // Point to the first new (free) element - Debug.Assert(!EncourageReuse,"Why do we extend an array, when we still have available slots?"); this.qubits[i] = oldNumQubits; } else if (oldQubitsArray[i] == oldAllocated) { // Allocated qubits are marked differently now. @@ -131,9 +130,6 @@ private void ExtendQubitArray() { free = oldNumQubits; freeTail = NumQubits - 1; - } else - { - Debug.Assert(!EncourageReuse, "Why do we extend an array, when we still have available slots?"); } }