Skip to content

Commit 6afb635

Browse files
Debug/optimize QTensorNetwork
1 parent 5fbefeb commit 6afb635

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/qtensornetwork.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ bool QTensorNetwork::ForceM(bitLenInt qubit, bool result, bool doForce, bool doA
279279

280280
// If no qubit in this layer is target of a non-phase gate, it can be completely telescoped into classical state
281281
// preparation.
282-
while (true) {
282+
while (layerId) {
283283
std::vector<bitLenInt> nonMeasuredQubits;
284284
nonMeasuredQubits.reserve(qubitCount);
285285
for (size_t i = 0U; i < qubitCount; ++i) {
@@ -301,14 +301,6 @@ bool QTensorNetwork::ForceM(bitLenInt qubit, bool result, bool doForce, bool doA
301301
// If we did not return, this circuit layer is fully collapsed.
302302
QRACK_CONST complex pauliX[4U]{ ZERO_CMPLX, ONE_CMPLX, ONE_CMPLX, ZERO_CMPLX };
303303

304-
if (!layerId) {
305-
if (toRet) {
306-
circuit[layerId]->AppendGate(std::make_shared<QCircuitGate>(qubit, pauliX));
307-
}
308-
309-
return toRet;
310-
}
311-
312304
const size_t layerIdMin1 = layerId - 1U;
313305
std::map<bitLenInt, bool>& mMin1 = measurements[layerIdMin1];
314306
for (const auto& b : m) {

0 commit comments

Comments
 (0)