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

Public Member Functions | |
| FuncCacheInt (const ICallableInt *g) | |
| virtual double | EvalAtEx (const CoordInt &r, CoordInt *) const |
Protected Attributes | |
| const ICallableInt * | fFunc |
| std::map< CoordInt, double > | fCache |
| std::map< CoordInt, CoordInt > | fRetCache |
| int | fNhit |
| int | fNmiss |
Friends | |
| ostream & | operator<< (ostream &os, const FuncCacheInt &c) |
|
|
Definition at line 114 of file NCFitter.h.
|
|
||||||||||||
|
Reimplemented from NC::Fitter::ICallableInt. Definition at line 172 of file NCFitter.cxx. References NC::Fitter::CoordInt, NC::Fitter::ICallableInt::EvalAtEx(), fCache, fFunc, and fRetCache. Referenced by NC::Fitter::FindContourInt(). 00173 {
00174 const std::map<CoordInt, double>::const_iterator it = fCache.find(r);
00175
00176 if(it != fCache.end()){
00177 ++fNhit;
00178 if(ret) *ret = fRetCache[r];
00179 return it->second;
00180 }
00181
00182 ++fNmiss;
00183
00184 // const unsigned int maxCacheSize = int(1e7); // on the order of 10meg
00185 // if(cache.size() > maxCacheSize) cache.clear();
00186
00187 CoordInt myret;
00188 const double val = fFunc->EvalAtEx(r, &myret);
00189 if(ret) *ret = myret;
00190
00191 fCache[r] = val;
00192 fRetCache[r] = myret;
00193
00194 return val;
00195 }
|
|
||||||||||||
|
Definition at line 197 of file NCFitter.cxx. 00198 {
00199 os << "FuncCacheInt for callable at " << c.fFunc
00200 << " with " << c.fNhit+c.fNmiss << " calls "
00201 << "of which " << c.fNhit << " hit and "
00202 << c.fNmiss << " missed." << endl;
00203 return os;
00204 }
|
|
|
Definition at line 119 of file NCFitter.h. Referenced by EvalAtEx(). |
|
|
Definition at line 118 of file NCFitter.h. Referenced by EvalAtEx(), and NC::Fitter::operator<<(). |
|
|
Definition at line 121 of file NCFitter.h. Referenced by NC::Fitter::operator<<(). |
|
|
Definition at line 121 of file NCFitter.h. Referenced by NC::Fitter::operator<<(). |
|
|
Definition at line 120 of file NCFitter.h. Referenced by EvalAtEx(). |
1.3.9.1