Logo ROOT  
Reference Guide
ParametricFunction.cxx
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 
11 #include "Minuit2/MnFcn.h"
12 #include "Minuit2/MnStrategy.h"
17 
18 namespace ROOT {
19 
20 namespace Minuit2 {
21 
22 //#include "Minuit2/MnPrint.h"
23 
24 std::vector<double> ParametricFunction::GetGradient(const std::vector<double> &x) const
25 {
26  // calculate the numerical gradient (using Numerical2PGradientCalculator)
27 
28  // LM: this I believe is not very efficient
29  MnFcn mfcn(*this);
30 
31  MnStrategy strategy(1);
32 
33  // ????????? how does it know the transformation????????
34  std::vector<double> err(x.size());
35  err.assign(x.size(), 0.1);
36  // need to use parameters
37  MnUserParameterState st(x, err);
38 
39  Numerical2PGradientCalculator gc(mfcn, st.Trafo(), strategy);
40  FunctionGradient g = gc(x);
41  const MnAlgebraicVector &grad = g.Vec();
42  assert(grad.size() == x.size());
44  // std::cout << "Param Function Gradient " << grad << std::endl;
45  return vt(grad);
46 }
47 
48 } // namespace Minuit2
49 
50 } // namespace ROOT
ROOT::Minuit2::MnFcn
Wrapper class to FCNBase interface used internally by Minuit.
Definition: MnFcn.h:30
ROOT::Minuit2::LAVector
Definition: LAVector.h:32
ROOT::Minuit2::ParametricFunction::GetGradient
virtual std::vector< double > GetGradient(const std::vector< double > &x) const
Member function returning the Gradient of the function with respect to its variables (but without inc...
Definition: ParametricFunction.cxx:24
MnStrategy.h
MnUserParameterState.h
MnVectorTransform.h
x
Double_t x[n]
Definition: legend1.C:17
ROOT::Minuit2::FunctionGradient
Definition: FunctionGradient.h:21
MnFcn.h
ROOT::Minuit2::MnVectorTransform
Definition: MnVectorTransform.h:21
Numerical2PGradientCalculator.h
ROOT::Minuit2::Numerical2PGradientCalculator
class performing the numerical gradient calculation
Definition: Numerical2PGradientCalculator.h:32
FunctionGradient.h
ROOT::Minuit2::MnUserParameterState::Trafo
const MnUserTransformation & Trafo() const
Definition: MnUserParameterState.h:104
ROOT::Minuit2::LAVector::size
unsigned int size() const
Definition: LAVector.h:227
ROOT::Minuit2::MnUserParameterState
class which holds the external user and/or internal Minuit representation of the parameters and error...
Definition: MnUserParameterState.h:33
ROOT::Minuit2::MnStrategy
API class for defining three levels of strategies: low (0), medium (1), high (>=2); acts on: Migrad (...
Definition: MnStrategy.h:27
ParametricFunction.h
ROOT
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: EExecutionPolicy.hxx:4
g
#define g(i)
Definition: RSha256.hxx:105