diff --git a/R/fit.R b/R/fit.R index 3bf3efc8..50ff905a 100644 --- a/R/fit.R +++ b/R/fit.R @@ -322,6 +322,7 @@ CmdStanFit$set("public", name = "init", value = init) #' @param seed (integer) The random seed to use when initializing the model. #' @param verbose (logical) Whether to show verbose logging during compilation. #' @param hessian (logical) Whether to expose the (experimental) hessian method. +#' @param force_recompile (logical) Whether to recompile cached model methods. #' #' @examples #' \dontrun{ diff --git a/R/utils.R b/R/utils.R index 14456888..a1d4963a 100644 --- a/R/utils.R +++ b/R/utils.R @@ -769,14 +769,22 @@ rcpp_source_stan <- function(code, env, verbose = FALSE) { } initialize_method_functions <- function(env, so_name) { - env$model_ptr <- function(...) { .Call("model_ptr_", ..., so_name) } - env$log_prob <- function(...) { .Call("log_prob_", ..., so_name) } - env$grad_log_prob <- function(...) { .Call("grad_log_prob_", ..., so_name) } - env$hessian <- function(...) { .Call("hessian_", ..., so_name) } - env$get_num_upars <- function(...) { .Call("get_num_upars_", ..., so_name) } - env$get_param_metadata <- function(...) { .Call("get_param_metadata_", ..., so_name) } - env$unconstrain_variables <- function(...) { .Call("unconstrain_variables_", ..., so_name) } - env$constrain_variables <- function(...) { .Call("constrain_variables_", ..., so_name) } + env$model_ptr <- + function(...) { .Call("model_ptr_", ..., PACKAGE = so_name) } + env$log_prob <- + function(...) { .Call("log_prob_", ..., PACKAGE = so_name) } + env$grad_log_prob <- + function(...) { .Call("grad_log_prob_", ..., PACKAGE = so_name) } + env$hessian <- + function(...) { .Call("hessian_", ..., PACKAGE = so_name) } + env$get_num_upars <- + function(...) { .Call("get_num_upars_", ..., PACKAGE = so_name) } + env$get_param_metadata <- + function(...) { .Call("get_param_metadata_", ..., PACKAGE = so_name) } + env$unconstrain_variables <- + function(...) { .Call("unconstrain_variables_", ..., PACKAGE = so_name) } + env$constrain_variables <- + function(...) { .Call("constrain_variables_", ..., PACKAGE = so_name) } } expose_model_methods <- function(env, force_recompile = FALSE, verbose = FALSE) { diff --git a/man/fit-method-init_model_methods.Rd b/man/fit-method-init_model_methods.Rd index c0b0ac0b..49d3b546 100644 --- a/man/fit-method-init_model_methods.Rd +++ b/man/fit-method-init_model_methods.Rd @@ -19,6 +19,8 @@ init_model_methods( \item{verbose}{(logical) Whether to show verbose logging during compilation.} \item{hessian}{(logical) Whether to expose the (experimental) hessian method.} + +\item{force_recompile}{(logical) Whether to recompile cached model methods.} } \description{ The \verb{$init_model_methods()} method compiles and initializes the