-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathload_stein.R
More file actions
39 lines (39 loc) · 1.13 KB
/
Copy pathload_stein.R
File metadata and controls
39 lines (39 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Load all package sources from R/ into the global environment (script workflow).
# For package installs use: devtools::load_all() or library(steingof)
# Set STEIN_SRC_ROOT to the repository root if getwd() is not the project root
# (e.g. parallel workers).
(function() {
root <- Sys.getenv("STEIN_SRC_ROOT", unset = "")
if (!nzchar(root)) {
root <- normalizePath(".", mustWork = FALSE)
Sys.setenv(STEIN_SRC_ROOT = root)
}
rd <- file.path(root, "R")
if (!dir.exists(rd)) {
stop("Cannot find R/ under ", root, "; set STEIN_SRC_ROOT to the repo root.", call. = FALSE)
}
owd <- getwd()
setwd(rd)
on.exit(setwd(owd), add = TRUE)
collate <- c(
"stein_helpers.R",
"kernel_classes.R",
"bootstrap.R",
"gmm_model.R",
"ksd_u_test.R",
"ksd_v_test.R",
"fssd_test.R",
"stein_discrepancy_gof.R",
"svgd.R",
"stein_thinning.R",
"stein_points.R",
"stein_point_mcmc.R"
)
for (fn in collate) {
if (!file.exists(fn)) {
stop("Missing required file: ", file.path(rd, fn), call. = FALSE)
}
sys.source(fn, envir = .GlobalEnv, keep.source = FALSE)
}
invisible(TRUE)
})()