Logo ROOT   6.13/01
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 
25 
26 std::vector<double> ParametricFunction::GetGradient(const std::vector<double>& x) const {
27  // calculate the numerical gradient (using Numerical2PGradientCalculator)
28 
29  //LM: this I believe is not very efficient
30  MnFcn mfcn(*this);
31 
32  MnStrategy strategy(1);
33 
34  // ????????? how does it know the transformation????????
35  std::vector<double> err(x.size());
36  err.assign(x.size(), 0.1);
37  // need to use parameters
38  MnUserParameterState st(x, err);
39 
40  Numerical2PGradientCalculator gc(mfcn, st.Trafo(), strategy);
41  FunctionGradient g = gc(x);
42  const MnAlgebraicVector & grad = g.Vec();
43  assert( grad.size() == x.size() );
45  // std::cout << "Param Function Gradient " << grad << std::endl;
46  return vt( grad );
47 }
48 
49  } // namespace Minuit2
50 
51 } // namespace ROOT
Namespace for new ROOT classes and functions.
Definition: TFoamSampler.h:19
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...
class performing the numerical gradient calculation
Wrapper class to FCNBase interface used internally by Minuit.
Definition: MnFcn.h:33
const MnUserTransformation & Trafo() const
class which holds the external user and/or internal Minuit representation of the parameters and error...
unsigned int size() const
Definition: LAVector.h:198
* x
Deprecated and error prone model selection interface.
Definition: TRolke.cxx:630
API class for defining three levels of strategies: low (0), medium (1), high (>=2); acts on: Migrad (...
Definition: MnStrategy.h:27