
If I can only suggest: Decouple evaluation of the objective function from its derivatives. Or have another concept that is not callable. I have an example of how one can specify a family of functions and their derivatives: http://sohail.taggedtype.net/software/newton_raphson.cxx You can blame the idle hands for this one. Sohail

Sohail Somani wrote:
:-) I see what you're doing, but I deliberately wanted the derivatives to be calculated at the same time as f(x): the functions I was interested in (incomplete beta and gamma's) have terms that are common to both the derivative and the objective function, and I wanted the option of calculating both the derivatives and the objective function at the same time. Now as it happens, I haven't got around to using this leeway yet, although I certainly do use it to advantage where the second derivative is concerned (it's way cheaper to calculate the second derivative from the first than from scratch). In any case if the derivative is unavailable or expensive to compute, then I would be inclined to use a method specifically optimised for that situation like the one of Alefeld et al (see toms748_solve in http://freespace.virgin.net/boost.regex/toolkit/libs/math/doc/html/math_tool...) rather than a discrete Newton-Raphson method. Just my 2c.... John.
participants (2)
-
John Maddock
-
Sohail Somani