10 bool continueLoop =
true;
11 unsigned int nbIterations = 0;
14 if (numParameters > 1)
15 throw itk::ExceptionObject(__FILE__, __LINE__,
"Dekker algorithm does not implement multi-dimensional optimization. Only one parameter allowed.");
25 p[0] = internalLowerBound;
32 p[0] = internalUpperBound;
36 if (std::abs(fValAtLowerBound) < std::abs(fValAtUpperBound))
38 double workValue = internalLowerBound;
39 internalLowerBound = internalUpperBound;
40 internalUpperBound = workValue;
41 workValue = fValAtLowerBound;
42 fValAtLowerBound = fValAtUpperBound;
43 fValAtUpperBound = workValue;
46 double previousUpperBound = internalLowerBound;
47 double previousFValAtUpperBound = fValAtLowerBound;
53 double fDiff = fValAtUpperBound - previousFValAtUpperBound;
56 p[0] = (internalLowerBound + internalUpperBound) / 2.0;
58 p[0] = internalUpperBound - (internalUpperBound - previousUpperBound) * fValAtUpperBound / fDiff;
60 previousUpperBound = internalUpperBound;
61 previousFValAtUpperBound = fValAtUpperBound;
63 internalUpperBound = p[0];
68 if (fValAtLowerBound * fValAtUpperBound > 0.0)
70 internalLowerBound = previousUpperBound;
71 fValAtLowerBound = previousFValAtUpperBound;
74 if (std::abs(fValAtLowerBound) < std::abs(fValAtUpperBound))
76 double workValue = internalLowerBound;
77 internalLowerBound = internalUpperBound;
78 internalUpperBound = workValue;
79 workValue = fValAtLowerBound;
80 fValAtLowerBound = fValAtUpperBound;
81 fValAtUpperBound = workValue;
85 (std::abs(internalUpperBound - internalLowerBound) < this->
GetRootRelativeTolerance() * (internalLowerBound + internalUpperBound) / 2.0))
double GetFunctionValueAtInitialLowerBound()
double Optimize() ITK_OVERRIDE
bool GetProvidedFunctionValueAtInitialLowerBound()
double GetRootRelativeTolerance()
bool GetProvidedFunctionValueAtInitialUpperBound()
unsigned int GetMaximumNumberOfIterations()
double GetCostFunctionTolerance()
BaseCostFunctionType::ParametersType ParametersType
double GetFunctionValueAtInitialUpperBound()
BaseCostFunctionType * GetRootFindingFunction()