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

Diff of /trunk/math/mathcore/inc/Fit/Chi2FCN.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 87  Line 87 
87        Constructor from data set (binned ) and model function        Constructor from data set (binned ) and model function
88     */     */
89     Chi2FCN (const BinData & data, IModelFunction & func) :     Chi2FCN (const BinData & data, IModelFunction & func) :
90          BaseObjFunction(func.NPar(), data.Size() ),
91     fData(data),     fData(data),
92     fFunc(func),     fFunc(func),
    fNDim(func.NPar() ),  
    fNPoints(data.Size()),  
93     fNEffPoints(0),     fNEffPoints(0),
    fNCalls(0),  
94     fGrad ( std::vector<double> ( func.NPar() ) )     fGrad ( std::vector<double> ( func.NPar() ) )
95     { }     { }
96    
# Line 126  Line 124 
124     }     }
125    
126    
    virtual unsigned int NDim() const { return fNDim; }  
127    
128     using BaseObjFunction::operator();     using BaseObjFunction::operator();
129    
    // count number of function calls  
    virtual unsigned int NCalls() const { return fNCalls; }  
   
    // size of the fit data points (required by interface)  
    virtual unsigned int NPoints() const { return fNPoints; }  
130    
131     // effective points used in the fit (exclude the rejected one)     // effective points used in the fit (exclude the rejected one)
132     virtual unsigned int NFitPoints() const { return fNEffPoints; }     virtual unsigned int NFitPoints() const { return fNEffPoints; }
133    
    virtual void ResetNCalls() { fNCalls = 0; }  
134    
135     /// i-th chi-square residual     /// i-th chi-square residual
136     virtual double DataElement(const double * x, unsigned int i, double * g) const {     virtual double DataElement(const double * x, unsigned int i, double * g) const {
# Line 162  Line 153 
153     virtual const IModelFunction & ModelFunction() const { return fFunc; }     virtual const IModelFunction & ModelFunction() const { return fFunc; }
154    
155    
156    
157  protected:  protected:
158    
159    
# Line 174  Line 166 
166        Evaluation of the  function (required by interface)        Evaluation of the  function (required by interface)
167      */      */
168     virtual double DoEval (const double * x) const {     virtual double DoEval (const double * x) const {
169        fNCalls++;        this->UpdateNCalls();
170  #ifdef ROOT_FIT_PARALLEL  #ifdef ROOT_FIT_PARALLEL
171        return FitUtilParallel::EvaluateChi2(fFunc, fData, x, fNEffPoints);        return FitUtilParallel::EvaluateChi2(fFunc, fData, x, fNEffPoints);
172  #else  #else
# Line 194  Line 186 
186     const BinData & fData;     const BinData & fData;
187     mutable IModelFunction & fFunc;     mutable IModelFunction & fFunc;
188    
    unsigned int fNDim;  
    unsigned int fNPoints;   // size of the data  
189     mutable unsigned int fNEffPoints;  // number of effective points used in the fit     mutable unsigned int fNEffPoints;  // number of effective points used in the fit
    mutable unsigned int fNCalls;  
190    
191     mutable std::vector<double> fGrad; // for derivatives     mutable std::vector<double> fGrad; // for derivatives
192    

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

Subversion Admin
ViewVC Help
Powered by ViewVC 1.0.9