title: Numerical multi-dimensional integration of a complex function
body: <p>I have two functions</p>
  <pre><code>std::complex&lt;double&gt; foo(double x, double y);
  double bar(double x, double y);
  </code></pre>
  <p>and I am trying to compute the following integral:</p>
  <pre><code>\int dx \int dy foo(x,y)*bar(x,y) .
  </code></pre>
  <p>It would certainly be possible to split this integral into its real and imaginary part and integrate those seperately using the routines provided by GSL, however, the function <code>bar</code> is computationally very expensive (and runtime is important), so that I would like to avoid calling <code>bar</code> twice. Is there any library that would allow me to perform this integration (or do you hav a suggestion how to perform this integral without having to call bar twice as much)?</p>
  <p>I should probably also state that both are member functions of a class.</p>