[apps/probability] Correct error: confusion between left and right

integrals

Change-Id: Ic1fe49701ec37fffb2bd09f83b2e65a50a03e2a6
This commit is contained in:
Émilie Feral
2016-12-29 11:38:49 +01:00
parent 3888802fa0
commit 30d9a1e227
4 changed files with 18 additions and 18 deletions

View File

@@ -6,7 +6,7 @@ namespace Probability {
LeftIntegralCalculation::LeftIntegralCalculation() :
Calculation(),
m_lowerBound(0.0f),
m_upperBound(0.0f),
m_result(0.0f)
{
compute(0);
@@ -27,7 +27,7 @@ const char * LeftIntegralCalculation::legendForParameterAtIndex(int index) {
void LeftIntegralCalculation::setParameterAtIndex(float f, int index) {
assert(index >= 0 && index < 2);
if (index == 0) {
m_lowerBound = f;
m_upperBound = f;
}
if (index == 1) {
m_result = f;
@@ -39,13 +39,13 @@ void LeftIntegralCalculation::setParameterAtIndex(float f, int index) {
float LeftIntegralCalculation::parameterAtIndex(int index) {
assert(index >= 0 && index < 2);
if (index == 0) {
return m_lowerBound;
return m_upperBound;
}
return m_result;
}
float LeftIntegralCalculation::lowerBound() {
return m_lowerBound;
float LeftIntegralCalculation::upperBound() {
return m_upperBound;
}
void LeftIntegralCalculation::compute(int indexKnownElement) {
@@ -53,9 +53,9 @@ void LeftIntegralCalculation::compute(int indexKnownElement) {
return;
}
if (indexKnownElement == 0) {
m_result = m_law->cumulativeDistributiveFunctionAtAbscissa(m_lowerBound);
m_result = m_law->cumulativeDistributiveFunctionAtAbscissa(m_upperBound);
} else {
m_lowerBound = m_law->cumulativeDistributiveInverseForProbability(&m_result);
m_upperBound = m_law->cumulativeDistributiveInverseForProbability(&m_result);
}
}

View File

@@ -13,10 +13,10 @@ public:
const char * legendForParameterAtIndex(int index) override;
void setParameterAtIndex(float f, int index) override;
float parameterAtIndex(int index) override;
float lowerBound() override;
float upperBound() override;
private:
void compute(int indexKnownElement) override;
float m_lowerBound;
float m_upperBound;
float m_result;
};

View File

@@ -6,7 +6,7 @@ namespace Probability {
RightIntegralCalculation::RightIntegralCalculation() :
Calculation(),
m_upperBound(0.0f),
m_lowerBound(0.0f),
m_result(0.0f)
{
compute(0);
@@ -27,7 +27,7 @@ const char * RightIntegralCalculation::legendForParameterAtIndex(int index) {
void RightIntegralCalculation::setParameterAtIndex(float f, int index) {
assert(index >= 0 && index < 2);
if (index == 0) {
m_upperBound = f;
m_lowerBound = f;
}
if (index == 1) {
m_result = f;
@@ -39,13 +39,13 @@ void RightIntegralCalculation::setParameterAtIndex(float f, int index) {
float RightIntegralCalculation::parameterAtIndex(int index) {
assert(index >= 0 && index < 2);
if (index == 0) {
return m_upperBound;
return m_lowerBound;
}
return m_result;
}
float RightIntegralCalculation::upperBound() {
return m_upperBound;
float RightIntegralCalculation::lowerBound() {
return m_lowerBound;
}
void RightIntegralCalculation::compute(int indexKnownElement) {
@@ -53,9 +53,9 @@ void RightIntegralCalculation::compute(int indexKnownElement) {
return;
}
if (indexKnownElement == 0) {
m_result = m_law->rightIntegralFromAbscissa(m_upperBound);
m_result = m_law->rightIntegralFromAbscissa(m_lowerBound);
} else {
m_upperBound = m_law->rightIntegralInverseForProbability(&m_result);
m_lowerBound = m_law->rightIntegralInverseForProbability(&m_result);
}
}

View File

@@ -13,10 +13,10 @@ public:
const char * legendForParameterAtIndex(int index) override;
void setParameterAtIndex(float f, int index) override;
float parameterAtIndex(int index) override;
float upperBound() override;
float lowerBound() override;
private:
void compute(int indexKnownElement) override;
float m_upperBound;
float m_lowerBound;
float m_result;
};