MCPcopy Create free account
hub / github.com/PX4/eigen / check_histogram

Function check_histogram

test/rand.cpp:40–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40template<typename Scalar> void check_histogram(Scalar x, Scalar y, int bins)
41{
42 Array<int,1,Dynamic> hist(bins);
43 hist.fill(0);
44 int f = 100000;
45 int n = bins*f;
46 int64 range = int64(y)-int64(x);
47 int divisor = int((range+1)/bins);
48 assert(((range+1)%bins)==0);
49 for(int k=0; k<n; ++k)
50 {
51 Scalar r = check_in_range(x,y);
52 hist( int((int64(r)-int64(x))/divisor) )++;
53 }
54 VERIFY( (((hist.cast<double>()/double(f))-1.0).abs()<0.02).all() );
55}
56
57void test_rand()
58{

Callers

nothing calls this directly

Calls 4

check_in_rangeFunction · 0.85
fillMethod · 0.80
absMethod · 0.80
allMethod · 0.45

Tested by

no test coverage detected