aGrUM  0.16.0
median.h
Go to the documentation of this file.
1 
30 #ifndef GUM_MEDIAN_AGGREGATOR_H
31 #define GUM_MEDIAN_AGGREGATOR_H
32 
34 
35 namespace gum {
36 
37  namespace aggregator {
38  // =========================================================================
39  // === GUM_MEDIAN_AGGREGATOR ===
40  // =========================================================================
41 
59  template < typename GUM_SCALAR >
60  class Median : public MultiDimAggregator< GUM_SCALAR > {
61  public:
62  Median();
63  Median(const Median< GUM_SCALAR >& from);
64  virtual ~Median();
65 
66  virtual std::string aggregatorName() const;
67 
86 
87  protected:
88  virtual Idx _buildValue(const gum::Instantiation& i) const;
89 
90  // fold scheme is not used, these methods are neutralized
91  virtual Idx _neutralElt() const { return 0; };
92  virtual Idx _fold(const DiscreteVariable& v,
93  Idx i1,
94  Idx i2,
95  bool& stop_iteration) const;
96 
97  private:
99  };
100 
101 
102 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
103  extern template class Median< double >;
104 #endif
105 
106 
107  } // namespace aggregator
108 } // namespace gum
109 
111 
112 #endif // GUM_MEDIAN_AGGREGATOR_H
virtual MultiDimContainer< GUM_SCALAR > * newFactory() const
This method creates a clone of this object, withouth its content (including variable), you must use this method if you want to ensure that the generated object has the same type than the object containing the called newFactory()
Definition: median_tpl.h:66
Base class for discrete random variable.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
Abstract base class for all multi dimensionnal containers.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
<agrum/multidim/aggregators/multiDimAggregator.h>
virtual std::string aggregatorName() const
Definition: median_tpl.h:58
virtual Idx _fold(const DiscreteVariable &v, Idx i1, Idx i2, bool &stop_iteration) const
_fold is applied on value i1 for variable v. the actual result for precedent applications is i2...
Definition: median_tpl.h:103
virtual Idx _neutralElt() const
_neutralElt() is the result value for the first application of _fold
Definition: median.h:91
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Class for assigning/browsing values to tuples of discrete variables.
Definition: instantiation.h:83
virtual Idx _buildValue(const gum::Instantiation &i) const
by default, _buildValue uses a "fold" scheme and the user has to implement _neutralElt and _fold but ...
Definition: median_tpl.h:71
Size Idx
Type for indexes.
Definition: types.h:53
median aggregator
Definition: median.h:60