Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
FCNGradientBase.h
Go to the documentation of this file.
1// @(#)root/minuit2:$Id$
2// Authors: M. Winkler, F. James, L. Moneta, A. Zsenei, E.G.P. Bos 2003-2017
3
4/**********************************************************************
5 * *
6 * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT *
7 * *
8 **********************************************************************/
9
10#ifndef ROOT_Minuit2_FCNGradientBase
11#define ROOT_Minuit2_FCNGradientBase
12
13#include "Minuit2/FCNBase.h"
14
15#include <vector>
16
17namespace ROOT {
18
19namespace Minuit2 {
20
21//________________________________________________________________________
22/** Extension of the FCNBase for providing the analytical Gradient of the
23 function. The user-Gradient is checked at the beginning of the
24 minimization against the Minuit internal numerical Gradient in order to
25 spot problems in the analytical Gradient calculation. This can be turned
26 off by overriding CheckGradient() to make it return "false".
27 The size of the output Gradient vector must be equal to the size of the
28 input Parameter vector.
29 Minuit does a check of the user Gradient at the beginning, if this is not
30 wanted the method "CheckGradient()" has to be overridden to return
31 "false".
32 */
33
36};
37
38class FCNGradientBase : public FCNBase {
39
40public:
41 ~FCNGradientBase() override {}
42
43 virtual std::vector<double> Gradient(const std::vector<double> &) const = 0;
44 virtual std::vector<double> GradientWithPrevResult(const std::vector<double> &parameters, double * /*previous_grad*/,
45 double * /*previous_g2*/, double * /*previous_gstep*/) const
46 {
47 return Gradient(parameters);
48 };
49
50 virtual bool CheckGradient() const { return true; }
51
54 };
55
56 /// return second derivatives (diagonal of the Hessian matrix)
57 virtual std::vector<double> G2(const std::vector<double> &) const { return std::vector<double>();}
58
59 /// return Hessian
60 virtual std::vector<double> Hessian(const std::vector<double> &) const { return std::vector<double>();}
61
62 virtual bool HasHessian() const { return false; }
63
64 virtual bool HasG2() const { return false; }
65
66
67};
68
69} // namespace Minuit2
70
71} // namespace ROOT
72
73#endif // ROOT_Minuit2_FCNGradientBase
Interface (abstract class) defining the function to be minimized, which has to be implemented by the ...
Definition FCNBase.h:45
virtual std::vector< double > G2(const std::vector< double > &) const
return second derivatives (diagonal of the Hessian matrix)
virtual std::vector< double > Gradient(const std::vector< double > &) const =0
virtual std::vector< double > GradientWithPrevResult(const std::vector< double > &parameters, double *, double *, double *) const
virtual std::vector< double > Hessian(const std::vector< double > &) const
return Hessian
virtual GradientParameterSpace gradParameterSpace() const
virtual bool HasHessian() const
virtual bool CheckGradient() const
GradientParameterSpace
Extension of the FCNBase for providing the analytical Gradient of the function.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...