I am trying to write a triple integration routine in C++ using the Boost Gauss-Kronrod quadrature for a function returning a complex result. I am not set on the Boost library, if there is another library that fits my requirements better suggestions are welcome. I am looking for an alternative to scipy since it doesn't support integrands returning complex values, meaning I have to integrate twice (complex and real part) and I am looking for a faster method.
Scipy.integrate provides a tplquad
function which integrates f(x, y, z). The integration interval can even be specified as a lambda function, so integration over a spherical domain is possible. Scipy also has nquad
, which can integrate over n dimensions.
So far I have failed to write something similar in C++, since the boost integration doesn't have an args parameter to allow me to pass additional arguments to a function. In Python with the quad 1D integration routine from scipy I could pass the current y,z values to the x integration.
This answer has code that shows what I am thinking about doing in C++, using a 1D integration routine for 3D integration.