18 #ifndef EULER_SDE_TMPL_HPP
19 #define EULER_SDE_TMPL_HPP
37 const std::type_info&
vtype()
const;
46 size_t steps = std::ceil((tf-ts)/stepsize);
47 double dt = (tf-ts)/steps;
55 for(
size_t i = 0; i < steps; i++){
56 if(
std::abs(dw_weight) > std::numeric_limits<real_type>::epsilon())
64 func->dxdt(vals, f0, tc);
65 func->dwdt(vals, bfnc, tc);
66 for(
size_t j = 0; j < dimension; j++){
67 vals[j] = vals[j] + dt_mul*f0[j] + bfnc[j]*w0[j];
71 rh_val->dxdt(vals, f0, tc);
72 for(
size_t j = 0; j < dimension; j++){
73 vals[j] = vals[j] + dt_mul*f0[j] + w0[j];
78 rh_val->dxdt(vals, f0, tc);
79 for(
size_t j = 0; j < dimension; j++){
80 vals[j] = vals[j] + dt_mul*f0[j];
94 return std::string(
"euler_sde_tmpl<") + this->vname() +
">";
101 dat.
retrieve(calc_dw,
"calc_dw",
this);
102 func =
dynamic_cast<rhs_sde*
>(rh_val);
105 err(
std::string(
"The rhs, ") + rh_val->name() +
", is not part of the rhs_sde inheritance heirarchy." +
106 " Consider setting calc_dw to 0 to allow for a constant multiple of the noise factor",
107 this->type() +
"::postprocess",
"integrator/euler_sde_tmpl.hpp",
FATAL_ERROR);
110 if(!rh_val->compare<T>()){
111 err(
"Bad rhs type passed to euler_sde integrator",
"euler_sde_tmpl::postprocess",
116 dat.
retrieve(_dw_weight,
"dw_weight",
this);
117 dw_weight=_dw_weight;
119 dat.
retrieve(_stepsize,
"stepsize",
this);
122 err(
"stepsize is invalid, must be >= 0",
"euler_sde_tmpl::postprocess",
123 "integrator/euler_sde_tmpl.hpp", dat[
"stepsize"],
FATAL_ERROR);
125 memp.create(dimension, &f0, &w0, &bfnc);