Logo ROOT  
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 
23 operator()(const MnFcn &fcn, const GradientCalculator &, const MnUserParameterState &st, const MnStrategy &stra) const
24 {
25  // create starting state for Simplex, which corresponds to the initial parameter values
26  // using the simple Initial gradient calculator (does not use any FCN function calls)
27  unsigned int n = st.VariableParameters();
28  const MnMachinePrecision &prec = st.Precision();
29 
30  // initial starting values
32  for (unsigned int i = 0; i < n; i++)
33  x(i) = st.IntParameters()[i];
34  double fcnmin = fcn(x);
35  MinimumParameters pa(x, fcnmin);
36  InitialGradientCalculator igc(fcn, st.Trafo(), stra);
37  FunctionGradient dgrad = igc(pa);
39  double dcovar = 1.;
40  for (unsigned int i = 0; i < n; i++)
41  mat(i, i) = (std::fabs(dgrad.G2()(i)) > prec.Eps2() ? 1. / dgrad.G2()(i) : 1.);
42  MinimumError err(mat, dcovar);
43  double edm = VariableMetricEDMEstimator().Estimate(dgrad, err);
44  MinimumState state(pa, err, dgrad, edm, fcn.NumOfCalls());
45 
46  return MinimumSeed(state, st.Trafo());
47 }
48 
50  const MnUserParameterState &st, const MnStrategy &stra) const
51 {
52  // base class interface
53  return (*this)(fcn, (const GradientCalculator &)(gc), st, stra);
54 }
55 
56 } // namespace Minuit2
57 
58 } // namespace ROOT
ROOT::Minuit2::MnMachinePrecision::Eps2
double Eps2() const
eps2 returns 2*sqrt(eps)
Definition: MnMachinePrecision.h:41
n
const Int_t n
Definition: legend1.C:16
ROOT::Minuit2::MnFcn
Wrapper class to FCNBase interface used internally by Minuit.
Definition: MnFcn.h:30
SimplexSeedGenerator.h
ROOT::Minuit2::MnFcn::NumOfCalls
unsigned int NumOfCalls() const
Definition: MnFcn.h:39
VariableMetricEDMEstimator.h
ROOT::Minuit2::MinimumState
MinimumState keeps the information (position, Gradient, 2nd deriv, etc) after one minimization step (...
Definition: MinimumState.h:29
ROOT::Minuit2::LAVector
Definition: LAVector.h:32
MnStrategy.h
ROOT::Minuit2::LASymMatrix
Class describing a symmetric matrix of size n.
Definition: LASymMatrix.h:45
MinimumSeed.h
ROOT::Minuit2::VariableMetricEDMEstimator
Definition: VariableMetricEDMEstimator.h:20
MnUserParameterState.h
x
Double_t x[n]
Definition: legend1.C:17
ROOT::Minuit2::InitialGradientCalculator
Class to calculate an initial estimate of the gradient.
Definition: InitialGradientCalculator.h:27
ROOT::Minuit2::FunctionGradient
Definition: FunctionGradient.h:21
ROOT::Minuit2::MnUserParameterState::VariableParameters
unsigned int VariableParameters() const
Definition: MnUserParameterState.cxx:506
MnFcn.h
ROOT::Minuit2::FunctionGradient::G2
const MnAlgebraicVector & G2() const
Definition: FunctionGradient.h:45
ROOT::Math::fabs
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
Definition: UnaryOperators.h:131
ROOT::Minuit2::MinimumParameters
Definition: MinimumParameters.h:21
ROOT::Minuit2::MnUserParameterState::IntParameters
const std::vector< double > & IntParameters() const
Definition: MnUserParameterState.h:97
ROOT::Minuit2::MnUserParameterState::Trafo
const MnUserTransformation & Trafo() const
Definition: MnUserParameterState.h:104
ROOT::Minuit2::MnUserParameterState::Precision
const MnMachinePrecision & Precision() const
Definition: MnUserParameterState.cxx:511
ROOT::Minuit2::MnMachinePrecision
Sets the relative floating point (double) arithmetic precision.
Definition: MnMachinePrecision.h:32
ROOT::Minuit2::VariableMetricEDMEstimator::Estimate
double Estimate(const FunctionGradient &, const MinimumError &) const
Definition: VariableMetricEDMEstimator.cxx:20
ROOT::Minuit2::SimplexSeedGenerator::operator()
virtual MinimumSeed operator()(const MnFcn &, const GradientCalculator &, const MnUserParameterState &, const MnStrategy &) const
Definition: SimplexSeedGenerator.cxx:23
ROOT::Minuit2::AnalyticalGradientCalculator
Definition: AnalyticalGradientCalculator.h:22
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::MinimumError
MinimumError keeps the inv.
Definition: MinimumError.h:26
ROOT::Minuit2::MnStrategy
API class for defining three levels of strategies: low (0), medium (1), high (>=2); acts on: Migrad (...
Definition: MnStrategy.h:27
InitialGradientCalculator.h
ROOT::Minuit2::GradientCalculator
interface class for gradient calculators
Definition: GradientCalculator.h:23
ROOT
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: EExecutionPolicy.hxx:4
ROOT::Minuit2::MinimumSeed
MinimumSeed contains the starting values for the minimization produced by the SeedGenerator.
Definition: MinimumSeed.h:31