
On Dec 7, 2006, at 7:14 PM, Theodore Papadopoulo wrote:
2. How to evaluate if the desired precision is reached? In the code I uploaded I explicitely let the user use it's own predicate, which I would say is important especially as some people would like to compare things in ULPs.
This should be a template parameters. Decide that one parameter of the integration routine is an "Iterator-like" class that has a method:
bool stop(const Integrator&).
Then each user has the choice of the implementation of the routine with maximum flexibility. I use such a thing for gradient descent and this is very flexible. It even allows to decide that only a certain amount of time is allowed to do the integration, or some number of iterations, or some sophisticated error measurement !! With a little more care, we can even define hierarchical behaviours (multiscale).
This function also allows the easy wrapping of the "Iterator-like" to output (debug) information during the computation.
Thanks for the answer and excellent suggestion :-) I'll try to post a draft trapezoidal integrator implementing this idea tomorrow.