Logo ROOT  
Reference Guide
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};
57
58} // namespace Minuit2
59
60} // namespace ROOT
61
62#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 > Gradient(const std::vector< double > &) const =0
virtual std::vector< double > GradientWithPrevResult(const std::vector< double > &parameters, double *, double *, double *) const
virtual GradientParameterSpace gradParameterSpace() const
virtual bool CheckGradient() const
GradientParameterSpace
Extension of the FCNBase for providing the analytical Gradient of the function.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.