Recently, I tried to numerically integrate a function for multiple parameters. The integral is four dimensional, so I use CubatureJLh() (but I don’t mind using other methods - the documentation doesn’t elaborate a lot on the differences, so I just chose one that supports multidimensional integration and batching).
The parameters I’m passing to the integral affect both the integrand itself and the integration boundaries (of some of the dimensions), and I need to evaluate a large matrix of parameters (about 100x100 pairs of parameters).
As a first step, I ran the computation (for each value of the parameters) in a multithreaded manner. This was sufficient when integrating a simple function, but for another integrand that I needed, this is still very slow. Generally, my integral consists of a product of exponents of a (smooth) function.
The documentation mentions that
Integrals.jl’s caching interface automates this process to reuse resources if an algorithm supports it and if the necessary types to build the cache can be inferred from
prob.
My questions are:
- Which methods, other than QuadJKL (which only supports one-dimensional integrals), supports caching?
- More generally, when can I expect caching to help with the performance? So far, I’ve used numerical integration as a blackbox, so it’s not immediately clear to me how caching of the computation of the integral for one parameter set can help compute the same integral for other values of the parameters.
- Other general tips for speeding up the computation for this kind of problem (multidimensional integral and a large matrix of parameters) would be appreciated.
Thanks in advance!