[Pomp-commits] r482 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu May 19 21:20:44 CEST 2011


Author: kingaa
Date: 2011-05-19 21:20:43 +0200 (Thu, 19 May 2011)
New Revision: 482

Modified:
   pkg/R/plugins.R
Log:
- change 'discrete.time.sim' so that 'delta.t' is not a required argument of 'step.fun'


Modified: pkg/R/plugins.R
===================================================================
--- pkg/R/plugins.R	2011-05-19 03:11:18 UTC (rev 481)
+++ pkg/R/plugins.R	2011-05-19 19:20:43 UTC (rev 482)
@@ -29,6 +29,37 @@
   }
 }
 
+discrete.time.sim <- function (step.fun, delta.t = 1, PACKAGE) {
+  efun <- pomp.fun(
+                   f=step.fun,
+                   PACKAGE=PACKAGE,
+                   proto=quote(step.fun(x,t,params,...))
+                   )
+  function (xstart, times, params, ...,
+            statenames = character(0),
+            paramnames = character(0),
+            covarnames = character(0),
+            zeronames = character(0),
+            tcovar, covar) {
+    .Call(
+          euler_model_simulator,
+          func=efun,
+          xstart=xstart,
+          times=times,
+          params=params,
+          dt=delta.t,
+          method=0L,
+          statenames=statenames,
+          paramnames=paramnames,
+          covarnames=covarnames,
+          zeronames=zeronames,
+          tcovar=tcovar,
+          covar=covar,
+          args=pairlist(...)
+          )
+  }
+}
+
 euler.sim <- function (step.fun, delta.t, PACKAGE) {
   efun <- pomp.fun(
                    f=step.fun,
@@ -60,9 +91,6 @@
   }
 }
 
-discrete.time.sim <- function (step.fun, delta.t = 1, PACKAGE)
-  euler.sim(step.fun=step.fun,delta.t=delta.t,PACKAGE=PACKAGE)
-
 onestep.dens <- function (dens.fun, PACKAGE) {
   efun <- pomp.fun(
                    f=dens.fun,



More information about the pomp-commits mailing list