BasicFunctionGradient.h

Go to the documentation of this file.
00001 // @(#)root/minuit2:$Id: BasicFunctionGradient.h 20880 2007-11-19 11:23:41Z rdm $
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_BasicFunctionGradient
00011 #define ROOT_Minuit2_BasicFunctionGradient
00012 
00013 #include "Minuit2/MnMatrix.h"
00014 
00015 #include "Minuit2/StackAllocator.h"
00016 
00017 namespace ROOT {
00018 
00019    namespace Minuit2 {
00020 
00021 
00022 //extern StackAllocator gStackAllocator;
00023 
00024 class BasicFunctionGradient {
00025 
00026 private:
00027 
00028 public:
00029   
00030   explicit BasicFunctionGradient(unsigned int n) :
00031     fGradient(MnAlgebraicVector(n)), fG2ndDerivative(MnAlgebraicVector(n)),
00032     fGStepSize(MnAlgebraicVector(n)), fValid(false), 
00033     fAnalytical(false) {}
00034   
00035   explicit BasicFunctionGradient(const MnAlgebraicVector& grd) : 
00036     fGradient(grd), fG2ndDerivative(MnAlgebraicVector(grd.size())),
00037     fGStepSize(MnAlgebraicVector(grd.size())), fValid(true), 
00038     fAnalytical(true) {}
00039 
00040   BasicFunctionGradient(const MnAlgebraicVector& grd, const MnAlgebraicVector& g2, const MnAlgebraicVector& gstep) : 
00041     fGradient(grd), fG2ndDerivative(g2),
00042     fGStepSize(gstep), fValid(true), fAnalytical(false) {}
00043   
00044   ~BasicFunctionGradient() {}
00045   
00046   BasicFunctionGradient(const BasicFunctionGradient& grad) : fGradient(grad.fGradient), fG2ndDerivative(grad.fG2ndDerivative), fGStepSize(grad.fGStepSize), fValid(grad.fValid) {}
00047 
00048   BasicFunctionGradient& operator=(const BasicFunctionGradient& grad) {
00049     fGradient = grad.fGradient;
00050     fG2ndDerivative = grad.fG2ndDerivative;
00051     fGStepSize = grad.fGStepSize;
00052     fValid = grad.fValid;
00053     return *this;
00054   }
00055 
00056   void* operator new(size_t nbytes) {
00057     return StackAllocatorHolder::Get().Allocate(nbytes);
00058   }
00059   
00060   void operator delete(void* p, size_t /*nbytes */) {
00061     StackAllocatorHolder::Get().Deallocate(p);
00062   }
00063 
00064   const MnAlgebraicVector& Grad() const {return fGradient;}
00065   const MnAlgebraicVector& Vec() const {return fGradient;}
00066   bool IsValid() const {return fValid;}
00067 
00068   bool IsAnalytical() const {return fAnalytical;}
00069   const MnAlgebraicVector& G2() const {return fG2ndDerivative;}
00070   const MnAlgebraicVector& Gstep() const {return fGStepSize;}
00071 
00072 private:
00073 
00074   MnAlgebraicVector fGradient;
00075   MnAlgebraicVector fG2ndDerivative;
00076   MnAlgebraicVector fGStepSize;
00077   bool fValid;
00078   bool fAnalytical;
00079 };
00080 
00081   }  // namespace Minuit2
00082 
00083 }  // namespace ROOT
00084 
00085 #endif  // ROOT_Minuit2_BasicFunctionGradient

Generated on Tue Jul 5 14:25:41 2011 for ROOT_528-00b_version by  doxygen 1.5.1