Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
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
18namespace ROOT {
19
20namespace Minuit2 {
21
23operator()(const MnFcn &fcn, const GradientCalculator &, const MnUserParameterState &st, const MnStrategy &) 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 double fcnmin = MnFcnCaller{fcn}(x);
33 MinimumParameters pa(x, fcnmin);
36 double dcovar = 1.;
37 for (unsigned int i = 0; i < n; i++)
38 mat(i, i) = (std::fabs(dgrad.G2()(i)) > prec.Eps2() ? 1. / dgrad.G2()(i) : 1.);
39 MinimumError err(mat, dcovar);
40 double edm = VariableMetricEDMEstimator().Estimate(dgrad, err);
41 MinimumState state(pa, err, dgrad, edm, fcn.NumOfCalls());
42
43 return MinimumSeed(state, st.Trafo());
44}
45
46} // namespace Minuit2
47
48} // namespace ROOT
Double_t err
const MnAlgebraicVector & G2() const
interface class for gradient calculators
MinimumError keeps the inv.
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:34
double ErrorDef() const
Definition MnFcn.h:45
unsigned int NumOfCalls() const
Definition MnFcn.h:43
Sets the relative floating point (double) arithmetic precision.
double Eps2() const
eps2 returns 2*sqrt(eps)
API class for defining four levels of strategies: low (0), medium (1), high (2), very high (>=3); act...
Definition MnStrategy.h:27
class which holds the external user and/or internal Minuit representation of the parameters and error...
const MnMachinePrecision & Precision() const
const std::vector< double > & IntParameters() const
const MnUserTransformation & Trafo() const
MinimumSeed operator()(const MnFcn &, const GradientCalculator &, const MnUserParameterState &, const MnStrategy &) const override
double Estimate(const FunctionGradient &, const MinimumError &) const
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
LAVector MnAlgebraicVector
Definition MnMatrixfwd.h:22
FunctionGradient calculateInitialGradient(const MinimumParameters &, const MnUserTransformation &, double errorDef)
Initial rough estimate of the gradient using the parameter step size.
LASymMatrix MnAlgebraicSymMatrix
Definition MnMatrixfwd.h:21