Skip to content

Commit 5fbefeb

Browse files
Debug/optimize QTensorNetwork
1 parent a2c76ba commit 5fbefeb

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/qtensornetwork.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -299,22 +299,16 @@ bool QTensorNetwork::ForceM(bitLenInt qubit, bool result, bool doForce, bool doA
299299
}
300300

301301
// If we did not return, this circuit layer is fully collapsed.
302+
QRACK_CONST complex pauliX[4U]{ ZERO_CMPLX, ONE_CMPLX, ONE_CMPLX, ZERO_CMPLX };
302303

303-
if (!layerId || !nonMeasuredQubits.size()) {
304-
bitCapInt perm = 0U;
305-
for (const auto& b : m) {
306-
if (b.second) {
307-
bi_or_ip(&perm, pow2(b.first));
308-
}
304+
if (!layerId) {
305+
if (toRet) {
306+
circuit[layerId]->AppendGate(std::make_shared<QCircuitGate>(qubit, pauliX));
309307
}
310308

311-
// The simulator is in a computational basis eigenstate.
312-
SetPermutation(perm);
313-
314309
return toRet;
315310
}
316311

317-
QRACK_CONST complex pauliX[4U]{ ZERO_CMPLX, ONE_CMPLX, ONE_CMPLX, ZERO_CMPLX };
318312
const size_t layerIdMin1 = layerId - 1U;
319313
std::map<bitLenInt, bool>& mMin1 = measurements[layerIdMin1];
320314
for (const auto& b : m) {

0 commit comments

Comments
 (0)