ANIMA
4.0
src
Anima
math-tools
optimizers
animaBoostBisectionRootFindingAlgorithm.cxx
Go to the documentation of this file.
1
#include <
animaBoostBisectionRootFindingAlgorithm.h
>
2
#include <boost/math/tools/roots.hpp>
3
4
namespace
anima
5
{
6
7
double
BoostBisectionRootFindingAlgorithm::Optimize
()
8
{
9
unsigned
int
numParameters = this->
GetRootFindingFunction
()->GetNumberOfParameters();
10
if
(numParameters > 1)
11
throw
itk::ExceptionObject(__FILE__, __LINE__,
"Boost bisection algorithm does not implement multi-dimensional optimization. Only one parameter allowed."
);
12
13
RootFindingFunctionBoostBridge
boostFunction;
14
boostFunction.
SetRootFindingFunction
(this->
GetRootFindingFunction
());
15
16
boost::uintmax_t maximumNumberOfIterations = this->
GetMaximumNumberOfIterations
();
17
18
RootToleranceBoostBridge
rootTolerance;
19
rootTolerance.
SetRootRelativeTolerance
(this->
GetRootRelativeTolerance
());
20
21
std::pair <double,double> r = boost::math::tools::bisect(boostFunction, this->
GetLowerBound
(), this->
GetUpperBound
(), rootTolerance, maximumNumberOfIterations);
22
23
return
(r.first + r.second) / 2.0;
24
}
25
26
}
// end namespace anima
anima::BaseRootFindingAlgorithm::GetLowerBound
double GetLowerBound()
Definition:
animaBaseRootFindingAlgorithm.h:67
anima::RootFindingFunctionBoostBridge::SetRootFindingFunction
void SetRootFindingFunction(BaseCostFunctionType *f)
Definition:
animaBaseRootFindingAlgorithm.h:35
anima::BaseRootFindingAlgorithm::GetRootRelativeTolerance
double GetRootRelativeTolerance()
Definition:
animaBaseRootFindingAlgorithm.h:70
anima::RootToleranceBoostBridge
Definition:
animaBaseRootFindingAlgorithm.h:11
anima::BaseRootFindingAlgorithm::GetUpperBound
double GetUpperBound()
Definition:
animaBaseRootFindingAlgorithm.h:68
anima::RootToleranceBoostBridge::SetRootRelativeTolerance
void SetRootRelativeTolerance(const double &tol)
Definition:
animaBaseRootFindingAlgorithm.h:19
anima::BaseRootFindingAlgorithm::GetMaximumNumberOfIterations
unsigned int GetMaximumNumberOfIterations()
Definition:
animaBaseRootFindingAlgorithm.h:69
animaBoostBisectionRootFindingAlgorithm.h
anima::BoostBisectionRootFindingAlgorithm::Optimize
double Optimize() ITK_OVERRIDE
Definition:
animaBoostBisectionRootFindingAlgorithm.cxx:7
anima
Definition:
animaDTIEstimationImageFilter.h:7
anima::BaseRootFindingAlgorithm::GetRootFindingFunction
BaseCostFunctionType * GetRootFindingFunction()
Definition:
animaBaseRootFindingAlgorithm.h:72
anima::RootFindingFunctionBoostBridge
Definition:
animaBaseRootFindingAlgorithm.h:26
Generated by
1.8.13