[Pomp-commits] r187 - in pkg: . inst/examples
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Dec 28 19:09:50 CET 2009
Author: kingaa
Date: 2009-12-28 19:09:50 +0100 (Mon, 28 Dec 2009)
New Revision: 187
Modified:
pkg/DESCRIPTION
pkg/inst/examples/euler_sir.R
Log:
- tests/examples.R has been improved for greater portability per suggestion of Brian Ripley
Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION 2009-12-10 13:07:16 UTC (rev 186)
+++ pkg/DESCRIPTION 2009-12-28 18:09:50 UTC (rev 187)
@@ -1,8 +1,8 @@
Package: pomp
Type: Package
Title: Statistical inference for partially observed Markov processes
-Version: 0.26-2
-Date: 2009-12-09
+Version: 0.26-3
+Date: 2009-12-28
Author: Aaron A. King, Edward L. Ionides, Carles Breto, Steve Ellner, Bruce Kendall
Maintainer: Aaron A. King <kingaa at umich.edu>
Description: Inference methods for partially-observed Markov processes
Modified: pkg/inst/examples/euler_sir.R
===================================================================
--- pkg/inst/examples/euler_sir.R 2009-12-10 13:07:16 UTC (rev 186)
+++ pkg/inst/examples/euler_sir.R 2009-12-28 18:09:50 UTC (rev 187)
@@ -127,14 +127,21 @@
if (Sys.info()['sysname']=='Linux') {
- modelfile <- system.file("examples/euler_sir.c",package="pomp")
- includedir <- system.file("include",package="pomp")
- lib <- system.file("libs/pomp.so",package="pomp")
+ model <- "euler_sir"
+ pkg <- "pomp"
+ modelfile <- paste(model,".c",sep="")
+ headerfile <- system.file("include/pomp.h",package=pkg)
+ pkglib <- system.file(paste("libs/",pkg,.Platform$dynlib.ext,sep=""),package=pkg)
+ solib <- paste(model,.Platform$dynlib.ext,sep="")
## compile the model into a shared-object library
- system(paste("cp",modelfile,"."))
- system(paste("cp ",includedir,"/pomp.h .",sep=""))
- system(paste("R CMD SHLIB -o ./euler_sir.so euler_sir.c",lib))
+ if (!file.copy(from=system.file(paste("examples/",modelfile,sep=""),package=pkg),to=getwd()))
+ stop("cannot copy source code ",modelfile," to ",getwd())
+ if (!file.copy(from=headerfile,to=getwd()))
+ stop("cannot copy header ",headerfile," to ",getwd())
+ rv <- system(paste(R.home("bin/R"),"CMD SHLIB -o",solib,modelfile,pkglib))
+ if (rv!=0)
+ stop("cannot compile shared-object library ",solib)
po <- pomp(
times=seq(1/52,4,by=1/52),
@@ -172,7 +179,7 @@
}
)
- dyn.load("euler_sir.so") ## load the shared-object library
+ dyn.load(solib) ## load the shared-object library
## compute a trajectory of the deterministic skeleton
tic <- Sys.time()
@@ -186,6 +193,6 @@
toc <- Sys.time()
print(toc-tic)
- dyn.unload("euler_sir.so")
+ dyn.unload(solib)
}
More information about the pomp-commits
mailing list