#include <NCFitter.h>
Inheritance diagram for NC::Fitter::FuncCache:

Public Member Functions | |
| FuncCache (ICallableND *g) | |
| virtual double | EvalAtEx (const CoordNDim &r, CoordNDim *ret) const |
| Find the value of the function and return additional information. | |
Protected Attributes | |
| ICallableND * | fFunc |
| std::map< CoordNDim, double > | fCache |
| std::map< CoordNDim, CoordNDim > | fCacheRetCoord |
| int | fNhit |
| int | fNmiss |
Friends | |
| ostream & | operator<< (ostream &os, const FuncCache &c) |
|
|
Definition at line 97 of file NCFitter.h.
|
|
||||||||||||
|
Find the value of the function and return additional information.
Implements NC::Fitter::ICallableND. Definition at line 138 of file NCFitter.cxx. References NC::Fitter::CoordNDim, NC::Fitter::ICallableND::EvalAtEx(), fCache, fCacheRetCoord, and fFunc. 00139 {
00140 const std::map<CoordNDim, double>::const_iterator it = fCache.find(r);
00141 if(it != fCache.end()){
00142 ++fNhit;
00143 if(retCoord) *retCoord = fCacheRetCoord[r];
00144 return it->second;
00145 }
00146
00147 ++fNmiss;
00148
00149 // const unsigned int maxCacheSize = int(1e7); // on the order of 10meg
00150 // if(cache.size() > maxCacheSize) fCache.clear();
00151
00152 CoordNDim myRetCoord;
00153 const double ret = fFunc->EvalAtEx(r, &myRetCoord);
00154
00155 fCache[r] = ret;
00156 fCacheRetCoord[r] = myRetCoord;
00157
00158 if(retCoord) *retCoord = myRetCoord;
00159 return ret;
00160 }
|
|
||||||||||||
|
Definition at line 162 of file NCFitter.cxx. 00163 {
00164 os << "FuncCache for callable at " << c.fFunc
00165 << " with " << c.fNhit+c.fNmiss << " calls "
00166 << "of which " << c.fNhit << " hit and "
00167 << c.fNmiss << " missed." << endl;
00168 return os;
00169 }
|
|
|
Definition at line 101 of file NCFitter.h. Referenced by EvalAtEx(). |
|
|
Definition at line 102 of file NCFitter.h. Referenced by EvalAtEx(). |
|
|
Definition at line 100 of file NCFitter.h. Referenced by EvalAtEx(), and NC::Fitter::operator<<(). |
|
|
Definition at line 103 of file NCFitter.h. Referenced by NC::Fitter::operator<<(). |
|
|
Definition at line 103 of file NCFitter.h. Referenced by NC::Fitter::operator<<(). |
1.3.9.1