MCPcopy Create free account
hub / github.com/davisking/dlib / main

Function main

examples/running_stats_ex.cpp:26–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26int main()
27{
28 running_stats<double> rs;
29
30 double tp1 = 0;
31 double tp2 = 0;
32
33 // We first generate the data and add it sequentially to our running_stats object. We
34 // then print every fifth data point.
35 for (int x = 1; x <= 100; x++)
36 {
37 tp1 = x/100.0;
38 tp2 = sinc(pi*x/100.0);
39 rs.add(tp2);
40
41 if(x % 5 == 0)
42 {
43 cout << " x = " << tp1 << " sinc(x) = " << tp2 << endl;
44 }
45 }
46
47 // Finally, we compute and print the mean, variance, skewness, and excess kurtosis of
48 // our data.
49
50 cout << endl;
51 cout << "Mean: " << rs.mean() << endl;
52 cout << "Variance: " << rs.variance() << endl;
53 cout << "Skewness: " << rs.skewness() << endl;
54 cout << "Excess Kurtosis " << rs.ex_kurtosis() << endl;
55
56 return 0;
57}
58

Callers

nothing calls this directly

Calls 6

skewnessMethod · 0.80
ex_kurtosisMethod · 0.80
sincFunction · 0.70
addMethod · 0.45
meanMethod · 0.45
varianceMethod · 0.45

Tested by

no test coverage detected