Skip to content

Commit

Permalink
baseline
Browse files Browse the repository at this point in the history
  • Loading branch information
Strilanc committed Mar 14, 2024
1 parent 4040fd8 commit ee49757
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/stim/stabilizers/conversions.perf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,51 @@ BENCHMARK(independent_to_disjoint_xyz_errors) {
std::cout << "data dependence";
}
}

BENCHMARK(stabilizers_to_tableau) {
std::vector<std::complex<float>> offsets{
{1, 0},
{-1, 0},
{0, 1},
{0, -1},
{3, 6},
{-6, 3},
};
size_t w = 24;
size_t h = 12;

auto normalize = [&](std::complex<float> c) -> std::complex<float> {
return {fmodf(c.real() + w*10, w), fmodf(c.imag() + h*10, h)};
};
auto q2i = [&](std::complex<float> c) -> size_t {
c = normalize(c);
return (int)c.real() / 2 + c.imag() * (w / 2);
};

std::vector<stim::PauliString<128>> stabilizers;
for (size_t x = 0; x < w; x++) {
for (size_t y = x % 2; y < h; y += 2) {
std::complex<float> s{x % 2 ? -1.0f : +1.0f, 0.0f};
std::complex<float> c{(float)x, (float)y};
stim::PauliString<128> ps(w * h / 2);
for (const auto &offset : offsets) {
size_t i = q2i(c + offset * s);
if (x % 2 == 0) {
ps.xs[i] = 1;
} else {
ps.zs[i] = 1;
}
}
stabilizers.push_back(ps);
}
}

size_t dep = 0;
benchmark_go([&]() {
Tableau<128> t = stabilizers_to_tableau(stabilizers, true, true, false);
dep += t.xs[0].zs[0];
}).goal_millis(140);
if (dep == 99999999) {
std::cout << "data dependence";
}
}

0 comments on commit ee49757

Please sign in to comment.