-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
7,695 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Generated by rstantools. Do not edit by hand. | ||
|
||
# names of stan models | ||
stanmodels <- c("rw1_model", "rw1_model_naive", "walker_glm", "walker_lm") | ||
|
||
# load each stan module | ||
Rcpp::loadModule("stan_fit4rw1_model_mod", what = TRUE) | ||
Rcpp::loadModule("stan_fit4rw1_model_naive_mod", what = TRUE) | ||
Rcpp::loadModule("stan_fit4walker_glm_mod", what = TRUE) | ||
Rcpp::loadModule("stan_fit4walker_lm_mod", what = TRUE) | ||
|
||
# instantiate each stanmodel object | ||
stanmodels <- sapply(stanmodels, function(model_name) { | ||
# create C++ code for stan model | ||
stan_file <- if(dir.exists("stan")) "stan" else file.path("inst", "stan") | ||
stan_file <- file.path(stan_file, paste0(model_name, ".stan")) | ||
stanfit <- rstan::stanc_builder(stan_file, | ||
allow_undefined = TRUE, | ||
obfuscate_model_name = FALSE) | ||
stanfit$model_cpp <- list(model_cppname = stanfit$model_name, | ||
model_cppcode = stanfit$cppcode) | ||
# create stanmodel object | ||
methods::new(Class = "stanmodel", | ||
model_name = stanfit$model_name, | ||
model_code = stanfit$model_code, | ||
model_cpp = stanfit$model_cpp, | ||
mk_cppmodule = function(x) get(paste0("rstantools_model_", model_name))) | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Generated by rstantools. Do not edit by hand. | ||
|
||
STANHEADERS_SRC = $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "message()" -e "cat(system.file('include', 'src', package = 'StanHeaders', mustWork = TRUE))" -e "message()" | grep "StanHeaders") | ||
|
||
STANC_FLAGS = $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "cat(ifelse(utils::packageVersion('rstan') >= '2.26', '-DUSE_STANC3',''))") | ||
PKG_CPPFLAGS = -I"../inst/include" -I"$(STANHEADERS_SRC)" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DRCPP_PARALLEL_USE_TBB=1 $(STANC_FLAGS) -D_HAS_AUTO_PTR_ETC=0 | ||
PKG_CXXFLAGS = $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "RcppParallel::CxxFlags()") $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "StanHeaders:::CxxFlags()") | ||
PKG_LIBS = $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "RcppParallel::RcppParallelLibs()") $(shell "$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" -e "StanHeaders:::LdFlags()") | ||
|
||
CXX_STD = CXX17 | ||
PKG_LIBS += $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Generated by rstantools. Do not edit by hand. | ||
|
||
#include <Rcpp.h> | ||
using namespace Rcpp ; | ||
#include "stanExports_rw1_model.h" | ||
|
||
RCPP_MODULE(stan_fit4rw1_model_mod) { | ||
|
||
|
||
class_<rstan::stan_fit<stan_model, boost::random::ecuyer1988> >("rstantools_model_rw1_model") | ||
|
||
.constructor<SEXP,SEXP,SEXP>() | ||
|
||
|
||
.method("call_sampler", &rstan::stan_fit<stan_model, boost::random::ecuyer1988> ::call_sampler) | ||
.method("param_names", &rstan::stan_fit<stan_model, boost::random::ecuyer1988> ::param_names) | ||
.method("param_names_oi", &rstan::stan_fit<stan_model, boost::random::ecuyer1988> ::param_names_oi) | ||
.method("param_fnames_oi", &rstan::stan_fit<stan_model, boost::random::ecuyer1988> ::param_fnames_oi) | ||
.method("param_dims", &rstan::stan_fit<stan_model, boost::random::ecuyer1988> ::param_dims) | ||
.method("param_dims_oi", &rstan::stan_fit<stan_model, boost::random::ecuyer1988> ::param_dims_oi) | ||
.method("update_param_oi", &rstan::stan_fit<stan_model, boost::random::ecuyer1988> ::update_param_oi) | ||
.method("param_oi_tidx", &rstan::stan_fit<stan_model, boost::random::ecuyer1988> ::param_oi_tidx) | ||
.method("grad_log_prob", &rstan::stan_fit<stan_model, boost::random::ecuyer1988> ::grad_log_prob) | ||
.method("log_prob", &rstan::stan_fit<stan_model, boost::random::ecuyer1988> ::log_prob) | ||
.method("unconstrain_pars", &rstan::stan_fit<stan_model, boost::random::ecuyer1988> ::unconstrain_pars) | ||
.method("constrain_pars", &rstan::stan_fit<stan_model, boost::random::ecuyer1988> ::constrain_pars) | ||
.method("num_pars_unconstrained", &rstan::stan_fit<stan_model, boost::random::ecuyer1988> ::num_pars_unconstrained) | ||
.method("unconstrained_param_names", &rstan::stan_fit<stan_model, boost::random::ecuyer1988> ::unconstrained_param_names) | ||
.method("constrained_param_names", &rstan::stan_fit<stan_model, boost::random::ecuyer1988> ::constrained_param_names) | ||
.method("standalone_gqs", &rstan::stan_fit<stan_model, boost::random::ecuyer1988> ::standalone_gqs) | ||
; | ||
} |
Oops, something went wrong.