32 #include "DGtal/base/Common.h"
33 #include "ConfigTest.h"
34 #include "DGtalCatch.h"
35 #include "DGtal/helpers/StdDefs.h"
36 #include "DGtal/math/MultiStatistics.h"
40 using namespace DGtal;
46 TEST_CASE(
"Testing MultiStatistics" )
49 for(
unsigned int i = 0; i< 100; i++)
51 for(
unsigned int j = 0; j<= i; j++)
58 SECTION(
"Testing multiStatics estimated quantities without saving the data")
60 unsigned int val = 50;
61 REQUIRE( stats.max(val) == val );
62 REQUIRE( stats.min(val) == 0 );
63 REQUIRE( stats.mean(val) == val/2.0 );
65 REQUIRE( stats.max(val) == val );
66 REQUIRE( stats.min(val) == 0 );
67 REQUIRE( stats.mean(val) == val/2.0 );
71 for(
unsigned int i = 0; i< 100; i++)
73 for(
unsigned int j = 0; j<= i; j++)
75 stats2.addValue(i, j);
80 SECTION(
"Testing multiStatics estimated quantities with saving the data")
82 unsigned int val = 12;
83 REQUIRE( stats2.max(val) == val );
84 REQUIRE( stats2.min(val) == 0 );
85 REQUIRE( stats2.mean(val) == val/2.0 );
86 REQUIRE( stats2.median(val) == ((val+1)/2) );
88 REQUIRE( stats2.max(val) == val );
89 REQUIRE( stats2.min(val) == 0 );
90 REQUIRE( stats2.mean(val) == val/2.0 );
91 REQUIRE( stats2.median(val) == ((val+1)/2) );
96 for(
unsigned int i = 0; i< 100; i++)
98 std::vector<double> vectValues;
99 for(
unsigned int j = 0; j<= i; j++)
101 vectValues.push_back(j);
103 stats3.addValues(i, vectValues.begin(), vectValues.end());
107 SECTION(
"Testing feature math of MultiStatistics with saving data")
109 unsigned int val = 12;
110 REQUIRE( stats3.max(val) == val );
111 REQUIRE( stats3.min(val) == 0 );
112 REQUIRE( stats3.mean(val) == val/2.0 );
113 REQUIRE( stats3.median(val) == ((val+1)/2) );
115 REQUIRE( stats3.max(val) == val );
116 REQUIRE( stats3.min(val) == 0 );
117 REQUIRE( stats3.mean(val) == val/2.0 );
118 REQUIRE( stats3.median(val) == ((val+1)/2) );
Aim: This class stores a set of sample values for several variables and can then compute different st...
DGtal is the top-level namespace which contains all DGtal functions and types.