cgv
statistics.h
1 #pragma once
2 
3 #include <iostream>
4 #include <cmath>
5 
6 #include "lib_begin.h"
7 
8 namespace cgv {
9  namespace utils {
10 
12 class CGV_API statistics
13 {
14 public:
16  statistics();
18  statistics(const double& v);
20  statistics(const double& v, unsigned int n);
22  void init();
24  void init(const double& v);
26  void init(const double& v, unsigned int n);
28  void update(const double& v);
30  void update(const double& v, unsigned int n);
32  double get_average() const;
34  double get_standard_deviation() const;
36  double get_sum() const;
38  double get_sum_of_squares() const;
40  double get_min() const;
42  double get_max() const;
44  unsigned int get_count() const;
45 protected:
46  double min, max, sum, sms;
47  unsigned int cnt;
48 };
49 
50 
51 extern CGV_API std::ostream& operator << (std::ostream& os, const statistics& s);
52 
53  }
54 }
55 
56 #include <cgv/config/lib_end.h>
cgv::utils::statistics
Definition: statistics.h:13
cgv
the cgv namespace
Definition: vr_calib.cxx:9