[root] / trunk / math / mathcore / inc / Fit / PoissonLikelihoodFCN.h Repository:
ViewVC logotype

Diff of /trunk/math/mathcore/inc/Fit/PoissonLikelihoodFCN.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 25485, Mon Sep 22 07:52:52 2008 UTC revision 25486, Mon Sep 22 12:43:03 2008 UTC
# Line 65  Line 65 
65        Constructor from unbin data set and model function (pdf)        Constructor from unbin data set and model function (pdf)
66     */     */
67     PoissonLikelihoodFCN (const BinData & data, IModelFunction & func) :     PoissonLikelihoodFCN (const BinData & data, IModelFunction & func) :
68          BaseObjFunction(func.NPar(), data.Size() ),
69     fData(data),     fData(data),
70     fFunc(func),     fFunc(func),
    fNDim(func.NPar() ),  
    fNPoints(data.Size()),  
71     fNEffPoints(0),     fNEffPoints(0),
    fNCalls(0),  
72     fGrad ( std::vector<double> ( func.NPar() ) )     fGrad ( std::vector<double> ( func.NPar() ) )
73     { }     { }
74    
# Line 98  Line 96 
96     /// clone the function (need to return Base for Windows)     /// clone the function (need to return Base for Windows)
97     BaseFunction * Clone() const { return new  PoissonLikelihoodFCN(fData,fFunc); }     BaseFunction * Clone() const { return new  PoissonLikelihoodFCN(fData,fFunc); }
98    
    unsigned int NDim() const { return fNDim; }  
   
    // count number of function calls  
    unsigned int NCalls() const { return fNCalls; }  
   
    // size of the data  
    unsigned int NPoints() const { return fNPoints; }  
   
99     // effective points used in the fit     // effective points used in the fit
100     unsigned int NFitPoints() const { return fNEffPoints; }     unsigned int NFitPoints() const { return fNEffPoints; }
101    
    void ResetNCalls() { fNCalls = 0; }  
   
102     /// i-th likelihood element and its gradient     /// i-th likelihood element and its gradient
103     double DataElement(const double * x, unsigned int i, double * g) const {     double DataElement(const double * x, unsigned int i, double * g) const {
104        return FitUtil::EvaluatePoissonBinPdf(fFunc, fData, x, i, g);        return FitUtil::EvaluatePoissonBinPdf(fFunc, fData, x, i, g);
# Line 125  Line 113 
113     /// get type of fit method function     /// get type of fit method function
114     virtual  typename BaseObjFunction::Type GetType() const { return BaseObjFunction::kLogLikelihood; }     virtual  typename BaseObjFunction::Type GetType() const { return BaseObjFunction::kLogLikelihood; }
115    
116       /// access to const reference to the data
117       virtual const BinData & Data() const { return fData; }
118    
119       /// access to const reference to the model function
120       virtual const IModelFunction & ModelFunction() const { return fFunc; }
121    
122    
123  protected:  protected:
124    
125    
# Line 134  Line 129 
129        Evaluation of the  function (required by interface)        Evaluation of the  function (required by interface)
130      */      */
131     double DoEval (const double * x) const {     double DoEval (const double * x) const {
132        fNCalls++;        this->UpdateNCalls();
133        return FitUtil::EvaluatePoissonLogL(fFunc, fData, x, fNEffPoints);        return FitUtil::EvaluatePoissonLogL(fFunc, fData, x, fNEffPoints);
134     }     }
135    

Legend:
Removed from v.25485  
changed lines
  Added in v.25486

Subversion Admin
ViewVC Help
Powered by ViewVC 1.0.9