Brent's Method in C++

  • Thread starter Thread starter VTQ
  • Start date Start date
Joined
8/10/18
Messages
122
Points
128
Hi All,

I am looking for an efficient implementation of Brent's method. I understand it is available in Boost. However is there any other implementation which you would recommend ?

Any suggestions for implementing indenpendently are also welcome.

Thanks in advance!

@Daniel Duffy
 
Yes, it is in Boost. It works very well.

Can you be more precise? Do you want other solvers for a problem? etc.
 
Yes, it is in Boost. It works very well.

Can you be more precise? Do you want other solvers for a problem? etc.
Hi Daniel, Thank you for the response. To be precise, I am looking for implementation of Brent's method without boost libraries. My purpose is solving for implied vol.
I want to use this in Python wherever possible for faster compute. So instead using Scipy, I want to keep my library light. I hope that makes sense.
 
That's a good argument :) I might even try it myself.

1.
  • Brent, R. P. (1973), "Chapter 4: An Algorithm with Guaranteed Convergence for Finding a Zero of a Function", Algorithms for Minimization without Derivatives, Englewood Cliffs, NJ: Prentice-Hall, ISBN 0-13-022335-2 (can alway write f(x) = 0 as min f(x)*f(x) ==. very robust fo iv Ihave found).
2. Numercal,Recipes section 9.3 vn Wijngaarden-Dekker-Brent ==> 1 page of C code.
3. Use source code in Boost C++ and leave the rest behind. (boost\maths\tools\minima.hpp)
(4. solve min f(x)*f(x) by formulating as an ODE .... more advanced).

I reckon this should help! Good luck. :cool:

//

Boost Code >> NR Code
 
Last edited:
That's a good argument :) I might even try it myself.

1.
  • Brent, R. P. (1973), "Chapter 4: An Algorithm with Guaranteed Convergence for Finding a Zero of a Function", Algorithms for Minimization without Derivatives, Englewood Cliffs, NJ: Prentice-Hall, ISBN 0-13-022335-2 (can alway write f(x) = 0 as min f(x)*f(x) ==. very robust fo iv Ihave found).
2. Numercal,Recipes section 9.3 vn Wijngaarden-Dekker-Brent ==> 1 page of C code.
3. Use source code in Boost C++ and leave the rest behind. (boost\maths\tools\minima.hpp)
(4. solve min f(x)*f(x) by formulating as an ODE .... more advanced).

I reckon this should help! Good luck. :cool:

//

Boost Code >> NR Code
Thanks a lot, let me give this a go.
 
If you get time, give us a shout on how it went.
You can benchmark againg Python and Boost. It would be an interesting test of accuracy, robustness, effiiciency etc.
 
Last edited:
Thanks a lot, let me give this a go.

If you get time, give us a shout on how it went.
You can benchmark againg Python and Boost. It would be an interesting test of accuracy, robustness, effiiciency etc.
Sure, it may not be immediate but I will definitely update on this post. All I can say now is brentq from Scipy is robust, however it is on slow side :)
 
Back
Top Bottom