00001 // @(#)root/minuit2:$Id: FCNGradientBase.h 21530 2007-12-20 11:14:35Z moneta $ 00002 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005 00003 00004 /********************************************************************** 00005 * * 00006 * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT * 00007 * * 00008 **********************************************************************/ 00009 00010 #ifndef ROOT_Minuit2_FCNGradientBase 00011 #define ROOT_Minuit2_FCNGradientBase 00012 00013 #include "Minuit2/FCNBase.h" 00014 00015 namespace ROOT { 00016 00017 namespace Minuit2 { 00018 00019 //________________________________________________________________________ 00020 /** Extension of the FCNBase for providing the analytical Gradient of the 00021 function. The user-Gradient is checked at the beginning of the 00022 minimization against the Minuit internal numerical Gradient in order to 00023 spot problems in the analytical Gradient calculation. This can be turned 00024 off by overriding CheckGradient() to make it return "false". 00025 The size of the output Gradient vector must be equal to the size of the 00026 input Parameter vector. 00027 Minuit does a check of the user Gradient at the beginning, if this is not 00028 wanted the method "CheckGradient()" has to be overridden to return 00029 "false". 00030 */ 00031 00032 class FCNGradientBase : public FCNBase { 00033 00034 public: 00035 00036 virtual ~FCNGradientBase() {} 00037 00038 virtual std::vector<double> Gradient(const std::vector<double>&) const = 0; 00039 00040 virtual bool CheckGradient() const {return true;} 00041 00042 }; 00043 00044 } // namespace Minuit2 00045 00046 } // namespace ROOT 00047 00048 #endif // ROOT_Minuit2_FCNGradientBase