54 const std::string& aDesc,
55 const std::vector< double >&
domain) :
59 for (
const auto value:
domain) {
73 const std::string& aDesc,
92 const double step = (last - first) / (
double(nb) - 1);
93 const double mask = std::pow(10, std::max(4,
int(2 + std::abs(-std::log10(step)))));
94 double current = first;
97 for (
Idx i = 1; i < nb - 1; i++) {
99 _domain_.push_back((std::round(current * mask) / mask));
117 for (
Idx i = 1; i < size; ++i)
Exception base for argument error.
Exception : default in label.
DiscreteVariable(const std::string &aName, const std::string &aDesc)
Default constructor.
Size domainSize() const final
returns the domain size of the discrete random variable
std::string domain() const final
Returns the domain as a string.
bool isValue(double value) const
does this value exist in the domain ?
NumericalDiscreteVariable(const std::string &aName, const std::string &aDesc="")
constructor
std::vector< double > _domain_
the domain of the variable
const std::string & name() const
returns the name of the variable
#define GUM_ERROR(type, msg)
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size Idx
Type for indexes.
gum is the global namespace for all aGrUM entities
Base class for numerical discrete random variables.
Base class for NumericalDiscrete discrete random variables.