[R-sig-dyn-mod] Using dynamically compiled code for use with deSolve in a new package
Thomas Petzoldt
thomas.petzoldt at tu-dresden.de
Sun Jun 11 21:15:22 CEST 2017
Hi,
that's straightforward.
1) Put deSolve in Depends of your package DESCRIPTION:
Depends: deSolve
2) Import the solver function (e.g. ode or lsoda) in the NAMESPACE of
your package and declare your dynamic library (.dll or .so)
importFrom(deSolve,ode)
useDynLib(mypackage)
3) and then use this .dll/.so in the call to ode():
ode(...., dllname = "mypackage", .....)
An example can be found in package growthrates:
https://github.com/tpetzoldt/growthrates/blob/master/pkg/R/grow_twostep.R
Hope it helps,
Thomas
On 11.06.2017 13:20, Rampal Etienne wrote:
> Dear all,
>
> I have written C and FORTRAN functions to use with deSolve and found
> that it works significantly faster than the analogous R functions. So
> far so good! However, now I want to build a package that uses this code.
> How do I do this? I can include the DLL in the package (so no more
> compilation by the user of the package, just loading it), but then the
> user needs to be able to find it. Where will this be installed? That may
> be different on different systems. Any suggestions?
>
> Cheers, Rampal
>
> _______________________________________________
> R-sig-dynamic-models mailing list
> R-sig-dynamic-models at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-dynamic-models
--
Dr. Thomas Petzoldt
Technische Universitaet Dresden
Faculty of Environmental Sciences
Institute of Hydrobiology
01062 Dresden, Germany
http://tu-dresden.de/Members/thomas.petzoldt
More information about the R-sig-dynamic-models
mailing list