-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ignacio82/main
Various changes so the package works outside google.
- Loading branch information
Showing
43 changed files
with
10,400 additions
and
727 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
^.*\.Rproj$ | ||
^\.Rproj\.user$ |
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,10 @@ | ||
.Rproj.user | ||
.Rhistory | ||
.RData | ||
.Ruserdata | ||
src/*.o | ||
src/*.so | ||
src/*.dll | ||
*.cc | ||
*.h | ||
*.Rproj |
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 @@ | ||
*.tar.gz |
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,45 @@ | ||
FROM rocker/r-base:latest | ||
LABEL maintainer="Ignacio Martinez <[email protected]>" | ||
|
||
RUN apt-get update -qq \ | ||
&& apt-get install -y \ | ||
libxml2-dev \ | ||
libssl-dev \ | ||
libcurl4-openssl-dev \ | ||
libv8-dev \ | ||
texlive-latex-extra \ | ||
libharfbuzz-dev \ | ||
libfribidi-dev \ | ||
libpng-dev \ | ||
libtiff5-dev \ | ||
libjpeg-dev \ | ||
libpq5 \ | ||
pandoc \ | ||
&& install.r \ | ||
magrittr \ | ||
R6 \ | ||
Rcpp \ | ||
cubelyr \ | ||
dplyr \ | ||
ggplot2 \ | ||
glue \ | ||
magrittr \ | ||
methods \ | ||
purrr \ | ||
rstan \ | ||
rstantools \ | ||
scales \ | ||
tibble \ | ||
tidyr \ | ||
vizdraws \ | ||
devtools \ | ||
BH \ | ||
RcppEigen \ | ||
methods \ | ||
rmarkdown \ | ||
vizdraws \ | ||
knitr \ | ||
rmarkdown \ | ||
roxygen2 \ | ||
gsynth | ||
|
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,12 @@ | ||
#!/bin/bash | ||
|
||
docker build --tag bsynth . | ||
|
||
docker run --rm \ | ||
-v $(pwd):/tmp/working_dir \ | ||
-v $(pwd)/../..:/tmp/bsynth \ | ||
-w /tmp/working_dir \ | ||
bsynth \ | ||
R -e "devtools::test(pkg = '/tmp/bsynth'); devtools::build(pkg = '/tmp/bsynth', path = '/tmp/working_dir, binary = TRUE')" | ||
|
||
|
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
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,36 @@ | ||
# Generated by rstantools. Do not edit by hand. | ||
|
||
# names of stan models | ||
stanmodels <- c("factor_functions", "factor_model_with_covariates", "factor_model_without_covariates", "model1_gammaOmega", "model1", "model2", "model3", "model4", "model5", "model6", "model7", "model8") | ||
|
||
# load each stan module | ||
Rcpp::loadModule("stan_fit4factor_functions_mod", what = TRUE) | ||
Rcpp::loadModule("stan_fit4factor_model_with_covariates_mod", what = TRUE) | ||
Rcpp::loadModule("stan_fit4factor_model_without_covariates_mod", what = TRUE) | ||
Rcpp::loadModule("stan_fit4model1_gammaOmega_mod", what = TRUE) | ||
Rcpp::loadModule("stan_fit4model1_mod", what = TRUE) | ||
Rcpp::loadModule("stan_fit4model2_mod", what = TRUE) | ||
Rcpp::loadModule("stan_fit4model3_mod", what = TRUE) | ||
Rcpp::loadModule("stan_fit4model4_mod", what = TRUE) | ||
Rcpp::loadModule("stan_fit4model5_mod", what = TRUE) | ||
Rcpp::loadModule("stan_fit4model6_mod", what = TRUE) | ||
Rcpp::loadModule("stan_fit4model7_mod", what = TRUE) | ||
Rcpp::loadModule("stan_fit4model8_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("model_", model_name))) | ||
}) |
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 @@ | ||
// Insert all #include<foo.hpp> statements here |
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,9 @@ | ||
# 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") | ||
|
||
PKG_CPPFLAGS = -I"../inst/include" -I"$(STANHEADERS_SRC)" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_MATH_OVERFLOW_ERROR_POLICY=errno_on_error | ||
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 = CXX14 |
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,9 @@ | ||
# 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") | ||
|
||
PKG_CPPFLAGS = -I"../inst/include" -I"$(STANHEADERS_SRC)" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DRCPP_PARALLEL_USE_TBB=1 | ||
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 = CXX14 |
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,47 @@ | ||
// Generated by using Rcpp::compileAttributes() -> do not edit by hand | ||
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 | ||
|
||
#include <RcppEigen.h> | ||
#include <Rcpp.h> | ||
|
||
using namespace Rcpp; | ||
|
||
#ifdef RCPP_USE_GLOBAL_ROSTREAM | ||
Rcpp::Rostream<true>& Rcpp::Rcout = Rcpp::Rcpp_cout_get(); | ||
Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get(); | ||
#endif | ||
|
||
|
||
RcppExport SEXP _rcpp_module_boot_stan_fit4factor_functions_mod(); | ||
RcppExport SEXP _rcpp_module_boot_stan_fit4factor_model_with_covariates_mod(); | ||
RcppExport SEXP _rcpp_module_boot_stan_fit4factor_model_without_covariates_mod(); | ||
RcppExport SEXP _rcpp_module_boot_stan_fit4model1_mod(); | ||
RcppExport SEXP _rcpp_module_boot_stan_fit4model1_gammaOmega_mod(); | ||
RcppExport SEXP _rcpp_module_boot_stan_fit4model2_mod(); | ||
RcppExport SEXP _rcpp_module_boot_stan_fit4model3_mod(); | ||
RcppExport SEXP _rcpp_module_boot_stan_fit4model4_mod(); | ||
RcppExport SEXP _rcpp_module_boot_stan_fit4model5_mod(); | ||
RcppExport SEXP _rcpp_module_boot_stan_fit4model6_mod(); | ||
RcppExport SEXP _rcpp_module_boot_stan_fit4model7_mod(); | ||
RcppExport SEXP _rcpp_module_boot_stan_fit4model8_mod(); | ||
|
||
static const R_CallMethodDef CallEntries[] = { | ||
{"_rcpp_module_boot_stan_fit4factor_functions_mod", (DL_FUNC) &_rcpp_module_boot_stan_fit4factor_functions_mod, 0}, | ||
{"_rcpp_module_boot_stan_fit4factor_model_with_covariates_mod", (DL_FUNC) &_rcpp_module_boot_stan_fit4factor_model_with_covariates_mod, 0}, | ||
{"_rcpp_module_boot_stan_fit4factor_model_without_covariates_mod", (DL_FUNC) &_rcpp_module_boot_stan_fit4factor_model_without_covariates_mod, 0}, | ||
{"_rcpp_module_boot_stan_fit4model1_mod", (DL_FUNC) &_rcpp_module_boot_stan_fit4model1_mod, 0}, | ||
{"_rcpp_module_boot_stan_fit4model1_gammaOmega_mod", (DL_FUNC) &_rcpp_module_boot_stan_fit4model1_gammaOmega_mod, 0}, | ||
{"_rcpp_module_boot_stan_fit4model2_mod", (DL_FUNC) &_rcpp_module_boot_stan_fit4model2_mod, 0}, | ||
{"_rcpp_module_boot_stan_fit4model3_mod", (DL_FUNC) &_rcpp_module_boot_stan_fit4model3_mod, 0}, | ||
{"_rcpp_module_boot_stan_fit4model4_mod", (DL_FUNC) &_rcpp_module_boot_stan_fit4model4_mod, 0}, | ||
{"_rcpp_module_boot_stan_fit4model5_mod", (DL_FUNC) &_rcpp_module_boot_stan_fit4model5_mod, 0}, | ||
{"_rcpp_module_boot_stan_fit4model6_mod", (DL_FUNC) &_rcpp_module_boot_stan_fit4model6_mod, 0}, | ||
{"_rcpp_module_boot_stan_fit4model7_mod", (DL_FUNC) &_rcpp_module_boot_stan_fit4model7_mod, 0}, | ||
{"_rcpp_module_boot_stan_fit4model8_mod", (DL_FUNC) &_rcpp_module_boot_stan_fit4model8_mod, 0}, | ||
{NULL, NULL, 0} | ||
}; | ||
|
||
RcppExport void R_init_bsynth(DllInfo *dll) { | ||
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); | ||
R_useDynamicSymbols(dll, FALSE); | ||
} |
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_factor_functions.h" | ||
|
||
RCPP_MODULE(stan_fit4factor_functions_mod) { | ||
|
||
|
||
class_<rstan::stan_fit<stan_model, boost::random::ecuyer1988> >("model_factor_functions") | ||
|
||
.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.