56 SEXP Pnames, pompfun,
fn,
args, F;
60 dim = INTEGER(GET_DIM(
params));
63 PROTECT(Pnames = GET_ROWNAMES(GET_DIMNAMES(
params)));
66 PROTECT(pompfun = GET_SLOT(
object,install(
"dprior")));
70 PROTECT(
args = GET_SLOT(
object,install(
"userdata")));
73 PROTECT(F = NEW_NUMERIC(
nreps));
85 for (j = 0, ps = REAL(
params), pt = REAL(F); j <
nreps; j++, ps +=
npars, pt++) {
88 *pt = *(REAL(AS_NUMERIC(ans)));
97 int give_log, *pidx = 0;
103 pidx = INTEGER(GET_SLOT(pompfun,install(
"paramindex")));
106 *((
void **) (&ff)) = R_ExternalPtrAddr(
fn);
108 give_log = *(INTEGER(AS_INTEGER(log)));
110 R_CheckUserInterrupt();
113 for (j = 0, pt = REAL(F), ps = REAL(
params); j <
nreps; j++, ps +=
npars, pt++)
114 (*ff)(pt,ps,give_log,pidx);
124 give_log = *(INTEGER(AS_INTEGER(log)));
127 for (j = 0, pt = REAL(F); j <
nreps; j++, pt++)
128 *pt = (give_log) ? 0.0 : 1.0;
SEXP pomp_fun_handler(SEXP, SEXP, pompfunmode *, SEXP, SEXP, SEXP, SEXP)
static R_INLINE SEXP eval_call(SEXP fn, SEXP args, double *p, int n)
static R_INLINE SEXP add_args(SEXP names, SEXP log, SEXP args)
void pomp_dprior(double *lik, const double *p, int give_log, const int *parindex)
static R_INLINE SEXP as_matrix(SEXP x)