42 #include "../Random/RandomTools.h" 43 #include "../NumConstants.h" 44 #include "../../Text/TextTools.h" 59 if (vn.size() <= 0 || vn.size() != valpha.size() - 1)
62 for (
size_t j = 0; j < valpha.size(); j++)
67 for (
size_t j = 0; j < vn.size(); j++)
73 for (
size_t j = 0; j < vn.size(); j++)
83 for (
unsigned int i = 0; i <
vpBDD_.size(); i++)
103 for (
unsigned int j = 0; j <
vpBDD_.size() + 1; j++)
122 for (
unsigned int j = 0; j <
vpBDD_.size(); j++)
125 for (
unsigned int i = j + 1; i < valpha.size(); i++)
133 vpBDD_[j]->matchParametersValues(pL);
144 for (
size_t j = 0; j <
vpBDD_.size(); j++)
146 n *=
vpBDD_[j]->getNumberOfCategories();
156 if (value.size() !=
vpBDD_.size() + 1)
157 throw Exception(
"Bad Vdouble parameter in DirichletDiscreteDistribution::getValueCategory");
162 for (
size_t j = 0; j <
vpBDD_.size(); j++)
167 y =
vpBDD_[j]->getValueCategory(value[j] / (1 - sumc)) * (1 - sumc);
171 vd.push_back(1 - sumc);
179 if (category.size() !=
vpBDD_.size() + 1)
180 throw Exception(
"Bad Vdouble parameter in DirichletDiscreteDistribution::getProbability");
185 for (
unsigned int j = 0; j <
vpBDD_.size(); j++)
187 p *=
vpBDD_[j]->getProbability(category[j] / (1 - sumc));
201 vdj =
vpBDD_[0]->getCategories();
202 for (
unsigned int k = 0; k < vdj.size(); k++)
204 vd.push_back(vdj[k]);
209 for (
unsigned int j = 1; j <
vpBDD_.size(); j++)
211 vdj =
vpBDD_[j]->getCategories();
213 for (
unsigned int i = 0; i < vvd1.size(); i++)
217 for (
unsigned int k = 0; k < vd.size(); k++)
221 for (
unsigned int k = 0; k < vdj.size(); k++)
223 vd.push_back(vdj[k] * (1 - sumc));
232 for (
unsigned int i = 0; i < vvd1.size(); i++)
236 for (
unsigned int k = 0; k < vd.size(); k++)
240 vd.push_back(1 - sumc);
253 for (
unsigned int j = 0; j <
vpBDD_.size(); j++)
255 x =
vpBDD_[j]->rand() * (1 - sumc);
260 vd.push_back(1 - sumc);
270 for (
unsigned int j = 0; j <
vpBDD_.size(); j++)
272 x =
vpBDD_[j]->randC() * (1 - sumc);
277 vd.push_back(1 - sumc);
~DirichletDiscreteDistribution()
void fireParameterChanged(const ParameterList ¶meters)
Notify the class when one or several parameters have changed.
An interval, either bounded or not, which can also have infinite bounds.
This class allows to perform a correspondence analysis.
Vdouble rand() const
Draw a random vector from this distribution.
This class is designed to facilitate the manipulation of parameters.
void addParameter_(Parameter *parameter)
Discretized Beta distribution with parameters alpha and beta, on a given interval. On default, the interval is , but it can be restricted.
static double VERY_TINY()
virtual void setParameterValue(const std::string &name, double value)
Set the value of parameter with name name to be equal to value.
static std::string toString(T t)
General template method to convert to a string.
The parameter list object.
Vdouble getValueCategory(Vdouble &Vvalue) const
VVdouble getCategories() const
A partial implementation of the Parametrizable interface.
std::vector< double > Vdouble
DirichletDiscreteDistribution(std::vector< size_t > vn, Vdouble valpha)
Build a new discretized Dirichlet distribution.
virtual double getProbability(Vdouble &category) const
void fireParameterChanged(const ParameterList ¶meters)
Notify the class when one or several parameters have changed.
virtual void addParameter(const Parameter ¶m)
Add a new parameter at the end of the list.
Vdouble randC() const
Draw a random vector from the continuous version of this distribution.
std::vector< BetaDiscreteDistribution *> vpBDD_
std::vector< Vdouble > VVdouble
void discretize(Vdouble &valpha)
double getParameterValue(const std::string &name) const
Get the value for parameter of name 'name'.
size_t getNumberOfCategories() const