56 for (
const auto& a: params)
87 _gamma_ = std::move(from._gamma_);
97 if (size == 0)
return res;
100 for (
Idx i = 0; i < size; ++i) {
101 _gamma_.param(std::gamma_distribution< float >::param_type(
_params_[i], 1));
106 for (
Idx i = 0; i < size; ++i) {
116 if (size == 0)
return res;
118 while (sum == 0.0f) {
119 for (
Idx i = 0; i < size; ++i) {
120 _gamma_.param(std::gamma_distribution< float >::param_type(parm[i], 1));
125 for (
Idx i = 0; i < size; ++i) {
136 for (
const auto& a: parm)
A class for sampling w.r.t.
~Dirichlet()
Class destructor.
Dirichlet & operator=(const Dirichlet &from)
Copy operator.
result_type operator()()
Returns a sample from the Dirichlet distribution.
std::gamma_distribution< float > _gamma_
The gamma distribution used to compute the Dirichlet unnormalized samples.
std::vector< float > param_type
The parameter type.
float max() const noexcept
Returns the lowest higher bound of the range of values returned by gum::Dirichlet::operator()().
Dirichlet(const param_type ¶ms)
Default constructor.
param_type _params_
The parameters of the distribution.
const param_type & param() const noexcept
Returns the parameters of the distribution.
std::vector< float > result_type
The type for the samples generated.
float min() const noexcept
Returns the greatest lower bound of the range of values returned by gum::Dirichlet::operator()().
Exception : out of bound.
#define GUM_ERROR(type, msg)
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size Idx
Type for indexes.
std::mt19937 & randomGenerator()
define a random_engine with correct seed
gum is the global namespace for all aGrUM entities