mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-24 16:20:49 +01:00
[apps/probability] Fix bug in authorized parameters
Change-Id: I53cccb0995af7b4a6b066218185f35e96d4ae835
This commit is contained in:
@@ -68,14 +68,14 @@ float BinomialLaw::yMax() {
|
||||
}
|
||||
|
||||
|
||||
bool BinomialLaw::authorizedValueAtIndex(double x, int index) const {
|
||||
bool BinomialLaw::authorizedValueAtIndex(float x, int index) const {
|
||||
if (index == 0) {
|
||||
if (x != (int)x || x < 0.0 || x > 999.0) {
|
||||
if (x != (int)x || x < 0.0f || x > 999.0f) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (x < 0.0 || x > 1.0) {
|
||||
if (x < 0.0f || x > 1.0f) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
float evaluateAtAbscissa(float x) const override {
|
||||
return templatedEvaluateAtAbscissa(x);
|
||||
}
|
||||
bool authorizedValueAtIndex(double x, int index) const override;
|
||||
bool authorizedValueAtIndex(float x, int index) const override;
|
||||
double cumulativeDistributiveInverseForProbability(double * probability) override;
|
||||
double rightIntegralInverseForProbability(double * probability) override;
|
||||
protected:
|
||||
|
||||
@@ -69,8 +69,8 @@ float ExponentialLaw::evaluateAtAbscissa(float x) const {
|
||||
return m_parameter1*std::exp(-m_parameter1*x);
|
||||
}
|
||||
|
||||
bool ExponentialLaw::authorizedValueAtIndex(double x, int index) const {
|
||||
if (x <= 0.0 || x > 7500.0) {
|
||||
bool ExponentialLaw::authorizedValueAtIndex(float x, int index) const {
|
||||
if (x <= 0.0f || x > 7500.0f) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
I18n::Message parameterNameAtIndex(int index) override;
|
||||
I18n::Message parameterDefinitionAtIndex(int index) override;
|
||||
float evaluateAtAbscissa(float x) const override;
|
||||
bool authorizedValueAtIndex(double x, int index) const override;
|
||||
bool authorizedValueAtIndex(float x, int index) const override;
|
||||
double cumulativeDistributiveFunctionAtAbscissa(double x) const override;
|
||||
double cumulativeDistributiveInverseForProbability(double * probability) override;
|
||||
};
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
virtual I18n::Message parameterDefinitionAtIndex(int index) = 0;
|
||||
virtual void setParameterAtIndex(float f, int index) = 0;
|
||||
virtual float evaluateAtAbscissa(float x) const = 0;
|
||||
virtual bool authorizedValueAtIndex(double x, int index) const = 0;
|
||||
virtual bool authorizedValueAtIndex(float x, int index) const = 0;
|
||||
virtual double cumulativeDistributiveFunctionAtAbscissa(double x) const;
|
||||
double rightIntegralFromAbscissa(double x) const;
|
||||
double finiteIntegralBetweenAbscissas(double a, double b) const;
|
||||
|
||||
@@ -75,7 +75,7 @@ float NormalLaw::evaluateAtAbscissa(float x) const {
|
||||
return (1.0f/(std::fabs(m_parameter2)*std::sqrt(2.0f*M_PI)))*std::exp(-0.5f*std::pow((x-m_parameter1)/m_parameter2,2));
|
||||
}
|
||||
|
||||
bool NormalLaw::authorizedValueAtIndex(double x, int index) const {
|
||||
bool NormalLaw::authorizedValueAtIndex(float x, int index) const {
|
||||
if (index == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
I18n::Message parameterNameAtIndex(int index) override;
|
||||
I18n::Message parameterDefinitionAtIndex(int index) override;
|
||||
float evaluateAtAbscissa(float x) const override;
|
||||
bool authorizedValueAtIndex(double x, int index) const override;
|
||||
bool authorizedValueAtIndex(float x, int index) const override;
|
||||
void setParameterAtIndex(float f, int index) override;
|
||||
double cumulativeDistributiveFunctionAtAbscissa(double x) const override;
|
||||
double cumulativeDistributiveInverseForProbability(double * probability) override;
|
||||
|
||||
@@ -63,8 +63,8 @@ float PoissonLaw::evaluateAtAbscissa(float x) const {
|
||||
return std::exp(lResult);
|
||||
}
|
||||
|
||||
bool PoissonLaw::authorizedValueAtIndex(double x, int index) const {
|
||||
if (x <= 0.0 || x > 999.0) {
|
||||
bool PoissonLaw::authorizedValueAtIndex(float x, int index) const {
|
||||
if (x <= 0.0f || x > 999.0f) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
I18n::Message parameterNameAtIndex(int index) override;
|
||||
I18n::Message parameterDefinitionAtIndex(int index) override;
|
||||
float evaluateAtAbscissa(float x) const override;
|
||||
bool authorizedValueAtIndex(double x, int index) const override;
|
||||
bool authorizedValueAtIndex(float x, int index) const override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ float UniformLaw::evaluateAtAbscissa(float t) const {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
bool UniformLaw::authorizedValueAtIndex(double x, int index) const {
|
||||
bool UniformLaw::authorizedValueAtIndex(float x, int index) const {
|
||||
if (index == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
I18n::Message parameterNameAtIndex(int index) override;
|
||||
I18n::Message parameterDefinitionAtIndex(int index) override;
|
||||
float evaluateAtAbscissa(float x) const override;
|
||||
bool authorizedValueAtIndex(double x, int index) const override;
|
||||
bool authorizedValueAtIndex(float x, int index) const override;
|
||||
void setParameterAtIndex(float f, int index) override;
|
||||
double cumulativeDistributiveFunctionAtAbscissa(double x) const override;
|
||||
double cumulativeDistributiveInverseForProbability(double * probability) override;
|
||||
|
||||
Reference in New Issue
Block a user