aGrUM  0.16.0
Dirichlet.h
Go to the documentation of this file.
1 
29 #ifndef GUM_LEARNING_DIRICHLET_H
30 #define GUM_LEARNING_DIRICHLET_H
31 
32 #include <random>
33 #include <vector>
34 
35 #include <agrum/agrum.h>
37 
38 namespace gum {
39 
40  // =========================================================================
41  // === DIRICHLET CLASS ===
42  // =========================================================================
43 
50  class Dirichlet {
51  public:
53  using param_type = std::vector< float >;
54 
56  using result_type = std::vector< float >;
57 
58  // ==========================================================================
60  // ==========================================================================
62 
68  Dirichlet(const param_type& params, unsigned int seed = GUM_RANDOMSEED);
69 
74  Dirichlet(const Dirichlet& from);
75 
80  Dirichlet(Dirichlet&& from);
81 
85  ~Dirichlet();
86 
88  // ==========================================================================
90  // ==========================================================================
92 
98  Dirichlet& operator=(const Dirichlet& from);
99 
105  Dirichlet& operator=(Dirichlet&& from);
106 
112 
119 
129  template < class URNG >
130  result_type operator()(URNG& generator, const param_type& p);
131 
133  // ==========================================================================
135  // ==========================================================================
137 
142  const param_type& param() const noexcept;
143 
149  void param(const param_type& p);
150 
157  float min() const noexcept;
158 
165  float max() const noexcept;
166 
168 
169  private:
171  std::default_random_engine __generator;
172 
175  std::gamma_distribution< float > __gamma;
176 
179  };
180 
181 } /* namespace gum */
182 
183 // include the inlined functions if necessary
184 #ifndef GUM_NO_INLINE
186 #endif /* GUM_NO_INLINE */
187 
188 // always include templates
190 
191 #endif /* GUM_LEARNING_DIRICHLET_H */
A class for sampling w.r.t.
Definition: Dirichlet.h:50
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
STL namespace.
const param_type & param() const noexcept
Returns the parameters of the distribution.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
Dirichlet(const param_type &params, unsigned int seed=GUM_RANDOMSEED)
Default constructor.
Definition: Dirichlet_inl.h:32
float min() const noexcept
Returns the greatest lower bound of the range of values returned by gum::Dirichlet::operator()().
std::gamma_distribution< float > __gamma
The gamma distribution used to compute the Dirichlet unnormalized samples.
Definition: Dirichlet.h:175
std::vector< float > param_type
The parameter type.
Definition: Dirichlet.h:53
std::vector< float > result_type
The type for the samples generated.
Definition: Dirichlet.h:56
std::default_random_engine __generator
The random engine used by the unform random distribution.
Definition: Dirichlet.h:171
float max() const noexcept
Returns the lowest higher bound of the range of values returned by gum::Dirichlet::operator()().
~Dirichlet()
Class destructor.
Definition: Dirichlet_inl.h:52
result_type operator()()
Returns a sample from the Dirichlet distribution.
Definition: Dirichlet_inl.h:75
param_type __params
The parameters of the distribution.
Definition: Dirichlet.h:178
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Dirichlet & operator=(const Dirichlet &from)
Copy operator.
Definition: Dirichlet_inl.h:55