
On Dec 7, 2006, at 5:02 PM, Neal Becker wrote:
I should explain that the previous was a simple outline.
I was thinking trap_1d::operator() does the complete integration. It will need more information to specify the desired precision. I'm thinking these additional arguments could be passed to trap_1d::operator() or could be constructor args.
Ok...then we ought to discuss those extra parameters as well: 1. Precision: what should be its type? Return type would be natural, but it is problematic for complex integrands. 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.
The reason trap_1d is a functor is just because I wanted to have arg_t and res_t be template parameters, and I wanted to have default values for them. This gives the best of all worlds. You can overide these types by specifying non-defaults, or you can specialize the arg or res templates, or you can use the default arg and res templates which are designed to work with functions of the style std::unary_function (sorry, I didn't check the spellings on the type names).
That's just fine with me :-) What do other people think aboout all this?