I’ve created the issue and started to work on merging the 1D integrator into the language, but I think there may be things we need to fix first.
Here’s the issue and the integrator in stan-dev/math.
The doc is a little unclear on types and the type names don’t match in the tparam, but that’s not a big deal.
Issue 1
Shouldn’t there be a data argument for real parameters to the function that aren’t differentiated? And shouldn’t there be a data argument for integer parameters? As is, we’ll have to promote real constants and won’t be able to use integer constants from the program.
I think we want this signature for the function that gets integrated, where theta is a parameter vector, x_r and x_i are real and integer data, and y is the variable being integrated:
real
f(real y, vector theta, real[] x_r, int[] x_i)
Then the function would look like this, where all the variables mean the same thing as above, and lb and ub anre the integration bounds and abs_tol and rel_tol are integration tolerances.
real
integrate_definite(F f, real lb, real ub,
vector theta, real[] x_r, int[] x_i,
real abs_tol, real rel_tol)
Issue 2
Shouldn’t the vector type for theta be real[] instead? That’s what we did with the other integrators.
Issue 3
Was there a way to use this to do unbounded integrals with transforms or should I just document the straight-ahead definite integral usage for the manual?