Logo ROOT   6.14/05
Reference Guide
SimplexSeedGenerator.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 
12 #include "Minuit2/MnFcn.h"
13 #include "Minuit2/MinimumSeed.h"
14 #include "Minuit2/MnStrategy.h"
17 
18 namespace ROOT {
19 
20  namespace Minuit2 {
21 
22 
24  // create starting state for Simplex, which corresponds to the initial parameter values
25  // using the simple Initial gradient calculator (does not use any FCN function calls)
26  unsigned int n = st.VariableParameters();
27  const MnMachinePrecision& prec = st.Precision();
28 
29  // initial starting values
31  for(unsigned int i = 0; i < n; i++) x(i) = st.IntParameters()[i];
32  double fcnmin = fcn(x);
33  MinimumParameters pa(x, fcnmin);
34  InitialGradientCalculator igc(fcn, st.Trafo(), stra);
35  FunctionGradient dgrad = igc(pa);
36  MnAlgebraicSymMatrix mat(n);
37  double dcovar = 1.;
38  for(unsigned int i = 0; i < n; i++)
39  mat(i,i) = (fabs(dgrad.G2()(i)) > prec.Eps2() ? 1./dgrad.G2()(i) : 1.);
40  MinimumError err(mat, dcovar);
41  double edm = VariableMetricEDMEstimator().Estimate(dgrad, err);
42  MinimumState state(pa, err, dgrad, edm, fcn.NumOfCalls());
43 
44  return MinimumSeed(state, st.Trafo());
45 }
46 
48  // base class interface
49  return (*this)(fcn, (const GradientCalculator&)(gc), st, stra);
50 }
51 
52  } // namespace Minuit2
53 
54 } // namespace ROOT
double Estimate(const FunctionGradient &, const MinimumError &) const
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
MinimumSeed contains the starting values for the minimization produced by the SeedGenerator.
Definition: MinimumSeed.h:31
Class describing a symmetric matrix of size n.
Definition: LASymMatrix.h:51
const std::vector< double > & IntParameters() const
determines the relative floating point arithmetic precision.
unsigned int NumOfCalls() const
Definition: MnFcn.h:43
Double_t x[n]
Definition: legend1.C:17
const MnMachinePrecision & Precision() const
Wrapper class to FCNBase interface used internally by Minuit.
Definition: MnFcn.h:33
const MnUserTransformation & Trafo() const
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
class which holds the external user and/or internal Minuit representation of the parameters and error...
Class to calculate an initial estimate of the gradient.
double Eps2() const
eps2 returns 2*sqrt(eps)
MinimumError keeps the inv.
Definition: MinimumError.h:26
MinimumState keeps the information (position, Gradient, 2nd deriv, etc) after one minimization step (...
Definition: MinimumState.h:29
API class for defining three levels of strategies: low (0), medium (1), high (>=2); acts on: Migrad (...
Definition: MnStrategy.h:27
const Int_t n
Definition: legend1.C:16
interface class for gradient calculators
virtual MinimumSeed operator()(const MnFcn &, const GradientCalculator &, const MnUserParameterState &, const MnStrategy &) const