Bayeux  3.4.1
Core Foundation library for SuperNEMO
min_max.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: 2014-11-18
5  *
6  * Description:
7  *
8  * An algorithm that computes the min and max values from
9  * a list of numbers.
10  *
11  */
12 
13 #ifndef MYGSL_MIN_MAX_H
14 #define MYGSL_MIN_MAX_H 1
15 
16 
17 // Third Party:
18 // - Bayeux/datatools
19 #include <datatools/i_tree_dump.h>
20 
21 namespace mygsl {
22 
25  {
26  public:
27 
29  bool is_valid() const;
30 
32  double get_min() const;
33 
35  double get_max() const;
36 
38  double get_median() const;
39 
41  double get_width() const;
42 
44  double get_half_width() const;
45 
47  int get_min_index() const;
48 
50  int get_max_index() const;
51 
53  int get_counter() const;
54 
56  min_max();
57 
59  void reset();
60 
62  void add(double value_);
63 
65  virtual void tree_dump(std::ostream & out_ = std::clog,
66  const std::string & title_ = "",
67  const std::string & indent_ = "",
68  bool inherit_ = false) const;
69 
70  private:
71 
72  int _counter_;
73  double _min_;
74  int _min_index_;
75  double _max_;
76  int _max_index_;
77 
78  };
79 
80 } // end of namespace mygsl
81 
82 #endif // MYGSL_MIN_MAX_H
83 
84 /* Local Variables: */
85 /* mode: c++ */
86 /* coding: utf-8 */
87 /* End: */
double get_min() const
Return the minimum value.
int get_min_index() const
Return the index of the minimum value.
An interface with utilities for printable objects.
Definition: i_tree_dump.h:36
Record the min and max values from a set of values.
Definition: min_max.h:24
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart printing.
double get_width() const
Return the width value.
double get_max() const
Return the maximum value.
Top-level namespace of the Bayeux/mygsl module library.
Definition: base_decay_driver.h:47
void add(double value_)
Add a value.
double get_median() const
Return the median value.
double get_half_width() const
Return the half width value.
int get_max_index() const
Return the index of the maximum value.
void reset()
Reset.
int get_counter() const
Return the value counter.
bool is_valid() const
Check validity.
min_max()
Default constructor.