[R-sig-dyn-mod] lsoda FASTER than ode45 (was: lsoda (deSolve) order of magnitude slower than ode45)

Thomas Petzoldt thomas.petzoldt at tu-dresden.de
Wed Nov 22 11:47:06 CET 2017


Hi Maciek,

I've made a small benchmark with your example (i5 4690, 3.5-3.9GHz, R 
3.4.2, deSolve 1.21, Windows 10,  average of 10 simulations each):

dt = 0.01
    lsoda: 2.85s

dt = 1
    ode45: 0.135
    lsoda: 0.039
    bdf:   0.025
    vode:  0.024


The plot of all simulations looks identical. B_CLL shows a steep change 
at the beginning, that's why dedicated solvers for stiff systems (bdf, 
vode) can be minimally faster than the automatic lsoda.

Finally, R/deSolve allows to use compiled C or Fortran models and there 
are now several packages that support creation of such code ...

Thomas


gc() # clean up memory to make benchmark more reproducible
times <- seq(0, 300, by = 1)
N <- 10
system.time(
   for (i in 1:N)
     out <- ode(y = state, times = times, func = Nanda,
       method="vode", parms = parameters)
)/N

plot(out)


-- 
Dr. Thomas Petzoldt
Technische Universitaet Dresden
Faculty of Environmental Sciences
Institute of Hydrobiology
01062 Dresden, Germany

E-Mail: thomas.petzoldt at tu-dresden.de
http://tu-dresden.de/Members/thomas.petzoldt



More information about the R-sig-dynamic-models mailing list