Bayeux  3.4.1
Core Foundation library for SuperNEMO
mean.h
Go to the documentation of this file.
1 /* Author(s): Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2009-10-02
4  * Last modified: 2013-04-23
5  *
6  * License:
7  *
8  * Description:
9  *
10  * A collection of algorithm to compute the mean of
11  * a list of numbers
12  *
13  */
14 
15 #ifndef MYGSL_MEAN_H
16 #define MYGSL_MEAN_H 1
17 
18 // Standard library:
19 #include <cstdlib>
20 
21 // Third party:
22 // - Boost:
23 #include <boost/cstdint.hpp>
24 
25 namespace mygsl {
26 
29  {
30  public:
31  bool is_valid () const;
32  size_t get_n () const;
33  double get_sum () const;
34  double get_sum_of_squared () const;
35  double get_mean () const;
36  double get_mean_of_squared () const;
37  double get_variance (bool bessel_correction_ = false) const;
38  arithmetic_mean ();
39  void reset ();
40  void add (double value_);
41  void remove (double value_);
42  private:
43  uint32_t _n_;
44  double _sum_;
45  double _sum_of_squared_;
46  };
47 
50  {
51  public:
52  bool is_valid () const;
53  double get_weight () const;
54  double get_weighted_sum () const;
55  double get_mean () const;
56  weighted_mean ();
57  void reset ();
58  void add (double value_, double weight_);
59  private:
60  double _weight_;
61  double _weighted_sum_;
62  };
63 
64 } // end of namespace mygsl
65 
66 #endif // MYGSL_MEAN_H
67 
68 /* Local Variables: */
69 /* mode: c++ */
70 /* coding: utf-8 */
71 /* End: */
double get_mean() const
double get_mean() const
void add(double value_)
Arithmetic mean computing algorithm.
Definition: mean.h:28
double get_sum_of_squared() const
void add(double value_, double weight_)
Weighted mean computing algorithm.
Definition: mean.h:49
double get_mean_of_squared() const
void remove(double value_)
double get_weight() const
Top-level namespace of the Bayeux/mygsl module library.
Definition: base_decay_driver.h:47
double get_variance(bool bessel_correction_=false) const
bool is_valid() const
double get_sum() const
double get_weighted_sum() const
size_t get_n() const