Skip to content

Commit

Permalink
Restore WeakSampleAncillae()
Browse files Browse the repository at this point in the history
  • Loading branch information
WrathfulSpatula committed Jul 16, 2023
1 parent 119fc12 commit 41b124b
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions src/qstabilizerhybrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1799,28 +1799,12 @@ void QStabilizerHybrid::WeakSampleAncillae()
}
}

const real1 finalProb =
(real1)(2 * FractionalRzAngleWithFlush(i, std::arg(shard->gate[3U] / shard->gate[0U])) / PI_R1);
if (finalProb < 0) {
if (Rand() < -finalProb) {
stabilizer->IS(i);
const real1 angleCos = cos(PI_R1 / 8);
const real1 angleSin = sin(PI_R1 / 8);
shard->gate[0U] *= complex(angleCos, angleSin);
shard->gate[3U] *= complex(angleCos, -angleSin);
}
} else {
if (Rand() < finalProb) {
stabilizer->S(i);
const real1 angleCos = cos(PI_R1 / 8);
const real1 angleSin = sin(PI_R1 / 8);
shard->gate[0U] *= complex(angleCos, -angleSin);
shard->gate[3U] *= complex(angleCos, angleSin);
}
}

shard->Compose(h);

if (toCombine.size() || toCombineAdj.size()) {
continue;
}

stabilizer->H(i);
stabilizer->ForceM(i, false);
stabilizer->Dispose(i, 1U);
Expand Down

0 comments on commit 41b124b

Please sign in to comment.