```// @(#)root/mathcore:\$Id: BrentMinimizer1D.h 31583 2009-12-06 13:55:26Z rdm \$
// Author: David Gonzalez Maline 2/2008
/**********************************************************************
*                                                                    *
* Copyright (c) 2004 Maline,  CERN/PH-SFT                            *
*                                                                    *
* This library is free software; you can redistribute it and/or      *
* modify it under the terms of the GNU General Public License        *
* as published by the Free Software Foundation; either version 2     *
* of the License, or (at your option) any later version.             *
*                                                                    *
* This library is distributed in the hope that it will be useful,    *
* but WITHOUT ANY WARRANTY; without even the implied warranty of     *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   *
* General Public License for more details.                           *
*                                                                    *
* You should have received a copy of the GNU General Public License  *
* along with this library (see file COPYING); if not, write          *
* to the Free Software Foundation, Inc., 59 Temple Place, Suite      *
* 330, Boston, MA 02111-1307 USA, or contact the author.             *
*                                                                    *
**********************************************************************/

// Header file for class BrentMinimizer1D
//
// Created by: Maline  at Mon Feb  4 09:32:36 2008
//
//

#include "Math/IMinimizer1D.h"
#include "Math/IFunction.h"

#ifndef ROOT_Math_BrentMinimizer1D
#define ROOT_Math_BrentMinimizer1D

namespace ROOT {
namespace Math {

//___________________________________________________________________________________________
/**
User class for performing function minimization

It will use the Brent Method for function minimization in a given interval.
This class is implemented from TF1::GetMinimum.

To use the class, three steps have to be taken:
1. Create the class.
2. Set a function within an interval to look for the minimum.
3. Call the Minimize function with the error parameters.

If another minimization is to be performed, repeat the last two steps.

@ingroup Min1D

*/

class BrentMinimizer1D: IMinimizer1D {

public:

/** Default Constructor. */
BrentMinimizer1D();

/** Default Destructor. */
virtual ~BrentMinimizer1D();

public:

/** Return current estimate of the position of the minimum. */
virtual double XMinimum() const;

/** Return current lower bound of the minimization interval. */
virtual double XLower() const;

/** Return current upper bound of the minimization interval. */
virtual double XUpper() const;

/** Return function value at current estimate of the minimum. */
virtual double FValMinimum() const;

/** Return function value at current lower bound of the minimization interval. */
virtual double FValLower() const;

/** Return function value at current upper bound of the minimization interval. */
virtual double FValUpper() const;

/** Find minimum position iterating until convergence specified by the absolute and relative tolerance or
the maximum number of iteration is reached.

\@param maxIter maximum number of iterations.
\@param absTol desired absolute error in the minimum position.
\@param absTol desired relative error in the minimum position.
*/
virtual int Minimize( int maxIter, double absTol, double relTol);

/** Return number of iteration used to find minimum */
virtual int Iterations() const;

/** Return name of minimization algorithm ("BrentMinimizer1D") */
virtual const char * Name() const;

/** Sets function to be minimized.

\@param f Function to be minimized.
\@param xlow Lower bound of the search interval.
\@param xup Upper bound of the search interval.
*/
int SetFunction(const ROOT::Math::IGenFunction& f, double xlow, double xup);

protected:
const IGenFunction* fFunction; // Pointer to the function.
double fXMin;                  // Lower bound of the search interval.
double fXMax;                  // Upper bound of the search interval
double fXMinimum;              // Position of the stimated minimum.
int fNIter;                    // Number of iterations needed for the last stimation.

};  // end class BrentMinimizer1D

} // end namespace Math

} // end namespace ROOT

#endif /* ROOT_Math_BrentMinimizer1D */
```
BrentMinimizer1D.h:1
BrentMinimizer1D.h:2
BrentMinimizer1D.h:3
BrentMinimizer1D.h:4
BrentMinimizer1D.h:5
BrentMinimizer1D.h:6
BrentMinimizer1D.h:7
BrentMinimizer1D.h:8
BrentMinimizer1D.h:9
BrentMinimizer1D.h:10
BrentMinimizer1D.h:11
BrentMinimizer1D.h:12
BrentMinimizer1D.h:13
BrentMinimizer1D.h:14
BrentMinimizer1D.h:15
BrentMinimizer1D.h:16
BrentMinimizer1D.h:17
BrentMinimizer1D.h:18
BrentMinimizer1D.h:19
BrentMinimizer1D.h:20
BrentMinimizer1D.h:21
BrentMinimizer1D.h:22
BrentMinimizer1D.h:23
BrentMinimizer1D.h:24
BrentMinimizer1D.h:25
BrentMinimizer1D.h:26
BrentMinimizer1D.h:27
BrentMinimizer1D.h:28
BrentMinimizer1D.h:29
BrentMinimizer1D.h:30
BrentMinimizer1D.h:31
BrentMinimizer1D.h:32
BrentMinimizer1D.h:33
BrentMinimizer1D.h:34
BrentMinimizer1D.h:35
BrentMinimizer1D.h:36
BrentMinimizer1D.h:37
BrentMinimizer1D.h:38
BrentMinimizer1D.h:39
BrentMinimizer1D.h:40
BrentMinimizer1D.h:41
BrentMinimizer1D.h:42
BrentMinimizer1D.h:43
BrentMinimizer1D.h:44
BrentMinimizer1D.h:45
BrentMinimizer1D.h:46
BrentMinimizer1D.h:47
BrentMinimizer1D.h:48
BrentMinimizer1D.h:49
BrentMinimizer1D.h:50
BrentMinimizer1D.h:51
BrentMinimizer1D.h:52
BrentMinimizer1D.h:53
BrentMinimizer1D.h:54
BrentMinimizer1D.h:55
BrentMinimizer1D.h:56
BrentMinimizer1D.h:57
BrentMinimizer1D.h:58
BrentMinimizer1D.h:59
BrentMinimizer1D.h:60
BrentMinimizer1D.h:61
BrentMinimizer1D.h:62
BrentMinimizer1D.h:63
BrentMinimizer1D.h:64
BrentMinimizer1D.h:65
BrentMinimizer1D.h:66
BrentMinimizer1D.h:67
BrentMinimizer1D.h:68
BrentMinimizer1D.h:69
BrentMinimizer1D.h:70
BrentMinimizer1D.h:71
BrentMinimizer1D.h:72
BrentMinimizer1D.h:73
BrentMinimizer1D.h:74
BrentMinimizer1D.h:75
BrentMinimizer1D.h:76
BrentMinimizer1D.h:77
BrentMinimizer1D.h:78
BrentMinimizer1D.h:79
BrentMinimizer1D.h:80
BrentMinimizer1D.h:81
BrentMinimizer1D.h:82
BrentMinimizer1D.h:83
BrentMinimizer1D.h:84
BrentMinimizer1D.h:85
BrentMinimizer1D.h:86
BrentMinimizer1D.h:87
BrentMinimizer1D.h:88
BrentMinimizer1D.h:89
BrentMinimizer1D.h:90
BrentMinimizer1D.h:91
BrentMinimizer1D.h:92
BrentMinimizer1D.h:93
BrentMinimizer1D.h:94
BrentMinimizer1D.h:95
BrentMinimizer1D.h:96
BrentMinimizer1D.h:97
BrentMinimizer1D.h:98
BrentMinimizer1D.h:99
BrentMinimizer1D.h:100
BrentMinimizer1D.h:101
BrentMinimizer1D.h:102
BrentMinimizer1D.h:103
BrentMinimizer1D.h:104
BrentMinimizer1D.h:105
BrentMinimizer1D.h:106
BrentMinimizer1D.h:107
BrentMinimizer1D.h:108
BrentMinimizer1D.h:109
BrentMinimizer1D.h:110
BrentMinimizer1D.h:111
BrentMinimizer1D.h:112
BrentMinimizer1D.h:113
BrentMinimizer1D.h:114
BrentMinimizer1D.h:115
BrentMinimizer1D.h:116
BrentMinimizer1D.h:117
BrentMinimizer1D.h:118
BrentMinimizer1D.h:119
BrentMinimizer1D.h:120
BrentMinimizer1D.h:121
BrentMinimizer1D.h:122
BrentMinimizer1D.h:123
BrentMinimizer1D.h:124