Subject: [boost] Minimal recalculation in formulas, using boost::proto
Date: 2011-02-05 12:25:08
I have a program which needs to recalculate a formula of independant
arguments (doubles or integers). These arguments can be updated at any time.
This math formula is expensive to evaluate, and performance-wise it is
worth, depending of which input argument changes, to recalculate only a
part of the evaluation tree. Here is a simplistic exemple:
z = sin(x+1)*cos(y-3)
When the argument x changes, it is not necessary to recompute cos(y-3).
I wrote a prototype lib to do this, where expressions are made of cells
wrapping operators, input cells and intermediate values, plus the list
of depending cells.
When the value of an argument, an input cell, changes, the lib just
builds the topologically sorted list of dependant cells, and reevaluates
them, performing what I think is the minimum recalculation (Excel style).
(An alternate strategy is to let each data update invalidate its cell
and its descendants - the actual calculation being done only when needed).
Instead of reinventing the wheel, my thought was to try to use
boost::proto for this. Does it make sense ? Any code change needed please ?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk