[Pomp-commits] r1154 - in pkg/pomp: . inst/include src tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu May 21 23:51:36 CEST 2015
Author: kingaa
Date: 2015-05-21 23:51:35 +0200 (Thu, 21 May 2015)
New Revision: 1154
Modified:
pkg/pomp/DESCRIPTION
pkg/pomp/inst/include/pomp.h
pkg/pomp/src/pomp.h
pkg/pomp/tests/synlik.Rout.save
Log:
- use 'const' where appropriate in pomp's C API
Modified: pkg/pomp/DESCRIPTION
===================================================================
--- pkg/pomp/DESCRIPTION 2015-05-21 13:40:13 UTC (rev 1153)
+++ pkg/pomp/DESCRIPTION 2015-05-21 21:51:35 UTC (rev 1154)
@@ -1,8 +1,8 @@
Package: pomp
Type: Package
Title: Statistical Inference for Partially Observed Markov Processes
-Version: 0.63-6
-Date: 2015-04-16
+Version: 0.63-7
+Date: 2015-05-21
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")),
Modified: pkg/pomp/inst/include/pomp.h
===================================================================
--- pkg/pomp/inst/include/pomp.h 2015-05-21 13:40:13 UTC (rev 1153)
+++ pkg/pomp/inst/include/pomp.h 2015-05-21 21:51:35 UTC (rev 1154)
@@ -65,7 +65,7 @@
// But note that when reulermultinom is called inside a pomp 'rprocess',
// there is no need to call {Get,Put}RNGState() as this is handled by pomp
-static R_INLINE void reulermultinom (int m, double size, double *rate,
+static R_INLINE void reulermultinom (int m, double size, const double *rate,
double dt, double *trans) {
double p = 0.0;
int j, k;
@@ -114,7 +114,7 @@
// See '?deulermultinom' and vignettes for more on the Euler-multinomial
// distributions.
-static R_INLINE double deulermultinom (int m, double size, double *rate,
+static R_INLINE double deulermultinom (int m, double size, const double *rate,
double dt, double *trans, int give_log) {
double p = 0.0;
double n = 0.0;
@@ -234,8 +234,8 @@
// prototype for stochastic simulation algorithm reaction-rate function, as used by "gillespie.sim":
typedef double pomp_ssa_rate_fn(int j, double t, const double *x, const double *p,
- int *stateindex, int *parindex, int *covindex,
- int ncovar, double *covars);
+ const int *stateindex, const int *parindex, const int *covindex,
+ int ncovar, const double *covars);
// Description:
// on input:
// j = integer specifying the number of the reaction whose rate is desired
@@ -283,7 +283,7 @@
// PROTOTYPE FOR ONE-STEP LOG PROBABILITY DENSITY FUNCTION, AS USED BY "ONESTEP.DENS":
typedef void pomp_onestep_pdf(double *f,
- double *x1, double *x2, double t1, double t2, const double *p,
+ const double *x1, const double *x2, double t1, double t2, const double *p,
const int *stateindex, const int *parindex, const int *covindex,
int ncovars, const double *covars);
// Description:
@@ -306,9 +306,9 @@
// f = pointer to the probability density (a single scalar)
// prototype for deterministic skeleton evaluation
-typedef void pomp_skeleton (double *f, double *x, double *p,
- int *stateindex, int *parindex, int *covindex,
- int ncovars, double *covars, double t);
+typedef void pomp_skeleton (double *f, const double *x, const double *p,
+ const int *stateindex, const int *parindex, const int *covindex,
+ int ncovars, const double *covars, double t);
// Description:
// on input:
@@ -328,9 +328,9 @@
// f = pointer to value of the map or vectorfield (a vector of the same length as 'x')
// prototype for measurement model simulation
-typedef void pomp_measure_model_simulator (double *y, double *x, double *p,
- int *obsindex, int *stateindex, int *parindex, int *covindex,
- int ncovars, double *covars, double t);
+typedef void pomp_measure_model_simulator (double *y, const double *x, const double *p,
+ const int *obsindex, const int *stateindex, const int *parindex, const int *covindex,
+ int ncovars, const double *covars, double t);
// Description:
// on input:
// x = pointer to state vector at time t
@@ -356,9 +356,9 @@
// prototype for measurement model density evaluator
-typedef void pomp_measure_model_density (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);
+typedef void pomp_measure_model_density (double *lik, const double *y, const double *x, const double *p, int give_log,
+ const int *obsindex, const int *stateindex, const int *parindex, const int *covindex,
+ int ncovars, const double *covars, double t);
// Description:
// on input:
// y = pointer to vector of observables at time t
@@ -381,7 +381,7 @@
// lik = pointer to scalar containing (log) likelihood
// prototype for prior simulation
-typedef void pomp_rprior (double *p, int *parindex);
+typedef void pomp_rprior (double *p, const int *parindex);
// Description:
// on input:
// p = pointer to parameter vector
@@ -395,7 +395,7 @@
// Inclusion of these calls in the user-defined function may result in significant slowdown.
// prototype for prior density evaluation
-typedef void pomp_dprior (double *lik, double *p, int give_log, int *parindex);
+typedef void pomp_dprior (double *lik, const double *p, int give_log, const int *parindex);
// Description:
// on input:
// p = pointer to parameter vector
@@ -406,6 +406,6 @@
// lik = pointer to vector containing likelihoods
// prototype for parameter transformation function.
-typedef void pomp_transform_fn (double *pt, double *p, int *parindex);
+typedef void pomp_transform_fn (double *pt, const double *p, const int *parindex);
#endif
Modified: pkg/pomp/src/pomp.h
===================================================================
--- pkg/pomp/src/pomp.h 2015-05-21 13:40:13 UTC (rev 1153)
+++ pkg/pomp/src/pomp.h 2015-05-21 21:51:35 UTC (rev 1154)
@@ -65,7 +65,7 @@
// But note that when reulermultinom is called inside a pomp 'rprocess',
// there is no need to call {Get,Put}RNGState() as this is handled by pomp
-static R_INLINE void reulermultinom (int m, double size, double *rate,
+static R_INLINE void reulermultinom (int m, double size, const double *rate,
double dt, double *trans) {
double p = 0.0;
int j, k;
@@ -114,7 +114,7 @@
// See '?deulermultinom' and vignettes for more on the Euler-multinomial
// distributions.
-static R_INLINE double deulermultinom (int m, double size, double *rate,
+static R_INLINE double deulermultinom (int m, double size, const double *rate,
double dt, double *trans, int give_log) {
double p = 0.0;
double n = 0.0;
@@ -234,8 +234,8 @@
// prototype for stochastic simulation algorithm reaction-rate function, as used by "gillespie.sim":
typedef double pomp_ssa_rate_fn(int j, double t, const double *x, const double *p,
- int *stateindex, int *parindex, int *covindex,
- int ncovar, double *covars);
+ const int *stateindex, const int *parindex, const int *covindex,
+ int ncovar, const double *covars);
// Description:
// on input:
// j = integer specifying the number of the reaction whose rate is desired
@@ -283,7 +283,7 @@
// PROTOTYPE FOR ONE-STEP LOG PROBABILITY DENSITY FUNCTION, AS USED BY "ONESTEP.DENS":
typedef void pomp_onestep_pdf(double *f,
- double *x1, double *x2, double t1, double t2, const double *p,
+ const double *x1, const double *x2, double t1, double t2, const double *p,
const int *stateindex, const int *parindex, const int *covindex,
int ncovars, const double *covars);
// Description:
@@ -306,9 +306,9 @@
// f = pointer to the probability density (a single scalar)
// prototype for deterministic skeleton evaluation
-typedef void pomp_skeleton (double *f, double *x, double *p,
- int *stateindex, int *parindex, int *covindex,
- int ncovars, double *covars, double t);
+typedef void pomp_skeleton (double *f, const double *x, const double *p,
+ const int *stateindex, const int *parindex, const int *covindex,
+ int ncovars, const double *covars, double t);
// Description:
// on input:
@@ -328,9 +328,9 @@
// f = pointer to value of the map or vectorfield (a vector of the same length as 'x')
// prototype for measurement model simulation
-typedef void pomp_measure_model_simulator (double *y, double *x, double *p,
- int *obsindex, int *stateindex, int *parindex, int *covindex,
- int ncovars, double *covars, double t);
+typedef void pomp_measure_model_simulator (double *y, const double *x, const double *p,
+ const int *obsindex, const int *stateindex, const int *parindex, const int *covindex,
+ int ncovars, const double *covars, double t);
// Description:
// on input:
// x = pointer to state vector at time t
@@ -356,9 +356,9 @@
// prototype for measurement model density evaluator
-typedef void pomp_measure_model_density (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);
+typedef void pomp_measure_model_density (double *lik, const double *y, const double *x, const double *p, int give_log,
+ const int *obsindex, const int *stateindex, const int *parindex, const int *covindex,
+ int ncovars, const double *covars, double t);
// Description:
// on input:
// y = pointer to vector of observables at time t
@@ -381,7 +381,7 @@
// lik = pointer to scalar containing (log) likelihood
// prototype for prior simulation
-typedef void pomp_rprior (double *p, int *parindex);
+typedef void pomp_rprior (double *p, const int *parindex);
// Description:
// on input:
// p = pointer to parameter vector
@@ -395,7 +395,7 @@
// Inclusion of these calls in the user-defined function may result in significant slowdown.
// prototype for prior density evaluation
-typedef void pomp_dprior (double *lik, double *p, int give_log, int *parindex);
+typedef void pomp_dprior (double *lik, const double *p, int give_log, const int *parindex);
// Description:
// on input:
// p = pointer to parameter vector
@@ -406,6 +406,6 @@
// lik = pointer to vector containing likelihoods
// prototype for parameter transformation function.
-typedef void pomp_transform_fn (double *pt, double *p, int *parindex);
+typedef void pomp_transform_fn (double *pt, const double *p, const int *parindex);
#endif
Modified: pkg/pomp/tests/synlik.Rout.save
===================================================================
--- pkg/pomp/tests/synlik.Rout.save 2015-05-21 13:40:13 UTC (rev 1153)
+++ pkg/pomp/tests/synlik.Rout.save 2015-05-21 21:51:35 UTC (rev 1154)
@@ -1,6 +1,6 @@
-R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet"
-Copyright (C) 2014 The R Foundation for Statistical Computing
+R version 3.2.0 (2015-04-16) -- "Full of Ingredients"
+Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
@@ -16,8 +16,6 @@
Type 'q()' to quit R.
> library(pomp)
-Loading required package: subplex
-Loading required package: nloptr
>
> pompExample(ou2)
newly created object(s):
@@ -87,14 +85,14 @@
Kruskal-Wallis rank sum test
data: list(loglik.probe, loglik.pfilter)
-Kruskal-Wallis chi-squared = 10.5617, df = 1, p-value = 0.001155
+Kruskal-Wallis chi-squared = 10.562, df = 1, p-value = 0.001155
> wilcox.test(loglik.probe,loglik.pfilter)
Wilcoxon rank sum test with continuity correction
data: loglik.probe and loglik.pfilter
-W = 139841, p-value = 0.001155
+W = 139840, p-value = 0.001155
alternative hypothesis: true location shift is not equal to 0
> ks.test(loglik.pfilter,loglik.probe)
@@ -116,4 +114,4 @@
>
> proc.time()
user system elapsed
- 7.286 0.042 7.322
+ 5.628 0.060 5.764
More information about the pomp-commits
mailing list