[Pomp-commits] r418 - pkg/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Nov 16 15:25:43 CET 2010


Author: kingaa
Date: 2010-11-16 15:25:43 +0100 (Tue, 16 Nov 2010)
New Revision: 418

Modified:
   pkg/src/skeleton.c
Log:
- minor tweaks


Modified: pkg/src/skeleton.c
===================================================================
--- pkg/src/skeleton.c	2010-11-14 17:09:42 UTC (rev 417)
+++ pkg/src/skeleton.c	2010-11-16 14:25:43 UTC (rev 418)
@@ -59,7 +59,6 @@
 static SEXP _pomp_skel_envir;	// function's environment
 static SEXP _pomp_skel_fcall;	// function call
 static SEXP _pomp_skel_vnames;	// names of state variables
-//static int *_pomp_skel_vindex;	// indices of state variables
 
 #define XVEC    (_pomp_skel_Xvec)
 #define PVEC    (_pomp_skel_Pvec)
@@ -70,7 +69,6 @@
 #define RHO     (_pomp_skel_envir)
 #define FCALL   (_pomp_skel_fcall)
 #define VNAMES  (_pomp_skel_vnames)
-//#define VINDEX  (_pomp_skel_vindex)
 
 // this is the vectorfield that is evaluated when the user supplies an R function
 // (and not a native routine)
@@ -102,12 +100,9 @@
 
   PROTECT(nm = GET_NAMES(ans)); nprotect++;
   use_names = !isNull(nm);
-  if (use_names) {	   // match names against names from data slot
+  if (use_names) {	  // match names against known names of states
     PROTECT(idx = matchnames(VNAMES,nm)); nprotect++;
     op = INTEGER(idx);
-    //    for (k = 0; k < NVAR; k++) VINDEX[k] = op[k];
-    //  } else {
-    //    VINDEX = 0;
   }
 
   xp = REAL(AS_NUMERIC(ans));
@@ -134,7 +129,7 @@
   SEXP sindex, pindex, cindex;
   SEXP Pnames, Cnames;
   pomp_vectorfield_map *ff = NULL;
-  int k;
+  int k, len;
 
   ntimes = LENGTH(t);
 
@@ -217,7 +212,7 @@
   PROTECT(F = makearray(3,fdim)); nprotect++; 
   setrownames(F,VNAMES,3);
   xp = REAL(F);
-  for (k = 0; k < nvars*nreps*ntimes; k++) xp[k] = 0.0;
+  for (k = 0, len = nvars*nreps*ntimes; k < len; k++) xp[k] = 0.0;
 
   if (nstates > 0) {
     PROTECT(sindex = MATCHROWNAMES(x,statenames)); nprotect++;



More information about the pomp-commits mailing list