Hi Daniel,
thanks for your positive response about using compiled ODE functions.
Did you use package deSolve?
Regarding the use of splines (as forcing functions ?) we don't have an
out of the box method yet, but you may consider to approximate the
splines by linear segments or contribute your own spline code to the
deSolve project.
The example Forcing_lv.R / Forcing_lv.c shows how to use (linearly)
interpolated forcing data within compiled code, and the interpolation
code itself (Initdeforc, updateforc) is found in forcings.c. Depending
on your particular problem there may be other possibilities too.
I don't want to go more into the details here on r-help, but you may
consider to post additional questions to the mailing list of the
respective special interest group
https://stat.ethz.ch/mailman/listinfo/r-sig-dynamic-models
This is also a good idea in general for such questions for getting more
immediate responses.
Thomas Petzoldt
On 3/15/2011 1:00 PM, Daniel Kaschek wrote:> I tried to use lsode with precompiled C code instead of an R function
> defining the derivatives. No problem so far.
>
> However, now I need to implement an ODE that contains spline functions,
> i.e. the derivatives at given time points depend on the value of a
> spline function at this time point. What is an efficient way to
> implement this in precompiled C code?
>
>
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.