15template <
class STATE,
class PARAMETERS,
size_t NEVENT>
41 return 2*
sizeof(
slate_t) +
sizeof(
size_t)
47 memcpy(o,A,
sizeof(A)); o +=
sizeof(A);
48 memcpy(o,&X.
event,
sizeof(
size_t)); o +=
sizeof(size_t);
57 memcpy(A,o,
sizeof(A)); o +=
sizeof(A);
59 memcpy(&X.
event,o,
sizeof(
size_t)); o +=
sizeof(size_t);
124 string_t
yaml (string_t tab)
const;
134#define PARAM_SET(X) if (!ISNA(p[m])) params.X = p[m]; m++;
135#define RATE_CALC(X) total += rate[m++] = (X);
136#define YAML_PARAM(X) (t + #X + ": " + std::to_string(params.X) + "\n")
137#define YAML_STATE(X) (t + #X + ": " + std::to_string(state.X) + "\n")
139template <
class STATE,
class PARAMETERS,
size_t NEVENT>
146 if (R_FINITE(total_rate)) {
147 if (total_rate > 0) {
154 if (!R_FINITE(rate[
event]))
155 Rprintf(
"in '%s': invalid event rate[%zd]=%lg\n",__func__,
event,rate[
event]);
157 err(
"in '%s': invalid total event rate=%lg", __func__,total_rate);
159 double u = runif(0,total_rate);
163 err(
"in '%s': negative rate[%zd]=%lg",__func__,
event,rate[
event]);
170template <
class STATE,
class PARAMETERS,
size_t NEVENT>
177 err(
"cannot simulate backward! (current t=%lg, requested t=%lg)",
current,tfin);
178 while (
next < tfin) {
183 R_CheckUserInterrupt();
virtual void jump(int e)=0
makes a jump
popul_proc_t(const popul_proc_t &X)
copy constructor
friend raw_t * operator>>(const popul_proc_t &X, raw_t *o)
binary serialization
virtual void valid(void) const
lbdp_parameters_t parameters_t
popul_proc_t & operator=(const popul_proc_t &X)
copy assignment operator
virtual void rinit(void)=0
initialize the state
~popul_proc_t(void)
destructor
popul_proc_t(popul_proc_t &&)=delete
move constructor
static const size_t nevent
void update_params(double *, int)
set parameters
slate_t time(void) const
get current time.
popul_proc_t(raw_t *o)
constructor from serialized binary form
popul_proc_t(double t0=0)
size_t bytesize(void) const
size of serialized binary form
double event_rates(double *rate, int n) const
compute event rates
void update_IVPs(double *, int)
set initial-value parameters
string_t yaml(string_t tab) const
machine/human readable info
void update_clocks(void)
updates clock and next event
static double event_rates(double *__x, const double *__p, double t, const int *__stateindex, const int *__parindex, double *rate, double *penalty)