alashworth / test-issue-import

0 stars 0 forks source link

ode wrapper functions to drop unused arguments #44

Open alashworth opened 5 years ago

alashworth commented 5 years ago

Issue by bob-carpenter Thursday Sep 11, 2014 at 17:24 GMT Originally opened as https://github.com/stan-dev/stan/issues/1027


Right now, there is only the fully specified function integrate_ode and it requires dummy size-0 arrays to be passed in as data if there is no data dependency in the ODE. It would be nice to add the following versions:

integrate_ode(sho, y0, t0, ts, theta) 
integrate_ode(sho, y0, t0, ts, theta, x_r) 
integrate_ode(sho, y0, t0, ts, theta, x_r, x_i)

where x_r is real data and x_i integer data. This is not confusing anywhere for typing. The semantics are that if you call the less specified ones, a default size-0 array is passed on to the full function.

Then it'd be nice if the system functions can be written the same way:

f(t,y,theta,x_r,x_i)
f(t,y,theta,x_r)
f(t,y,theta)

The semantics of these two with the idea being that if the system function doesn't specify the argument, it ignores it.

It'd also be possible to include

integrate_ode(sho, y0, t0, ts, theta, x_i)
f(t,y,theta,x_i)

without ambiguity in Stan.

Then there's the issue of including a relative error specification (I don't see that absolute error ever really matters, but I may be missing something).

This will require work on the modeling language side and some fancy template specialization footwork to get all the calls working together, but it shouldn't be too difficult.

I also thought it might be useful to wait to hear back from users, and perhaps go a rather different route in wrapping ODEs. Whatever else we do, though, doing this won't cause a problem other than perhaps too many functions.