mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[apps/shared] Cache lookup on function evaluation
When evaluating a ContinuousFunction for a float value, the function will first try to ask its cache (if it has been filled beforehand). Change-Id: I519d2d3dcf344ba63e30a0f011db2306c7141315
This commit is contained in:
committed by
Émilie Feral
parent
a9c633a540
commit
c70b545ba1
@@ -351,6 +351,18 @@ Poincare::Expression ContinuousFunction::sumBetweenBounds(double start, double e
|
||||
* the derivative table. */
|
||||
}
|
||||
|
||||
Poincare::Coordinate2D<float> ContinuousFunction::checkForCacheHitAndEvaluate(float t, Poincare::Context * context) const {
|
||||
Poincare::Coordinate2D<float> res(NAN, NAN);
|
||||
if (cache()->filled()) {
|
||||
res = cache()->valueForParameter(this, t);
|
||||
}
|
||||
if (std::isnan(res.x1()) || std::isnan(res.x2())) {
|
||||
res = privateEvaluateXYAtParameter(t, context);
|
||||
//res = Poincare::Coordinate2D<float>(privateEvaluateXYAtParameter(t, context).x1(), 0);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
Ion::Storage::Record::ErrorStatus ContinuousFunction::setContent(const char * c, Poincare::Context * context) {
|
||||
cache()->clear();
|
||||
return ExpressionModelHandle::setContent(c, context);
|
||||
|
||||
Reference in New Issue
Block a user