42 #include "../NumConstants.h"
43 #include "../VectorTools.h"
64 for (
unsigned int i = 0; i <
dim_; i++)
66 vProb_.push_back(probas[i]);
73 for (
unsigned int i = 0; i <
dim_ - 1; i++)
80 for (
unsigned int i = 0; i <
dim_ - 1; i++)
84 for (
unsigned int i = 0; i <
dim_ - 1; i++)
90 for (
size_t i = 1; i <
dim_; i++)
100 double i1 = 0, i0 = 0;
102 size_t pi = i & ~(1 << (li2 - 1));
105 size_t t = (j << li2) + pi;
110 t += (1 << (li2 - 1));
121 Simplex::Simplex(
size_t dim,
unsigned short method,
bool allowNull,
const std::string& name) :
131 for (
size_t i = 0; i <
dim_; i++)
133 vProb_.push_back(1. /
static_cast<double>(
dim_));
142 for (
unsigned int i = 0; i <
dim_ - 1; i++)
149 for (
unsigned int i = 0; i <
dim_ - 1; i++)
153 for (
unsigned int i = 0; i <
dim_ - 1; i++)
159 for (
unsigned int i = 0; i <
dim_ - 1; i++)
179 for (
unsigned int i = 0; i <
dim_ - 1; i++)
188 for (
unsigned int i = 0; i <
dim_ - 1; i++)
196 for (
unsigned int i = 0; i <
dim_ - 1; i++)
211 vp = 1.0 / double(
dim_);
223 for (
size_t i = 0; i <
dim_; i++)
234 if ((k + (1 << (ld - 1))) <
dim_)
261 for (
unsigned int i = 0; i <
dim_ - 1; i++)
268 for (
unsigned int i = 0; i <
dim_ - 1; i++)
271 valpha_[i] = probas[i + 1] / probas[i];
275 for (
size_t i = 1; i <
dim_; i++)
285 double i1 = 0, i0 = 0;
287 size_t pi = i & ~(1 << (li2 - 1));
290 size_t t = (j << li2) + pi;
295 t += (1 << (li2 - 1));
A partial implementation of the Parametrizable interface.
void addParameter_(Parameter *parameter)
std::string getNamespace() const
double getParameterValue(const std::string &name) const
Get the value for parameter of name 'name'.
bool matchParametersValues(const ParameterList ¶meters)
Update the parameters from parameters.
Exception base class. Overload exception constructor (to control the exceptions mechanism)....
The parameter list object.
virtual void addParameter(const Parameter ¶m)
Add a new parameter at the end of the list.
This class is designed to facilitate the manipulation of parameters.
static const std::shared_ptr< IntervalConstraint > PROP_CONSTRAINT_IN
static const std::shared_ptr< IntervalConstraint > PROP_CONSTRAINT_EX
unsigned short method_
the method of parametrization.
void fireParameterChanged(const ParameterList ¶meters)
Notify the class when one or several parameters have changed.
std::vector< double > vProb_
size_t dim_
The dimension+1 of the space simplex (ie the number of probabilities).
std::vector< double > valpha_
just used with local ratio (method 2)
void setFrequencies(const std::vector< double > &)
Simplex(size_t dim, unsigned short method=0, bool allowNull=false, const std::string &name="Simplex.")
Builds a new Simplex object from a number of probabilities. They are initialized equal.
std::string toString(T t)
General template method to convert to a string.