BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
ROOT::Math::GSLMinimizer1D Class Reference

Description

Minimizer for arbitrary one dimensional functions.

Implemented using GSL, for detailed description see: GSL online doc

The algorithms uspported are only bracketing algorithm which do not use derivatives information. The algorithms which can be chosen at construction time are GOLDENSECTION, whic is the simplest method but the slowest and BRENT (the default one) which combines the golden section with a parabolic interpolation.

This class does not support copying

Definition at line 81 of file GSLMinimizer1D.h.

Inheritance diagram for ROOT::Math::GSLMinimizer1D:
[legend]
Collaboration diagram for ROOT::Math::GSLMinimizer1D:
[legend]

Public Member Functions

 GSLMinimizer1D (Minim1D::Type type=Minim1D::kBRENT)
 
virtual ~GSLMinimizer1D ()
 
double FValLower () const
 
double FValMinimum () const
 
double FValUpper () const
 
int Iterate ()
 
int Iterations () const
 
bool Minimize (int maxIter, double absTol, double relTol)
 
const char * Name () const
 
template<class UserFunc >
void SetFunction (const UserFunc &f, double xmin, double xlow, double xup)
 
void SetFunction (GSLFuncPointer f, void *params, double xmin, double xlow, double xup)
 
int Status () const
 
double XLower () const
 
double XMinimum () const
 
double XUpper () const
 

Static Public Member Functions

static int TestInterval (double xlow, double xup, double epsAbs, double epsRel)
 

Private Member Functions

 GSLMinimizer1D (const GSLMinimizer1D &)
 
GSLMinimizer1Doperator= (const GSLMinimizer1D &)
 

Private Attributes

GSLFunctionWrapperfFunction
 
bool fIsSet
 
int fIter
 
double fLow
 
double fMin
 
GSL1DMinimizerWrapperfMinimizer
 
int fStatus
 
double fUp
 
double fXlow
 
double fXmin
 
double fXup
 

Constructor & Destructor Documentation

◆ GSLMinimizer1D() [1/2]

ROOT::Math::GSLMinimizer1D::GSLMinimizer1D ( Minim1D::Type  type = Minim1D::kBRENT)
explicit

Construct the minimizer passing the minimizer type using the Minim1D::Algorithm enumeration

◆ ~GSLMinimizer1D()

virtual ROOT::Math::GSLMinimizer1D::~GSLMinimizer1D ( )
virtual

Destructor: free allocated resources

◆ GSLMinimizer1D() [2/2]

ROOT::Math::GSLMinimizer1D::GSLMinimizer1D ( const GSLMinimizer1D )
private

Member Function Documentation

◆ FValLower()

double ROOT::Math::GSLMinimizer1D::FValLower ( ) const
virtual

Return function value at current lower bound of the minimization interval

Implements ROOT::Math::IMinimizer1D.

◆ FValMinimum()

double ROOT::Math::GSLMinimizer1D::FValMinimum ( ) const
virtual

Return function value at current estimate of the minimum

Implements ROOT::Math::IMinimizer1D.

◆ FValUpper()

double ROOT::Math::GSLMinimizer1D::FValUpper ( ) const
virtual

Return function value at current upper bound of the minimization interval

Implements ROOT::Math::IMinimizer1D.

◆ Iterate()

int ROOT::Math::GSLMinimizer1D::Iterate ( )

Perform a minimizer iteration and if an unexepcted problem occurr then an error code will be returned

◆ Iterations()

int ROOT::Math::GSLMinimizer1D::Iterations ( ) const
inlinevirtual

Return number of iteration used to find minimum

Implements ROOT::Math::IMinimizer1D.

Definition at line 174 of file GSLMinimizer1D.h.

174  {
175  return fIter;
176  }

References fIter.

◆ Minimize()

bool ROOT::Math::GSLMinimizer1D::Minimize ( int  maxIter,
double  absTol,
double  relTol 
)
virtual

Find minimum position iterating until convergence specified by the absolute and relative tolerance or the maximum number of iteration is reached Return true is result is successfull @param maxIter maximum number of iteration @param absTol desired absolute error in the minimum position @param absTol desired relative error in the minimum position

Implements ROOT::Math::IMinimizer1D.

◆ Name()

const char* ROOT::Math::GSLMinimizer1D::Name ( ) const
virtual

Return name of minimization algorithm

Implements ROOT::Math::IMinimizer1D.

◆ operator=()

GSLMinimizer1D& ROOT::Math::GSLMinimizer1D::operator= ( const GSLMinimizer1D )
private

◆ SetFunction() [1/2]

template<class UserFunc >
void ROOT::Math::GSLMinimizer1D::SetFunction ( const UserFunc &  f,
double  xmin,
double  xlow,
double  xup 
)
inline

Set, or reset, minimizer to use the function f and the initial search interval [xlow, xup], with a guess for the location of the minimum xmin. The condition : $ f(xlow) > f(xmin) < f(xup)$ must be satisfied

Definition at line 109 of file GSLMinimizer1D.h.

109  {
110  const void * p = &f;
111  SetFunction( &GSLFunctionAdapter<UserFunc>::F, const_cast<void *>(p), xmin, xlow, xup );
112  }
static double F(double x, void *p)
void SetFunction(const UserFunc &f, double xmin, double xlow, double xup)

◆ SetFunction() [2/2]

void ROOT::Math::GSLMinimizer1D::SetFunction ( GSLFuncPointer  f,
void *  params,
double  xmin,
double  xlow,
double  xup 
)

Set, or reset, minimizer to use the function f and the initial search interval [xlow, xup], with a guess for the location of the minimum xmin. The condition : $ f(xlow) > f(xmin) < f(xup) $ must be satisfied

Method specialized on the GSL function type

◆ Status()

int ROOT::Math::GSLMinimizer1D::Status ( ) const
inlinevirtual

Return status of last minimization

Implements ROOT::Math::IMinimizer1D.

Definition at line 181 of file GSLMinimizer1D.h.

181 { return fStatus; }

References fStatus.

◆ TestInterval()

static int ROOT::Math::GSLMinimizer1D::TestInterval ( double  xlow,
double  xup,
double  epsAbs,
double  epsRel 
)
static

Test convergence of the interval. The test returns success if

\[ |x_{min}-x_{truemin}| < epsAbs + epsRel *x_{truemin} \]

◆ XLower()

double ROOT::Math::GSLMinimizer1D::XLower ( ) const
virtual

Return current lower bound of the minimization interval

Implements ROOT::Math::IMinimizer1D.

◆ XMinimum()

double ROOT::Math::GSLMinimizer1D::XMinimum ( ) const
virtual

Return current estimate of the position of the minimum

Implements ROOT::Math::IMinimizer1D.

◆ XUpper()

double ROOT::Math::GSLMinimizer1D::XUpper ( ) const
virtual

Return current upper bound of the minimization interval

Implements ROOT::Math::IMinimizer1D.

Member Data Documentation

◆ fFunction

GSLFunctionWrapper* ROOT::Math::GSLMinimizer1D::fFunction
private

Definition at line 215 of file GSLMinimizer1D.h.

◆ fIsSet

bool ROOT::Math::GSLMinimizer1D::fIsSet
private

Definition at line 211 of file GSLMinimizer1D.h.

◆ fIter

int ROOT::Math::GSLMinimizer1D::fIter
private

Definition at line 209 of file GSLMinimizer1D.h.

Referenced by Iterations().

◆ fLow

double ROOT::Math::GSLMinimizer1D::fLow
private

Definition at line 207 of file GSLMinimizer1D.h.

◆ fMin

double ROOT::Math::GSLMinimizer1D::fMin
private

Definition at line 206 of file GSLMinimizer1D.h.

◆ fMinimizer

GSL1DMinimizerWrapper* ROOT::Math::GSLMinimizer1D::fMinimizer
private

Definition at line 214 of file GSLMinimizer1D.h.

◆ fStatus

int ROOT::Math::GSLMinimizer1D::fStatus
private

Definition at line 210 of file GSLMinimizer1D.h.

Referenced by Status().

◆ fUp

double ROOT::Math::GSLMinimizer1D::fUp
private

Definition at line 208 of file GSLMinimizer1D.h.

◆ fXlow

double ROOT::Math::GSLMinimizer1D::fXlow
private

Definition at line 204 of file GSLMinimizer1D.h.

◆ fXmin

double ROOT::Math::GSLMinimizer1D::fXmin
private

Definition at line 203 of file GSLMinimizer1D.h.

◆ fXup

double ROOT::Math::GSLMinimizer1D::fXup
private

Definition at line 205 of file GSLMinimizer1D.h.


The documentation for this class was generated from the following file: