diff --git a/inst/include/model_methods.cpp b/inst/include/model_methods.cpp index 70eeabf5..e4931462 100644 --- a/inst/include/model_methods.cpp +++ b/inst/include/model_methods.cpp @@ -3,13 +3,13 @@ #include #include #include -#include #ifdef CMDSTAN_JSON #include #else #include #include #endif +#include std::shared_ptr var_context(std::string file_path) { if (file_path == "") { @@ -36,7 +36,7 @@ Rcpp::List model_ptr(std::string data_path, boost::uint32_t seed) { Rcpp::XPtr ptr( &new_model(*var_context(data_path), seed, &Rcpp::Rcout) ); - Rcpp::XPtr base_rng(new boost::ecuyer1988(seed)); + Rcpp::XPtr base_rng(new stan::rng_t(seed)); return Rcpp::List::create( Rcpp::Named("model_ptr") = ptr, Rcpp::Named("base_rng") = base_rng @@ -144,7 +144,7 @@ std::vector constrain_variables(SEXP ext_model_ptr, SEXP base_rng, bool return_trans_pars, bool return_gen_quants) { Rcpp::XPtr ptr(ext_model_ptr); - Rcpp::XPtr rng(base_rng); + Rcpp::XPtr rng(base_rng); std::vector params_i; std::vector vars; diff --git a/inst/include/rcpp_tuple_interop.hpp b/inst/include/rcpp_tuple_interop.hpp index 52a614ab..2d59f949 100644 --- a/inst/include/rcpp_tuple_interop.hpp +++ b/inst/include/rcpp_tuple_interop.hpp @@ -1,3 +1,6 @@ +#ifndef CMDSTANR_RCPP_TUPLE_INTEROP_HPP +#define CMDSTANR_RCPP_TUPLE_INTEROP_HPP + #include #include @@ -38,3 +41,5 @@ namespace Rcpp { }, x); } } + +#endif diff --git a/inst/include/stan_rng.hpp b/inst/include/stan_rng.hpp new file mode 100644 index 00000000..834464f7 --- /dev/null +++ b/inst/include/stan_rng.hpp @@ -0,0 +1,17 @@ +#ifndef CMDSTANR_STAN_RNG_HPP +#define CMDSTANR_STAN_RNG_HPP + +#include +#include + +// A consistent rng_t is defined from 2.35 onwards +// so add a fallback for older versions +#if STAN_MAJOR == 2 && STAN_MINOR >= 35 +#include +#else +namespace stan { + using rng_t = boost::ecuyer1988; +} +#endif + +#endif