Skip to content

Commit

Permalink
Debug negator shadows
Browse files Browse the repository at this point in the history
  • Loading branch information
WrathfulSpatula committed Nov 10, 2024
1 parent 78a2058 commit 6fbf4c7
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/qunit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3923,8 +3923,25 @@ void QUnit::ApplyBuffer(PhaseShardPtr phaseShard, bitLenInt control, bitLenInt t
}
}

if (!phaseShard->isInvert) {
X(target);
X(target);

if (phaseShard->isInvert) {
H(target);

const real1_f tHProb = Prob(target);
const real1_f cHProb = isAnti ? antiCProb : cProb;

if (tHProb > cProb) {
if (tHProb > (ONE_R1_F / 2)) {
Phase(ONE_CMPLX, -ONE_CMPLX, control);
}
} else {
if (cHProb > (ONE_R1_F / 2)) {
Phase(ONE_CMPLX, -ONE_CMPLX, target);
}
}

H(target);
}
}
freezeBasis2Qb = false;
Expand Down

0 comments on commit 6fbf4c7

Please sign in to comment.