MCPcopy Create free account
hub / github.com/boostorg/histogram / compare_2d

Function compare_2d

test/speed_gsl.cpp:46–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46void compare_2d(unsigned n, int distrib) {
47 auto r = random_array(n, distrib);
48
49 double best = std::numeric_limits<double>::max();
50 for (unsigned k = 0; k < 20; ++k) {
51 gsl_histogram2d* h = gsl_histogram2d_alloc(100, 100);
52 gsl_histogram2d_set_ranges_uniform(h, 0, 1, 0, 1);
53 auto t = clock();
54 for (unsigned i = 0; i < n / 2; ++i)
55 gsl_histogram2d_increment(h, r[2 * i], r[2 * i + 1]);
56 t = clock() - t;
57 best = std::min(best, double(t) / CLOCKS_PER_SEC);
58 gsl_histogram2d_free(h);
59 }
60 printf("gsl %.3f\n", best);
61}
62
63int main(int argc, char** argv) {
64 constexpr unsigned nfill = 6000000;

Callers 1

mainFunction · 0.70

Calls 1

random_arrayFunction · 0.70

Tested by

no test coverage detected