60 template < GUM_Numeric GUM_SCALAR >
65 template < GUM_Numeric GUM_SCALAR >
71 template < GUM_Numeric GUM_SCALAR >
76 template < GUM_Numeric GUM_SCALAR >
81 template < GUM_Numeric GUM_SCALAR >
86 template < GUM_Numeric GUM_SCALAR >
93 std::vector< Idx > cum(maxVal, 0);
98 Idx half = (this->nbrDim() + 1) / 2;
101 for (
Idx j = 0, sumcum = 0; j < maxVal; j++)
102 if ((sumcum += cum[j]) >= half) {
107 for (
Idx j = maxVal - 1, jj = 0, sumcum = 0; jj < maxVal; jj++, j--)
108 if ((sumcum += cum[j]) >= half) {
114 return (maxR + max) / 2;
117 template < GUM_Numeric GUM_SCALAR >
121 bool& stop_iteration)
const {
125 template < GUM_Numeric GUM_SCALAR >
Base class for discrete random variable.
virtual Size domainSize() const =0
Class for assigning/browsing values to tuples of discrete variables.
Idx val(Idx i) const
Returns the current value of the variable at position i.
const DiscreteVariable & variable(Idx i) const final
Returns the variable at position i in the tuple.
Idx nbrDim() const final
Returns the number of variables in the Instantiation.
Idx nbrDim() const override
Size Idx
Type for indexes.
Aggregators are functional description of CPTs.
gum is the global namespace for all aGrUM entities