29 SEXP
X, copy, rproc,
args, accumvars, covar;
31 const char *dimnm[3] = {
"name",
".id",
"time"};
33 PROTECT(gnsi = duplicate(gnsi));
35 PROTECT(tstart = AS_NUMERIC(tstart));
37 PROTECT(times = AS_NUMERIC(times));
38 ntimes = length(times);
40 err(
"length(times) < 1: no work to do.");
44 PROTECT(dimXstart = GET_DIM(xstart));
45 xdim = INTEGER(dimXstart);
46 nvars = xdim[0]; nrepsx = xdim[1];
49 PROTECT(dimP = GET_DIM(
params));
56 if (nrepsx %
nreps != 0) {
57 err(
"the larger number of replicates is not a multiple of smaller.");
62 dims[0] =
npars; dims[1] = nrepsx;
63 PROTECT(copy = duplicate(
params));
69 for (j = 0; j < nrepsx; j++) {
70 for (k = 0; k <
npars; k++, tgt++) {
76 }
else if (nrepsx <
nreps) {
77 if (
nreps % nrepsx != 0) {
78 err(
"the larger number of replicates is not a multiple of smaller.");
84 PROTECT(copy = duplicate(xstart));
87 setrownames(xstart,GET_ROWNAMES(GET_DIMNAMES(copy)),2);
90 for (j = 0; j <
nreps; j++) {
91 for (k = 0; k <
nvars; k++, tgt++) {
92 *tgt = src[k+
nvars*(j%nrepsx)];
98 PROTECT(rproc = GET_SLOT(
object,install(
"rprocess")));
99 PROTECT(
args = GET_SLOT(
object,install(
"userdata")));
100 PROTECT(accumvars = GET_SLOT(
object,install(
"accumvars")));
101 PROTECT(covar = GET_SLOT(
object,install(
"covar")));
106 type = *(INTEGER(GET_SLOT(rproc,install(
"type"))));
112 PROTECT(
fn = GET_SLOT(rproc,install(
"step.fn")));
114 accumvars,covar,
args,gnsi));
122 PROTECT(
fn = GET_SLOT(rproc,install(
"step.fn")));
123 deltat = *(REAL(AS_NUMERIC(GET_SLOT(rproc,install(
"delta.t")))));
125 accumvars,covar,
args,gnsi));
131 SEXP
fn, vmatrix, hmax;
132 PROTECT(
fn = GET_SLOT(rproc,install(
"rate.fn")));
133 PROTECT(vmatrix = GET_SLOT(rproc,install(
"v")));
134 PROTECT(hmax = GET_SLOT(rproc,install(
"hmax")));
136 accumvars,hmax,
args,gnsi));
SEXP euler_simulator(SEXP, SEXP, SEXP, SEXP, SEXP, double, rprocmode, SEXP, SEXP, SEXP, SEXP)
SEXP SSA_simulator(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP)
SEXP do_rprocess(SEXP object, SEXP xstart, SEXP tstart, SEXP times, SEXP params, SEXP gnsi)