[Pomp-commits] r868 - in pkg/pomp: . R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Nov 11 02:28:49 CET 2013


Author: kingaa
Date: 2013-11-11 02:28:48 +0100 (Mon, 11 Nov 2013)
New Revision: 868

Added:
   pkg/pomp/R/logmeanexp.R
   pkg/pomp/man/logmeanexp.Rd
Modified:
   pkg/pomp/DESCRIPTION
   pkg/pomp/NAMESPACE
   pkg/pomp/R/builder.R
   pkg/pomp/inst/NEWS
   pkg/pomp/man/builder.Rd
Log:
- add 'logmeanexp'
- fix 'pompBuilder' codes for windows


Modified: pkg/pomp/DESCRIPTION
===================================================================
--- pkg/pomp/DESCRIPTION	2013-11-05 22:58:31 UTC (rev 867)
+++ pkg/pomp/DESCRIPTION	2013-11-11 01:28:48 UTC (rev 868)
@@ -1,21 +1,24 @@
 Package: pomp
 Type: Package
 Title: Statistical inference for partially observed Markov processes
-Version: 0.45-5
-Date: 2013-11-05
-Authors at R: c(person(given=c("Aaron","A."),family="King",role=c("aut","cre"),email="kingaa at umich.edu"),
+Version: 0.45-6
+Date: 2013-11-10
+Authors at R: c(
+	   person(given=c("Aaron","A."),family="King",
+		role=c("aut","cre"),email="kingaa at umich.edu"),
 	  person(given=c("Edward","L."),family="Ionides",role=c("aut")),
 	  person(given=c("Carles"),family="Breto",role=c("aut")),
 	  person(given=c("Stephen","P."),family="Ellner",role=c("ctb")),
 	  person(given=c("Matthew","J."),family="Ferrari",role=c("ctb")),
 	  person(given=c("Bruce","E."),family="Kendall",role=c("ctb")),
 	  person(given=c("Michael"),family="Lavine",role=c("ctb")),
+	  person(given="Dao",family="Nguyen",role=c("ctb")),
 	  person(given=c("Daniel","C."),family="Reuman",role=c("ctb")),
 	  person(given=c("Helen"),family="Wearing",role=c("ctb")),
-	  person(given=c("Simon","N."),family="Wood",role=c("ctb")),
-	  person(given="Dao",family="Nguyen",role=c("ctb"))	)
+	  person(given=c("Simon","N."),family="Wood",role=c("ctb"))
+	  )
 Maintainer: Aaron A. King <kingaa at umich.edu>
-Author: Aaron A. King, Edward L. Ionides, Carles Breto, Steve Ellner, Bruce Kendall, Helen Wearing, Matthew J. Ferrari, Michael Lavine, Daniel C. Reuman, Simon N. Wood, Dao Nguyen
+Author: Aaron A. King, Edward L. Ionides, Carles Breto, Stephen P. Ellner, Matthew J. Ferrari, Bruce E. Kendall, Michael Lavine, Dao Nguyen, Daniel C. Reuman, Helen Wearing, Simon N. Wood
 URL: http://pomp.r-forge.r-project.org
 Description: Inference methods for partially-observed Markov processes
 Depends: R(>= 2.14.1), stats, graphics, methods, mvtnorm, subplex, deSolve
@@ -23,7 +26,8 @@
 LazyData: true
 BuildVignettes: true
 Collate: aaa.R authors.R version.R eulermultinom.R plugins.R 
-	 parmat.R slice-design.R profile-design.R sobol.R bsplines.R sannbox.R
+	 parmat.R logmeanexp.R slice-design.R 
+	 profile-design.R sobol.R bsplines.R sannbox.R
 	 pomp-fun.R pomp-class.R pomp.R pomp-methods.R 
 	 rmeasure-pomp.R rprocess-pomp.R init-state-pomp.R dmeasure-pomp.R dprocess-pomp.R skeleton-pomp.R 
 	 simulate-pomp.R trajectory-pomp.R plot-pomp.R 

Modified: pkg/pomp/NAMESPACE
===================================================================
--- pkg/pomp/NAMESPACE	2013-11-05 22:58:31 UTC (rev 867)
+++ pkg/pomp/NAMESPACE	2013-11-11 01:28:48 UTC (rev 868)
@@ -81,6 +81,7 @@
        compare.mif,
        nlf,
        parmat,
+       logmeanexp,
        probe.mean,
        probe.median,
        probe.var,

Modified: pkg/pomp/R/builder.R
===================================================================
--- pkg/pomp/R/builder.R	2013-11-05 22:58:31 UTC (rev 867)
+++ pkg/pomp/R/builder.R	2013-11-11 01:28:48 UTC (rev 868)
@@ -96,7 +96,7 @@
                  )
 
 header <- list(
-               file="/* pomp model file: {%name%} */\n\n#include <pomp.h>\n#include <R_ext/Rdynload.h>\n\n",
+               file="/* pomp model file: {%name%} */\n\n#include <{%pompheader%}>\n#include <R_ext/Rdynload.h>\n\n",
                rmeasure="\nvoid {%name%}_rmeasure (double *__y, double *__x, double *__p, int *__obsindex, int *__stateindex, int *__parindex, int *__covindex, int __ncovars, double *__covars, double t)\n{\n",
                dmeasure= "\nvoid {%name%}_dmeasure (double *__lik, double *__y, double *__x, double *__p, int give_log, int *__obsindex, int *__stateindex, int *__parindex, int *__covindex, int __ncovars, double *__covars, double t)\n{\n",
                step.fn="\nvoid {%name%}_stepfn (double *__x, const double *__p, const int *__stateindex, const int *__parindex, const int *__covindex, int __covdim, const double *__covars, double t, double dt)\n{\n",
@@ -148,10 +148,15 @@
 
   modelfile <- paste0(name,".c")
   solib <- paste0(name,.Platform$dynlib.ext)
-
+  if (.Platform$OS.type=="unix") {
+    pompheader <- "pomp.h"
+  } else {
+    pompheader <- system.file("include/pomp.h",package="pomp")
+  }
+  
   out <- file(description=modelfile,open="w")
   
-  cat(file=out,render(header$file,name=name))
+  cat(file=out,render(header$file,name=name,pompheader=pompheader))
 
   for (f in utility.fns) {
     cat(file=out,f)

Added: pkg/pomp/R/logmeanexp.R
===================================================================
--- pkg/pomp/R/logmeanexp.R	                        (rev 0)
+++ pkg/pomp/R/logmeanexp.R	2013-11-11 01:28:48 UTC (rev 868)
@@ -0,0 +1,4 @@
+logmeanexp <- function (x) {
+  mx <- max(x)
+  mx+log(mean(exp(x-mx)))
+}

Modified: pkg/pomp/inst/NEWS
===================================================================
--- pkg/pomp/inst/NEWS	2013-11-05 22:58:31 UTC (rev 867)
+++ pkg/pomp/inst/NEWS	2013-11-11 01:28:48 UTC (rev 868)
@@ -1,4 +1,9 @@
 NEWS
+0.45-5
+     o	a fix so that 'pompBuilder' will find 'pomp.h' header file on Windows machines.  Thanks to Dave Hayman for finding the problem.
+
+     o	some reorganization of the source package structure.
+
 0.45-4
      o	changes in the way 'reulermultinom', 'deulermultinom', 'dot_product' are exported to other packages.  Rather than just being exported as linkables, these are now also defined as static inline functions in the 'pomp.h' header.
 

Modified: pkg/pomp/man/builder.Rd
===================================================================
--- pkg/pomp/man/builder.Rd	2013-11-05 22:58:31 UTC (rev 867)
+++ pkg/pomp/man/builder.Rd	2013-11-11 01:28:48 UTC (rev 868)
@@ -55,12 +55,20 @@
 }
 \value{
   The constructed \code{pomp} object.
-  A side-effect is the writing and compilation of a C code into a shared-object library.
+  A side-effect is the writing and compilation of a C code into a dynamics shared object.
   These files will reside in the current working directory (see \code{\link{getwd}}).
-  If \code{pompBuilder} has been called with \code{link=FALSE}, this shared-object library must be linked (see \code{\link{dyn.load}}) before the \code{pomp} object can be used.
+  If \code{pompBuilder} has been called with \code{link=FALSE}, this dynamic shared object must be linked (see \code{\link{dyn.load}}) before the \code{pomp} object can be used.
+
+  \strong{Parallel computing caution:}
+  note that, since a side-effect of running \code{pompBuilder} is the writing and compilation of a file, caution must be used when running parallel computations.
+  Simultaneous execution of \code{pompBuilder} on nodes sharing a common disk will cause all nodes to attempt to write the same file at the same time;
+  the results will be undefined.
+  If multiple nodes are to work on the same \code{pomp} object built by \code{pompBuilder}, first run \code{pompBuilder} once (perhaps with \code{link=FALSE}) to write the C file and compile it into a dynamic shared object file.
+  The \code{pomp} object returned by \code{pompBuilder} can then be shared with all worker nodes.
+  Note, however, that all worker nodes must dynamically load (using \code{\link{dyn.load}}) the dynamic shared object file before anything can be done with the \code{pomp} object.
 }
 \details{
-  \code{pompBuilder} assumes that files can be written to the current working directory and that shared-object libraries can be compiled and linked, i.e., that \code{R CMD SHLIB} will work.
+  \code{pompBuilder} assumes that files can be written to the current working directory and that dynamic shared objects can be compiled and linked, i.e., that \code{R CMD SHLIB} will work.
   This will not typically be the case in out-of-the-box Windows installations.
 }
 \seealso{

Added: pkg/pomp/man/logmeanexp.Rd
===================================================================
--- pkg/pomp/man/logmeanexp.Rd	                        (rev 0)
+++ pkg/pomp/man/logmeanexp.Rd	2013-11-11 01:28:48 UTC (rev 868)
@@ -0,0 +1,23 @@
+\name{logmeanexp}
+\alias{logmeanexp}
+\title{The log-mean-exp trick}
+\description{
+  \code{logmeanexp} computes the log-mean-exp of a set of numbers.
+}
+\usage{
+logmeanexp(x)
+}
+\arguments{
+  \item{x}{numeric}
+}
+\value{
+  \code{log(mean(exp(x)))} computed so as to avoid over- or underflow.
+}
+\author{Aaron A. King \email{kingaa at umich dot edu}}
+\examples{
+  ## generate a bifurcation diagram for the Ricker map
+  pompExample(ricker)
+  ll <- replicate(n=5,logLik(pfilter(ricker,Np=1000)))
+  ## an estimate of the log likelihood:
+  logmeanexp(ll)
+}



More information about the pomp-commits mailing list