#include "WireCellUtil/ExecMon.h"
#include "WireCellUtil/Waveform.h"
#include <random>
#include <iostream>
Go to the source code of this file.
Definition at line 9 of file test_median.cxx.
12 std::random_device rd;
13 std::default_random_engine re(rd());
14 std::uniform_real_distribution<> dist(0, 1000);
16 em(
"generate randoms");
18 const int nmaxbins = 10000;
19 std::vector<float>
data(nmaxbins);
20 for(
int ind=0; ind<nmaxbins; ++ind) {
24 const int ntimes = 10000;
25 em(
"start scaling tests");
26 int sizes[] = {100, 1000, 10000, 0};
28 for (
int ind=0; sizes[ind]; ++ind) {
29 auto size = sizes[ind];
30 std::vector<float> chunk(
data.begin(),
data.begin()+
size);
33 float med1 =
median(chunk);
34 cerr << ind <<
": median of " <<
size <<
" = " << med1 <<
endl;
38 cerr << em(
"end medium (many times)") <<
endl;
41 em(
"start median_binned");
43 cerr << ind <<
": median_binned of " <<
size <<
" = " << med2 <<
endl;
47 cerr << em(
"end medium_binned (many times)") <<
endl;
48 cerr <<
"Median difference: " << med1-med2 <<
endl;
50 em(
"done with chunked test");
53 cerr << em.summary() <<
endl;
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
cet::LibraryManager dummy("noplugin")
double median(sqlite3 *db, std::string const &table_name, std::string const &column_name)
QTextStream & endl(QTextStream &s)