Benchmark of numerical integration packages for multi-dimensional integration

Hello,

I need to integrate a vector valued function F: \mathbb{R} \xrightarrow{} \mathbb{R}^n, with n \sim 5000 over [0.0, 1.0]. I don’t need to very accurate result, an error estimate of 1e-6 is sufficient for my application, but I need the fastest integration possible.

There are a lot of packages for numerical integrations in Julia: FastQaussQuadrature, QuadGK, Cuba, Cubature, HCubature, Quadrature…

Is there a benchmark for these different packages?

Look at https://github.com/SciML/Quadrature.jl. It just wraps them all in one interface so you can flip through and benchmark them quite easily. We haven’t done the benchmarking yet, but that would be a nice thing to do and then just get a JOSS paper out, so if you want to join in on that let us know.

4 Likes

Thanks Chris, I will look for Quadrature.jl !

I am not sure you need any fancy methods if your function is “nice” enough (smooth, differentiable) since the domain is the real line.

The first thing I would try is Gaussian quadrature with FastGaussQuadrature: calculate nodes & weights once, then evaluate F on the nodes, and just use a matrix product (or dot product of vectors, depending on how your formulate it).

I’d also note that benchmarks highly depends on the characteristics of the integrand function, it’s hard to provide benchmarks that cover all possible cases. As an example, among the methods provided by Cuba.jl, cuhre tends to be the fastest and most accurate one in many cases, but if the function has some very sharp peaks whose position is known, divonne is a much better choice as you can provide the position of the peaks in order to increase sampling around them (to be honest, I’ve never used this feature in Cuba.jl even though it should be somewhat exposed, I did it some years ago with the Fortran library).

To summarise, you should really benchmark the different methods with your integrand function.

1 Like