[Pomp-commits] r1222 - pkg/pomp/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jun 18 19:55:07 CEST 2015


Author: kingaa
Date: 2015-06-18 19:55:06 +0200 (Thu, 18 Jun 2015)
New Revision: 1222

Modified:
   pkg/pomp/R/abc-methods.R
   pkg/pomp/R/bsmc.R
   pkg/pomp/R/bsmc2.R
   pkg/pomp/R/mif-methods.R
   pkg/pomp/R/mif2-methods.R
   pkg/pomp/R/mif2.R
   pkg/pomp/R/pfilter.R
   pkg/pomp/R/pmcmc-methods.R
Log:
- minor tweak for speed

Modified: pkg/pomp/R/abc-methods.R
===================================================================
--- pkg/pomp/R/abc-methods.R	2015-06-18 11:56:46 UTC (rev 1221)
+++ pkg/pomp/R/abc-methods.R	2015-06-18 17:55:06 UTC (rev 1222)
@@ -35,7 +35,7 @@
             } else {
               p <- sapply(y,is,'abc')
               pl <- sapply(y,is,'abcList')
-              if (any(!(p||pl)))
+              if (!all(p||pl))
                 stop("cannot mix ",sQuote("abc"),
                      " and non-",sQuote("abc")," objects")
               y[p] <- lapply(y[p],list)
@@ -55,7 +55,7 @@
             } else {
               p <- sapply(y,is,'abc')
               pl <- sapply(y,is,'abcList')
-              if (any(!(p||pl)))
+              if (!all(p||pl))
                 stop("cannot mix ",sQuote("abc"),
                      " and non-",sQuote("abc")," objects")
               y[p] <- lapply(y[p],list)

Modified: pkg/pomp/R/bsmc.R
===================================================================
--- pkg/pomp/R/bsmc.R	2015-06-18 11:56:46 UTC (rev 1221)
+++ pkg/pomp/R/bsmc.R	2015-06-18 17:55:06 UTC (rev 1222)
@@ -222,7 +222,7 @@
                 )
     if (inherits(pvec,"try-error"))
       stop(error.prefix,"error in ",sQuote("rmvnorm"),call.=FALSE)
-    if (any(!is.finite(pvec)))
+    if (!all(is.finite(pvec)))
       stop(error.prefix,"extreme particle depletion",call.=FALSE)
     params[estind,] <- m[estind,]+t(pvec)
 
@@ -282,7 +282,7 @@
       ##               )
       ##   if (inherits(pvec,"try-error"))
       ##     stop(error.prefix,"error in ",sQuote("rmvnorm"),call.=FALSE)
-      ##   if (any(!is.finite(pvec)))
+      ##   if (!all(is.finite(pvec)))
       ##     stop(error.prefix,"extreme particle depletion",call.=FALSE)
       ##   params[estind,j] <- m[estind,j]+pvec[1,]
       ## }

Modified: pkg/pomp/R/bsmc2.R
===================================================================
--- pkg/pomp/R/bsmc2.R	2015-06-18 11:56:46 UTC (rev 1221)
+++ pkg/pomp/R/bsmc2.R	2015-06-18 17:55:06 UTC (rev 1222)
@@ -128,7 +128,7 @@
                 )
     if (inherits(pert,"try-error"))
       stop(error.prefix,"error in ",sQuote("rmvnorm"),call.=FALSE)
-    if (any(!is.finite(pert)))
+    if (!all(is.finite(pert)))
       stop(error.prefix,"extreme particle depletion",call.=FALSE)
     params[estind,] <- m[estind,]+t(pert)
 

Modified: pkg/pomp/R/mif-methods.R
===================================================================
--- pkg/pomp/R/mif-methods.R	2015-06-18 11:56:46 UTC (rev 1221)
+++ pkg/pomp/R/mif-methods.R	2015-06-18 17:55:06 UTC (rev 1222)
@@ -129,7 +129,7 @@
             } else {
               p <- sapply(y,is,'mif')
               pl <- sapply(y,is,'mifList')
-              if (any(!(p||pl)))
+              if (!all(p||pl))
                 stop("cannot mix ",sQuote("mif"),
                      " and non-",sQuote("mif")," objects")
               y[p] <- lapply(y[p],list)
@@ -149,7 +149,7 @@
             } else {
               p <- sapply(y,is,'mif')
               pl <- sapply(y,is,'mifList')
-              if (any(!(p||pl)))
+              if (!all(p||pl))
                 stop("cannot mix ",sQuote("mif"),
                      " and non-",sQuote("mif")," objects")
               y[p] <- lapply(y[p],list)

Modified: pkg/pomp/R/mif2-methods.R
===================================================================
--- pkg/pomp/R/mif2-methods.R	2015-06-18 11:56:46 UTC (rev 1221)
+++ pkg/pomp/R/mif2-methods.R	2015-06-18 17:55:06 UTC (rev 1222)
@@ -41,7 +41,7 @@
             } else {
               p <- sapply(y,is,'mif2d.pomp')
               pl <- sapply(y,is,'mif2List')
-              if (any(!(p||pl)))
+              if (!all(p||pl))
                 stop("cannot mix ",sQuote("mif2d.pomp"),
                      " and non-",sQuote("mif2d.pomp")," objects")
               y[p] <- lapply(y[p],list)
@@ -61,7 +61,7 @@
             } else {
               p <- sapply(y,is,'mif2d.pomp')
               pl <- sapply(y,is,'mif2List')
-              if (any(!(p||pl)))
+              if (!all(p||pl))
                 stop("cannot mix ",sQuote("mif2d.pomp"),
                      " and non-",sQuote("mif2d.pomp")," objects")
               y[p] <- lapply(y[p],list)

Modified: pkg/pomp/R/mif2.R
===================================================================
--- pkg/pomp/R/mif2.R	2015-06-18 11:56:46 UTC (rev 1221)
+++ pkg/pomp/R/mif2.R	2015-06-18 17:55:06 UTC (rev 1222)
@@ -114,10 +114,9 @@
                    )
     if (inherits(weights,'try-error'))
       stop(sQuote("mif2.pfilter")," error: error in calculation of weights",call.=FALSE)
-    if (any(!is.finite(weights))) {
+    if (!all(is.finite(weights)))
       stop(sQuote("mif2.pfilter")," error: ",sQuote("dmeasure"),
            " returns non-finite value",call.=FALSE)
-    }
     gnsi <- FALSE
 
     ## compute weighted mean at last timestep

Modified: pkg/pomp/R/pfilter.R
===================================================================
--- pkg/pomp/R/pfilter.R	2015-06-18 11:56:46 UTC (rev 1221)
+++ pkg/pomp/R/pfilter.R	2015-06-18 17:55:06 UTC (rev 1222)
@@ -136,7 +136,7 @@
     rw.names <- names(.rw.sd)
     if (is.null(rw.names)||!is.numeric(.rw.sd))
       stop(sQuote("pfilter")," error: ",sQuote(".rw.sd")," must be a named vector",call.=FALSE)
-    if (any(!(rw.names%in%paramnames)))
+    if (!all(rw.names%in%paramnames))
       stop(
            sQuote("pfilter")," error: the rownames of ",
            sQuote("params")," must include all of the names of ",
@@ -266,9 +266,8 @@
                    )
     if (inherits(weights,'try-error'))
       stop(sQuote("pfilter")," error: error in calculation of weights",call.=FALSE)
-    if (any(!is.finite(weights))) {
+    if (!all(is.finite(weights)))
       stop(sQuote("pfilter")," error: ",sQuote("dmeasure")," returns non-finite value",call.=FALSE)
-    }
     gnsi.dmeas <- FALSE
     
     ## compute prediction mean, prediction variance, filtering mean,

Modified: pkg/pomp/R/pmcmc-methods.R
===================================================================
--- pkg/pomp/R/pmcmc-methods.R	2015-06-18 11:56:46 UTC (rev 1221)
+++ pkg/pomp/R/pmcmc-methods.R	2015-06-18 17:55:06 UTC (rev 1222)
@@ -38,7 +38,7 @@
             } else {
               p <- sapply(y,is,'pmcmc')
               pl <- sapply(y,is,'pmcmcList')
-              if (any(!(p||pl)))
+              if (!all(p||pl))
                 stop("cannot mix ",sQuote("pmcmc"),
                      " and non-",sQuote("pmcmc")," objects")
               y[p] <- lapply(y[p],list)
@@ -58,7 +58,7 @@
             } else {
               p <- sapply(y,is,'pmcmc')
               pl <- sapply(y,is,'pmcmcList')
-              if (any(!(p||pl)))
+              if (!all(p||pl))
                 stop("cannot mix ",sQuote("pmcmc"),
                      " and non-",sQuote("pmcmc")," objects")
               y[p] <- lapply(y[p],list)



More information about the pomp-commits mailing list