I've found two good libraries for numerical integration in c++ that are easy enough for me to use. I have to integrate fairly complex functions with the possibility of singularities at endpoints and it appears that an adaptive integration method using the Wynn's epsilon algorithm is the best choice. Both libraries have an implementation for this (gsl_integration_qags and boost::numeric::quadrature::adaptive().accelerator(wynn_epsilon_algorithm)) but I can't decide which one is faster. I wonder if there are any experts who have experience with this and can help me decide. The computational cost of numerical integration is critical for my current project. (I've done some tests and found GSL to perform faster here but I'm not sure if my testing is conclusive. In general I've found Boost faster for mathematical methods.)
Asked
Active
Viewed 4,966 times
4
-
2Is faster all you care about here? One might also be more accurate too... – Flexo Sep 04 '11 at 16:40
-
Accuracy is also important. I tried different limits for absolute and relative errors and for each test the limits were the same for both methods. GSL seems to work faster. If there are no other opinions on this I guess I'll go with GSL. – Raul Laasner Sep 04 '11 at 18:33
-
I would lean the opposite way since boost has a nice C++ interface whilst gsl is C and so make RAII harder than it needs to be. I'm not familiar with either of the implementations enough to comment on that though. – Flexo Sep 04 '11 at 18:35
-
I was also biased towards Boost because of the C++ interface. However, GSL has seen extensive testing and as I mentioned it seems to run faster for my case. The Boost library was a small project and not part of the official libraries. They both reimplement algorithms used in Quadpack, which is a Fortran 77 library. As for other Boost math libraries that are part of the official libraries Boost seems to run faster than GSL. – Raul Laasner Sep 04 '11 at 20:15
-
2Another good numerical integration library: http://www.feynarts.de/cuba/ – quant_dev Oct 20 '11 at 16:36
-
1So what did you choose? And which one proved faster, how much? – Yaroslav Nikitenko Mar 10 '21 at 19:17
-
@YaroslavNikitenko That was a long time ago and I don't remember what the timings for the two libraries were. But I ended up using GSL for the project I was working on at the time. – Raul Laasner Mar 11 '21 at 09:44