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

Function compare_1d

test/speed_gsl.cpp:30–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30void compare_1d(unsigned n, int distrib) {
31 auto r = random_array(n, distrib);
32
33 double best = std::numeric_limits<double>::max();
34 for (unsigned k = 0; k < 20; ++k) {
35 gsl_histogram* h = gsl_histogram_alloc(100);
36 gsl_histogram_set_ranges_uniform(h, 0, 1);
37 auto t = clock();
38 for (unsigned i = 0; i < n; ++i) gsl_histogram_increment(h, r[i]);
39 t = clock() - t;
40 best = std::min(best, double(t) / CLOCKS_PER_SEC);
41 gsl_histogram_free(h);
42 }
43 printf("gsl %.3f\n", best);
44}
45
46void compare_2d(unsigned n, int distrib) {
47 auto r = random_array(n, distrib);

Callers 1

mainFunction · 0.70

Calls 1

random_arrayFunction · 0.70

Tested by

no test coverage detected