63 SEXP Pnames, pompfun,
fn,
args;
67 dim = INTEGER(GET_DIM(
params));
70 PROTECT(Pnames = GET_ROWNAMES(GET_DIMNAMES(
params)));
73 PROTECT(pompfun = GET_SLOT(
object,install(
"rprior")));
77 PROTECT(
args = GET_SLOT(
object,install(
"userdata")));
87 double *pa, *p = REAL(
params);
99 PROTECT(ans = AS_NUMERIC(ans));
101 PROTECT(nm = GET_NAMES(ans));
103 err(
"'rprior' must return a named numeric vector.");
104 posn = INTEGER(PROTECT(
matchnames(Pnames,nm,
"parameters")));
109 for (i = 0; i < LENGTH(ans); i++) p[posn[i]] = pa[i];
116 PROTECT(ans = AS_NUMERIC(ans));
119 for (i = 0; i < LENGTH(ans); i++) p[posn[i]] = pa[i];
137 pidx = INTEGER(GET_SLOT(pompfun,install(
"paramindex")));
140 *((
void **) (&ff)) = R_ExternalPtrAddr(
fn);
142 R_CheckUserInterrupt();
158 warn(
"'rprior' unspecified: duplicating parameters.");
SEXP pomp_fun_handler(SEXP, SEXP, pompfunmode *, SEXP, SEXP, SEXP, SEXP)
void pomp_rprior(double *p, const int *parindex)
static R_INLINE SEXP matchnames(SEXP provided, SEXP needed, const char *where)
static R_INLINE int invalid_names(SEXP names)
static R_INLINE SEXP eval_call(SEXP fn, SEXP args, double *p, int n)
static R_INLINE SEXP ret_array(SEXP params)
static R_INLINE SEXP add_args(SEXP args, SEXP names)