// @(#)root/minuit2:$Id$ // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005 /********************************************************************** * * * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT * * * **********************************************************************/ #include "Minuit2/Numerical2PGradientCalculator.h" #include "Minuit2/InitialGradientCalculator.h" #include "Minuit2/MnFcn.h" #include "Minuit2/MnUserTransformation.h" #include "Minuit2/MnMachinePrecision.h" #include "Minuit2/MinimumParameters.h" #include "Minuit2/FunctionGradient.h" #include "Minuit2/MnStrategy.h" //#define DEBUG #if defined(DEBUG) || defined(WARNINGMSG) #include "Minuit2/MnPrint.h" #ifdef _OPENMP #include #include #ifdef DEBUG #define DEBUG_MP #endif #endif #endif #include #include "Minuit2/MPIProcess.h" namespace ROOT { namespace Minuit2 { FunctionGradient Numerical2PGradientCalculator::operator()(const MinimumParameters& par) const { // calculate gradient using Initial gradient calculator and from MinimumParameters object InitialGradientCalculator gc(fFcn, fTransformation, fStrategy); FunctionGradient gra = gc(par); return (*this)(par, gra); } // comment it, because it was added FunctionGradient Numerical2PGradientCalculator::operator()(const std::vector& params) const { // calculate gradient from an std;:vector of paramteters int npar = params.size(); MnAlgebraicVector par(npar); for (int i = 0; i < npar; ++i) { par(i) = params[i]; } double fval = Fcn()(par); MinimumParameters minpars = MinimumParameters(par, fval); return (*this)(minpars); } FunctionGradient Numerical2PGradientCalculator::operator()(const MinimumParameters& par, const FunctionGradient& Gradient) const { // calculate numerical gradient from MinimumParameters object // the algorithm takes correctly care when the gradient is approximatly zero // std::cout<<"########### Numerical2PDerivative"< 0.5) step = 0.5; } double stpmax = 10.*fabs(gstep(i)); if(step > stpmax) step = stpmax; // std::cout<<" "<