Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
MnHesse.h
Go to the documentation of this file.
1// @(#)root/minuit2:$Id$
2// Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005
3
4/**********************************************************************
5 * *
6 * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT *
7 * *
8 **********************************************************************/
9
10#ifndef ROOT_Minuit2_MnHesse
11#define ROOT_Minuit2_MnHesse
12
13#include "Minuit2/MnConfig.h"
14#include "Minuit2/MnStrategy.h"
15
16#include <vector>
17
18namespace ROOT {
19
20namespace Minuit2 {
21
22class FCNBase;
23class MnUserParameterState;
24class MnUserParameters;
25class MnUserCovariance;
26class MnUserTransformation;
27class MinimumState;
28class MnMachinePrecision;
29class MnFcn;
30class FunctionMinimum;
31class FCNGradientBase;
32
33//_______________________________________________________________________
34/**
35 API class for calculating the numerical covariance matrix
36 (== 2x Inverse Hessian == 2x Inverse 2nd derivative); can be used by the
37 user or Minuit itself
38 */
39
40class MnHesse {
41
42public:
43 /// default constructor with default strategy
45
46 /// constructor with user-defined strategy level
47 MnHesse(unsigned int stra) : fStrategy(MnStrategy(stra)) {}
48
49 /// conctructor with specific strategy
50 MnHesse(const MnStrategy &stra) : fStrategy(stra) {}
51
53
54 ///
55 /// low-level API
56 ///
57 /// FCN + parameters + errors
58 MnUserParameterState operator()(const FCNBase &, const std::vector<double> &, const std::vector<double> &,
59 unsigned int maxcalls = 0) const;
60 /// FCN + parameters + covariance
61 MnUserParameterState operator()(const FCNBase &, const std::vector<double> &, unsigned int nrow,
62 const std::vector<double> &, unsigned int maxcalls = 0) const;
63 /// FCN + parameters + MnUserCovariance
65 operator()(const FCNBase &, const std::vector<double> &, const MnUserCovariance &, unsigned int maxcalls = 0) const;
66 ///
67 /// high-level API
68 ///
69 /// FCN + MnUserParameters
70 MnUserParameterState operator()(const FCNBase &, const MnUserParameters &, unsigned int maxcalls = 0) const;
71 /// FCN + MnUserParameters + MnUserCovariance
73 operator()(const FCNBase &, const MnUserParameters &, const MnUserCovariance &, unsigned int maxcalls = 0) const;
74 /// FCN + MnUserParameterState
75 MnUserParameterState operator()(const FCNBase &, const MnUserParameterState &, unsigned int maxcalls = 0) const;
76 ///
77 /// API to use MnHesse after minimization when function minimum is avalilable, otherwise information on the last
78 /// state will be lost. (It would be needed to re-call the gradient and spend extra useless function calls) The
79 /// Function Minimum is updated (modified) by adding the Hesse results as last state of minimization
80 ///
81 void operator()(const FCNBase &, FunctionMinimum &, unsigned int maxcalls = 0) const;
82
83 /// internal interface
84 ///
86 operator()(const MnFcn &, const MinimumState &, const MnUserTransformation &, unsigned int maxcalls = 0) const;
87
88 /// forward interface of MnStrategy
89 unsigned int Ncycles() const { return fStrategy.HessianNCycles(); }
90 double Tolerstp() const { return fStrategy.HessianStepTolerance(); }
91 double TolerG2() const { return fStrategy.HessianG2Tolerance(); }
92
93private:
94
95 /// internal function to compute the Hessian using numerical derivative computation
96 MinimumState ComputeNumerical(const MnFcn &, const MinimumState &, const MnUserTransformation &, unsigned int maxcalls) const;
97
98 /// internal function to compute the Hessian using an analytical computation or externally provided in the FCNGradientBase class
100
102};
103
104} // namespace Minuit2
105
106} // namespace ROOT
107
108#endif // ROOT_Minuit2_MnHesse
Interface (abstract class) defining the function to be minimized, which has to be implemented by the ...
Definition FCNBase.h:45
class holding the full result of the minimization; both internal and external (MnUserParameterState) ...
MinimumState keeps the information (position, Gradient, 2nd deriv, etc) after one minimization step (...
Wrapper class to FCNBase interface used internally by Minuit.
Definition MnFcn.h:30
API class for calculating the numerical covariance matrix (== 2x Inverse Hessian == 2x Inverse 2nd de...
Definition MnHesse.h:40
MnHesse(const MnStrategy &stra)
conctructor with specific strategy
Definition MnHesse.h:50
MnHesse()
default constructor with default strategy
Definition MnHesse.h:44
double Tolerstp() const
Definition MnHesse.h:90
unsigned int Ncycles() const
forward interface of MnStrategy
Definition MnHesse.h:89
MnUserParameterState operator()(const FCNBase &, const std::vector< double > &, const std::vector< double > &, unsigned int maxcalls=0) const
low-level API
Definition MnHesse.cxx:31
MinimumState ComputeNumerical(const MnFcn &, const MinimumState &, const MnUserTransformation &, unsigned int maxcalls) const
internal function to compute the Hessian using numerical derivative computation
Definition MnHesse.cxx:188
MnStrategy fStrategy
Definition MnHesse.h:101
MnHesse(unsigned int stra)
constructor with user-defined strategy level
Definition MnHesse.h:47
MinimumState ComputeAnalytical(const FCNGradientBase &, const MinimumState &, const MnUserTransformation &) const
internal function to compute the Hessian using an analytical computation or externally provided in th...
Definition MnHesse.cxx:117
double TolerG2() const
Definition MnHesse.h:91
API class for defining four levels of strategies: low (0), medium (1), high (2), very high (>=3); act...
Definition MnStrategy.h:27
double HessianG2Tolerance() const
Definition MnStrategy.h:46
double HessianStepTolerance() const
Definition MnStrategy.h:45
unsigned int HessianNCycles() const
Definition MnStrategy.h:44
Class containing the covariance matrix data represented as a vector of size n*(n+1)/2 Used to hide in...
class which holds the external user and/or internal Minuit representation of the parameters and error...
API class for the user interaction with the parameters; serves as input to the minimizer as well as o...
class dealing with the transformation between user specified parameters (external) and internal param...
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...