Re: [R] precompiled ode with spline input

From: Thomas Petzoldt <thpe_at_simecol.de>
Date: Tue, 05 Apr 2011 07:35:03 +0200

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.



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. Received on Tue 05 Apr 2011 - 05:36:18 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 05 Apr 2011 - 05:40:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive