Skip to content

Commit

Permalink
Merge pull request #126 from stan-dev/new-stan-rng
Browse files Browse the repository at this point in the history
Add handling for new RNG type in Stan
  • Loading branch information
andrjohns authored May 20, 2024
2 parents 2010d4b + 0deef43 commit 99c0d66
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion R/rstan_config.R
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ rstan_config <- function(pkgdir = ".") {
} else {
cppcode <- c("#include <rstan/rstaninc.hpp>", cppcode)
}
rng_type <- ifelse(utils::packageVersion('StanHeaders') >= "2.34",
"stan::rng_t", "boost::ecuyer1988")
if (utils::packageVersion('StanHeaders') >= "2.34") {
cppcode <- gsub("boost::ecuyer1988", "stan::rng_t", cppcode, fixed = TRUE)
}
Expand Down Expand Up @@ -278,7 +280,7 @@ rstan_config <- function(pkgdir = ".") {
header = paste0('#include "', hdr_name, '"'),
module = paste0("stan_fit4",
model_name, "_mod"),
CppClass = "rstan::stan_fit<stan_model, boost::random::ecuyer1988> ",
CppClass = paste0("rstan::stan_fit<stan_model, ", rng_type, "> "),
Rfile = FALSE)
)
})
Expand Down

0 comments on commit 99c0d66

Please sign in to comment.