INNER CODE UNIT · C++

op

aromanro/QCSim · QCSim/CliffordTests.cpp:1021

                const auto op = actions() % 100;
                const size_t q = actions() % n, other = (q + 1 + actions() % (n - 1)) % n;
                if (op < 72)
                {
                    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";

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…