INNER CODE UNIT · C++
code
aromanro/QCSim · QCSim/CliffordTests.cpp:1025
const int code = actions() % 15;
ApplyGate(s, code, int(q), int(other));
ref.ApplyGate(*GetGate(code), q, other);
}
else if (op < 87)
{
const bool value = s.MeasureQubit(q);
auto v = ref.getRegisterStorage();
for (size_t b = 0; b < size_t(v.size()); ++b)
if (bool((b >> q) & 1) != value)
v[b] = 0.;
if (v.squaredNorm() < 1e-10)
{
std::cout << "impossible measurement\n";
return false;
}
ref.setRegisterStorage(v);
++measurements;