From 6d81eab7af15f25c8571ba0cdf727516536b5dcf Mon Sep 17 00:00:00 2001 From: Jouni Helske Date: Wed, 28 Aug 2024 08:44:48 +0300 Subject: [PATCH] fix imports and depends --- DESCRIPTION | 16 +- NAMESPACE | 1 - R/plot_coefs.R | 1 - R/pp_check.R | 5 +- man/pp_check.walker_fit.Rd | 5 +- src/stanExports_rw1_model.h | 2134 +++++++-------- src/stanExports_rw1_model_naive.h | 1214 ++++----- src/stanExports_walker_glm.h | 4145 ++++++++++++++--------------- src/stanExports_walker_lm.h | 3295 +++++++++++------------ 9 files changed, 5191 insertions(+), 5625 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 2c3f148..5dabe01 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -23,11 +23,9 @@ Suggests: rmarkdown (>= 0.8.1), testthat Depends: - R (>= 3.4.0), - Rcpp (>= 0.12.9), - rstan (>= 2.26.0) -Imports: bayesplot, + R (>= 3.4.0) +Imports: coda, dplyr, Hmisc, @@ -35,17 +33,19 @@ Imports: KFAS, loo, methods, + Rcpp (>= 0.12.9), RcppParallel, rlang, + rstan (>= 2.26.0), rstantools (>= 2.0.0) -LinkingTo: - StanHeaders (>= 2.26.0), - rstan (>= 2.26.0), +LinkingTo: BH (>= 1.66.0), Rcpp (>= 0.12.9), RcppArmadillo, RcppEigen (>= 0.3.3.3.0), - RcppParallel + RcppParallel, + rstan (>= 2.26.0), + StanHeaders (>= 2.26.0) SystemRequirements: GNU make Biarch: true VignetteBuilder: knitr diff --git a/NAMESPACE b/NAMESPACE index 8fbee84..80f06d8 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -18,7 +18,6 @@ export(walker) export(walker_glm) export(walker_rw1) import(Rcpp) -import(bayesplot) import(ggplot2) import(methods) import(rstan) diff --git a/R/plot_coefs.R b/R/plot_coefs.R index 36295ee..7080a93 100644 --- a/R/plot_coefs.R +++ b/R/plot_coefs.R @@ -7,7 +7,6 @@ #' @importFrom rlang .data #' @importFrom stats quantile time update.formula drop.terms #' @import ggplot2 -#' @import bayesplot #' @param object An output from [walker()]. #' @param level Level for intervals. Default is 0.05, leading to 90% intervals. #' @param alpha Transparency level for [ggplot2::geom_ribbon()]. diff --git a/R/pp_check.R b/R/pp_check.R index 83bde91..f2f24b7 100644 --- a/R/pp_check.R +++ b/R/pp_check.R @@ -14,10 +14,11 @@ #' \dontrun{ #' # Extracting the yrep variable for general use: #' # extract yrep -#' y_rep <- extract(object$stanfit, pars = "y_rep", permuted = TRUE)$y_rep +#' y_rep <- rstan::extract(object$stanfit, pars = "y_rep", permuted = TRUE)$y_rep #' #' # For non-gaussian model: -#' weights <- extract(object$stanfit, pars = "weights", permuted = TRUE)$weights +#' weights <- rstan::extract(object$stanfit, +#' pars = "weights", permuted = TRUE)$weights #' y_rep <- y_rep[sample(1:nrow(y_rep), #' size = nrow(y_rep), replace = TRUE, prob = weights), , drop = FALSE] #'} diff --git a/man/pp_check.walker_fit.Rd b/man/pp_check.walker_fit.Rd index 32a0ebd..845ff0c 100644 --- a/man/pp_check.walker_fit.Rd +++ b/man/pp_check.walker_fit.Rd @@ -22,10 +22,11 @@ you can extract the variable \code{yrep} from the output, see examples. \dontrun{ # Extracting the yrep variable for general use: # extract yrep -y_rep <- extract(object$stanfit, pars = "y_rep", permuted = TRUE)$y_rep +y_rep <- rstan::extract(object$stanfit, pars = "y_rep", permuted = TRUE)$y_rep # For non-gaussian model: -weights <- extract(object$stanfit, pars = "weights", permuted = TRUE)$weights +weights <- rstan::extract(object$stanfit, +pars = "weights", permuted = TRUE)$weights y_rep <- y_rep[sample(1:nrow(y_rep), size = nrow(y_rep), replace = TRUE, prob = weights), , drop = FALSE] } diff --git a/src/stanExports_rw1_model.h b/src/stanExports_rw1_model.h index cb487ee..ed9bc8f 100644 --- a/src/stanExports_rw1_model.h +++ b/src/stanExports_rw1_model.h @@ -21,640 +21,580 @@ #define USE_STANC3 #endif #include -// Code generated by stanc v2.26.1-4-gd72b68b7-dirty +// Code generated by stanc v2.32.2 #include namespace model_rw1_model_namespace { -inline void validate_positive_index(const char* var_name, const char* expr, - int val) { - if (val < 1) { - std::stringstream msg; - msg << "Found dimension size less than one in simplex declaration" - << "; variable=" << var_name << "; dimension size expression=" << expr - << "; expression value=" << val; - std::string msg_str(msg.str()); - throw std::invalid_argument(msg_str.c_str()); - } -} -inline void validate_unit_vector_index(const char* var_name, const char* expr, - int val) { - if (val <= 1) { - std::stringstream msg; - if (val == 1) { - msg << "Found dimension size one in unit vector declaration." - << " One-dimensional unit vector is discrete" - << " but the target distribution must be continuous." - << " variable=" << var_name << "; dimension size expression=" << expr; - } else { - msg << "Found dimension size less than one in unit vector declaration" - << "; variable=" << var_name << "; dimension size expression=" << expr - << "; expression value=" << val; - } - std::string msg_str(msg.str()); - throw std::invalid_argument(msg_str.c_str()); - } -} -using std::istream; -using std::string; -using std::stringstream; -using std::vector; -using std::pow; -using stan::io::dump; -using stan::math::lgamma; using stan::model::model_base_crtp; -using stan::model::rvalue; -using stan::model::cons_list; -using stan::model::index_uni; -using stan::model::index_max; -using stan::model::index_min; -using stan::model::index_min_max; -using stan::model::index_multi; -using stan::model::index_omni; -using stan::model::nil_index_list; using namespace stan::math; -using stan::math::pow; stan::math::profile_map profiles__; -static int current_statement__= 0; -static const std::vector locations_array__ = {" (found before start of program)", - " (in 'string', line 74, column 2 to column 33)", - " (in 'string', line 75, column 2 to column 24)", - " (in 'string', line 78, column 2 to column 21)", - " (in 'string', line 79, column 2 to column 22)", - " (in 'string', line 81, column 4 to column 31)", - " (in 'string', line 82, column 4 to column 32)", - " (in 'string', line 80, column 16 to line 83, column 3)", - " (in 'string', line 80, column 2 to line 83, column 3)", - " (in 'string', line 92, column 2 to column 18)", - " (in 'string', line 93, column 2 to column 20)", - " (in 'string', line 94, column 2 to column 22)", - " (in 'string', line 95, column 2 to column 28)", - " (in 'string', line 99, column 5 to column 55)", - " (in 'string', line 98, column 16 to line 100, column 3)", - " (in 'string', line 98, column 2 to line 100, column 3)", - " (in 'string', line 103, column 6 to column 56)", - " (in 'string', line 102, column 18 to line 104, column 5)", - " (in 'string', line 102, column 4 to line 104, column 5)", - " (in 'string', line 101, column 23 to line 105, column 3)", - " (in 'string', line 101, column 2 to line 105, column 3)", - " (in 'string', line 108, column 4 to column 73)", - " (in 'string', line 107, column 16 to line 109, column 3)", - " (in 'string', line 107, column 2 to line 109, column 3)", - " (in 'string', line 111, column 2 to column 104)", - " (in 'string', line 115, column 4 to column 77)", - " (in 'string', line 114, column 16 to line 116, column 3)", - " (in 'string', line 114, column 2 to line 116, column 3)", - " (in 'string', line 121, column 6 to column 58)", - " (in 'string', line 120, column 18 to line 122, column 5)", - " (in 'string', line 120, column 4 to line 122, column 5)", - " (in 'string', line 124, column 6 to column 84)", - " (in 'string', line 126, column 8 to column 66)", - " (in 'string', line 125, column 20 to line 127, column 7)", - " (in 'string', line 125, column 6 to line 127, column 7)", - " (in 'string', line 123, column 28 to line 128, column 5)", - " (in 'string', line 123, column 4 to line 128, column 5)", - " (in 'string', line 129, column 4 to column 94)", - " (in 'string', line 119, column 17 to line 130, column 3)", - " (in 'string', line 119, column 2 to line 130, column 3)", - " (in 'string', line 86, column 2 to column 45)", - " (in 'string', line 87, column 2 to column 45)", - " (in 'string', line 88, column 2 to column 87)", - " (in 'string', line 56, column 2 to column 17)", - " (in 'string', line 57, column 2 to column 17)", - " (in 'string', line 58, column 9 to column 10)", - " (in 'string', line 58, column 12 to column 13)", - " (in 'string', line 58, column 2 to column 20)", - " (in 'string', line 59, column 9 to column 10)", - " (in 'string', line 59, column 2 to column 14)", - " (in 'string', line 60, column 9 to column 10)", - " (in 'string', line 60, column 2 to column 22)", - " (in 'string', line 61, column 9 to column 10)", - " (in 'string', line 61, column 2 to column 20)", - " (in 'string', line 62, column 9 to column 14)", - " (in 'string', line 62, column 2 to column 27)", - " (in 'string', line 63, column 9 to column 14)", - " (in 'string', line 63, column 2 to column 25)", - " (in 'string', line 64, column 2 to column 21)", - " (in 'string', line 65, column 9 to column 10)", - " (in 'string', line 65, column 12 to column 17)", - " (in 'string', line 65, column 2 to column 28)", - " (in 'string', line 68, column 9 to column 10)", - " (in 'string', line 68, column 2 to column 42)", - " (in 'string', line 69, column 9 to column 10)", - " (in 'string', line 69, column 2 to column 38)", - " (in 'string', line 70, column 2 to column 36)", - " (in 'string', line 71, column 2 to column 32)", - " (in 'string', line 74, column 8 to column 9)", - " (in 'string', line 78, column 9 to column 10)", - " (in 'string', line 79, column 9 to column 10)", - " (in 'string', line 92, column 9 to column 10)", - " (in 'string', line 93, column 9 to column 10)", - " (in 'string', line 93, column 12 to column 13)", - " (in 'string', line 94, column 9 to column 14)", - " (in 'string', line 95, column 9 to column 10)", - " (in 'string', line 95, column 12 to column 17)", - " (in 'string', line 6, column 2 to column 18)", - " (in 'string', line 7, column 2 to column 19)", - " (in 'string', line 8, column 2 to column 20)", - " (in 'string', line 9, column 9 to column 10)", - " (in 'string', line 9, column 2 to column 19)", - " (in 'string', line 10, column 9 to column 10)", - " (in 'string', line 10, column 12 to column 13)", - " (in 'string', line 10, column 2 to column 35)", - " (in 'string', line 12, column 4 to column 42)", - " (in 'string', line 13, column 4 to column 46)", - " (in 'string', line 14, column 11 to column 12)", - " (in 'string', line 14, column 4 to column 36)", - " (in 'string', line 15, column 4 to column 15)", - " (in 'string', line 16, column 4 to column 27)", - " (in 'string', line 17, column 4 to column 41)", - " (in 'string', line 11, column 17 to line 18, column 3)", - " (in 'string', line 11, column 2 to line 18, column 3)", - " (in 'string', line 19, column 3 to column 17)", - " (in 'string', line 5, column 94 to line 20, column 3)", - " (in 'string', line 23, column 2 to column 18)", - " (in 'string', line 24, column 2 to column 19)", - " (in 'string', line 25, column 9 to column 10)", - " (in 'string', line 25, column 2 to column 19)", - " (in 'string', line 26, column 9 to column 10)", - " (in 'string', line 26, column 12 to column 13)", - " (in 'string', line 26, column 2 to column 35)", - " (in 'string', line 27, column 9 to column 10)", - " (in 'string', line 27, column 2 to column 14)", - " (in 'string', line 28, column 9 to column 10)", - " (in 'string', line 28, column 2 to column 14)", - " (in 'string', line 29, column 9 to column 10)", - " (in 'string', line 29, column 12 to column 13)", - " (in 'string', line 29, column 2 to column 17)", - " (in 'string', line 30, column 9 to column 10)", - " (in 'string', line 30, column 12 to column 15)", - " (in 'string', line 30, column 2 to column 19)", - " (in 'string', line 31, column 9 to column 10)", - " (in 'string', line 31, column 2 to column 17)", - " (in 'string', line 33, column 4 to column 40)", - " (in 'string', line 34, column 4 to column 44)", - " (in 'string', line 35, column 4 to column 34)", - " (in 'string', line 36, column 4 to column 23)", - " (in 'string', line 37, column 4 to column 40)", - " (in 'string', line 32, column 17 to line 38, column 3)", - " (in 'string', line 32, column 2 to line 38, column 3)", - " (in 'string', line 39, column 2 to column 31)", - " (in 'string', line 41, column 4 to column 23)", - " (in 'string', line 42, column 11 to column 12)", - " (in 'string', line 42, column 4 to column 28)", - " (in 'string', line 43, column 4 to column 81)", - " (in 'string', line 40, column 18 to line 44, column 3)", - " (in 'string', line 40, column 2 to line 44, column 3)", - " (in 'string', line 45, column 2 to column 15)", - " (in 'string', line 46, column 2 to column 26)", - " (in 'string', line 48, column 11 to column 12)", - " (in 'string', line 48, column 4 to column 28)", - " (in 'string', line 49, column 11 to column 12)", - " (in 'string', line 49, column 4 to column 27)", - " (in 'string', line 50, column 4 to column 28)", - " (in 'string', line 47, column 17 to line 51, column 3)", - " (in 'string', line 47, column 2 to line 51, column 3)", - " (in 'string', line 52, column 2 to column 21)", - " (in 'string', line 22, column 93 to line 53, column 3)"}; +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'string', line 74, column 2 to column 33)", + " (in 'string', line 75, column 2 to column 24)", + " (in 'string', line 78, column 2 to column 21)", + " (in 'string', line 79, column 2 to column 22)", + " (in 'string', line 92, column 2 to column 18)", + " (in 'string', line 93, column 2 to column 20)", + " (in 'string', line 94, column 2 to column 22)", + " (in 'string', line 95, column 2 to column 28)", + " (in 'string', line 81, column 4 to column 31)", + " (in 'string', line 82, column 4 to column 32)", + " (in 'string', line 80, column 16 to line 83, column 3)", + " (in 'string', line 80, column 2 to line 83, column 3)", + " (in 'string', line 99, column 5 to column 55)", + " (in 'string', line 98, column 16 to line 100, column 3)", + " (in 'string', line 98, column 2 to line 100, column 3)", + " (in 'string', line 103, column 6 to column 56)", + " (in 'string', line 102, column 18 to line 104, column 5)", + " (in 'string', line 102, column 4 to line 104, column 5)", + " (in 'string', line 101, column 23 to line 105, column 3)", + " (in 'string', line 101, column 2 to line 105, column 3)", + " (in 'string', line 108, column 4 to column 73)", + " (in 'string', line 107, column 16 to line 109, column 3)", + " (in 'string', line 107, column 2 to line 109, column 3)", + " (in 'string', line 111, column 2 to column 104)", + " (in 'string', line 115, column 4 to column 77)", + " (in 'string', line 114, column 16 to line 116, column 3)", + " (in 'string', line 114, column 2 to line 116, column 3)", + " (in 'string', line 121, column 6 to column 58)", + " (in 'string', line 120, column 18 to line 122, column 5)", + " (in 'string', line 120, column 4 to line 122, column 5)", + " (in 'string', line 124, column 6 to column 84)", + " (in 'string', line 126, column 8 to column 66)", + " (in 'string', line 125, column 20 to line 127, column 7)", + " (in 'string', line 125, column 6 to line 127, column 7)", + " (in 'string', line 123, column 28 to line 128, column 5)", + " (in 'string', line 123, column 4 to line 128, column 5)", + " (in 'string', line 129, column 4 to column 94)", + " (in 'string', line 119, column 17 to line 130, column 3)", + " (in 'string', line 119, column 2 to line 130, column 3)", + " (in 'string', line 86, column 2 to column 45)", + " (in 'string', line 87, column 2 to column 45)", + " (in 'string', line 88, column 2 to column 87)", + " (in 'string', line 56, column 2 to column 17)", + " (in 'string', line 57, column 2 to column 17)", + " (in 'string', line 58, column 9 to column 10)", + " (in 'string', line 58, column 12 to column 13)", + " (in 'string', line 58, column 2 to column 20)", + " (in 'string', line 59, column 9 to column 10)", + " (in 'string', line 59, column 2 to column 14)", + " (in 'string', line 60, column 9 to column 10)", + " (in 'string', line 60, column 2 to column 22)", + " (in 'string', line 61, column 9 to column 10)", + " (in 'string', line 61, column 2 to column 20)", + " (in 'string', line 62, column 9 to column 14)", + " (in 'string', line 62, column 2 to column 27)", + " (in 'string', line 63, column 9 to column 14)", + " (in 'string', line 63, column 2 to column 25)", + " (in 'string', line 64, column 2 to column 21)", + " (in 'string', line 65, column 9 to column 10)", + " (in 'string', line 65, column 12 to column 17)", + " (in 'string', line 65, column 2 to column 28)", + " (in 'string', line 68, column 9 to column 10)", + " (in 'string', line 68, column 2 to column 42)", + " (in 'string', line 69, column 9 to column 10)", + " (in 'string', line 69, column 2 to column 38)", + " (in 'string', line 70, column 2 to column 36)", + " (in 'string', line 71, column 2 to column 32)", + " (in 'string', line 74, column 8 to column 9)", + " (in 'string', line 78, column 9 to column 10)", + " (in 'string', line 79, column 9 to column 10)", + " (in 'string', line 92, column 9 to column 10)", + " (in 'string', line 93, column 9 to column 10)", + " (in 'string', line 93, column 12 to column 13)", + " (in 'string', line 94, column 9 to column 14)", + " (in 'string', line 95, column 9 to column 10)", + " (in 'string', line 95, column 12 to column 17)", + " (in 'string', line 6, column 2 to column 18)", + " (in 'string', line 7, column 2 to column 19)", + " (in 'string', line 8, column 2 to column 20)", + " (in 'string', line 9, column 9 to column 10)", + " (in 'string', line 9, column 2 to column 19)", + " (in 'string', line 10, column 9 to column 10)", + " (in 'string', line 10, column 12 to column 13)", + " (in 'string', line 10, column 2 to column 35)", + " (in 'string', line 12, column 4 to column 42)", + " (in 'string', line 13, column 4 to column 46)", + " (in 'string', line 14, column 11 to column 12)", + " (in 'string', line 14, column 4 to column 36)", + " (in 'string', line 15, column 4 to column 15)", + " (in 'string', line 16, column 4 to column 27)", + " (in 'string', line 17, column 4 to column 41)", + " (in 'string', line 11, column 17 to line 18, column 3)", + " (in 'string', line 11, column 2 to line 18, column 3)", + " (in 'string', line 19, column 3 to column 17)", + " (in 'string', line 5, column 94 to line 20, column 3)", + " (in 'string', line 23, column 2 to column 18)", + " (in 'string', line 24, column 2 to column 19)", + " (in 'string', line 25, column 9 to column 10)", + " (in 'string', line 25, column 2 to column 19)", + " (in 'string', line 26, column 9 to column 10)", + " (in 'string', line 26, column 12 to column 13)", + " (in 'string', line 26, column 2 to column 35)", + " (in 'string', line 27, column 9 to column 10)", + " (in 'string', line 27, column 2 to column 14)", + " (in 'string', line 28, column 9 to column 10)", + " (in 'string', line 28, column 2 to column 14)", + " (in 'string', line 29, column 9 to column 10)", + " (in 'string', line 29, column 12 to column 13)", + " (in 'string', line 29, column 2 to column 17)", + " (in 'string', line 30, column 9 to column 10)", + " (in 'string', line 30, column 12 to column 15)", + " (in 'string', line 30, column 2 to column 19)", + " (in 'string', line 31, column 9 to column 10)", + " (in 'string', line 31, column 2 to column 17)", + " (in 'string', line 33, column 4 to column 40)", + " (in 'string', line 34, column 4 to column 44)", + " (in 'string', line 35, column 4 to column 34)", + " (in 'string', line 36, column 4 to column 23)", + " (in 'string', line 37, column 4 to column 40)", + " (in 'string', line 32, column 17 to line 38, column 3)", + " (in 'string', line 32, column 2 to line 38, column 3)", + " (in 'string', line 39, column 2 to column 31)", + " (in 'string', line 41, column 4 to column 23)", + " (in 'string', line 42, column 11 to column 12)", + " (in 'string', line 42, column 4 to column 28)", + " (in 'string', line 43, column 4 to column 81)", + " (in 'string', line 40, column 18 to line 44, column 3)", + " (in 'string', line 40, column 2 to line 44, column 3)", + " (in 'string', line 45, column 2 to column 15)", + " (in 'string', line 46, column 2 to column 26)", + " (in 'string', line 48, column 11 to column 12)", + " (in 'string', line 48, column 4 to column 28)", + " (in 'string', line 49, column 11 to column 12)", + " (in 'string', line 49, column 4 to column 27)", + " (in 'string', line 50, column 4 to column 28)", + " (in 'string', line 47, column 17 to line 51, column 3)", + " (in 'string', line 47, column 2 to line 51, column 3)", + " (in 'string', line 52, column 2 to column 21)", + " (in 'string', line 22, column 93 to line 53, column 3)"}; template -stan::promote_args_t, stan::value_type_t, -stan::value_type_t, T3__, -stan::value_type_t, stan::promote_args_t>> + typename T3__, typename T4__, typename T5__, + stan::require_all_t, + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +stan::promote_args_t, stan::base_type_t, + stan::base_type_t, T3__, stan::base_type_t, + stan::promote_args_t>> gaussian_filter_rw_lpdf(const T0__& y_arg__, const T1__& a1_arg__, - const T2__& P1_arg__, const T3__& Ht, - const T4__& Rt_arg__, const T5__& xreg_arg__, - std::ostream* pstream__) { - using local_scalar_t__ = stan::promote_args_t, - stan::value_type_t, - stan::value_type_t, - T3__, - stan::value_type_t, stan::promote_args_t>>; - const auto& y = to_ref(y_arg__); - const auto& a1 = to_ref(a1_arg__); - const auto& P1 = to_ref(P1_arg__); - const auto& Rt = to_ref(Rt_arg__); - const auto& xreg = to_ref(xreg_arg__); + const T2__& P1_arg__, const T3__& Ht, const T4__& + Rt_arg__, const T5__& xreg_arg__, std::ostream* + pstream__); +template , + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t, stan::base_type_t, T3__, + stan::base_type_t, + stan::promote_args_t>>,-1,-1> +gaussian_smoother_rw(const T0__& y_arg__, const T1__& a1_arg__, const T2__& + P1_arg__, const T3__& Ht, const T4__& Rt_arg__, + const T5__& xreg_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>*> +stan::promote_args_t, stan::base_type_t, + stan::base_type_t, T3__, stan::base_type_t, + stan::promote_args_t>> +gaussian_filter_rw_lpdf(const T0__& y_arg__, const T1__& a1_arg__, + const T2__& P1_arg__, const T3__& Ht, const T4__& + Rt_arg__, const T5__& xreg_arg__, std::ostream* + pstream__) { + using local_scalar_t__ = stan::promote_args_t, + stan::base_type_t, + stan::base_type_t, T3__, + stan::base_type_t, + stan::promote_args_t>>; + int current_statement__ = 0; + const auto& y = stan::math::to_ref(y_arg__); + const auto& a1 = stan::math::to_ref(a1_arg__); + const auto& P1 = stan::math::to_ref(P1_arg__); + const auto& Rt = stan::math::to_ref(Rt_arg__); + const auto& xreg = stan::math::to_ref(xreg_arg__); local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; try { - int n; - n = std::numeric_limits::min(); - + int n = std::numeric_limits::min(); current_statement__ = 77; - n = rows(y); - int m; - m = std::numeric_limits::min(); - + n = stan::math::rows(y); + int m = std::numeric_limits::min(); current_statement__ = 78; - m = rows(a1); - local_scalar_t__ loglik; - loglik = DUMMY_VAR__; - + m = stan::math::rows(a1); + local_scalar_t__ loglik = DUMMY_VAR__; current_statement__ = 79; loglik = 0.0; current_statement__ = 80; - validate_non_negative_index("x", "m", m); - Eigen::Matrix x; - x = Eigen::Matrix(m); - stan::math::fill(x, DUMMY_VAR__); - + stan::math::validate_non_negative_index("x", "m", m); + Eigen::Matrix x = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 81; - assign(x, nil_index_list(), a1, "assigning variable x"); + stan::model::assign(x, a1, "assigning variable x"); current_statement__ = 82; - validate_non_negative_index("P", "m", m); + stan::math::validate_non_negative_index("P", "m", m); current_statement__ = 83; - validate_non_negative_index("P", "m", m); - Eigen::Matrix P; - P = Eigen::Matrix(m, m); - stan::math::fill(P, DUMMY_VAR__); - + stan::math::validate_non_negative_index("P", "m", m); + Eigen::Matrix P = + Eigen::Matrix::Constant(m, m, DUMMY_VAR__); current_statement__ = 84; - assign(P, nil_index_list(), diag_matrix(P1), "assigning variable P"); + stan::model::assign(P, stan::math::diag_matrix(P1), + "assigning variable P"); current_statement__ = 93; for (int t = 1; t <= n; ++t) { - local_scalar_t__ F; - F = DUMMY_VAR__; - + local_scalar_t__ F = DUMMY_VAR__; current_statement__ = 85; - F = (quad_form(P, - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg")) + Ht); - local_scalar_t__ v; - v = DUMMY_VAR__; - + F = (stan::math::quad_form(P, + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t))) + + Ht); + local_scalar_t__ v = DUMMY_VAR__; current_statement__ = 86; - v = (y[(t - 1)] - - dot_product( - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg"), x)); + v = (stan::model::rvalue(y, "y", stan::model::index_uni(t)) - + stan::math::dot_product( + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t)), x)); current_statement__ = 87; - validate_non_negative_index("K", "m", m); - Eigen::Matrix K; - K = Eigen::Matrix(m); - stan::math::fill(K, DUMMY_VAR__); - + stan::math::validate_non_negative_index("K", "m", m); + Eigen::Matrix K = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 88; - assign(K, nil_index_list(), - divide( - multiply(P, - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg")), F), - "assigning variable K"); + stan::model::assign(K, + stan::math::divide( + stan::math::multiply(P, + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t))), F), "assigning variable K"); current_statement__ = 89; - assign(x, nil_index_list(), - add(stan::model::deep_copy(x), multiply(K, v)), + stan::model::assign(x, + stan::math::add(stan::model::deep_copy(x), stan::math::multiply(K, v)), "assigning variable x"); current_statement__ = 90; - assign(P, nil_index_list(), - add(stan::model::deep_copy(P), - add(multiply(multiply(minus(K), transpose(K)), F), Rt)), - "assigning variable P"); + stan::model::assign(P, + stan::math::add(stan::model::deep_copy(P), + stan::math::add( + stan::math::multiply( + stan::math::multiply(stan::math::minus(K), + stan::math::transpose(K)), F), Rt)), "assigning variable P"); current_statement__ = 91; - loglik = (loglik - (0.5 * (stan::math::log(F) + ((v * v) / F))));} + loglik = (loglik - (0.5 * (stan::math::log(F) + ((v * v) / F)))); + } current_statement__ = 94; return loglik; } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } - -} -struct gaussian_filter_rw_lpdf_functor__ { -template -stan::promote_args_t, stan::value_type_t, -stan::value_type_t, T3__, -stan::value_type_t, stan::promote_args_t>> -operator()(const T0__& y, const T1__& a1, const T2__& P1, const T3__& Ht, - const T4__& Rt, const T5__& xreg, std::ostream* pstream__) const -{ -return gaussian_filter_rw_lpdf(y, a1, P1, Ht, Rt, xreg, pstream__); } -}; template -Eigen::Matrix, stan::value_type_t, -stan::value_type_t, T3__, -stan::value_type_t, stan::promote_args_t>>, -1, -1> -gaussian_smoother_rw(const T0__& y_arg__, const T1__& a1_arg__, - const T2__& P1_arg__, const T3__& Ht, - const T4__& Rt_arg__, const T5__& xreg_arg__, - std::ostream* pstream__) { - using local_scalar_t__ = stan::promote_args_t, - stan::value_type_t, - stan::value_type_t, - T3__, - stan::value_type_t, stan::promote_args_t>>; - const auto& y = to_ref(y_arg__); - const auto& a1 = to_ref(a1_arg__); - const auto& P1 = to_ref(P1_arg__); - const auto& Rt = to_ref(Rt_arg__); - const auto& xreg = to_ref(xreg_arg__); - const static bool propto__ = true; + typename T4__, typename T5__, + stan::require_all_t, + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>*> +Eigen::Matrix, + stan::base_type_t, stan::base_type_t, T3__, + stan::base_type_t, + stan::promote_args_t>>,-1,-1> +gaussian_smoother_rw(const T0__& y_arg__, const T1__& a1_arg__, const T2__& + P1_arg__, const T3__& Ht, const T4__& Rt_arg__, + const T5__& xreg_arg__, std::ostream* pstream__) { + using local_scalar_t__ = stan::promote_args_t, + stan::base_type_t, + stan::base_type_t, T3__, + stan::base_type_t, + stan::promote_args_t>>; + int current_statement__ = 0; + const auto& y = stan::math::to_ref(y_arg__); + const auto& a1 = stan::math::to_ref(a1_arg__); + const auto& P1 = stan::math::to_ref(P1_arg__); + const auto& Rt = stan::math::to_ref(Rt_arg__); + const auto& xreg = stan::math::to_ref(xreg_arg__); + static constexpr bool propto__ = true; + // suppress unused var warning (void) propto__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; try { - int n; - n = std::numeric_limits::min(); - + int n = std::numeric_limits::min(); current_statement__ = 96; - n = rows(y); - int m; - m = std::numeric_limits::min(); - + n = stan::math::rows(y); + int m = std::numeric_limits::min(); current_statement__ = 97; - m = rows(a1); + m = stan::math::rows(a1); current_statement__ = 98; - validate_non_negative_index("x", "m", m); - Eigen::Matrix x; - x = Eigen::Matrix(m); - stan::math::fill(x, DUMMY_VAR__); - + stan::math::validate_non_negative_index("x", "m", m); + Eigen::Matrix x = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 99; - assign(x, nil_index_list(), a1, "assigning variable x"); + stan::model::assign(x, a1, "assigning variable x"); current_statement__ = 100; - validate_non_negative_index("P", "m", m); + stan::math::validate_non_negative_index("P", "m", m); current_statement__ = 101; - validate_non_negative_index("P", "m", m); - Eigen::Matrix P; - P = Eigen::Matrix(m, m); - stan::math::fill(P, DUMMY_VAR__); - + stan::math::validate_non_negative_index("P", "m", m); + Eigen::Matrix P = + Eigen::Matrix::Constant(m, m, DUMMY_VAR__); current_statement__ = 102; - assign(P, nil_index_list(), diag_matrix(P1), "assigning variable P"); + stan::model::assign(P, stan::math::diag_matrix(P1), + "assigning variable P"); current_statement__ = 103; - validate_non_negative_index("v", "n", n); - Eigen::Matrix v; - v = Eigen::Matrix(n); - stan::math::fill(v, DUMMY_VAR__); - + stan::math::validate_non_negative_index("v", "n", n); + Eigen::Matrix v = + Eigen::Matrix::Constant(n, DUMMY_VAR__); current_statement__ = 105; - validate_non_negative_index("F", "n", n); - Eigen::Matrix F; - F = Eigen::Matrix(n); - stan::math::fill(F, DUMMY_VAR__); - + stan::math::validate_non_negative_index("F", "n", n); + Eigen::Matrix F = + Eigen::Matrix::Constant(n, DUMMY_VAR__); current_statement__ = 107; - validate_non_negative_index("K", "m", m); + stan::math::validate_non_negative_index("K", "m", m); current_statement__ = 108; - validate_non_negative_index("K", "n", n); - Eigen::Matrix K; - K = Eigen::Matrix(m, n); - stan::math::fill(K, DUMMY_VAR__); - + stan::math::validate_non_negative_index("K", "n", n); + Eigen::Matrix K = + Eigen::Matrix::Constant(m, n, DUMMY_VAR__); current_statement__ = 110; - validate_non_negative_index("r", "m", m); + stan::math::validate_non_negative_index("r", "m", m); current_statement__ = 111; - validate_non_negative_index("r", "n + 1", (n + 1)); - Eigen::Matrix r; - r = Eigen::Matrix(m, (n + 1)); - stan::math::fill(r, DUMMY_VAR__); - + stan::math::validate_non_negative_index("r", "n + 1", (n + 1)); + Eigen::Matrix r = + Eigen::Matrix::Constant(m, (n + 1), + DUMMY_VAR__); current_statement__ = 113; - validate_non_negative_index("tmpr", "m", m); - Eigen::Matrix tmpr; - tmpr = Eigen::Matrix(m); - stan::math::fill(tmpr, DUMMY_VAR__); - + stan::math::validate_non_negative_index("tmpr", "m", m); + Eigen::Matrix tmpr = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 121; for (int t = 1; t <= n; ++t) { current_statement__ = 115; - assign(F, cons_list(index_uni(t), nil_index_list()), - (quad_form(P, - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg")) + Ht), - "assigning variable F"); + stan::model::assign(F, + (stan::math::quad_form(P, + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t))) + Ht), "assigning variable F", + stan::model::index_uni(t)); current_statement__ = 116; - assign(v, cons_list(index_uni(t), nil_index_list()), - (y[(t - 1)] - - dot_product( - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg"), x)), - "assigning variable v"); + stan::model::assign(v, + (stan::model::rvalue(y, "y", stan::model::index_uni(t)) - + stan::math::dot_product( + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t)), x)), "assigning variable v", + stan::model::index_uni(t)); current_statement__ = 117; - assign(K, - cons_list(index_omni(), cons_list(index_uni(t), nil_index_list())), - divide( - multiply(P, - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg")), - F[(t - 1)]), "assigning variable K"); + stan::model::assign(K, + stan::math::divide( + stan::math::multiply(P, + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t))), + stan::model::rvalue(F, "F", stan::model::index_uni(t))), + "assigning variable K", stan::model::index_omni(), + stan::model::index_uni(t)); current_statement__ = 118; - assign(x, nil_index_list(), - add(stan::model::deep_copy(x), - multiply( - rvalue(K, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "K"), v[(t - 1)])), + stan::model::assign(x, + stan::math::add(stan::model::deep_copy(x), + stan::math::multiply( + stan::model::rvalue(K, "K", stan::model::index_omni(), + stan::model::index_uni(t)), + stan::model::rvalue(v, "v", stan::model::index_uni(t)))), "assigning variable x"); current_statement__ = 119; - assign(P, nil_index_list(), - add(stan::model::deep_copy(P), - add( - multiply( - multiply( - minus( - rvalue(K, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "K")), - transpose( - rvalue(K, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "K"))), - F[(t - 1)]), Rt)), "assigning variable P");} + stan::model::assign(P, + stan::math::add(stan::model::deep_copy(P), + stan::math::add( + stan::math::multiply( + stan::math::multiply( + stan::math::minus( + stan::model::rvalue(K, "K", stan::model::index_omni(), + stan::model::index_uni(t))), + stan::math::transpose( + stan::model::rvalue(K, "K", stan::model::index_omni(), + stan::model::index_uni(t)))), + stan::model::rvalue(F, "F", stan::model::index_uni(t))), Rt)), + "assigning variable P"); + } current_statement__ = 122; - assign(r, - cons_list(index_omni(), - cons_list(index_uni((n + 1)), nil_index_list())), rep_vector(0.0, m), - "assigning variable r"); + stan::model::assign(r, stan::math::rep_vector(0.0, m), + "assigning variable r", stan::model::index_omni(), + stan::model::index_uni((n + 1))); current_statement__ = 128; for (int tt = 1; tt <= n; ++tt) { - int t; - t = std::numeric_limits::min(); - + int t = std::numeric_limits::min(); current_statement__ = 123; t = ((n + 1) - tt); current_statement__ = 124; - validate_non_negative_index("tmp", "m", m); - Eigen::Matrix tmp; - tmp = Eigen::Matrix(m); - stan::math::fill(tmp, DUMMY_VAR__); - + stan::math::validate_non_negative_index("tmp", "m", m); + Eigen::Matrix tmp = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 125; - assign(tmp, nil_index_list(), - rvalue(r, - cons_list(index_omni(), - cons_list(index_uni((t + 1)), nil_index_list())), "r"), - "assigning variable tmp"); + stan::model::assign(tmp, + stan::model::rvalue(r, "r", stan::model::index_omni(), + stan::model::index_uni((t + 1))), "assigning variable tmp"); current_statement__ = 126; - assign(r, - cons_list(index_omni(), cons_list(index_uni(t), nil_index_list())), - subtract( - add( - divide( - multiply( - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg"), - v[(t - 1)]), F[(t - 1)]), tmp), - multiply( - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg"), - dot_product( - rvalue(K, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "K"), tmp))), - "assigning variable r");} + stan::model::assign(r, + stan::math::subtract( + stan::math::add( + stan::math::divide( + stan::math::multiply( + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t)), + stan::model::rvalue(v, "v", stan::model::index_uni(t))), + stan::model::rvalue(F, "F", stan::model::index_uni(t))), tmp), + stan::math::multiply( + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t)), + stan::math::dot_product( + stan::model::rvalue(K, "K", stan::model::index_omni(), + stan::model::index_uni(t)), tmp))), "assigning variable r", + stan::model::index_omni(), stan::model::index_uni(t)); + } current_statement__ = 129; - assign(tmpr, nil_index_list(), - rvalue(r, - cons_list(index_omni(), cons_list(index_uni(1), nil_index_list())), - "r"), "assigning variable tmpr"); + stan::model::assign(tmpr, + stan::model::rvalue(r, "r", stan::model::index_omni(), + stan::model::index_uni(1)), "assigning variable tmpr"); current_statement__ = 130; - assign(r, - cons_list(index_omni(), cons_list(index_uni(1), nil_index_list())), - add(a1, elt_multiply(P1, tmpr)), "assigning variable r"); + stan::model::assign(r, + stan::math::add(a1, stan::math::elt_multiply(P1, tmpr)), + "assigning variable r", stan::model::index_omni(), + stan::model::index_uni(1)); current_statement__ = 137; for (int t = 2; t <= n; ++t) { current_statement__ = 131; - validate_non_negative_index("tmp", "m", m); - Eigen::Matrix tmp; - tmp = Eigen::Matrix(m); - stan::math::fill(tmp, DUMMY_VAR__); - + stan::math::validate_non_negative_index("tmp", "m", m); + Eigen::Matrix tmp = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 132; - assign(tmp, nil_index_list(), - rvalue(r, - cons_list(index_omni(), - cons_list(index_uni((t - 1)), nil_index_list())), "r"), - "assigning variable tmp"); + stan::model::assign(tmp, + stan::model::rvalue(r, "r", stan::model::index_omni(), + stan::model::index_uni((t - 1))), "assigning variable tmp"); current_statement__ = 133; - validate_non_negative_index("tmp2", "m", m); - Eigen::Matrix tmp2; - tmp2 = Eigen::Matrix(m); - stan::math::fill(tmp2, DUMMY_VAR__); - + stan::math::validate_non_negative_index("tmp2", "m", m); + Eigen::Matrix tmp2 = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 134; - assign(tmp2, nil_index_list(), - rvalue(r, - cons_list(index_omni(), cons_list(index_uni(t), nil_index_list())), - "r"), "assigning variable tmp2"); + stan::model::assign(tmp2, + stan::model::rvalue(r, "r", stan::model::index_omni(), + stan::model::index_uni(t)), "assigning variable tmp2"); current_statement__ = 135; - assign(r, - cons_list(index_omni(), cons_list(index_uni(t), nil_index_list())), - add(tmp, multiply(Rt, tmp2)), "assigning variable r");} + stan::model::assign(r, + stan::math::add(tmp, stan::math::multiply(Rt, tmp2)), + "assigning variable r", stan::model::index_omni(), + stan::model::index_uni(t)); + } current_statement__ = 138; - return rvalue(r, - cons_list(index_min_max(1, m), - cons_list(index_min_max(1, n), nil_index_list())), "r"); + return stan::model::rvalue(r, "r", stan::model::index_min_max(1, m), + stan::model::index_min_max(1, n)); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } - } -struct gaussian_smoother_rw_functor__ { -template -Eigen::Matrix, stan::value_type_t, -stan::value_type_t, T3__, -stan::value_type_t, stan::promote_args_t>>, -1, -1> -operator()(const T0__& y, const T1__& a1, const T2__& P1, const T3__& Ht, - const T4__& Rt, const T5__& xreg, std::ostream* pstream__) const -{ -return gaussian_smoother_rw(y, a1, P1, Ht, Rt, xreg, pstream__); -} -}; #include class model_rw1_model final : public model_base_crtp { private: int k; int n; - Eigen::Matrix xreg; - Eigen::Matrix y; - Eigen::Matrix beta_mean; - Eigen::Matrix beta_sd; - Eigen::Matrix sigma_mean; - Eigen::Matrix sigma_sd; + Eigen::Matrix xreg_data__; + Eigen::Matrix y_data__; + Eigen::Matrix beta_mean_data__; + Eigen::Matrix beta_sd_data__; + Eigen::Matrix sigma_mean_data__; + Eigen::Matrix sigma_sd_data__; int n_new; - Eigen::Matrix xreg_new; - Eigen::Matrix sigma_b_mean; - Eigen::Matrix sigma_b_sd; + Eigen::Matrix xreg_new_data__; + Eigen::Matrix sigma_b_mean_data__; + Eigen::Matrix sigma_b_sd_data__; double sigma_y_mean; double sigma_y_sd; - + Eigen::Map> xreg{nullptr, 0, 0}; + Eigen::Map> y{nullptr, 0}; + Eigen::Map> beta_mean{nullptr, 0}; + Eigen::Map> beta_sd{nullptr, 0}; + Eigen::Map> sigma_mean{nullptr, 0}; + Eigen::Map> sigma_sd{nullptr, 0}; + Eigen::Map> xreg_new{nullptr, 0, 0}; + Eigen::Map> sigma_b_mean{nullptr, 0}; + Eigen::Map> sigma_b_sd{nullptr, 0}; public: - ~model_rw1_model() { } - - inline std::string model_name() const final { return "model_rw1_model"; } - inline std::vector model_compile_info() const noexcept { - return std::vector{"stanc_version = stanc3 v2.26.1-4-gd72b68b7-dirty", "stancflags = "}; - } - - - model_rw1_model(stan::io::var_context& context__, - unsigned int random_seed__ = 0, - std::ostream* pstream__ = nullptr) : model_base_crtp(0) { - using local_scalar_t__ = double ; - boost::ecuyer1988 base_rng__ = - stan::services::util::create_rng(random_seed__, 0); - (void) base_rng__; // suppress unused var warning - static const char* function__ = "model_rw1_model_namespace::model_rw1_model"; - (void) function__; // suppress unused var warning + ~model_rw1_model() {} + model_rw1_model(stan::io::var_context& context__, unsigned int + random_seed__ = 0, std::ostream* pstream__ = nullptr) + : model_base_crtp(0) { + int current_statement__ = 0; + using local_scalar_t__ = double; + boost::ecuyer1988 base_rng__ = + stan::services::util::create_rng(random_seed__, 0); + // suppress unused var warning + (void) base_rng__; + static constexpr const char* function__ = + "model_rw1_model_namespace::model_rw1_model"; + // suppress unused var warning + (void) function__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; try { - int pos__; - pos__ = std::numeric_limits::min(); - + int pos__ = std::numeric_limits::min(); pos__ = 1; current_statement__ = 43; - context__.validate_dims("data initialization","k","int", - context__.to_vec()); + context__.validate_dims("data initialization", "k", "int", + std::vector{}); k = std::numeric_limits::min(); - current_statement__ = 43; k = context__.vals_i("k")[(1 - 1)]; current_statement__ = 43; - current_statement__ = 43; - check_greater_or_equal(function__, "k", k, 0); + stan::math::check_greater_or_equal(function__, "k", k, 0); current_statement__ = 44; - context__.validate_dims("data initialization","n","int", - context__.to_vec()); + context__.validate_dims("data initialization", "n", "int", + std::vector{}); n = std::numeric_limits::min(); - current_statement__ = 44; n = context__.vals_i("n")[(1 - 1)]; current_statement__ = 44; - current_statement__ = 44; - check_greater_or_equal(function__, "n", n, 0); + stan::math::check_greater_or_equal(function__, "n", n, 0); current_statement__ = 45; - validate_non_negative_index("xreg", "k", k); + stan::math::validate_non_negative_index("xreg", "k", k); current_statement__ = 46; - validate_non_negative_index("xreg", "n", n); + stan::math::validate_non_negative_index("xreg", "n", n); current_statement__ = 47; - context__.validate_dims("data initialization","xreg","double", - context__.to_vec(k, n)); - xreg = Eigen::Matrix(k, n); - stan::math::fill(xreg, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "xreg", "double", + std::vector{static_cast(k), static_cast(n)}); + xreg_data__ = Eigen::Matrix::Constant(k, n, + std::numeric_limits::quiet_NaN()); + new (&xreg) Eigen::Map>(xreg_data__.data(), + k, n); { std::vector xreg_flat__; current_statement__ = 47; - assign(xreg_flat__, nil_index_list(), context__.vals_r("xreg"), - "assigning variable xreg_flat__"); + xreg_flat__ = context__.vals_r("xreg"); current_statement__ = 47; pos__ = 1; current_statement__ = 47; @@ -662,155 +602,160 @@ class model_rw1_model final : public model_base_crtp { current_statement__ = 47; for (int sym2__ = 1; sym2__ <= k; ++sym2__) { current_statement__ = 47; - assign(xreg, - cons_list(index_uni(sym2__), - cons_list(index_uni(sym1__), nil_index_list())), - xreg_flat__[(pos__ - 1)], "assigning variable xreg"); + stan::model::assign(xreg, xreg_flat__[(pos__ - 1)], + "assigning variable xreg", stan::model::index_uni(sym2__), + stan::model::index_uni(sym1__)); current_statement__ = 47; - pos__ = (pos__ + 1);}} + pos__ = (pos__ + 1); + } + } } current_statement__ = 48; - validate_non_negative_index("y", "n", n); + stan::math::validate_non_negative_index("y", "n", n); current_statement__ = 49; - context__.validate_dims("data initialization","y","double", - context__.to_vec(n)); - y = Eigen::Matrix(n); - stan::math::fill(y, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "y", "double", + std::vector{static_cast(n)}); + y_data__ = Eigen::Matrix::Constant(n, + std::numeric_limits::quiet_NaN()); + new (&y) Eigen::Map>(y_data__.data(), n); { std::vector y_flat__; current_statement__ = 49; - assign(y_flat__, nil_index_list(), context__.vals_r("y"), - "assigning variable y_flat__"); + y_flat__ = context__.vals_r("y"); current_statement__ = 49; pos__ = 1; current_statement__ = 49; for (int sym1__ = 1; sym1__ <= n; ++sym1__) { current_statement__ = 49; - assign(y, cons_list(index_uni(sym1__), nil_index_list()), - y_flat__[(pos__ - 1)], "assigning variable y"); + stan::model::assign(y, y_flat__[(pos__ - 1)], + "assigning variable y", stan::model::index_uni(sym1__)); current_statement__ = 49; - pos__ = (pos__ + 1);} + pos__ = (pos__ + 1); + } } current_statement__ = 50; - validate_non_negative_index("beta_mean", "k", k); + stan::math::validate_non_negative_index("beta_mean", "k", k); current_statement__ = 51; - context__.validate_dims("data initialization","beta_mean","double", - context__.to_vec(k)); - beta_mean = Eigen::Matrix(k); - stan::math::fill(beta_mean, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "beta_mean", "double", + std::vector{static_cast(k)}); + beta_mean_data__ = Eigen::Matrix::Constant(k, + std::numeric_limits::quiet_NaN()); + new (&beta_mean) + Eigen::Map>(beta_mean_data__.data(), k); { std::vector beta_mean_flat__; current_statement__ = 51; - assign(beta_mean_flat__, nil_index_list(), - context__.vals_r("beta_mean"), - "assigning variable beta_mean_flat__"); + beta_mean_flat__ = context__.vals_r("beta_mean"); current_statement__ = 51; pos__ = 1; current_statement__ = 51; for (int sym1__ = 1; sym1__ <= k; ++sym1__) { current_statement__ = 51; - assign(beta_mean, cons_list(index_uni(sym1__), nil_index_list()), - beta_mean_flat__[(pos__ - 1)], "assigning variable beta_mean"); + stan::model::assign(beta_mean, beta_mean_flat__[(pos__ - 1)], + "assigning variable beta_mean", stan::model::index_uni(sym1__)); current_statement__ = 51; - pos__ = (pos__ + 1);} + pos__ = (pos__ + 1); + } } current_statement__ = 52; - validate_non_negative_index("beta_sd", "k", k); + stan::math::validate_non_negative_index("beta_sd", "k", k); current_statement__ = 53; - context__.validate_dims("data initialization","beta_sd","double", - context__.to_vec(k)); - beta_sd = Eigen::Matrix(k); - stan::math::fill(beta_sd, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "beta_sd", "double", + std::vector{static_cast(k)}); + beta_sd_data__ = Eigen::Matrix::Constant(k, + std::numeric_limits::quiet_NaN()); + new (&beta_sd) + Eigen::Map>(beta_sd_data__.data(), k); { std::vector beta_sd_flat__; current_statement__ = 53; - assign(beta_sd_flat__, nil_index_list(), context__.vals_r("beta_sd"), - "assigning variable beta_sd_flat__"); + beta_sd_flat__ = context__.vals_r("beta_sd"); current_statement__ = 53; pos__ = 1; current_statement__ = 53; for (int sym1__ = 1; sym1__ <= k; ++sym1__) { current_statement__ = 53; - assign(beta_sd, cons_list(index_uni(sym1__), nil_index_list()), - beta_sd_flat__[(pos__ - 1)], "assigning variable beta_sd"); + stan::model::assign(beta_sd, beta_sd_flat__[(pos__ - 1)], + "assigning variable beta_sd", stan::model::index_uni(sym1__)); current_statement__ = 53; - pos__ = (pos__ + 1);} + pos__ = (pos__ + 1); + } } current_statement__ = 54; - validate_non_negative_index("sigma_mean", "k + 1", (k + 1)); + stan::math::validate_non_negative_index("sigma_mean", "k + 1", (k + 1)); current_statement__ = 55; - context__.validate_dims("data initialization","sigma_mean","double", - context__.to_vec((k + 1))); - sigma_mean = Eigen::Matrix((k + 1)); - stan::math::fill(sigma_mean, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "sigma_mean", "double", + std::vector{static_cast((k + 1))}); + sigma_mean_data__ = Eigen::Matrix::Constant((k + 1), + std::numeric_limits::quiet_NaN()); + new (&sigma_mean) + Eigen::Map>(sigma_mean_data__.data(), (k + + 1)); { std::vector sigma_mean_flat__; current_statement__ = 55; - assign(sigma_mean_flat__, nil_index_list(), - context__.vals_r("sigma_mean"), - "assigning variable sigma_mean_flat__"); + sigma_mean_flat__ = context__.vals_r("sigma_mean"); current_statement__ = 55; pos__ = 1; current_statement__ = 55; for (int sym1__ = 1; sym1__ <= (k + 1); ++sym1__) { current_statement__ = 55; - assign(sigma_mean, cons_list(index_uni(sym1__), nil_index_list()), - sigma_mean_flat__[(pos__ - 1)], "assigning variable sigma_mean"); + stan::model::assign(sigma_mean, sigma_mean_flat__[(pos__ - 1)], + "assigning variable sigma_mean", stan::model::index_uni(sym1__)); current_statement__ = 55; - pos__ = (pos__ + 1);} + pos__ = (pos__ + 1); + } } current_statement__ = 56; - validate_non_negative_index("sigma_sd", "k + 1", (k + 1)); + stan::math::validate_non_negative_index("sigma_sd", "k + 1", (k + 1)); current_statement__ = 57; - context__.validate_dims("data initialization","sigma_sd","double", - context__.to_vec((k + 1))); - sigma_sd = Eigen::Matrix((k + 1)); - stan::math::fill(sigma_sd, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "sigma_sd", "double", + std::vector{static_cast((k + 1))}); + sigma_sd_data__ = Eigen::Matrix::Constant((k + 1), + std::numeric_limits::quiet_NaN()); + new (&sigma_sd) + Eigen::Map>(sigma_sd_data__.data(), (k + + 1)); { std::vector sigma_sd_flat__; current_statement__ = 57; - assign(sigma_sd_flat__, nil_index_list(), - context__.vals_r("sigma_sd"), "assigning variable sigma_sd_flat__"); + sigma_sd_flat__ = context__.vals_r("sigma_sd"); current_statement__ = 57; pos__ = 1; current_statement__ = 57; for (int sym1__ = 1; sym1__ <= (k + 1); ++sym1__) { current_statement__ = 57; - assign(sigma_sd, cons_list(index_uni(sym1__), nil_index_list()), - sigma_sd_flat__[(pos__ - 1)], "assigning variable sigma_sd"); + stan::model::assign(sigma_sd, sigma_sd_flat__[(pos__ - 1)], + "assigning variable sigma_sd", stan::model::index_uni(sym1__)); current_statement__ = 57; - pos__ = (pos__ + 1);} + pos__ = (pos__ + 1); + } } current_statement__ = 58; - context__.validate_dims("data initialization","n_new","int", - context__.to_vec()); + context__.validate_dims("data initialization", "n_new", "int", + std::vector{}); n_new = std::numeric_limits::min(); - current_statement__ = 58; n_new = context__.vals_i("n_new")[(1 - 1)]; current_statement__ = 58; - current_statement__ = 58; - check_greater_or_equal(function__, "n_new", n_new, 0); + stan::math::check_greater_or_equal(function__, "n_new", n_new, 0); current_statement__ = 59; - validate_non_negative_index("xreg_new", "k", k); + stan::math::validate_non_negative_index("xreg_new", "k", k); current_statement__ = 60; - validate_non_negative_index("xreg_new", "n_new", n_new); + stan::math::validate_non_negative_index("xreg_new", "n_new", n_new); current_statement__ = 61; - context__.validate_dims("data initialization","xreg_new","double", - context__.to_vec(k, n_new)); - xreg_new = Eigen::Matrix(k, n_new); - stan::math::fill(xreg_new, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "xreg_new", "double", + std::vector{static_cast(k), + static_cast(n_new)}); + xreg_new_data__ = Eigen::Matrix::Constant(k, n_new, + std::numeric_limits::quiet_NaN()); + new (&xreg_new) + Eigen::Map>(xreg_new_data__.data(), k, + n_new); { std::vector xreg_new_flat__; current_statement__ = 61; - assign(xreg_new_flat__, nil_index_list(), - context__.vals_r("xreg_new"), "assigning variable xreg_new_flat__"); + xreg_new_flat__ = context__.vals_r("xreg_new"); current_statement__ = 61; pos__ = 1; current_statement__ = 61; @@ -818,636 +763,625 @@ class model_rw1_model final : public model_base_crtp { current_statement__ = 61; for (int sym2__ = 1; sym2__ <= k; ++sym2__) { current_statement__ = 61; - assign(xreg_new, - cons_list(index_uni(sym2__), - cons_list(index_uni(sym1__), nil_index_list())), - xreg_new_flat__[(pos__ - 1)], "assigning variable xreg_new"); + stan::model::assign(xreg_new, xreg_new_flat__[(pos__ - 1)], + "assigning variable xreg_new", stan::model::index_uni(sym2__), + stan::model::index_uni(sym1__)); current_statement__ = 61; - pos__ = (pos__ + 1);}} + pos__ = (pos__ + 1); + } + } } current_statement__ = 62; - validate_non_negative_index("sigma_b_mean", "k", k); + stan::math::validate_non_negative_index("sigma_b_mean", "k", k); current_statement__ = 63; - sigma_b_mean = Eigen::Matrix(k); - stan::math::fill(sigma_b_mean, std::numeric_limits::quiet_NaN()); - + sigma_b_mean_data__ = Eigen::Matrix::Constant(k, + std::numeric_limits::quiet_NaN()); + new (&sigma_b_mean) + Eigen::Map>(sigma_b_mean_data__.data(), k); current_statement__ = 63; - assign(sigma_b_mean, nil_index_list(), - rvalue(sigma_mean, cons_list(index_min(2), nil_index_list()), - "sigma_mean"), "assigning variable sigma_b_mean"); + stan::model::assign(sigma_b_mean, + stan::model::rvalue(sigma_mean, "sigma_mean", + stan::model::index_min(2)), "assigning variable sigma_b_mean"); current_statement__ = 64; - validate_non_negative_index("sigma_b_sd", "k", k); + stan::math::validate_non_negative_index("sigma_b_sd", "k", k); current_statement__ = 65; - sigma_b_sd = Eigen::Matrix(k); - stan::math::fill(sigma_b_sd, std::numeric_limits::quiet_NaN()); - + sigma_b_sd_data__ = Eigen::Matrix::Constant(k, + std::numeric_limits::quiet_NaN()); + new (&sigma_b_sd) + Eigen::Map>(sigma_b_sd_data__.data(), k); current_statement__ = 65; - assign(sigma_b_sd, nil_index_list(), - rvalue(sigma_sd, cons_list(index_min(2), nil_index_list()), - "sigma_sd"), "assigning variable sigma_b_sd"); + stan::model::assign(sigma_b_sd, + stan::model::rvalue(sigma_sd, "sigma_sd", stan::model::index_min(2)), + "assigning variable sigma_b_sd"); current_statement__ = 66; sigma_y_mean = std::numeric_limits::quiet_NaN(); - current_statement__ = 66; - sigma_y_mean = sigma_mean[(1 - 1)]; + sigma_y_mean = stan::model::rvalue(sigma_mean, "sigma_mean", + stan::model::index_uni(1)); current_statement__ = 67; sigma_y_sd = std::numeric_limits::quiet_NaN(); - current_statement__ = 67; - sigma_y_sd = sigma_sd[(1 - 1)]; + sigma_y_sd = stan::model::rvalue(sigma_sd, "sigma_sd", + stan::model::index_uni(1)); current_statement__ = 68; - validate_non_negative_index("sigma_b", "k", k); + stan::math::validate_non_negative_index("sigma_b", "k", k); current_statement__ = 69; - validate_non_negative_index("R_vector", "k", k); + stan::math::validate_non_negative_index("R_vector", "k", k); current_statement__ = 70; - validate_non_negative_index("P1_vector", "k", k); + stan::math::validate_non_negative_index("P1_vector", "k", k); current_statement__ = 71; - validate_non_negative_index("y_rep", "n", n); + stan::math::validate_non_negative_index("y_rep", "n", n); current_statement__ = 72; - validate_non_negative_index("beta", "k", k); + stan::math::validate_non_negative_index("beta", "k", k); current_statement__ = 73; - validate_non_negative_index("beta", "n", n); + stan::math::validate_non_negative_index("beta", "n", n); current_statement__ = 74; - validate_non_negative_index("y_new", "n_new", n_new); + stan::math::validate_non_negative_index("y_new", "n_new", n_new); current_statement__ = 75; - validate_non_negative_index("beta_new", "k", k); + stan::math::validate_non_negative_index("beta_new", "k", k); current_statement__ = 76; - validate_non_negative_index("beta_new", "n_new", n_new); - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); - } - num_params_r__ = 0U; - - try { - num_params_r__ += k; - num_params_r__ += 1; + stan::math::validate_non_negative_index("beta_new", "n_new", n_new); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } + num_params_r__ = k + 1; + } + inline std::string model_name() const final { + return "model_rw1_model"; + } + inline std::vector model_compile_info() const noexcept { + return std::vector{"stanc_version = stanc3 v2.32.2", + "stancflags = --allow-undefined"}; } - template * = nullptr, stan::require_vector_like_vt* = nullptr> - inline stan::scalar_type_t log_prob_impl(VecR& params_r__, - VecI& params_i__, - std::ostream* pstream__ = nullptr) const { + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline stan::scalar_type_t + log_prob_impl(VecR& params_r__, VecI& params_i__, std::ostream* + pstream__ = nullptr) const { using T__ = stan::scalar_type_t; using local_scalar_t__ = T__; T__ lp__(0.0); stan::math::accumulator lp_accum__; - static const char* function__ = "model_rw1_model_namespace::log_prob"; -(void) function__; // suppress unused var warning - stan::io::reader in__(params_r__, params_i__); + stan::io::deserializer in__(params_r__, params_i__); + int current_statement__ = 0; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; + static constexpr const char* function__ = + "model_rw1_model_namespace::log_prob"; + // suppress unused var warning + (void) function__; try { - std::vector sigma_b; - sigma_b = std::vector(k, DUMMY_VAR__); - + std::vector sigma_b = + std::vector(k, DUMMY_VAR__); current_statement__ = 1; - for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - current_statement__ = 1; - assign(sigma_b, cons_list(index_uni(sym1__), nil_index_list()), - in__.scalar(), "assigning variable sigma_b");} - current_statement__ = 1; - for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - current_statement__ = 1; - if (jacobian__) { - current_statement__ = 1; - assign(sigma_b, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(sigma_b[(sym1__ - 1)], 0, lp__), - "assigning variable sigma_b"); - } else { - current_statement__ = 1; - assign(sigma_b, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(sigma_b[(sym1__ - 1)], 0), - "assigning variable sigma_b"); - }} - local_scalar_t__ sigma_y; - sigma_y = DUMMY_VAR__; - + sigma_b = in__.template read_constrain_lb< + std::vector, jacobian__>(0, lp__, k); + local_scalar_t__ sigma_y = DUMMY_VAR__; current_statement__ = 2; - sigma_y = in__.scalar(); - current_statement__ = 2; - if (jacobian__) { - current_statement__ = 2; - sigma_y = stan::math::lb_constrain(sigma_y, 0, lp__); - } else { - current_statement__ = 2; - sigma_y = stan::math::lb_constrain(sigma_y, 0); - } - Eigen::Matrix R_vector; - R_vector = Eigen::Matrix(k); - stan::math::fill(R_vector, DUMMY_VAR__); - - Eigen::Matrix P1_vector; - P1_vector = Eigen::Matrix(k); - stan::math::fill(P1_vector, DUMMY_VAR__); - - current_statement__ = 8; + sigma_y = in__.template read_constrain_lb(0, lp__); + Eigen::Matrix R_vector = + Eigen::Matrix::Constant(k, DUMMY_VAR__); + Eigen::Matrix P1_vector = + Eigen::Matrix::Constant(k, DUMMY_VAR__); + current_statement__ = 12; for (int i = 1; i <= k; ++i) { - current_statement__ = 5; - assign(R_vector, cons_list(index_uni(i), nil_index_list()), - pow(sigma_b[(i - 1)], 2), "assigning variable R_vector"); - current_statement__ = 6; - assign(P1_vector, cons_list(index_uni(i), nil_index_list()), - pow(beta_sd[(i - 1)], 2), "assigning variable P1_vector");} + current_statement__ = 9; + stan::model::assign(R_vector, + stan::math::pow( + stan::model::rvalue(sigma_b, "sigma_b", stan::model::index_uni(i)), + 2), "assigning variable R_vector", stan::model::index_uni(i)); + current_statement__ = 10; + stan::model::assign(P1_vector, + stan::math::pow( + stan::model::rvalue(beta_sd, "beta_sd", stan::model::index_uni(i)), + 2), "assigning variable P1_vector", stan::model::index_uni(i)); + } { current_statement__ = 40; - lp_accum__.add( - normal_lpdf(sigma_b, sigma_b_mean, sigma_b_sd)); + lp_accum__.add(stan::math::normal_lpdf(sigma_b, + sigma_b_mean, sigma_b_sd)); current_statement__ = 41; - lp_accum__.add( - normal_lpdf(sigma_y, sigma_y_mean, sigma_y_sd)); + lp_accum__.add(stan::math::normal_lpdf(sigma_y, + sigma_y_mean, sigma_y_sd)); current_statement__ = 42; - lp_accum__.add( - gaussian_filter_rw_lpdf(y, beta_mean, P1_vector, - pow(sigma_y, 2), diag_matrix(R_vector), xreg, pstream__)); + lp_accum__.add(gaussian_filter_rw_lpdf(y, beta_mean, + P1_vector, stan::math::pow(sigma_y, 2), + stan::math::diag_matrix(R_vector), xreg, pstream__)); } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } lp_accum__.add(lp__); return lp_accum__.sum(); - } // log_prob_impl() - - template * = nullptr, stan::require_vector_like_vt* = nullptr, stan::require_std_vector_vt* = nullptr> - inline void write_array_impl(RNG& base_rng__, VecR& params_r__, - VecI& params_i__, VecVar& vars__, - const bool emit_transformed_parameters__ = true, - const bool emit_generated_quantities__ = true, - std::ostream* pstream__ = nullptr) const { + } + template * = nullptr, stan::require_vector_like_vt* = nullptr, stan::require_vector_vt* = nullptr> + inline void + write_array_impl(RNG& base_rng__, VecR& params_r__, VecI& params_i__, + VecVar& vars__, const bool + emit_transformed_parameters__ = true, const bool + emit_generated_quantities__ = true, std::ostream* + pstream__ = nullptr) const { using local_scalar_t__ = double; - vars__.resize(0); - stan::io::reader in__(params_r__, params_i__); - static const char* function__ = "model_rw1_model_namespace::write_array"; -(void) function__; // suppress unused var warning - (void) function__; // suppress unused var warning + stan::io::deserializer in__(params_r__, params_i__); + stan::io::serializer out__(vars__); + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; double lp__ = 0.0; - (void) lp__; // dummy to suppress unused var warning + // suppress unused var warning + (void) lp__; + int current_statement__ = 0; stan::math::accumulator lp_accum__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; + constexpr bool jacobian__ = false; + static constexpr const char* function__ = + "model_rw1_model_namespace::write_array"; + // suppress unused var warning + (void) function__; try { - std::vector sigma_b; - sigma_b = std::vector(k, std::numeric_limits::quiet_NaN()); - - current_statement__ = 1; - for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - current_statement__ = 1; - assign(sigma_b, cons_list(index_uni(sym1__), nil_index_list()), - in__.scalar(), "assigning variable sigma_b");} + std::vector sigma_b = + std::vector(k, std::numeric_limits::quiet_NaN()); current_statement__ = 1; - for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - current_statement__ = 1; - assign(sigma_b, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(sigma_b[(sym1__ - 1)], 0), - "assigning variable sigma_b");} - double sigma_y; - sigma_y = std::numeric_limits::quiet_NaN(); - - current_statement__ = 2; - sigma_y = in__.scalar(); + sigma_b = in__.template read_constrain_lb< + std::vector, jacobian__>(0, lp__, k); + double sigma_y = std::numeric_limits::quiet_NaN(); current_statement__ = 2; - sigma_y = stan::math::lb_constrain(sigma_y, 0); - Eigen::Matrix R_vector; - R_vector = Eigen::Matrix(k); - stan::math::fill(R_vector, std::numeric_limits::quiet_NaN()); - - Eigen::Matrix P1_vector; - P1_vector = Eigen::Matrix(k); - stan::math::fill(P1_vector, std::numeric_limits::quiet_NaN()); - - for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - vars__.emplace_back(sigma_b[(sym1__ - 1)]);} - vars__.emplace_back(sigma_y); - if (logical_negation((primitive_value(emit_transformed_parameters__) || - primitive_value(emit_generated_quantities__)))) { + sigma_y = in__.template read_constrain_lb(0, lp__); + Eigen::Matrix R_vector = + Eigen::Matrix::Constant(k, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix P1_vector = + Eigen::Matrix::Constant(k, + std::numeric_limits::quiet_NaN()); + out__.write(sigma_b); + out__.write(sigma_y); + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { return ; - } - current_statement__ = 8; + } + current_statement__ = 12; for (int i = 1; i <= k; ++i) { - current_statement__ = 5; - assign(R_vector, cons_list(index_uni(i), nil_index_list()), - pow(sigma_b[(i - 1)], 2), "assigning variable R_vector"); - current_statement__ = 6; - assign(P1_vector, cons_list(index_uni(i), nil_index_list()), - pow(beta_sd[(i - 1)], 2), "assigning variable P1_vector");} + current_statement__ = 9; + stan::model::assign(R_vector, + stan::math::pow( + stan::model::rvalue(sigma_b, "sigma_b", stan::model::index_uni(i)), + 2), "assigning variable R_vector", stan::model::index_uni(i)); + current_statement__ = 10; + stan::model::assign(P1_vector, + stan::math::pow( + stan::model::rvalue(beta_sd, "beta_sd", stan::model::index_uni(i)), + 2), "assigning variable P1_vector", stan::model::index_uni(i)); + } if (emit_transformed_parameters__) { - for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - vars__.emplace_back(R_vector[(sym1__ - 1)]);} - for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - vars__.emplace_back(P1_vector[(sym1__ - 1)]);} - } - if (logical_negation(emit_generated_quantities__)) { + out__.write(R_vector); + out__.write(P1_vector); + } + if (stan::math::logical_negation(emit_generated_quantities__)) { return ; - } - Eigen::Matrix y_rep; - y_rep = Eigen::Matrix(n); - stan::math::fill(y_rep, std::numeric_limits::quiet_NaN()); - - Eigen::Matrix beta; - beta = Eigen::Matrix(k, n); - stan::math::fill(beta, std::numeric_limits::quiet_NaN()); - - Eigen::Matrix y_new; - y_new = Eigen::Matrix(n_new); - stan::math::fill(y_new, std::numeric_limits::quiet_NaN()); - - Eigen::Matrix beta_new; - beta_new = Eigen::Matrix(k, n_new); - stan::math::fill(beta_new, std::numeric_limits::quiet_NaN()); - + } + Eigen::Matrix y_rep = + Eigen::Matrix::Constant(n, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix beta = + Eigen::Matrix::Constant(k, n, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix y_new = + Eigen::Matrix::Constant(n_new, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix beta_new = + Eigen::Matrix::Constant(k, n_new, + std::numeric_limits::quiet_NaN()); current_statement__ = 15; for (int i = 1; i <= k; ++i) { current_statement__ = 13; - assign(beta, - cons_list(index_uni(i), cons_list(index_uni(1), nil_index_list())), - normal_rng(beta_mean[(i - 1)], beta_sd[(i - 1)], base_rng__), - "assigning variable beta");} + stan::model::assign(beta, + stan::math::normal_rng( + stan::model::rvalue(beta_mean, "beta_mean", + stan::model::index_uni(i)), + stan::model::rvalue(beta_sd, "beta_sd", stan::model::index_uni(i)), + base_rng__), "assigning variable beta", + stan::model::index_uni(i), stan::model::index_uni(1)); + } current_statement__ = 20; for (int t = 1; t <= (n - 1); ++t) { current_statement__ = 18; for (int i = 1; i <= k; ++i) { current_statement__ = 16; - assign(beta, - cons_list(index_uni(i), - cons_list(index_uni((t + 1)), nil_index_list())), - normal_rng( - rvalue(beta, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "beta"), - sigma_b[(i - 1)], base_rng__), "assigning variable beta");}} + stan::model::assign(beta, + stan::math::normal_rng( + stan::model::rvalue(beta, "beta", stan::model::index_uni(i), + stan::model::index_uni(t)), + stan::model::rvalue(sigma_b, "sigma_b", + stan::model::index_uni(i)), base_rng__), + "assigning variable beta", stan::model::index_uni(i), + stan::model::index_uni((t + 1))); + } + } current_statement__ = 23; for (int t = 1; t <= n; ++t) { current_statement__ = 21; - assign(y_rep, cons_list(index_uni(t), nil_index_list()), - normal_rng( - dot_product( - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg"), - rvalue(beta, - cons_list(index_min_max(1, k), - cons_list(index_uni(t), nil_index_list())), "beta")), - sigma_y, base_rng__), "assigning variable y_rep");} + stan::model::assign(y_rep, + stan::math::normal_rng( + stan::math::dot_product( + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t)), + stan::model::rvalue(beta, "beta", + stan::model::index_min_max(1, k), stan::model::index_uni(t))), + sigma_y, base_rng__), "assigning variable y_rep", + stan::model::index_uni(t)); + } current_statement__ = 24; - assign(beta, nil_index_list(), - add(stan::model::deep_copy(beta), - gaussian_smoother_rw(subtract(y, y_rep), beta_mean, P1_vector, - pow(sigma_y, 2), diag_matrix(R_vector), xreg, pstream__)), + stan::model::assign(beta, + stan::math::add(stan::model::deep_copy(beta), + gaussian_smoother_rw(stan::math::subtract(y, y_rep), beta_mean, + P1_vector, stan::math::pow(sigma_y, 2), + stan::math::diag_matrix(R_vector), xreg, pstream__)), "assigning variable beta"); current_statement__ = 27; for (int t = 1; t <= n; ++t) { current_statement__ = 25; - assign(y_rep, cons_list(index_uni(t), nil_index_list()), - (dot_product( - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg"), - rvalue(beta, - cons_list(index_min_max(1, k), - cons_list(index_uni(t), nil_index_list())), "beta")) + - normal_rng(0, sigma_y, base_rng__)), "assigning variable y_rep"); + stan::model::assign(y_rep, + (stan::math::dot_product( + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t)), + stan::model::rvalue(beta, "beta", + stan::model::index_min_max(1, k), stan::model::index_uni(t))) + + stan::math::normal_rng(0, sigma_y, base_rng__)), + "assigning variable y_rep", stan::model::index_uni(t)); } current_statement__ = 39; - if (logical_gt(n_new, 0)) { + if (stan::math::logical_gt(n_new, 0)) { current_statement__ = 30; for (int i = 1; i <= k; ++i) { current_statement__ = 28; - assign(beta_new, - cons_list(index_uni(i), - cons_list(index_uni(1), nil_index_list())), - normal_rng( - rvalue(beta, - cons_list(index_uni(i), - cons_list(index_uni(n), nil_index_list())), "beta"), - sigma_b[(i - 1)], base_rng__), "assigning variable beta_new");} + stan::model::assign(beta_new, + stan::math::normal_rng( + stan::model::rvalue(beta, "beta", stan::model::index_uni(i), + stan::model::index_uni(n)), + stan::model::rvalue(sigma_b, "sigma_b", + stan::model::index_uni(i)), base_rng__), + "assigning variable beta_new", stan::model::index_uni(i), + stan::model::index_uni(1)); + } current_statement__ = 36; for (int t = 1; t <= (n_new - 1); ++t) { current_statement__ = 31; - assign(y_new, cons_list(index_uni(t), nil_index_list()), - (dot_product( - rvalue(xreg_new, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg_new"), - rvalue(beta_new, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "beta_new")) + - normal_rng(0, sigma_y, base_rng__)), "assigning variable y_new"); + stan::model::assign(y_new, + (stan::math::dot_product( + stan::model::rvalue(xreg_new, "xreg_new", + stan::model::index_omni(), stan::model::index_uni(t)), + stan::model::rvalue(beta_new, "beta_new", + stan::model::index_omni(), stan::model::index_uni(t))) + + stan::math::normal_rng(0, sigma_y, base_rng__)), + "assigning variable y_new", stan::model::index_uni(t)); current_statement__ = 34; for (int i = 1; i <= k; ++i) { current_statement__ = 32; - assign(beta_new, - cons_list(index_uni(i), - cons_list(index_uni((t + 1)), nil_index_list())), - normal_rng( - rvalue(beta_new, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "beta_new"), - sigma_b[(i - 1)], base_rng__), "assigning variable beta_new"); - }} + stan::model::assign(beta_new, + stan::math::normal_rng( + stan::model::rvalue(beta_new, "beta_new", + stan::model::index_uni(i), stan::model::index_uni(t)), + stan::model::rvalue(sigma_b, "sigma_b", + stan::model::index_uni(i)), base_rng__), + "assigning variable beta_new", stan::model::index_uni(i), + stan::model::index_uni((t + 1))); + } + } current_statement__ = 37; - assign(y_new, cons_list(index_uni(n_new), nil_index_list()), - (dot_product( - rvalue(xreg_new, - cons_list(index_omni(), - cons_list(index_uni(n_new), nil_index_list())), "xreg_new"), - rvalue(beta_new, - cons_list(index_omni(), - cons_list(index_uni(n_new), nil_index_list())), "beta_new")) - + normal_rng(0, sigma_y, base_rng__)), "assigning variable y_new"); - } - for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - vars__.emplace_back(y_rep[(sym1__ - 1)]);} - for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - for (int sym2__ = 1; sym2__ <= k; ++sym2__) { - vars__.emplace_back( - rvalue(beta, - cons_list(index_uni(sym2__), - cons_list(index_uni(sym1__), nil_index_list())), "beta"));}} - for (int sym1__ = 1; sym1__ <= n_new; ++sym1__) { - vars__.emplace_back(y_new[(sym1__ - 1)]);} - for (int sym1__ = 1; sym1__ <= n_new; ++sym1__) { - for (int sym2__ = 1; sym2__ <= k; ++sym2__) { - vars__.emplace_back( - rvalue(beta_new, - cons_list(index_uni(sym2__), - cons_list(index_uni(sym1__), nil_index_list())), "beta_new")); - }} + stan::model::assign(y_new, + (stan::math::dot_product( + stan::model::rvalue(xreg_new, "xreg_new", + stan::model::index_omni(), stan::model::index_uni(n_new)), + stan::model::rvalue(beta_new, "beta_new", + stan::model::index_omni(), stan::model::index_uni(n_new))) + + stan::math::normal_rng(0, sigma_y, base_rng__)), + "assigning variable y_new", stan::model::index_uni(n_new)); + } + out__.write(y_rep); + out__.write(beta); + out__.write(y_new); + out__.write(beta_new); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } - } // write_array_impl() - - template * = nullptr, stan::require_vector_like_vt* = nullptr> - inline void transform_inits_impl(const stan::io::var_context& context__, - VecI& params_i__, VecVar& vars__, - std::ostream* pstream__ = nullptr) const { + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline void + unconstrain_array_impl(const VecVar& params_r__, const VecI& params_i__, + VecVar& vars__, std::ostream* pstream__ = nullptr) const { using local_scalar_t__ = double; - vars__.clear(); - vars__.reserve(num_params_r__); - + stan::io::deserializer in__(params_r__, params_i__); + stan::io::serializer out__(vars__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; try { - int pos__; - pos__ = std::numeric_limits::min(); - + int pos__ = std::numeric_limits::min(); pos__ = 1; - std::vector sigma_b; - sigma_b = std::vector(k, std::numeric_limits::quiet_NaN()); - + std::vector sigma_b = + std::vector(k, DUMMY_VAR__); current_statement__ = 1; - assign(sigma_b, nil_index_list(), context__.vals_r("sigma_b"), + stan::model::assign(sigma_b, + in__.read>(k), "assigning variable sigma_b"); - std::vector sigma_b_free__; - sigma_b_free__ = std::vector(k, std::numeric_limits::quiet_NaN()); - + out__.write_free_lb(0, sigma_b); + local_scalar_t__ sigma_y = DUMMY_VAR__; + current_statement__ = 2; + sigma_y = in__.read(); + out__.write_free_lb(0, sigma_y); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + template * = nullptr> + inline void + transform_inits_impl(const stan::io::var_context& context__, VecVar& + vars__, std::ostream* pstream__ = nullptr) const { + using local_scalar_t__ = double; + stan::io::serializer out__(vars__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { current_statement__ = 1; - for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - current_statement__ = 1; - assign(sigma_b_free__, - cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_free(sigma_b[(sym1__ - 1)], 0), - "assigning variable sigma_b_free__");} - double sigma_y; - sigma_y = std::numeric_limits::quiet_NaN(); - + context__.validate_dims("parameter initialization", "sigma_b", + "double", std::vector{static_cast(k)}); current_statement__ = 2; - sigma_y = context__.vals_r("sigma_y")[(1 - 1)]; - double sigma_y_free__; - sigma_y_free__ = std::numeric_limits::quiet_NaN(); - + context__.validate_dims("parameter initialization", "sigma_y", + "double", std::vector{}); + int pos__ = std::numeric_limits::min(); + pos__ = 1; + std::vector sigma_b = + std::vector(k, DUMMY_VAR__); + current_statement__ = 1; + sigma_b = context__.vals_r("sigma_b"); + out__.write_free_lb(0, sigma_b); + local_scalar_t__ sigma_y = DUMMY_VAR__; current_statement__ = 2; - sigma_y_free__ = stan::math::lb_free(sigma_y, 0); - for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - vars__.emplace_back(sigma_b_free__[(sym1__ - 1)]);} - vars__.emplace_back(sigma_y_free__); + sigma_y = context__.vals_r("sigma_y")[(1 - 1)]; + out__.write_free_lb(0, sigma_y); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } - } // transform_inits_impl() - - inline void get_param_names(std::vector& names__) const { - - names__.clear(); - names__.emplace_back("sigma_b"); - names__.emplace_back("sigma_y"); - names__.emplace_back("R_vector"); - names__.emplace_back("P1_vector"); - names__.emplace_back("y_rep"); - names__.emplace_back("beta"); - names__.emplace_back("y_new"); - names__.emplace_back("beta_new"); - } // get_param_names() - - inline void get_dims(std::vector>& dimss__) const { - dimss__.clear(); - dimss__.emplace_back(std::vector{static_cast(k)}); - - dimss__.emplace_back(std::vector{}); - - dimss__.emplace_back(std::vector{static_cast(k)}); - - dimss__.emplace_back(std::vector{static_cast(k)}); - - dimss__.emplace_back(std::vector{static_cast(n)}); - - dimss__.emplace_back(std::vector{static_cast(k), - static_cast(n)}); - - dimss__.emplace_back(std::vector{static_cast(n_new)}); - - dimss__.emplace_back(std::vector{static_cast(k), - static_cast(n_new)}); - - } // get_dims() - - inline void constrained_param_names( - std::vector& param_names__, - bool emit_transformed_parameters__ = true, - bool emit_generated_quantities__ = true) const - final { - + } + inline void + get_param_names(std::vector& names__, const bool + emit_transformed_parameters__ = true, const bool + emit_generated_quantities__ = true) const { + names__ = std::vector{"sigma_b", "sigma_y"}; + if (emit_transformed_parameters__) { + std::vector temp{"R_vector", "P1_vector"}; + names__.reserve(names__.size() + temp.size()); + names__.insert(names__.end(), temp.begin(), temp.end()); + } + if (emit_generated_quantities__) { + std::vector temp{"y_rep", "beta", "y_new", "beta_new"}; + names__.reserve(names__.size() + temp.size()); + names__.insert(names__.end(), temp.begin(), temp.end()); + } + } + inline void + get_dims(std::vector>& dimss__, const bool + emit_transformed_parameters__ = true, const bool + emit_generated_quantities__ = true) const { + dimss__ = std::vector>{std::vector{static_cast< + size_t>(k)}, + std::vector{}}; + if (emit_transformed_parameters__) { + std::vector> + temp{std::vector{static_cast(k)}, + std::vector{static_cast(k)}}; + dimss__.reserve(dimss__.size() + temp.size()); + dimss__.insert(dimss__.end(), temp.begin(), temp.end()); + } + if (emit_generated_quantities__) { + std::vector> + temp{std::vector{static_cast(n)}, + std::vector{static_cast(k), + static_cast(n)}, + std::vector{static_cast(n_new)}, + std::vector{static_cast(k), + static_cast(n_new)}}; + dimss__.reserve(dimss__.size() + temp.size()); + dimss__.insert(dimss__.end(), temp.begin(), temp.end()); + } + } + inline void + constrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - { - param_names__.emplace_back(std::string() + "sigma_b" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "sigma_b" + '.' + + std::to_string(sym1__)); + } param_names__.emplace_back(std::string() + "sigma_y"); if (emit_transformed_parameters__) { for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - { - param_names__.emplace_back(std::string() + "R_vector" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "R_vector" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - { - param_names__.emplace_back(std::string() + "P1_vector" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "P1_vector" + '.' + + std::to_string(sym1__)); + } } - if (emit_generated_quantities__) { for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - param_names__.emplace_back(std::string() + "y_rep" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "y_rep" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - for (int sym2__ = 1; sym2__ <= k; ++sym2__) { - { - param_names__.emplace_back(std::string() + "beta" + '.' + std::to_string(sym2__) + '.' + std::to_string(sym1__)); - }} - }} + for (int sym2__ = 1; sym2__ <= k; ++sym2__) { + param_names__.emplace_back(std::string() + "beta" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } for (int sym1__ = 1; sym1__ <= n_new; ++sym1__) { - { - param_names__.emplace_back(std::string() + "y_new" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "y_new" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= n_new; ++sym1__) { - { - for (int sym2__ = 1; sym2__ <= k; ++sym2__) { - { - param_names__.emplace_back(std::string() + "beta_new" + '.' + std::to_string(sym2__) + '.' + std::to_string(sym1__)); - }} - }} + for (int sym2__ = 1; sym2__ <= k; ++sym2__) { + param_names__.emplace_back(std::string() + "beta_new" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } } - - } // constrained_param_names() - - inline void unconstrained_param_names( - std::vector& param_names__, - bool emit_transformed_parameters__ = true, - bool emit_generated_quantities__ = true) const - final { - + } + inline void + unconstrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - { - param_names__.emplace_back(std::string() + "sigma_b" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "sigma_b" + '.' + + std::to_string(sym1__)); + } param_names__.emplace_back(std::string() + "sigma_y"); if (emit_transformed_parameters__) { for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - { - param_names__.emplace_back(std::string() + "R_vector" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "R_vector" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - { - param_names__.emplace_back(std::string() + "P1_vector" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "P1_vector" + '.' + + std::to_string(sym1__)); + } } - if (emit_generated_quantities__) { for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - param_names__.emplace_back(std::string() + "y_rep" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "y_rep" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - for (int sym2__ = 1; sym2__ <= k; ++sym2__) { - { - param_names__.emplace_back(std::string() + "beta" + '.' + std::to_string(sym2__) + '.' + std::to_string(sym1__)); - }} - }} + for (int sym2__ = 1; sym2__ <= k; ++sym2__) { + param_names__.emplace_back(std::string() + "beta" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } for (int sym1__ = 1; sym1__ <= n_new; ++sym1__) { - { - param_names__.emplace_back(std::string() + "y_new" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "y_new" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= n_new; ++sym1__) { - { - for (int sym2__ = 1; sym2__ <= k; ++sym2__) { - { - param_names__.emplace_back(std::string() + "beta_new" + '.' + std::to_string(sym2__) + '.' + std::to_string(sym1__)); - }} - }} + for (int sym2__ = 1; sym2__ <= k; ++sym2__) { + param_names__.emplace_back(std::string() + "beta_new" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } } - - } // unconstrained_param_names() - + } inline std::string get_constrained_sizedtypes() const { - stringstream s__; - s__ << "[{\"name\":\"sigma_b\",\"type\":{\"name\":\"array\",\"length\":" << k << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"sigma_y\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"R_vector\",\"type\":{\"name\":\"vector\",\"length\":" << k << "},\"block\":\"transformed_parameters\"},{\"name\":\"P1_vector\",\"type\":{\"name\":\"vector\",\"length\":" << k << "},\"block\":\"transformed_parameters\"},{\"name\":\"y_rep\",\"type\":{\"name\":\"vector\",\"length\":" << n << "},\"block\":\"generated_quantities\"},{\"name\":\"beta\",\"type\":{\"name\":\"matrix\",\"rows\":" << k << ",\"cols\":" << n << "},\"block\":\"generated_quantities\"},{\"name\":\"y_new\",\"type\":{\"name\":\"vector\",\"length\":" << n_new << "},\"block\":\"generated_quantities\"},{\"name\":\"beta_new\",\"type\":{\"name\":\"matrix\",\"rows\":" << k << ",\"cols\":" << n_new << "},\"block\":\"generated_quantities\"}]"; - return s__.str(); - } // get_constrained_sizedtypes() - + return std::string("[{\"name\":\"sigma_b\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(k) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"sigma_y\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"R_vector\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(k) + "},\"block\":\"transformed_parameters\"},{\"name\":\"P1_vector\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(k) + "},\"block\":\"transformed_parameters\"},{\"name\":\"y_rep\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n) + "},\"block\":\"generated_quantities\"},{\"name\":\"beta\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(k) + ",\"cols\":" + std::to_string(n) + "},\"block\":\"generated_quantities\"},{\"name\":\"y_new\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_new) + "},\"block\":\"generated_quantities\"},{\"name\":\"beta_new\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(k) + ",\"cols\":" + std::to_string(n_new) + "},\"block\":\"generated_quantities\"}]"); + } inline std::string get_unconstrained_sizedtypes() const { - stringstream s__; - s__ << "[{\"name\":\"sigma_b\",\"type\":{\"name\":\"array\",\"length\":" << k << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"sigma_y\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"R_vector\",\"type\":{\"name\":\"vector\",\"length\":" << k << "},\"block\":\"transformed_parameters\"},{\"name\":\"P1_vector\",\"type\":{\"name\":\"vector\",\"length\":" << k << "},\"block\":\"transformed_parameters\"},{\"name\":\"y_rep\",\"type\":{\"name\":\"vector\",\"length\":" << n << "},\"block\":\"generated_quantities\"},{\"name\":\"beta\",\"type\":{\"name\":\"matrix\",\"rows\":" << k << ",\"cols\":" << n << "},\"block\":\"generated_quantities\"},{\"name\":\"y_new\",\"type\":{\"name\":\"vector\",\"length\":" << n_new << "},\"block\":\"generated_quantities\"},{\"name\":\"beta_new\",\"type\":{\"name\":\"matrix\",\"rows\":" << k << ",\"cols\":" << n_new << "},\"block\":\"generated_quantities\"}]"; - return s__.str(); - } // get_unconstrained_sizedtypes() - - - // Begin method overload boilerplate - template - inline void write_array(RNG& base_rng, - Eigen::Matrix& params_r, - Eigen::Matrix& vars, - const bool emit_transformed_parameters = true, - const bool emit_generated_quantities = true, - std::ostream* pstream = nullptr) const { - std::vector vars_vec(vars.size()); - std::vector params_i; - write_array_impl(base_rng, params_r, params_i, vars_vec, - emit_transformed_parameters, emit_generated_quantities, pstream); - vars.resize(vars_vec.size()); - for (int i = 0; i < vars.size(); ++i) { - vars.coeffRef(i) = vars_vec[i]; - } - } - template - inline void write_array(RNG& base_rng, std::vector& params_r, - std::vector& params_i, - std::vector& vars, - bool emit_transformed_parameters = true, - bool emit_generated_quantities = true, - std::ostream* pstream = nullptr) const { - write_array_impl(base_rng, params_r, params_i, vars, emit_transformed_parameters, emit_generated_quantities, pstream); - } - template - inline T_ log_prob(Eigen::Matrix& params_r, - std::ostream* pstream = nullptr) const { - Eigen::Matrix params_i; - return log_prob_impl(params_r, params_i, pstream); - } - template - inline T__ log_prob(std::vector& params_r, - std::vector& params_i, - std::ostream* pstream = nullptr) const { - return log_prob_impl(params_r, params_i, pstream); - } - - inline void transform_inits(const stan::io::var_context& context, - Eigen::Matrix& params_r, - std::ostream* pstream = nullptr) const final { - std::vector params_r_vec(params_r.size()); - std::vector params_i; - transform_inits_impl(context, params_i, params_r_vec, pstream); - params_r.resize(params_r_vec.size()); - for (int i = 0; i < params_r.size(); ++i) { - params_r.coeffRef(i) = params_r_vec[i]; - } - } - inline void transform_inits(const stan::io::var_context& context, - std::vector& params_i, - std::vector& vars, - std::ostream* pstream = nullptr) const final { - transform_inits_impl(context, params_i, vars, pstream); - } + return std::string("[{\"name\":\"sigma_b\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(k) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"sigma_y\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"R_vector\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(k) + "},\"block\":\"transformed_parameters\"},{\"name\":\"P1_vector\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(k) + "},\"block\":\"transformed_parameters\"},{\"name\":\"y_rep\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n) + "},\"block\":\"generated_quantities\"},{\"name\":\"beta\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(k) + ",\"cols\":" + std::to_string(n) + "},\"block\":\"generated_quantities\"},{\"name\":\"y_new\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_new) + "},\"block\":\"generated_quantities\"},{\"name\":\"beta_new\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(k) + ",\"cols\":" + std::to_string(n_new) + "},\"block\":\"generated_quantities\"}]"); + } + // Begin method overload boilerplate + template inline void + write_array(RNG& base_rng, Eigen::Matrix& params_r, + Eigen::Matrix& vars, const bool + emit_transformed_parameters = true, const bool + emit_generated_quantities = true, std::ostream* + pstream = nullptr) const { + const size_t num_params__ = (k + 1); + const size_t num_transformed = emit_transformed_parameters * ((k + k)); + const size_t num_gen_quantities = emit_generated_quantities * ((((n + (k + * n)) + n_new) + (k * n_new))); + const size_t num_to_write = num_params__ + num_transformed + + num_gen_quantities; + std::vector params_i; + vars = Eigen::Matrix::Constant(num_to_write, + std::numeric_limits::quiet_NaN()); + write_array_impl(base_rng, params_r, params_i, vars, + emit_transformed_parameters, emit_generated_quantities, pstream); + } + template inline void + write_array(RNG& base_rng, std::vector& params_r, std::vector& + params_i, std::vector& vars, bool + emit_transformed_parameters = true, bool + emit_generated_quantities = true, std::ostream* + pstream = nullptr) const { + const size_t num_params__ = (k + 1); + const size_t num_transformed = emit_transformed_parameters * ((k + k)); + const size_t num_gen_quantities = emit_generated_quantities * ((((n + (k + * n)) + n_new) + (k * n_new))); + const size_t num_to_write = num_params__ + num_transformed + + num_gen_quantities; + vars = std::vector(num_to_write, + std::numeric_limits::quiet_NaN()); + write_array_impl(base_rng, params_r, params_i, vars, + emit_transformed_parameters, emit_generated_quantities, pstream); + } + template inline T_ + log_prob(Eigen::Matrix& params_r, std::ostream* pstream = nullptr) const { + Eigen::Matrix params_i; + return log_prob_impl(params_r, params_i, pstream); + } + template inline T_ + log_prob(std::vector& params_r, std::vector& params_i, + std::ostream* pstream = nullptr) const { + return log_prob_impl(params_r, params_i, pstream); + } + inline void + transform_inits(const stan::io::var_context& context, + Eigen::Matrix& params_r, std::ostream* + pstream = nullptr) const final { + std::vector params_r_vec(params_r.size()); + std::vector params_i; + transform_inits(context, params_i, params_r_vec, pstream); + params_r = Eigen::Map>(params_r_vec.data(), + params_r_vec.size()); + } + inline void + transform_inits(const stan::io::var_context& context, std::vector& + params_i, std::vector& vars, std::ostream* + pstream__ = nullptr) const { + vars.resize(num_params_r__); + transform_inits_impl(context, vars, pstream__); + } + inline void + unconstrain_array(const std::vector& params_constrained, + std::vector& params_unconstrained, std::ostream* + pstream = nullptr) const { + const std::vector params_i; + params_unconstrained = std::vector(num_params_r__, + std::numeric_limits::quiet_NaN()); + unconstrain_array_impl(params_constrained, params_i, + params_unconstrained, pstream); + } + inline void + unconstrain_array(const Eigen::Matrix& params_constrained, + Eigen::Matrix& params_unconstrained, + std::ostream* pstream = nullptr) const { + const std::vector params_i; + params_unconstrained = Eigen::Matrix::Constant(num_params_r__, + std::numeric_limits::quiet_NaN()); + unconstrain_array_impl(params_constrained, params_i, + params_unconstrained, pstream); + } }; } using stan_model = model_rw1_model_namespace::model_rw1_model; #ifndef USING_R // Boilerplate -stan::model::model_base& new_model( - stan::io::var_context& data_context, - unsigned int seed, - std::ostream* msg_stream) { +stan::model::model_base& +new_model(stan::io::var_context& data_context, unsigned int seed, + std::ostream* msg_stream) { stan_model* m = new stan_model(data_context, seed, msg_stream); return *m; } diff --git a/src/stanExports_rw1_model_naive.h b/src/stanExports_rw1_model_naive.h index 8cb988d..0c2b536 100644 --- a/src/stanExports_rw1_model_naive.h +++ b/src/stanExports_rw1_model_naive.h @@ -21,181 +21,133 @@ #define USE_STANC3 #endif #include -// Code generated by stanc v2.26.1-4-gd72b68b7-dirty +// Code generated by stanc v2.32.2 #include namespace model_rw1_model_naive_namespace { -inline void validate_positive_index(const char* var_name, const char* expr, - int val) { - if (val < 1) { - std::stringstream msg; - msg << "Found dimension size less than one in simplex declaration" - << "; variable=" << var_name << "; dimension size expression=" << expr - << "; expression value=" << val; - std::string msg_str(msg.str()); - throw std::invalid_argument(msg_str.c_str()); - } -} -inline void validate_unit_vector_index(const char* var_name, const char* expr, - int val) { - if (val <= 1) { - std::stringstream msg; - if (val == 1) { - msg << "Found dimension size one in unit vector declaration." - << " One-dimensional unit vector is discrete" - << " but the target distribution must be continuous." - << " variable=" << var_name << "; dimension size expression=" << expr; - } else { - msg << "Found dimension size less than one in unit vector declaration" - << "; variable=" << var_name << "; dimension size expression=" << expr - << "; expression value=" << val; - } - std::string msg_str(msg.str()); - throw std::invalid_argument(msg_str.c_str()); - } -} -using std::istream; -using std::string; -using std::stringstream; -using std::vector; -using std::pow; -using stan::io::dump; -using stan::math::lgamma; using stan::model::model_base_crtp; -using stan::model::rvalue; -using stan::model::cons_list; -using stan::model::index_uni; -using stan::model::index_max; -using stan::model::index_min; -using stan::model::index_min_max; -using stan::model::index_multi; -using stan::model::index_omni; -using stan::model::nil_index_list; using namespace stan::math; -using stan::math::pow; stan::math::profile_map profiles__; -static int current_statement__= 0; -static const std::vector locations_array__ = {" (found before start of program)", - " (in 'string', line 18, column 2 to column 33)", - " (in 'string', line 19, column 2 to column 24)", - " (in 'string', line 20, column 2 to column 24)", - " (in 'string', line 23, column 2 to column 20)", - " (in 'string', line 25, column 2 to column 16)", - " (in 'string', line 26, column 2 to column 51)", - " (in 'string', line 28, column 4 to column 24)", - " (in 'string', line 29, column 4 to column 58)", - " (in 'string', line 27, column 16 to line 30, column 3)", - " (in 'string', line 27, column 2 to line 30, column 3)", - " (in 'string', line 33, column 2 to column 45)", - " (in 'string', line 34, column 2 to column 45)", - " (in 'string', line 35, column 2 to column 37)", - " (in 'string', line 37, column 15 to column 16)", - " (in 'string', line 37, column 4 to column 55)", - " (in 'string', line 38, column 4 to column 28)", - " (in 'string', line 36, column 2 to line 39, column 3)", - " (in 'string', line 2, column 2 to column 17)", - " (in 'string', line 3, column 2 to column 17)", - " (in 'string', line 4, column 9 to column 10)", - " (in 'string', line 4, column 12 to column 13)", - " (in 'string', line 4, column 2 to column 20)", - " (in 'string', line 5, column 9 to column 10)", - " (in 'string', line 5, column 2 to column 14)", - " (in 'string', line 6, column 9 to column 10)", - " (in 'string', line 6, column 2 to column 22)", - " (in 'string', line 7, column 9 to column 10)", - " (in 'string', line 7, column 2 to column 20)", - " (in 'string', line 8, column 9 to column 14)", - " (in 'string', line 8, column 2 to column 27)", - " (in 'string', line 9, column 9 to column 14)", - " (in 'string', line 9, column 2 to column 25)", - " (in 'string', line 12, column 9 to column 10)", - " (in 'string', line 12, column 2 to column 42)", - " (in 'string', line 13, column 9 to column 10)", - " (in 'string', line 13, column 2 to column 38)", - " (in 'string', line 14, column 2 to column 36)", - " (in 'string', line 15, column 2 to column 32)", - " (in 'string', line 18, column 8 to column 9)", - " (in 'string', line 20, column 9 to column 10)", - " (in 'string', line 20, column 12 to column 13)", - " (in 'string', line 23, column 9 to column 10)", - " (in 'string', line 23, column 12 to column 13)", - " (in 'string', line 25, column 9 to column 10)"}; +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'string', line 18, column 2 to column 33)", + " (in 'string', line 19, column 2 to column 24)", + " (in 'string', line 20, column 2 to column 24)", + " (in 'string', line 23, column 2 to column 20)", + " (in 'string', line 25, column 2 to column 16)", + " (in 'string', line 26, column 2 to column 51)", + " (in 'string', line 28, column 4 to column 24)", + " (in 'string', line 29, column 4 to column 58)", + " (in 'string', line 27, column 16 to line 30, column 3)", + " (in 'string', line 27, column 2 to line 30, column 3)", + " (in 'string', line 33, column 2 to column 45)", + " (in 'string', line 34, column 2 to column 45)", + " (in 'string', line 35, column 2 to column 37)", + " (in 'string', line 37, column 15 to column 16)", + " (in 'string', line 37, column 4 to column 55)", + " (in 'string', line 38, column 4 to column 28)", + " (in 'string', line 36, column 2 to line 39, column 3)", + " (in 'string', line 2, column 2 to column 17)", + " (in 'string', line 3, column 2 to column 17)", + " (in 'string', line 4, column 9 to column 10)", + " (in 'string', line 4, column 12 to column 13)", + " (in 'string', line 4, column 2 to column 20)", + " (in 'string', line 5, column 9 to column 10)", + " (in 'string', line 5, column 2 to column 14)", + " (in 'string', line 6, column 9 to column 10)", + " (in 'string', line 6, column 2 to column 22)", + " (in 'string', line 7, column 9 to column 10)", + " (in 'string', line 7, column 2 to column 20)", + " (in 'string', line 8, column 9 to column 14)", + " (in 'string', line 8, column 2 to column 27)", + " (in 'string', line 9, column 9 to column 14)", + " (in 'string', line 9, column 2 to column 25)", + " (in 'string', line 12, column 9 to column 10)", + " (in 'string', line 12, column 2 to column 42)", + " (in 'string', line 13, column 9 to column 10)", + " (in 'string', line 13, column 2 to column 38)", + " (in 'string', line 14, column 2 to column 36)", + " (in 'string', line 15, column 2 to column 32)", + " (in 'string', line 18, column 8 to column 9)", + " (in 'string', line 20, column 9 to column 10)", + " (in 'string', line 20, column 12 to column 13)", + " (in 'string', line 23, column 9 to column 10)", + " (in 'string', line 23, column 12 to column 13)", + " (in 'string', line 25, column 9 to column 10)"}; #include class model_rw1_model_naive final : public model_base_crtp { private: int k; int n; - Eigen::Matrix xreg; - Eigen::Matrix y; - Eigen::Matrix beta_mean; - Eigen::Matrix beta_sd; - Eigen::Matrix sigma_mean; - Eigen::Matrix sigma_sd; - Eigen::Matrix sigma_b_mean; - Eigen::Matrix sigma_b_sd; + Eigen::Matrix xreg_data__; + Eigen::Matrix y_data__; + Eigen::Matrix beta_mean_data__; + Eigen::Matrix beta_sd_data__; + Eigen::Matrix sigma_mean_data__; + Eigen::Matrix sigma_sd_data__; + Eigen::Matrix sigma_b_mean_data__; + Eigen::Matrix sigma_b_sd_data__; double sigma_y_mean; double sigma_y_sd; - + Eigen::Map> xreg{nullptr, 0, 0}; + Eigen::Map> y{nullptr, 0}; + Eigen::Map> beta_mean{nullptr, 0}; + Eigen::Map> beta_sd{nullptr, 0}; + Eigen::Map> sigma_mean{nullptr, 0}; + Eigen::Map> sigma_sd{nullptr, 0}; + Eigen::Map> sigma_b_mean{nullptr, 0}; + Eigen::Map> sigma_b_sd{nullptr, 0}; public: - ~model_rw1_model_naive() { } - - inline std::string model_name() const final { return "model_rw1_model_naive"; } - inline std::vector model_compile_info() const noexcept { - return std::vector{"stanc_version = stanc3 v2.26.1-4-gd72b68b7-dirty", "stancflags = "}; - } - - - model_rw1_model_naive(stan::io::var_context& context__, - unsigned int random_seed__ = 0, - std::ostream* pstream__ = nullptr) : model_base_crtp(0) { - using local_scalar_t__ = double ; - boost::ecuyer1988 base_rng__ = - stan::services::util::create_rng(random_seed__, 0); - (void) base_rng__; // suppress unused var warning - static const char* function__ = "model_rw1_model_naive_namespace::model_rw1_model_naive"; - (void) function__; // suppress unused var warning + ~model_rw1_model_naive() {} + model_rw1_model_naive(stan::io::var_context& context__, unsigned int + random_seed__ = 0, std::ostream* pstream__ = nullptr) + : model_base_crtp(0) { + int current_statement__ = 0; + using local_scalar_t__ = double; + boost::ecuyer1988 base_rng__ = + stan::services::util::create_rng(random_seed__, 0); + // suppress unused var warning + (void) base_rng__; + static constexpr const char* function__ = + "model_rw1_model_naive_namespace::model_rw1_model_naive"; + // suppress unused var warning + (void) function__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; try { - int pos__; - pos__ = std::numeric_limits::min(); - + int pos__ = std::numeric_limits::min(); pos__ = 1; current_statement__ = 18; - context__.validate_dims("data initialization","k","int", - context__.to_vec()); + context__.validate_dims("data initialization", "k", "int", + std::vector{}); k = std::numeric_limits::min(); - current_statement__ = 18; k = context__.vals_i("k")[(1 - 1)]; current_statement__ = 18; - current_statement__ = 18; - check_greater_or_equal(function__, "k", k, 0); + stan::math::check_greater_or_equal(function__, "k", k, 0); current_statement__ = 19; - context__.validate_dims("data initialization","n","int", - context__.to_vec()); + context__.validate_dims("data initialization", "n", "int", + std::vector{}); n = std::numeric_limits::min(); - current_statement__ = 19; n = context__.vals_i("n")[(1 - 1)]; current_statement__ = 19; - current_statement__ = 19; - check_greater_or_equal(function__, "n", n, 0); + stan::math::check_greater_or_equal(function__, "n", n, 0); current_statement__ = 20; - validate_non_negative_index("xreg", "k", k); + stan::math::validate_non_negative_index("xreg", "k", k); current_statement__ = 21; - validate_non_negative_index("xreg", "n", n); + stan::math::validate_non_negative_index("xreg", "n", n); current_statement__ = 22; - context__.validate_dims("data initialization","xreg","double", - context__.to_vec(k, n)); - xreg = Eigen::Matrix(k, n); - stan::math::fill(xreg, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "xreg", "double", + std::vector{static_cast(k), static_cast(n)}); + xreg_data__ = Eigen::Matrix::Constant(k, n, + std::numeric_limits::quiet_NaN()); + new (&xreg) Eigen::Map>(xreg_data__.data(), + k, n); { std::vector xreg_flat__; current_statement__ = 22; - assign(xreg_flat__, nil_index_list(), context__.vals_r("xreg"), - "assigning variable xreg_flat__"); + xreg_flat__ = context__.vals_r("xreg"); current_statement__ = 22; pos__ = 1; current_statement__ = 22; @@ -203,474 +155,451 @@ class model_rw1_model_naive final : public model_base_crtp(n); - stan::math::fill(y, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "y", "double", + std::vector{static_cast(n)}); + y_data__ = Eigen::Matrix::Constant(n, + std::numeric_limits::quiet_NaN()); + new (&y) Eigen::Map>(y_data__.data(), n); { std::vector y_flat__; current_statement__ = 24; - assign(y_flat__, nil_index_list(), context__.vals_r("y"), - "assigning variable y_flat__"); + y_flat__ = context__.vals_r("y"); current_statement__ = 24; pos__ = 1; current_statement__ = 24; for (int sym1__ = 1; sym1__ <= n; ++sym1__) { current_statement__ = 24; - assign(y, cons_list(index_uni(sym1__), nil_index_list()), - y_flat__[(pos__ - 1)], "assigning variable y"); + stan::model::assign(y, y_flat__[(pos__ - 1)], + "assigning variable y", stan::model::index_uni(sym1__)); current_statement__ = 24; - pos__ = (pos__ + 1);} + pos__ = (pos__ + 1); + } } current_statement__ = 25; - validate_non_negative_index("beta_mean", "k", k); + stan::math::validate_non_negative_index("beta_mean", "k", k); current_statement__ = 26; - context__.validate_dims("data initialization","beta_mean","double", - context__.to_vec(k)); - beta_mean = Eigen::Matrix(k); - stan::math::fill(beta_mean, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "beta_mean", "double", + std::vector{static_cast(k)}); + beta_mean_data__ = Eigen::Matrix::Constant(k, + std::numeric_limits::quiet_NaN()); + new (&beta_mean) + Eigen::Map>(beta_mean_data__.data(), k); { std::vector beta_mean_flat__; current_statement__ = 26; - assign(beta_mean_flat__, nil_index_list(), - context__.vals_r("beta_mean"), - "assigning variable beta_mean_flat__"); + beta_mean_flat__ = context__.vals_r("beta_mean"); current_statement__ = 26; pos__ = 1; current_statement__ = 26; for (int sym1__ = 1; sym1__ <= k; ++sym1__) { current_statement__ = 26; - assign(beta_mean, cons_list(index_uni(sym1__), nil_index_list()), - beta_mean_flat__[(pos__ - 1)], "assigning variable beta_mean"); + stan::model::assign(beta_mean, beta_mean_flat__[(pos__ - 1)], + "assigning variable beta_mean", stan::model::index_uni(sym1__)); current_statement__ = 26; - pos__ = (pos__ + 1);} + pos__ = (pos__ + 1); + } } current_statement__ = 27; - validate_non_negative_index("beta_sd", "k", k); + stan::math::validate_non_negative_index("beta_sd", "k", k); current_statement__ = 28; - context__.validate_dims("data initialization","beta_sd","double", - context__.to_vec(k)); - beta_sd = Eigen::Matrix(k); - stan::math::fill(beta_sd, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "beta_sd", "double", + std::vector{static_cast(k)}); + beta_sd_data__ = Eigen::Matrix::Constant(k, + std::numeric_limits::quiet_NaN()); + new (&beta_sd) + Eigen::Map>(beta_sd_data__.data(), k); { std::vector beta_sd_flat__; current_statement__ = 28; - assign(beta_sd_flat__, nil_index_list(), context__.vals_r("beta_sd"), - "assigning variable beta_sd_flat__"); + beta_sd_flat__ = context__.vals_r("beta_sd"); current_statement__ = 28; pos__ = 1; current_statement__ = 28; for (int sym1__ = 1; sym1__ <= k; ++sym1__) { current_statement__ = 28; - assign(beta_sd, cons_list(index_uni(sym1__), nil_index_list()), - beta_sd_flat__[(pos__ - 1)], "assigning variable beta_sd"); + stan::model::assign(beta_sd, beta_sd_flat__[(pos__ - 1)], + "assigning variable beta_sd", stan::model::index_uni(sym1__)); current_statement__ = 28; - pos__ = (pos__ + 1);} + pos__ = (pos__ + 1); + } } current_statement__ = 29; - validate_non_negative_index("sigma_mean", "k + 1", (k + 1)); + stan::math::validate_non_negative_index("sigma_mean", "k + 1", (k + 1)); current_statement__ = 30; - context__.validate_dims("data initialization","sigma_mean","double", - context__.to_vec((k + 1))); - sigma_mean = Eigen::Matrix((k + 1)); - stan::math::fill(sigma_mean, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "sigma_mean", "double", + std::vector{static_cast((k + 1))}); + sigma_mean_data__ = Eigen::Matrix::Constant((k + 1), + std::numeric_limits::quiet_NaN()); + new (&sigma_mean) + Eigen::Map>(sigma_mean_data__.data(), (k + + 1)); { std::vector sigma_mean_flat__; current_statement__ = 30; - assign(sigma_mean_flat__, nil_index_list(), - context__.vals_r("sigma_mean"), - "assigning variable sigma_mean_flat__"); + sigma_mean_flat__ = context__.vals_r("sigma_mean"); current_statement__ = 30; pos__ = 1; current_statement__ = 30; for (int sym1__ = 1; sym1__ <= (k + 1); ++sym1__) { current_statement__ = 30; - assign(sigma_mean, cons_list(index_uni(sym1__), nil_index_list()), - sigma_mean_flat__[(pos__ - 1)], "assigning variable sigma_mean"); + stan::model::assign(sigma_mean, sigma_mean_flat__[(pos__ - 1)], + "assigning variable sigma_mean", stan::model::index_uni(sym1__)); current_statement__ = 30; - pos__ = (pos__ + 1);} + pos__ = (pos__ + 1); + } } current_statement__ = 31; - validate_non_negative_index("sigma_sd", "k + 1", (k + 1)); + stan::math::validate_non_negative_index("sigma_sd", "k + 1", (k + 1)); current_statement__ = 32; - context__.validate_dims("data initialization","sigma_sd","double", - context__.to_vec((k + 1))); - sigma_sd = Eigen::Matrix((k + 1)); - stan::math::fill(sigma_sd, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "sigma_sd", "double", + std::vector{static_cast((k + 1))}); + sigma_sd_data__ = Eigen::Matrix::Constant((k + 1), + std::numeric_limits::quiet_NaN()); + new (&sigma_sd) + Eigen::Map>(sigma_sd_data__.data(), (k + + 1)); { std::vector sigma_sd_flat__; current_statement__ = 32; - assign(sigma_sd_flat__, nil_index_list(), - context__.vals_r("sigma_sd"), "assigning variable sigma_sd_flat__"); + sigma_sd_flat__ = context__.vals_r("sigma_sd"); current_statement__ = 32; pos__ = 1; current_statement__ = 32; for (int sym1__ = 1; sym1__ <= (k + 1); ++sym1__) { current_statement__ = 32; - assign(sigma_sd, cons_list(index_uni(sym1__), nil_index_list()), - sigma_sd_flat__[(pos__ - 1)], "assigning variable sigma_sd"); + stan::model::assign(sigma_sd, sigma_sd_flat__[(pos__ - 1)], + "assigning variable sigma_sd", stan::model::index_uni(sym1__)); current_statement__ = 32; - pos__ = (pos__ + 1);} + pos__ = (pos__ + 1); + } } current_statement__ = 33; - validate_non_negative_index("sigma_b_mean", "k", k); + stan::math::validate_non_negative_index("sigma_b_mean", "k", k); current_statement__ = 34; - sigma_b_mean = Eigen::Matrix(k); - stan::math::fill(sigma_b_mean, std::numeric_limits::quiet_NaN()); - + sigma_b_mean_data__ = Eigen::Matrix::Constant(k, + std::numeric_limits::quiet_NaN()); + new (&sigma_b_mean) + Eigen::Map>(sigma_b_mean_data__.data(), k); current_statement__ = 34; - assign(sigma_b_mean, nil_index_list(), - rvalue(sigma_mean, cons_list(index_min(2), nil_index_list()), - "sigma_mean"), "assigning variable sigma_b_mean"); + stan::model::assign(sigma_b_mean, + stan::model::rvalue(sigma_mean, "sigma_mean", + stan::model::index_min(2)), "assigning variable sigma_b_mean"); current_statement__ = 35; - validate_non_negative_index("sigma_b_sd", "k", k); + stan::math::validate_non_negative_index("sigma_b_sd", "k", k); current_statement__ = 36; - sigma_b_sd = Eigen::Matrix(k); - stan::math::fill(sigma_b_sd, std::numeric_limits::quiet_NaN()); - + sigma_b_sd_data__ = Eigen::Matrix::Constant(k, + std::numeric_limits::quiet_NaN()); + new (&sigma_b_sd) + Eigen::Map>(sigma_b_sd_data__.data(), k); current_statement__ = 36; - assign(sigma_b_sd, nil_index_list(), - rvalue(sigma_sd, cons_list(index_min(2), nil_index_list()), - "sigma_sd"), "assigning variable sigma_b_sd"); + stan::model::assign(sigma_b_sd, + stan::model::rvalue(sigma_sd, "sigma_sd", stan::model::index_min(2)), + "assigning variable sigma_b_sd"); current_statement__ = 37; sigma_y_mean = std::numeric_limits::quiet_NaN(); - current_statement__ = 37; - sigma_y_mean = sigma_mean[(1 - 1)]; + sigma_y_mean = stan::model::rvalue(sigma_mean, "sigma_mean", + stan::model::index_uni(1)); current_statement__ = 38; sigma_y_sd = std::numeric_limits::quiet_NaN(); - current_statement__ = 38; - sigma_y_sd = sigma_sd[(1 - 1)]; + sigma_y_sd = stan::model::rvalue(sigma_sd, "sigma_sd", + stan::model::index_uni(1)); current_statement__ = 39; - validate_non_negative_index("sigma_b", "k", k); + stan::math::validate_non_negative_index("sigma_b", "k", k); current_statement__ = 40; - validate_non_negative_index("beta_raw", "k", k); + stan::math::validate_non_negative_index("beta_raw", "k", k); current_statement__ = 41; - validate_non_negative_index("beta_raw", "n", n); + stan::math::validate_non_negative_index("beta_raw", "n", n); current_statement__ = 42; - validate_non_negative_index("beta", "k", k); + stan::math::validate_non_negative_index("beta", "k", k); current_statement__ = 43; - validate_non_negative_index("beta", "n", n); + stan::math::validate_non_negative_index("beta", "n", n); current_statement__ = 44; - validate_non_negative_index("tmp", "k", k); - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); - } - num_params_r__ = 0U; - - try { - num_params_r__ += k; - num_params_r__ += 1; - num_params_r__ += k * n; + stan::math::validate_non_negative_index("tmp", "k", k); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } + num_params_r__ = k + 1 + (k * n); + } + inline std::string model_name() const final { + return "model_rw1_model_naive"; + } + inline std::vector model_compile_info() const noexcept { + return std::vector{"stanc_version = stanc3 v2.32.2", + "stancflags = --allow-undefined"}; } - template * = nullptr, stan::require_vector_like_vt* = nullptr> - inline stan::scalar_type_t log_prob_impl(VecR& params_r__, - VecI& params_i__, - std::ostream* pstream__ = nullptr) const { + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline stan::scalar_type_t + log_prob_impl(VecR& params_r__, VecI& params_i__, std::ostream* + pstream__ = nullptr) const { using T__ = stan::scalar_type_t; using local_scalar_t__ = T__; T__ lp__(0.0); stan::math::accumulator lp_accum__; - static const char* function__ = "model_rw1_model_naive_namespace::log_prob"; -(void) function__; // suppress unused var warning - stan::io::reader in__(params_r__, params_i__); + stan::io::deserializer in__(params_r__, params_i__); + int current_statement__ = 0; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; + static constexpr const char* function__ = + "model_rw1_model_naive_namespace::log_prob"; + // suppress unused var warning + (void) function__; try { - std::vector sigma_b; - sigma_b = std::vector(k, DUMMY_VAR__); - + std::vector sigma_b = + std::vector(k, DUMMY_VAR__); current_statement__ = 1; - for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - current_statement__ = 1; - assign(sigma_b, cons_list(index_uni(sym1__), nil_index_list()), - in__.scalar(), "assigning variable sigma_b");} - current_statement__ = 1; - for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - current_statement__ = 1; - if (jacobian__) { - current_statement__ = 1; - assign(sigma_b, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(sigma_b[(sym1__ - 1)], 0, lp__), - "assigning variable sigma_b"); - } else { - current_statement__ = 1; - assign(sigma_b, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(sigma_b[(sym1__ - 1)], 0), - "assigning variable sigma_b"); - }} - local_scalar_t__ sigma_y; - sigma_y = DUMMY_VAR__; - - current_statement__ = 2; - sigma_y = in__.scalar(); + sigma_b = in__.template read_constrain_lb< + std::vector, jacobian__>(0, lp__, k); + local_scalar_t__ sigma_y = DUMMY_VAR__; current_statement__ = 2; - if (jacobian__) { - current_statement__ = 2; - sigma_y = stan::math::lb_constrain(sigma_y, 0, lp__); - } else { - current_statement__ = 2; - sigma_y = stan::math::lb_constrain(sigma_y, 0); - } - Eigen::Matrix beta_raw; - beta_raw = Eigen::Matrix(k, n); - stan::math::fill(beta_raw, DUMMY_VAR__); - + sigma_y = in__.template read_constrain_lb(0, lp__); + Eigen::Matrix beta_raw = + Eigen::Matrix::Constant(k, n, DUMMY_VAR__); current_statement__ = 3; - beta_raw = in__.matrix(k, n); - Eigen::Matrix beta; - beta = Eigen::Matrix(k, n); - stan::math::fill(beta, DUMMY_VAR__); - - Eigen::Matrix tmp; - tmp = Eigen::Matrix(k); - stan::math::fill(tmp, DUMMY_VAR__); - + beta_raw = in__.template read>(k, + n); + Eigen::Matrix beta = + Eigen::Matrix::Constant(k, n, DUMMY_VAR__); + Eigen::Matrix tmp = + Eigen::Matrix::Constant(k, DUMMY_VAR__); current_statement__ = 6; - assign(beta, - cons_list(index_omni(), cons_list(index_uni(1), nil_index_list())), - add(beta_mean, - elt_multiply(beta_sd, - rvalue(beta_raw, - cons_list(index_omni(), - cons_list(index_uni(1), nil_index_list())), "beta_raw"))), - "assigning variable beta"); + stan::model::assign(beta, + stan::math::add(beta_mean, + stan::math::elt_multiply(beta_sd, + stan::model::rvalue(beta_raw, "beta_raw", + stan::model::index_omni(), stan::model::index_uni(1)))), + "assigning variable beta", stan::model::index_omni(), + stan::model::index_uni(1)); current_statement__ = 10; for (int t = 2; t <= n; ++t) { current_statement__ = 7; - assign(tmp, nil_index_list(), - rvalue(beta, - cons_list(index_omni(), - cons_list(index_uni((t - 1)), nil_index_list())), "beta"), - "assigning variable tmp"); + stan::model::assign(tmp, + stan::model::rvalue(beta, "beta", stan::model::index_omni(), + stan::model::index_uni((t - 1))), "assigning variable tmp"); current_statement__ = 8; - assign(beta, - cons_list(index_omni(), cons_list(index_uni(t), nil_index_list())), - add(tmp, - elt_multiply(to_vector(sigma_b), - rvalue(beta_raw, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "beta_raw"))), - "assigning variable beta");} + stan::model::assign(beta, + stan::math::add(tmp, + stan::math::elt_multiply(stan::math::to_vector(sigma_b), + stan::model::rvalue(beta_raw, "beta_raw", + stan::model::index_omni(), stan::model::index_uni(t)))), + "assigning variable beta", stan::model::index_omni(), + stan::model::index_uni(t)); + } { current_statement__ = 11; - lp_accum__.add( - normal_lpdf(sigma_b, sigma_b_mean, sigma_b_sd)); + lp_accum__.add(stan::math::normal_lpdf(sigma_b, + sigma_b_mean, sigma_b_sd)); current_statement__ = 12; - lp_accum__.add( - normal_lpdf(sigma_y, sigma_y_mean, sigma_y_sd)); + lp_accum__.add(stan::math::normal_lpdf(sigma_y, + sigma_y_mean, sigma_y_sd)); current_statement__ = 13; - lp_accum__.add(normal_lpdf(to_vector(beta_raw), 0, 1)); + lp_accum__.add(stan::math::normal_lpdf( + stan::math::to_vector(beta_raw), 0, 1)); { current_statement__ = 14; - validate_non_negative_index("mu", "n", n); - Eigen::Matrix mu; - mu = Eigen::Matrix(n); - stan::math::fill(mu, DUMMY_VAR__); - + stan::math::validate_non_negative_index("mu", "n", n); + Eigen::Matrix mu = + Eigen::Matrix::Constant(n, DUMMY_VAR__); current_statement__ = 15; - assign(mu, nil_index_list(), columns_dot_product(xreg, beta), + stan::model::assign(mu, + stan::math::columns_dot_product(xreg, beta), "assigning variable mu"); current_statement__ = 16; - lp_accum__.add(normal_lpdf(y, mu, sigma_y)); + lp_accum__.add(stan::math::normal_lpdf(y, mu, sigma_y)); } } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } lp_accum__.add(lp__); return lp_accum__.sum(); - } // log_prob_impl() - - template * = nullptr, stan::require_vector_like_vt* = nullptr, stan::require_std_vector_vt* = nullptr> - inline void write_array_impl(RNG& base_rng__, VecR& params_r__, - VecI& params_i__, VecVar& vars__, - const bool emit_transformed_parameters__ = true, - const bool emit_generated_quantities__ = true, - std::ostream* pstream__ = nullptr) const { + } + template * = nullptr, stan::require_vector_like_vt* = nullptr, stan::require_vector_vt* = nullptr> + inline void + write_array_impl(RNG& base_rng__, VecR& params_r__, VecI& params_i__, + VecVar& vars__, const bool + emit_transformed_parameters__ = true, const bool + emit_generated_quantities__ = true, std::ostream* + pstream__ = nullptr) const { using local_scalar_t__ = double; - vars__.resize(0); - stan::io::reader in__(params_r__, params_i__); - static const char* function__ = "model_rw1_model_naive_namespace::write_array"; -(void) function__; // suppress unused var warning - (void) function__; // suppress unused var warning + stan::io::deserializer in__(params_r__, params_i__); + stan::io::serializer out__(vars__); + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; double lp__ = 0.0; - (void) lp__; // dummy to suppress unused var warning + // suppress unused var warning + (void) lp__; + int current_statement__ = 0; stan::math::accumulator lp_accum__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; + constexpr bool jacobian__ = false; + static constexpr const char* function__ = + "model_rw1_model_naive_namespace::write_array"; + // suppress unused var warning + (void) function__; try { - std::vector sigma_b; - sigma_b = std::vector(k, std::numeric_limits::quiet_NaN()); - + std::vector sigma_b = + std::vector(k, std::numeric_limits::quiet_NaN()); current_statement__ = 1; - for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - current_statement__ = 1; - assign(sigma_b, cons_list(index_uni(sym1__), nil_index_list()), - in__.scalar(), "assigning variable sigma_b");} - current_statement__ = 1; - for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - current_statement__ = 1; - assign(sigma_b, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(sigma_b[(sym1__ - 1)], 0), - "assigning variable sigma_b");} - double sigma_y; - sigma_y = std::numeric_limits::quiet_NaN(); - - current_statement__ = 2; - sigma_y = in__.scalar(); + sigma_b = in__.template read_constrain_lb< + std::vector, jacobian__>(0, lp__, k); + double sigma_y = std::numeric_limits::quiet_NaN(); current_statement__ = 2; - sigma_y = stan::math::lb_constrain(sigma_y, 0); - Eigen::Matrix beta_raw; - beta_raw = Eigen::Matrix(k, n); - stan::math::fill(beta_raw, std::numeric_limits::quiet_NaN()); - + sigma_y = in__.template read_constrain_lb(0, lp__); + Eigen::Matrix beta_raw = + Eigen::Matrix::Constant(k, n, + std::numeric_limits::quiet_NaN()); current_statement__ = 3; - beta_raw = in__.matrix(k, n); - Eigen::Matrix beta; - beta = Eigen::Matrix(k, n); - stan::math::fill(beta, std::numeric_limits::quiet_NaN()); - - Eigen::Matrix tmp; - tmp = Eigen::Matrix(k); - stan::math::fill(tmp, std::numeric_limits::quiet_NaN()); - - for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - vars__.emplace_back(sigma_b[(sym1__ - 1)]);} - vars__.emplace_back(sigma_y); - for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - for (int sym2__ = 1; sym2__ <= k; ++sym2__) { - vars__.emplace_back( - rvalue(beta_raw, - cons_list(index_uni(sym2__), - cons_list(index_uni(sym1__), nil_index_list())), "beta_raw")); - }} - if (logical_negation((primitive_value(emit_transformed_parameters__) || - primitive_value(emit_generated_quantities__)))) { + beta_raw = in__.template read>(k, + n); + Eigen::Matrix beta = + Eigen::Matrix::Constant(k, n, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix tmp = + Eigen::Matrix::Constant(k, + std::numeric_limits::quiet_NaN()); + out__.write(sigma_b); + out__.write(sigma_y); + out__.write(beta_raw); + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { return ; - } + } current_statement__ = 6; - assign(beta, - cons_list(index_omni(), cons_list(index_uni(1), nil_index_list())), - add(beta_mean, - elt_multiply(beta_sd, - rvalue(beta_raw, - cons_list(index_omni(), - cons_list(index_uni(1), nil_index_list())), "beta_raw"))), - "assigning variable beta"); + stan::model::assign(beta, + stan::math::add(beta_mean, + stan::math::elt_multiply(beta_sd, + stan::model::rvalue(beta_raw, "beta_raw", + stan::model::index_omni(), stan::model::index_uni(1)))), + "assigning variable beta", stan::model::index_omni(), + stan::model::index_uni(1)); current_statement__ = 10; for (int t = 2; t <= n; ++t) { current_statement__ = 7; - assign(tmp, nil_index_list(), - rvalue(beta, - cons_list(index_omni(), - cons_list(index_uni((t - 1)), nil_index_list())), "beta"), - "assigning variable tmp"); + stan::model::assign(tmp, + stan::model::rvalue(beta, "beta", stan::model::index_omni(), + stan::model::index_uni((t - 1))), "assigning variable tmp"); current_statement__ = 8; - assign(beta, - cons_list(index_omni(), cons_list(index_uni(t), nil_index_list())), - add(tmp, - elt_multiply(to_vector(sigma_b), - rvalue(beta_raw, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "beta_raw"))), - "assigning variable beta");} + stan::model::assign(beta, + stan::math::add(tmp, + stan::math::elt_multiply(stan::math::to_vector(sigma_b), + stan::model::rvalue(beta_raw, "beta_raw", + stan::model::index_omni(), stan::model::index_uni(t)))), + "assigning variable beta", stan::model::index_omni(), + stan::model::index_uni(t)); + } if (emit_transformed_parameters__) { - for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - for (int sym2__ = 1; sym2__ <= k; ++sym2__) { - vars__.emplace_back( - rvalue(beta, - cons_list(index_uni(sym2__), - cons_list(index_uni(sym1__), nil_index_list())), "beta"));} - } - for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - vars__.emplace_back(tmp[(sym1__ - 1)]);} - } - if (logical_negation(emit_generated_quantities__)) { + out__.write(beta); + out__.write(tmp); + } + if (stan::math::logical_negation(emit_generated_quantities__)) { return ; - } + } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } - } // write_array_impl() - - template * = nullptr, stan::require_vector_like_vt* = nullptr> - inline void transform_inits_impl(const stan::io::var_context& context__, - VecI& params_i__, VecVar& vars__, - std::ostream* pstream__ = nullptr) const { + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline void + unconstrain_array_impl(const VecVar& params_r__, const VecI& params_i__, + VecVar& vars__, std::ostream* pstream__ = nullptr) const { using local_scalar_t__ = double; - vars__.clear(); - vars__.reserve(num_params_r__); - + stan::io::deserializer in__(params_r__, params_i__); + stan::io::serializer out__(vars__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; try { - int pos__; - pos__ = std::numeric_limits::min(); - + int pos__ = std::numeric_limits::min(); pos__ = 1; - std::vector sigma_b; - sigma_b = std::vector(k, std::numeric_limits::quiet_NaN()); - + std::vector sigma_b = + std::vector(k, DUMMY_VAR__); current_statement__ = 1; - assign(sigma_b, nil_index_list(), context__.vals_r("sigma_b"), + stan::model::assign(sigma_b, + in__.read>(k), "assigning variable sigma_b"); - std::vector sigma_b_free__; - sigma_b_free__ = std::vector(k, std::numeric_limits::quiet_NaN()); - + out__.write_free_lb(0, sigma_b); + local_scalar_t__ sigma_y = DUMMY_VAR__; + current_statement__ = 2; + sigma_y = in__.read(); + out__.write_free_lb(0, sigma_y); + Eigen::Matrix beta_raw = + Eigen::Matrix::Constant(k, n, DUMMY_VAR__); + current_statement__ = 3; + stan::model::assign(beta_raw, + in__.read>(k, n), + "assigning variable beta_raw"); + out__.write(beta_raw); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + template * = nullptr> + inline void + transform_inits_impl(const stan::io::var_context& context__, VecVar& + vars__, std::ostream* pstream__ = nullptr) const { + using local_scalar_t__ = double; + stan::io::serializer out__(vars__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { current_statement__ = 1; - for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - current_statement__ = 1; - assign(sigma_b_free__, - cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_free(sigma_b[(sym1__ - 1)], 0), - "assigning variable sigma_b_free__");} - double sigma_y; - sigma_y = std::numeric_limits::quiet_NaN(); - + context__.validate_dims("parameter initialization", "sigma_b", + "double", std::vector{static_cast(k)}); current_statement__ = 2; - sigma_y = context__.vals_r("sigma_y")[(1 - 1)]; - double sigma_y_free__; - sigma_y_free__ = std::numeric_limits::quiet_NaN(); - + context__.validate_dims("parameter initialization", "sigma_y", + "double", std::vector{}); + current_statement__ = 3; + context__.validate_dims("parameter initialization", "beta_raw", + "double", + std::vector{static_cast(k), static_cast(n)}); + int pos__ = std::numeric_limits::min(); + pos__ = 1; + std::vector sigma_b = + std::vector(k, DUMMY_VAR__); + current_statement__ = 1; + sigma_b = context__.vals_r("sigma_b"); + out__.write_free_lb(0, sigma_b); + local_scalar_t__ sigma_y = DUMMY_VAR__; current_statement__ = 2; - sigma_y_free__ = stan::math::lb_free(sigma_y, 0); - Eigen::Matrix beta_raw; - beta_raw = Eigen::Matrix(k, n); - stan::math::fill(beta_raw, std::numeric_limits::quiet_NaN()); - + sigma_y = context__.vals_r("sigma_y")[(1 - 1)]; + out__.write_free_lb(0, sigma_y); + Eigen::Matrix beta_raw = + Eigen::Matrix::Constant(k, n, DUMMY_VAR__); { std::vector beta_raw_flat__; current_statement__ = 3; - assign(beta_raw_flat__, nil_index_list(), - context__.vals_r("beta_raw"), "assigning variable beta_raw_flat__"); + beta_raw_flat__ = context__.vals_r("beta_raw"); current_statement__ = 3; pos__ = 1; current_statement__ = 3; @@ -678,210 +607,205 @@ class model_rw1_model_naive final : public model_base_crtp& names__) const { - - names__.clear(); - names__.emplace_back("sigma_b"); - names__.emplace_back("sigma_y"); - names__.emplace_back("beta_raw"); - names__.emplace_back("beta"); - names__.emplace_back("tmp"); - } // get_param_names() - - inline void get_dims(std::vector>& dimss__) const { - dimss__.clear(); - dimss__.emplace_back(std::vector{static_cast(k)}); - - dimss__.emplace_back(std::vector{}); - - dimss__.emplace_back(std::vector{static_cast(k), - static_cast(n)}); - - dimss__.emplace_back(std::vector{static_cast(k), - static_cast(n)}); - - dimss__.emplace_back(std::vector{static_cast(k)}); - - } // get_dims() - - inline void constrained_param_names( - std::vector& param_names__, - bool emit_transformed_parameters__ = true, - bool emit_generated_quantities__ = true) const - final { - + } + inline void + get_param_names(std::vector& names__, const bool + emit_transformed_parameters__ = true, const bool + emit_generated_quantities__ = true) const { + names__ = std::vector{"sigma_b", "sigma_y", "beta_raw"}; + if (emit_transformed_parameters__) { + std::vector temp{"beta", "tmp"}; + names__.reserve(names__.size() + temp.size()); + names__.insert(names__.end(), temp.begin(), temp.end()); + } + if (emit_generated_quantities__) {} + } + inline void + get_dims(std::vector>& dimss__, const bool + emit_transformed_parameters__ = true, const bool + emit_generated_quantities__ = true) const { + dimss__ = std::vector>{std::vector{static_cast< + size_t>(k)}, + std::vector{}, + std::vector{static_cast(k), + static_cast(n)}}; + if (emit_transformed_parameters__) { + std::vector> + temp{std::vector{static_cast(k), + static_cast(n)}, + std::vector{static_cast(k)}}; + dimss__.reserve(dimss__.size() + temp.size()); + dimss__.insert(dimss__.end(), temp.begin(), temp.end()); + } + if (emit_generated_quantities__) {} + } + inline void + constrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - { - param_names__.emplace_back(std::string() + "sigma_b" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "sigma_b" + '.' + + std::to_string(sym1__)); + } param_names__.emplace_back(std::string() + "sigma_y"); for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - for (int sym2__ = 1; sym2__ <= k; ++sym2__) { - { - param_names__.emplace_back(std::string() + "beta_raw" + '.' + std::to_string(sym2__) + '.' + std::to_string(sym1__)); - }} - }} + for (int sym2__ = 1; sym2__ <= k; ++sym2__) { + param_names__.emplace_back(std::string() + "beta_raw" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } if (emit_transformed_parameters__) { for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - for (int sym2__ = 1; sym2__ <= k; ++sym2__) { - { - param_names__.emplace_back(std::string() + "beta" + '.' + std::to_string(sym2__) + '.' + std::to_string(sym1__)); - }} - }} + for (int sym2__ = 1; sym2__ <= k; ++sym2__) { + param_names__.emplace_back(std::string() + "beta" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - { - param_names__.emplace_back(std::string() + "tmp" + '.' + std::to_string(sym1__)); - }} - } - - if (emit_generated_quantities__) { - + param_names__.emplace_back(std::string() + "tmp" + '.' + + std::to_string(sym1__)); + } } - - } // constrained_param_names() - - inline void unconstrained_param_names( - std::vector& param_names__, - bool emit_transformed_parameters__ = true, - bool emit_generated_quantities__ = true) const - final { - + if (emit_generated_quantities__) {} + } + inline void + unconstrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - { - param_names__.emplace_back(std::string() + "sigma_b" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "sigma_b" + '.' + + std::to_string(sym1__)); + } param_names__.emplace_back(std::string() + "sigma_y"); for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - for (int sym2__ = 1; sym2__ <= k; ++sym2__) { - { - param_names__.emplace_back(std::string() + "beta_raw" + '.' + std::to_string(sym2__) + '.' + std::to_string(sym1__)); - }} - }} + for (int sym2__ = 1; sym2__ <= k; ++sym2__) { + param_names__.emplace_back(std::string() + "beta_raw" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } if (emit_transformed_parameters__) { for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - for (int sym2__ = 1; sym2__ <= k; ++sym2__) { - { - param_names__.emplace_back(std::string() + "beta" + '.' + std::to_string(sym2__) + '.' + std::to_string(sym1__)); - }} - }} + for (int sym2__ = 1; sym2__ <= k; ++sym2__) { + param_names__.emplace_back(std::string() + "beta" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } for (int sym1__ = 1; sym1__ <= k; ++sym1__) { - { - param_names__.emplace_back(std::string() + "tmp" + '.' + std::to_string(sym1__)); - }} - } - - if (emit_generated_quantities__) { - + param_names__.emplace_back(std::string() + "tmp" + '.' + + std::to_string(sym1__)); + } } - - } // unconstrained_param_names() - + if (emit_generated_quantities__) {} + } inline std::string get_constrained_sizedtypes() const { - stringstream s__; - s__ << "[{\"name\":\"sigma_b\",\"type\":{\"name\":\"array\",\"length\":" << k << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"sigma_y\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta_raw\",\"type\":{\"name\":\"matrix\",\"rows\":" << k << ",\"cols\":" << n << "},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"matrix\",\"rows\":" << k << ",\"cols\":" << n << "},\"block\":\"transformed_parameters\"},{\"name\":\"tmp\",\"type\":{\"name\":\"vector\",\"length\":" << k << "},\"block\":\"transformed_parameters\"}]"; - return s__.str(); - } // get_constrained_sizedtypes() - + return std::string("[{\"name\":\"sigma_b\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(k) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"sigma_y\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta_raw\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(k) + ",\"cols\":" + std::to_string(n) + "},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(k) + ",\"cols\":" + std::to_string(n) + "},\"block\":\"transformed_parameters\"},{\"name\":\"tmp\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(k) + "},\"block\":\"transformed_parameters\"}]"); + } inline std::string get_unconstrained_sizedtypes() const { - stringstream s__; - s__ << "[{\"name\":\"sigma_b\",\"type\":{\"name\":\"array\",\"length\":" << k << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"sigma_y\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta_raw\",\"type\":{\"name\":\"matrix\",\"rows\":" << k << ",\"cols\":" << n << "},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"matrix\",\"rows\":" << k << ",\"cols\":" << n << "},\"block\":\"transformed_parameters\"},{\"name\":\"tmp\",\"type\":{\"name\":\"vector\",\"length\":" << k << "},\"block\":\"transformed_parameters\"}]"; - return s__.str(); - } // get_unconstrained_sizedtypes() - - - // Begin method overload boilerplate - template - inline void write_array(RNG& base_rng, - Eigen::Matrix& params_r, - Eigen::Matrix& vars, - const bool emit_transformed_parameters = true, - const bool emit_generated_quantities = true, - std::ostream* pstream = nullptr) const { - std::vector vars_vec(vars.size()); - std::vector params_i; - write_array_impl(base_rng, params_r, params_i, vars_vec, - emit_transformed_parameters, emit_generated_quantities, pstream); - vars.resize(vars_vec.size()); - for (int i = 0; i < vars.size(); ++i) { - vars.coeffRef(i) = vars_vec[i]; - } - } - template - inline void write_array(RNG& base_rng, std::vector& params_r, - std::vector& params_i, - std::vector& vars, - bool emit_transformed_parameters = true, - bool emit_generated_quantities = true, - std::ostream* pstream = nullptr) const { - write_array_impl(base_rng, params_r, params_i, vars, emit_transformed_parameters, emit_generated_quantities, pstream); - } - template - inline T_ log_prob(Eigen::Matrix& params_r, - std::ostream* pstream = nullptr) const { - Eigen::Matrix params_i; - return log_prob_impl(params_r, params_i, pstream); - } - template - inline T__ log_prob(std::vector& params_r, - std::vector& params_i, - std::ostream* pstream = nullptr) const { - return log_prob_impl(params_r, params_i, pstream); - } - - inline void transform_inits(const stan::io::var_context& context, - Eigen::Matrix& params_r, - std::ostream* pstream = nullptr) const final { - std::vector params_r_vec(params_r.size()); - std::vector params_i; - transform_inits_impl(context, params_i, params_r_vec, pstream); - params_r.resize(params_r_vec.size()); - for (int i = 0; i < params_r.size(); ++i) { - params_r.coeffRef(i) = params_r_vec[i]; - } - } - inline void transform_inits(const stan::io::var_context& context, - std::vector& params_i, - std::vector& vars, - std::ostream* pstream = nullptr) const final { - transform_inits_impl(context, params_i, vars, pstream); - } + return std::string("[{\"name\":\"sigma_b\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(k) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"sigma_y\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta_raw\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(k) + ",\"cols\":" + std::to_string(n) + "},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(k) + ",\"cols\":" + std::to_string(n) + "},\"block\":\"transformed_parameters\"},{\"name\":\"tmp\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(k) + "},\"block\":\"transformed_parameters\"}]"); + } + // Begin method overload boilerplate + template inline void + write_array(RNG& base_rng, Eigen::Matrix& params_r, + Eigen::Matrix& vars, const bool + emit_transformed_parameters = true, const bool + emit_generated_quantities = true, std::ostream* + pstream = nullptr) const { + const size_t num_params__ = ((k + 1) + (k * n)); + const size_t num_transformed = emit_transformed_parameters * (((k * n) + + k)); + const size_t num_gen_quantities = emit_generated_quantities * (0); + const size_t num_to_write = num_params__ + num_transformed + + num_gen_quantities; + std::vector params_i; + vars = Eigen::Matrix::Constant(num_to_write, + std::numeric_limits::quiet_NaN()); + write_array_impl(base_rng, params_r, params_i, vars, + emit_transformed_parameters, emit_generated_quantities, pstream); + } + template inline void + write_array(RNG& base_rng, std::vector& params_r, std::vector& + params_i, std::vector& vars, bool + emit_transformed_parameters = true, bool + emit_generated_quantities = true, std::ostream* + pstream = nullptr) const { + const size_t num_params__ = ((k + 1) + (k * n)); + const size_t num_transformed = emit_transformed_parameters * (((k * n) + + k)); + const size_t num_gen_quantities = emit_generated_quantities * (0); + const size_t num_to_write = num_params__ + num_transformed + + num_gen_quantities; + vars = std::vector(num_to_write, + std::numeric_limits::quiet_NaN()); + write_array_impl(base_rng, params_r, params_i, vars, + emit_transformed_parameters, emit_generated_quantities, pstream); + } + template inline T_ + log_prob(Eigen::Matrix& params_r, std::ostream* pstream = nullptr) const { + Eigen::Matrix params_i; + return log_prob_impl(params_r, params_i, pstream); + } + template inline T_ + log_prob(std::vector& params_r, std::vector& params_i, + std::ostream* pstream = nullptr) const { + return log_prob_impl(params_r, params_i, pstream); + } + inline void + transform_inits(const stan::io::var_context& context, + Eigen::Matrix& params_r, std::ostream* + pstream = nullptr) const final { + std::vector params_r_vec(params_r.size()); + std::vector params_i; + transform_inits(context, params_i, params_r_vec, pstream); + params_r = Eigen::Map>(params_r_vec.data(), + params_r_vec.size()); + } + inline void + transform_inits(const stan::io::var_context& context, std::vector& + params_i, std::vector& vars, std::ostream* + pstream__ = nullptr) const { + vars.resize(num_params_r__); + transform_inits_impl(context, vars, pstream__); + } + inline void + unconstrain_array(const std::vector& params_constrained, + std::vector& params_unconstrained, std::ostream* + pstream = nullptr) const { + const std::vector params_i; + params_unconstrained = std::vector(num_params_r__, + std::numeric_limits::quiet_NaN()); + unconstrain_array_impl(params_constrained, params_i, + params_unconstrained, pstream); + } + inline void + unconstrain_array(const Eigen::Matrix& params_constrained, + Eigen::Matrix& params_unconstrained, + std::ostream* pstream = nullptr) const { + const std::vector params_i; + params_unconstrained = Eigen::Matrix::Constant(num_params_r__, + std::numeric_limits::quiet_NaN()); + unconstrain_array_impl(params_constrained, params_i, + params_unconstrained, pstream); + } }; } using stan_model = model_rw1_model_naive_namespace::model_rw1_model_naive; #ifndef USING_R // Boilerplate -stan::model::model_base& new_model( - stan::io::var_context& data_context, - unsigned int seed, - std::ostream* msg_stream) { +stan::model::model_base& +new_model(stan::io::var_context& data_context, unsigned int seed, + std::ostream* msg_stream) { stan_model* m = new stan_model(data_context, seed, msg_stream); return *m; } diff --git a/src/stanExports_walker_glm.h b/src/stanExports_walker_glm.h index f330f39..e0550e6 100644 --- a/src/stanExports_walker_glm.h +++ b/src/stanExports_walker_glm.h @@ -21,1134 +21,1086 @@ #define USE_STANC3 #endif #include -// Code generated by stanc v2.26.1-4-gd72b68b7-dirty +// Code generated by stanc v2.32.2 #include namespace model_walker_glm_namespace { -inline void validate_positive_index(const char* var_name, const char* expr, - int val) { - if (val < 1) { - std::stringstream msg; - msg << "Found dimension size less than one in simplex declaration" - << "; variable=" << var_name << "; dimension size expression=" << expr - << "; expression value=" << val; - std::string msg_str(msg.str()); - throw std::invalid_argument(msg_str.c_str()); - } -} -inline void validate_unit_vector_index(const char* var_name, const char* expr, - int val) { - if (val <= 1) { - std::stringstream msg; - if (val == 1) { - msg << "Found dimension size one in unit vector declaration." - << " One-dimensional unit vector is discrete" - << " but the target distribution must be continuous." - << " variable=" << var_name << "; dimension size expression=" << expr; - } else { - msg << "Found dimension size less than one in unit vector declaration" - << "; variable=" << var_name << "; dimension size expression=" << expr - << "; expression value=" << val; - } - std::string msg_str(msg.str()); - throw std::invalid_argument(msg_str.c_str()); - } -} -using std::istream; -using std::string; -using std::stringstream; -using std::vector; -using std::pow; -using stan::io::dump; -using stan::math::lgamma; using stan::model::model_base_crtp; -using stan::model::rvalue; -using stan::model::cons_list; -using stan::model::index_uni; -using stan::model::index_max; -using stan::model::index_min; -using stan::model::index_min_max; -using stan::model::index_multi; -using stan::model::index_omni; -using stan::model::nil_index_list; using namespace stan::math; -using stan::math::pow; stan::math::profile_map profiles__; -static int current_statement__= 0; -static const std::vector locations_array__ = {" (found before start of program)", - " (in 'string', line 230, column 2 to column 29)", - " (in 'string', line 231, column 2 to column 39)", - " (in 'string', line 232, column 2 to column 39)", - " (in 'string', line 235, column 2 to column 42)", - " (in 'string', line 236, column 2 to column 18)", - " (in 'string', line 237, column 2 to column 15)", - " (in 'string', line 238, column 2 to column 22)", - " (in 'string', line 243, column 4 to column 31)", - " (in 'string', line 242, column 9 to line 244, column 3)", - " (in 'string', line 241, column 4 to column 36)", - " (in 'string', line 240, column 19 to line 242, column 3)", - " (in 'string', line 240, column 2 to line 244, column 3)", - " (in 'string', line 245, column 2 to column 17)", - " (in 'string', line 249, column 6 to column 52)", - " (in 'string', line 248, column 22 to line 250, column 5)", - " (in 'string', line 248, column 4 to line 250, column 5)", - " (in 'string', line 252, column 6 to column 56)", - " (in 'string', line 251, column 22 to line 253, column 5)", - " (in 'string', line 251, column 4 to line 253, column 5)", - " (in 'string', line 247, column 17 to line 254, column 3)", - " (in 'string', line 247, column 2 to line 254, column 3)", - " (in 'string', line 256, column 2 to line 257, column 55)", - " (in 'string', line 271, column 2 to column 38)", - " (in 'string', line 272, column 2 to column 37)", - " (in 'string', line 273, column 2 to column 15)", - " (in 'string', line 274, column 2 to column 33)", - " (in 'string', line 275, column 2 to column 33)", - " (in 'string', line 277, column 2 to column 48)", - " (in 'string', line 281, column 11 to column 12)", - " (in 'string', line 281, column 4 to column 22)", - " (in 'string', line 282, column 11 to column 12)", - " (in 'string', line 282, column 14 to column 15)", - " (in 'string', line 282, column 4 to column 24)", - " (in 'string', line 283, column 11 to column 16)", - " (in 'string', line 283, column 18 to column 19)", - " (in 'string', line 283, column 4 to column 26)", - " (in 'string', line 284, column 10 to column 11)", - " (in 'string', line 284, column 13 to column 14)", - " (in 'string', line 284, column 16 to column 17)", - " (in 'string', line 284, column 4 to column 35)", - " (in 'string', line 285, column 10 to column 15)", - " (in 'string', line 285, column 17 to column 18)", - " (in 'string', line 285, column 20 to column 21)", - " (in 'string', line 285, column 4 to column 37)", - " (in 'string', line 286, column 11 to column 12)", - " (in 'string', line 286, column 4 to column 37)", - " (in 'string', line 296, column 8 to column 62)", - " (in 'string', line 295, column 24 to line 297, column 7)", - " (in 'string', line 295, column 6 to line 297, column 7)", - " (in 'string', line 299, column 8 to column 70)", - " (in 'string', line 300, column 8 to column 48)", - " (in 'string', line 298, column 24 to line 301, column 7)", - " (in 'string', line 298, column 6 to line 301, column 7)", - " (in 'string', line 305, column 10 to column 86)", - " (in 'string', line 304, column 26 to line 306, column 9)", - " (in 'string', line 304, column 8 to line 306, column 9)", - " (in 'string', line 308, column 10 to column 69)", - " (in 'string', line 309, column 10 to column 82)", - " (in 'string', line 307, column 26 to line 310, column 9)", - " (in 'string', line 307, column 8 to line 310, column 9)", - " (in 'string', line 303, column 27 to line 311, column 7)", - " (in 'string', line 303, column 6 to line 311, column 7)", - " (in 'string', line 314, column 8 to column 85)", - " (in 'string', line 313, column 20 to line 315, column 7)", - " (in 'string', line 313, column 6 to line 315, column 7)", - " (in 'string', line 318, column 15 to column 16)", - " (in 'string', line 318, column 18 to column 19)", - " (in 'string', line 318, column 8 to line 319, column 29)", - " (in 'string', line 320, column 8 to column 35)", - " (in 'string', line 321, column 22 to column 53)", - " (in 'string', line 321, column 8 to column 53)", - " (in 'string', line 317, column 6 to line 322, column 7)", - " (in 'string', line 324, column 6 to column 50)", - " (in 'string', line 325, column 20 to column 64)", - " (in 'string', line 325, column 6 to column 64)", - " (in 'string', line 327, column 6 to column 37)", - " (in 'string', line 336, column 10 to column 78)", - " (in 'string', line 337, column 10 to line 338, column 45)", - " (in 'string', line 335, column 22 to line 339, column 9)", - " (in 'string', line 335, column 8 to line 339, column 9)", - " (in 'string', line 334, column 13 to line 340, column 7)", - " (in 'string', line 330, column 10 to column 78)", - " (in 'string', line 331, column 10 to line 332, column 45)", - " (in 'string', line 329, column 22 to line 333, column 9)", - " (in 'string', line 329, column 8 to line 333, column 9)", - " (in 'string', line 328, column 29 to line 334, column 7)", - " (in 'string', line 328, column 6 to line 340, column 7)", - " (in 'string', line 293, column 18 to line 341, column 5)", - " (in 'string', line 293, column 4 to line 341, column 5)", - " (in 'string', line 350, column 6 to column 16)", - " (in 'string', line 351, column 13 to column 14)", - " (in 'string', line 351, column 6 to column 30)", - " (in 'string', line 352, column 6 to column 27)", - " (in 'string', line 353, column 6 to column 48)", - " (in 'string', line 354, column 6 to column 49)", - " (in 'string', line 355, column 21 to column 57)", - " (in 'string', line 355, column 6 to column 57)", - " (in 'string', line 366, column 10 to column 77)", - " (in 'string', line 367, column 10 to column 39)", - " (in 'string', line 368, column 10 to column 50)", - " (in 'string', line 365, column 22 to line 369, column 9)", - " (in 'string', line 365, column 8 to line 369, column 9)", - " (in 'string', line 364, column 13 to line 370, column 7)", - " (in 'string', line 361, column 10 to column 84)", - " (in 'string', line 362, column 10 to column 43)", - " (in 'string', line 360, column 22 to line 363, column 9)", - " (in 'string', line 360, column 8 to line 363, column 9)", - " (in 'string', line 359, column 29 to line 364, column 7)", - " (in 'string', line 359, column 6 to line 370, column 7)", - " (in 'string', line 343, column 4 to line 371, column 5)", - " (in 'string', line 279, column 17 to line 373, column 3)", - " (in 'string', line 279, column 2 to line 373, column 3)", - " (in 'string', line 261, column 2 to column 54)", - " (in 'string', line 262, column 2 to column 53)", - " (in 'string', line 263, column 2 to column 53)", - " (in 'string', line 267, column 2 to column 38)", - " (in 'string', line 162, column 2 to column 23)", - " (in 'string', line 163, column 2 to column 21)", - " (in 'string', line 164, column 2 to column 21)", - " (in 'string', line 165, column 2 to column 17)", - " (in 'string', line 166, column 2 to column 17)", - " (in 'string', line 167, column 2 to column 17)", - " (in 'string', line 168, column 2 to column 21)", - " (in 'string', line 169, column 9 to column 10)", - " (in 'string', line 169, column 12 to column 19)", - " (in 'string', line 169, column 2 to column 32)", - " (in 'string', line 170, column 9 to column 10)", - " (in 'string', line 170, column 12 to column 13)", - " (in 'string', line 170, column 2 to column 23)", - " (in 'string', line 171, column 9 to column 10)", - " (in 'string', line 171, column 2 to column 14)", - " (in 'string', line 172, column 8 to column 9)", - " (in 'string', line 172, column 2 to column 31)", - " (in 'string', line 173, column 2 to column 23)", - " (in 'string', line 174, column 2 to column 30)", - " (in 'string', line 175, column 2 to column 21)", - " (in 'string', line 176, column 2 to column 28)", - " (in 'string', line 177, column 2 to column 21)", - " (in 'string', line 178, column 2 to column 28)", - " (in 'string', line 180, column 2 to column 32)", - " (in 'string', line 181, column 2 to column 32)", - " (in 'string', line 182, column 2 to column 31)", - " (in 'string', line 183, column 2 to column 31)", - " (in 'string', line 185, column 2 to column 24)", - " (in 'string', line 186, column 2 to column 22)", - " (in 'string', line 188, column 9 to column 10)", - " (in 'string', line 188, column 2 to column 15)", - " (in 'string', line 189, column 9 to column 10)", - " (in 'string', line 189, column 2 to column 23)", - " (in 'string', line 190, column 8 to column 9)", - " (in 'string', line 190, column 2 to column 26)", - " (in 'string', line 191, column 2 to column 19)", - " (in 'string', line 192, column 2 to column 17)", - " (in 'string', line 193, column 9 to column 14)", - " (in 'string', line 193, column 16 to column 17)", - " (in 'string', line 193, column 2 to column 29)", - " (in 'string', line 194, column 9 to column 14)", - " (in 'string', line 194, column 16 to column 17)", - " (in 'string', line 194, column 2 to column 29)", - " (in 'string', line 198, column 8 to column 36)", - " (in 'string', line 198, column 2 to column 50)", - " (in 'string', line 199, column 9 to column 10)", - " (in 'string', line 199, column 2 to column 15)", - " (in 'string', line 200, column 9 to column 10)", - " (in 'string', line 200, column 12 to column 13)", - " (in 'string', line 200, column 2 to column 42)", - " (in 'string', line 201, column 9 to column 10)", - " (in 'string', line 201, column 12 to column 13)", - " (in 'string', line 201, column 2 to column 52)", - " (in 'string', line 203, column 4 to column 15)", - " (in 'string', line 206, column 8 to column 20)", - " (in 'string', line 207, column 8 to column 24)", - " (in 'string', line 205, column 25 to line 208, column 7)", - " (in 'string', line 205, column 6 to line 208, column 7)", - " (in 'string', line 204, column 22 to line 209, column 5)", - " (in 'string', line 204, column 4 to line 209, column 5)", - " (in 'string', line 202, column 2 to line 210, column 3)", - " (in 'string', line 212, column 4 to column 67)", - " (in 'string', line 211, column 16 to line 213, column 3)", - " (in 'string', line 211, column 2 to line 213, column 3)", - " (in 'string', line 216, column 4 to column 26)", - " (in 'string', line 217, column 4 to column 29)", - " (in 'string', line 215, column 20 to line 218, column 3)", - " (in 'string', line 215, column 2 to line 218, column 3)", - " (in 'string', line 220, column 4 to column 26)", - " (in 'string', line 221, column 4 to column 29)", - " (in 'string', line 219, column 26 to line 222, column 3)", - " (in 'string', line 219, column 2 to line 222, column 3)", - " (in 'string', line 224, column 4 to column 20)", - " (in 'string', line 225, column 4 to column 23)", - " (in 'string', line 223, column 22 to line 226, column 3)", - " (in 'string', line 223, column 2 to line 226, column 3)", - " (in 'string', line 230, column 9 to column 16)", - " (in 'string', line 231, column 8 to column 13)", - " (in 'string', line 232, column 8 to column 13)", - " (in 'string', line 235, column 9 to column 10)", - " (in 'string', line 235, column 12 to column 13)", - " (in 'string', line 236, column 9 to column 10)", - " (in 'string', line 237, column 9 to column 10)", - " (in 'string', line 238, column 9 to column 10)", - " (in 'string', line 271, column 9 to column 10)", - " (in 'string', line 271, column 12 to column 28)", - " (in 'string', line 272, column 9 to column 14)", - " (in 'string', line 272, column 16 to column 32)", - " (in 'string', line 274, column 9 to column 25)", - " (in 'string', line 275, column 9 to column 25)", - " (in 'string', line 277, column 9 to column 10)", - " (in 'string', line 17, column 4 to column 23)", - " (in 'string', line 18, column 4 to column 20)", - " (in 'string', line 19, column 4 to column 21)", - " (in 'string', line 20, column 11 to column 12)", - " (in 'string', line 20, column 4 to column 64)", - " (in 'string', line 21, column 11 to column 12)", - " (in 'string', line 21, column 4 to column 21)", - " (in 'string', line 22, column 11 to column 12)", - " (in 'string', line 22, column 14 to column 15)", - " (in 'string', line 22, column 4 to column 24)", - " (in 'string', line 23, column 11 to column 12)", - " (in 'string', line 23, column 4 to column 16)", - " (in 'string', line 24, column 11 to column 12)", - " (in 'string', line 24, column 4 to column 16)", - " (in 'string', line 25, column 11 to column 12)", - " (in 'string', line 25, column 14 to column 15)", - " (in 'string', line 25, column 4 to column 19)", - " (in 'string', line 26, column 11 to column 12)", - " (in 'string', line 26, column 14 to column 17)", - " (in 'string', line 26, column 4 to column 21)", - " (in 'string', line 27, column 11 to column 12)", - " (in 'string', line 27, column 4 to column 19)", - " (in 'string', line 29, column 4 to column 30)", - " (in 'string', line 33, column 6 to column 55)", - " (in 'string', line 45, column 8 to column 19)", - " (in 'string', line 46, column 8 to column 34)", - " (in 'string', line 48, column 10 to column 30)", - " (in 'string', line 47, column 23 to line 49, column 9)", - " (in 'string', line 47, column 8 to line 49, column 9)", - " (in 'string', line 44, column 13 to line 50, column 7)", - " (in 'string', line 36, column 8 to column 57)", - " (in 'string', line 37, column 8 to column 48)", - " (in 'string', line 38, column 8 to column 36)", - " (in 'string', line 39, column 8 to column 58)", - " (in 'string', line 41, column 10 to column 30)", - " (in 'string', line 40, column 23 to line 42, column 9)", - " (in 'string', line 40, column 8 to line 42, column 9)", - " (in 'string', line 43, column 8 to column 72)", - " (in 'string', line 35, column 26 to line 44, column 7)", - " (in 'string', line 35, column 6 to line 50, column 7)", - " (in 'string', line 31, column 19 to line 51, column 5)", - " (in 'string', line 31, column 4 to line 51, column 5)", - " (in 'string', line 53, column 4 to column 33)", - " (in 'string', line 55, column 6 to column 25)", - " (in 'string', line 56, column 13 to column 14)", - " (in 'string', line 56, column 6 to column 31)", - " (in 'string', line 62, column 8 to column 26)", - " (in 'string', line 61, column 13 to line 63, column 7)", - " (in 'string', line 58, column 15 to column 16)", - " (in 'string', line 58, column 8 to column 44)", - " (in 'string', line 59, column 8 to column 30)", - " (in 'string', line 60, column 8 to column 71)", - " (in 'string', line 57, column 25 to line 61, column 7)", - " (in 'string', line 57, column 6 to line 63, column 7)", - " (in 'string', line 54, column 20 to line 64, column 5)", - " (in 'string', line 54, column 4 to line 64, column 5)", - " (in 'string', line 66, column 4 to column 17)", - " (in 'string', line 67, column 4 to column 27)", - " (in 'string', line 69, column 13 to column 14)", - " (in 'string', line 69, column 6 to column 30)", - " (in 'string', line 70, column 13 to column 14)", - " (in 'string', line 70, column 6 to column 29)", - " (in 'string', line 71, column 6 to column 41)", - " (in 'string', line 68, column 19 to line 72, column 5)", - " (in 'string', line 68, column 4 to line 72, column 5)", - " (in 'string', line 87, column 10 to column 59)", - " (in 'string', line 88, column 10 to line 90, column 44)", - " (in 'string', line 86, column 27 to line 91, column 9)", - " (in 'string', line 86, column 8 to line 91, column 9)", - " (in 'string', line 85, column 20 to line 92, column 7)", - " (in 'string', line 85, column 6 to line 92, column 7)", - " (in 'string', line 84, column 11 to line 93, column 5)", - " (in 'string', line 78, column 10 to column 59)", - " (in 'string', line 79, column 10 to line 81, column 44)", - " (in 'string', line 77, column 27 to line 82, column 9)", - " (in 'string', line 77, column 8 to line 82, column 9)", - " (in 'string', line 76, column 20 to line 83, column 7)", - " (in 'string', line 76, column 6 to line 83, column 7)", - " (in 'string', line 75, column 27 to line 84, column 5)", - " (in 'string', line 75, column 4 to line 93, column 5)", - " (in 'string', line 94, column 4 to column 18)", - " (in 'string', line 15, column 41 to line 95, column 3)", - " (in 'string', line 104, column 4 to column 23)", - " (in 'string', line 105, column 4 to column 20)", - " (in 'string', line 106, column 4 to column 21)", - " (in 'string', line 107, column 11 to column 12)", - " (in 'string', line 107, column 4 to column 21)", - " (in 'string', line 108, column 11 to column 12)", - " (in 'string', line 108, column 14 to column 15)", - " (in 'string', line 108, column 4 to column 24)", - " (in 'string', line 109, column 11 to column 12)", - " (in 'string', line 109, column 4 to column 16)", - " (in 'string', line 110, column 11 to column 12)", - " (in 'string', line 110, column 4 to column 16)", - " (in 'string', line 111, column 11 to column 12)", - " (in 'string', line 111, column 14 to column 15)", - " (in 'string', line 111, column 4 to column 19)", - " (in 'string', line 112, column 11 to column 12)", - " (in 'string', line 112, column 14 to column 17)", - " (in 'string', line 112, column 4 to column 21)", - " (in 'string', line 113, column 11 to column 12)", - " (in 'string', line 113, column 4 to column 19)", - " (in 'string', line 117, column 6 to column 55)", - " (in 'string', line 128, column 8 to column 19)", - " (in 'string', line 129, column 8 to column 34)", - " (in 'string', line 131, column 10 to column 30)", - " (in 'string', line 130, column 23 to line 132, column 9)", - " (in 'string', line 130, column 8 to line 132, column 9)", - " (in 'string', line 127, column 13 to line 133, column 7)", - " (in 'string', line 120, column 8 to column 57)", - " (in 'string', line 121, column 8 to column 48)", - " (in 'string', line 122, column 8 to column 36)", - " (in 'string', line 123, column 8 to column 58)", - " (in 'string', line 125, column 10 to column 30)", - " (in 'string', line 124, column 23 to line 126, column 9)", - " (in 'string', line 124, column 8 to line 126, column 9)", - " (in 'string', line 119, column 26 to line 127, column 7)", - " (in 'string', line 119, column 6 to line 133, column 7)", - " (in 'string', line 115, column 19 to line 134, column 5)", - " (in 'string', line 115, column 4 to line 134, column 5)", - " (in 'string', line 136, column 4 to column 36)", - " (in 'string', line 138, column 6 to column 25)", - " (in 'string', line 139, column 13 to column 14)", - " (in 'string', line 139, column 6 to column 31)", - " (in 'string', line 145, column 8 to column 27)", - " (in 'string', line 144, column 13 to line 146, column 7)", - " (in 'string', line 141, column 15 to column 16)", - " (in 'string', line 141, column 8 to column 44)", - " (in 'string', line 142, column 8 to column 30)", - " (in 'string', line 143, column 8 to column 71)", - " (in 'string', line 140, column 25 to line 144, column 7)", - " (in 'string', line 140, column 6 to line 146, column 7)", - " (in 'string', line 137, column 20 to line 147, column 5)", - " (in 'string', line 137, column 4 to line 147, column 5)", - " (in 'string', line 149, column 4 to column 17)", - " (in 'string', line 150, column 4 to column 27)", - " (in 'string', line 152, column 13 to column 14)", - " (in 'string', line 152, column 6 to column 30)", - " (in 'string', line 153, column 13 to column 14)", - " (in 'string', line 153, column 6 to column 29)", - " (in 'string', line 154, column 6 to column 41)", - " (in 'string', line 151, column 19 to line 155, column 5)", - " (in 'string', line 151, column 4 to line 155, column 5)", - " (in 'string', line 157, column 4 to column 23)", - " (in 'string', line 102, column 37 to line 158, column 3)"}; +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'string', line 230, column 2 to column 29)", + " (in 'string', line 231, column 2 to column 39)", + " (in 'string', line 232, column 2 to column 39)", + " (in 'string', line 235, column 2 to column 42)", + " (in 'string', line 236, column 2 to column 18)", + " (in 'string', line 237, column 2 to column 15)", + " (in 'string', line 238, column 2 to column 22)", + " (in 'string', line 271, column 2 to column 38)", + " (in 'string', line 272, column 2 to column 37)", + " (in 'string', line 273, column 2 to column 15)", + " (in 'string', line 274, column 2 to column 33)", + " (in 'string', line 275, column 2 to column 33)", + " (in 'string', line 277, column 2 to column 48)", + " (in 'string', line 243, column 4 to column 31)", + " (in 'string', line 242, column 9 to line 244, column 3)", + " (in 'string', line 241, column 4 to column 36)", + " (in 'string', line 240, column 19 to line 242, column 3)", + " (in 'string', line 240, column 2 to line 244, column 3)", + " (in 'string', line 245, column 2 to column 17)", + " (in 'string', line 249, column 6 to column 52)", + " (in 'string', line 248, column 22 to line 250, column 5)", + " (in 'string', line 248, column 4 to line 250, column 5)", + " (in 'string', line 252, column 6 to column 56)", + " (in 'string', line 251, column 22 to line 253, column 5)", + " (in 'string', line 251, column 4 to line 253, column 5)", + " (in 'string', line 247, column 17 to line 254, column 3)", + " (in 'string', line 247, column 2 to line 254, column 3)", + " (in 'string', line 256, column 2 to line 257, column 55)", + " (in 'string', line 281, column 11 to column 12)", + " (in 'string', line 281, column 4 to column 22)", + " (in 'string', line 282, column 11 to column 12)", + " (in 'string', line 282, column 14 to column 15)", + " (in 'string', line 282, column 4 to column 24)", + " (in 'string', line 283, column 11 to column 16)", + " (in 'string', line 283, column 18 to column 19)", + " (in 'string', line 283, column 4 to column 26)", + " (in 'string', line 284, column 10 to column 11)", + " (in 'string', line 284, column 13 to column 14)", + " (in 'string', line 284, column 16 to column 17)", + " (in 'string', line 284, column 4 to column 35)", + " (in 'string', line 285, column 10 to column 15)", + " (in 'string', line 285, column 17 to column 18)", + " (in 'string', line 285, column 20 to column 21)", + " (in 'string', line 285, column 4 to column 37)", + " (in 'string', line 286, column 11 to column 12)", + " (in 'string', line 286, column 4 to column 37)", + " (in 'string', line 296, column 8 to column 62)", + " (in 'string', line 295, column 24 to line 297, column 7)", + " (in 'string', line 295, column 6 to line 297, column 7)", + " (in 'string', line 299, column 8 to column 70)", + " (in 'string', line 300, column 8 to column 48)", + " (in 'string', line 298, column 24 to line 301, column 7)", + " (in 'string', line 298, column 6 to line 301, column 7)", + " (in 'string', line 305, column 10 to column 86)", + " (in 'string', line 304, column 26 to line 306, column 9)", + " (in 'string', line 304, column 8 to line 306, column 9)", + " (in 'string', line 308, column 10 to column 69)", + " (in 'string', line 309, column 10 to column 82)", + " (in 'string', line 307, column 26 to line 310, column 9)", + " (in 'string', line 307, column 8 to line 310, column 9)", + " (in 'string', line 303, column 27 to line 311, column 7)", + " (in 'string', line 303, column 6 to line 311, column 7)", + " (in 'string', line 314, column 8 to column 85)", + " (in 'string', line 313, column 20 to line 315, column 7)", + " (in 'string', line 313, column 6 to line 315, column 7)", + " (in 'string', line 318, column 15 to column 16)", + " (in 'string', line 318, column 18 to column 19)", + " (in 'string', line 318, column 8 to line 319, column 29)", + " (in 'string', line 320, column 8 to column 35)", + " (in 'string', line 321, column 22 to column 53)", + " (in 'string', line 321, column 8 to column 53)", + " (in 'string', line 317, column 6 to line 322, column 7)", + " (in 'string', line 324, column 6 to column 50)", + " (in 'string', line 325, column 20 to column 64)", + " (in 'string', line 325, column 6 to column 64)", + " (in 'string', line 327, column 6 to column 37)", + " (in 'string', line 336, column 10 to column 78)", + " (in 'string', line 337, column 10 to line 338, column 45)", + " (in 'string', line 335, column 22 to line 339, column 9)", + " (in 'string', line 335, column 8 to line 339, column 9)", + " (in 'string', line 334, column 13 to line 340, column 7)", + " (in 'string', line 330, column 10 to column 78)", + " (in 'string', line 331, column 10 to line 332, column 45)", + " (in 'string', line 329, column 22 to line 333, column 9)", + " (in 'string', line 329, column 8 to line 333, column 9)", + " (in 'string', line 328, column 29 to line 334, column 7)", + " (in 'string', line 328, column 6 to line 340, column 7)", + " (in 'string', line 293, column 18 to line 341, column 5)", + " (in 'string', line 293, column 4 to line 341, column 5)", + " (in 'string', line 350, column 6 to column 16)", + " (in 'string', line 351, column 13 to column 14)", + " (in 'string', line 351, column 6 to column 30)", + " (in 'string', line 352, column 6 to column 27)", + " (in 'string', line 353, column 6 to column 48)", + " (in 'string', line 354, column 6 to column 49)", + " (in 'string', line 355, column 21 to column 57)", + " (in 'string', line 355, column 6 to column 57)", + " (in 'string', line 366, column 10 to column 77)", + " (in 'string', line 367, column 10 to column 39)", + " (in 'string', line 368, column 10 to column 50)", + " (in 'string', line 365, column 22 to line 369, column 9)", + " (in 'string', line 365, column 8 to line 369, column 9)", + " (in 'string', line 364, column 13 to line 370, column 7)", + " (in 'string', line 361, column 10 to column 84)", + " (in 'string', line 362, column 10 to column 43)", + " (in 'string', line 360, column 22 to line 363, column 9)", + " (in 'string', line 360, column 8 to line 363, column 9)", + " (in 'string', line 359, column 29 to line 364, column 7)", + " (in 'string', line 359, column 6 to line 370, column 7)", + " (in 'string', line 343, column 4 to line 371, column 5)", + " (in 'string', line 279, column 17 to line 373, column 3)", + " (in 'string', line 279, column 2 to line 373, column 3)", + " (in 'string', line 261, column 2 to column 54)", + " (in 'string', line 262, column 2 to column 53)", + " (in 'string', line 263, column 2 to column 53)", + " (in 'string', line 267, column 2 to column 38)", + " (in 'string', line 162, column 2 to column 23)", + " (in 'string', line 163, column 2 to column 21)", + " (in 'string', line 164, column 2 to column 21)", + " (in 'string', line 165, column 2 to column 17)", + " (in 'string', line 166, column 2 to column 17)", + " (in 'string', line 167, column 2 to column 17)", + " (in 'string', line 168, column 2 to column 21)", + " (in 'string', line 169, column 9 to column 10)", + " (in 'string', line 169, column 12 to column 19)", + " (in 'string', line 169, column 2 to column 32)", + " (in 'string', line 170, column 9 to column 10)", + " (in 'string', line 170, column 12 to column 13)", + " (in 'string', line 170, column 2 to column 23)", + " (in 'string', line 171, column 9 to column 10)", + " (in 'string', line 171, column 2 to column 14)", + " (in 'string', line 172, column 8 to column 9)", + " (in 'string', line 172, column 2 to column 31)", + " (in 'string', line 173, column 2 to column 23)", + " (in 'string', line 174, column 2 to column 30)", + " (in 'string', line 175, column 2 to column 21)", + " (in 'string', line 176, column 2 to column 28)", + " (in 'string', line 177, column 2 to column 21)", + " (in 'string', line 178, column 2 to column 28)", + " (in 'string', line 180, column 2 to column 32)", + " (in 'string', line 181, column 2 to column 32)", + " (in 'string', line 182, column 2 to column 31)", + " (in 'string', line 183, column 2 to column 31)", + " (in 'string', line 185, column 2 to column 24)", + " (in 'string', line 186, column 2 to column 22)", + " (in 'string', line 188, column 9 to column 10)", + " (in 'string', line 188, column 2 to column 15)", + " (in 'string', line 189, column 9 to column 10)", + " (in 'string', line 189, column 2 to column 23)", + " (in 'string', line 190, column 8 to column 9)", + " (in 'string', line 190, column 2 to column 26)", + " (in 'string', line 191, column 2 to column 19)", + " (in 'string', line 192, column 2 to column 17)", + " (in 'string', line 193, column 9 to column 14)", + " (in 'string', line 193, column 16 to column 17)", + " (in 'string', line 193, column 2 to column 29)", + " (in 'string', line 194, column 9 to column 14)", + " (in 'string', line 194, column 16 to column 17)", + " (in 'string', line 194, column 2 to column 29)", + " (in 'string', line 198, column 8 to column 36)", + " (in 'string', line 198, column 2 to column 50)", + " (in 'string', line 199, column 9 to column 10)", + " (in 'string', line 199, column 2 to column 15)", + " (in 'string', line 200, column 9 to column 10)", + " (in 'string', line 200, column 12 to column 13)", + " (in 'string', line 200, column 2 to column 42)", + " (in 'string', line 201, column 9 to column 10)", + " (in 'string', line 201, column 12 to column 13)", + " (in 'string', line 201, column 2 to column 52)", + " (in 'string', line 203, column 4 to column 15)", + " (in 'string', line 206, column 8 to column 20)", + " (in 'string', line 207, column 8 to column 24)", + " (in 'string', line 205, column 25 to line 208, column 7)", + " (in 'string', line 205, column 6 to line 208, column 7)", + " (in 'string', line 204, column 22 to line 209, column 5)", + " (in 'string', line 204, column 4 to line 209, column 5)", + " (in 'string', line 202, column 2 to line 210, column 3)", + " (in 'string', line 212, column 4 to column 67)", + " (in 'string', line 211, column 16 to line 213, column 3)", + " (in 'string', line 211, column 2 to line 213, column 3)", + " (in 'string', line 216, column 4 to column 26)", + " (in 'string', line 217, column 4 to column 29)", + " (in 'string', line 215, column 20 to line 218, column 3)", + " (in 'string', line 215, column 2 to line 218, column 3)", + " (in 'string', line 220, column 4 to column 26)", + " (in 'string', line 221, column 4 to column 29)", + " (in 'string', line 219, column 26 to line 222, column 3)", + " (in 'string', line 219, column 2 to line 222, column 3)", + " (in 'string', line 224, column 4 to column 20)", + " (in 'string', line 225, column 4 to column 23)", + " (in 'string', line 223, column 22 to line 226, column 3)", + " (in 'string', line 223, column 2 to line 226, column 3)", + " (in 'string', line 230, column 9 to column 16)", + " (in 'string', line 231, column 8 to column 13)", + " (in 'string', line 232, column 8 to column 13)", + " (in 'string', line 235, column 9 to column 10)", + " (in 'string', line 235, column 12 to column 13)", + " (in 'string', line 236, column 9 to column 10)", + " (in 'string', line 237, column 9 to column 10)", + " (in 'string', line 238, column 9 to column 10)", + " (in 'string', line 271, column 9 to column 10)", + " (in 'string', line 271, column 12 to column 28)", + " (in 'string', line 272, column 9 to column 14)", + " (in 'string', line 272, column 16 to column 32)", + " (in 'string', line 274, column 9 to column 25)", + " (in 'string', line 275, column 9 to column 25)", + " (in 'string', line 277, column 9 to column 10)", + " (in 'string', line 17, column 4 to column 23)", + " (in 'string', line 18, column 4 to column 20)", + " (in 'string', line 19, column 4 to column 21)", + " (in 'string', line 20, column 11 to column 12)", + " (in 'string', line 20, column 4 to column 64)", + " (in 'string', line 21, column 11 to column 12)", + " (in 'string', line 21, column 4 to column 21)", + " (in 'string', line 22, column 11 to column 12)", + " (in 'string', line 22, column 14 to column 15)", + " (in 'string', line 22, column 4 to column 24)", + " (in 'string', line 23, column 11 to column 12)", + " (in 'string', line 23, column 4 to column 16)", + " (in 'string', line 24, column 11 to column 12)", + " (in 'string', line 24, column 4 to column 16)", + " (in 'string', line 25, column 11 to column 12)", + " (in 'string', line 25, column 14 to column 15)", + " (in 'string', line 25, column 4 to column 19)", + " (in 'string', line 26, column 11 to column 12)", + " (in 'string', line 26, column 14 to column 17)", + " (in 'string', line 26, column 4 to column 21)", + " (in 'string', line 27, column 11 to column 12)", + " (in 'string', line 27, column 4 to column 19)", + " (in 'string', line 29, column 4 to column 30)", + " (in 'string', line 33, column 6 to column 55)", + " (in 'string', line 45, column 8 to column 19)", + " (in 'string', line 46, column 8 to column 34)", + " (in 'string', line 48, column 10 to column 30)", + " (in 'string', line 47, column 23 to line 49, column 9)", + " (in 'string', line 47, column 8 to line 49, column 9)", + " (in 'string', line 44, column 13 to line 50, column 7)", + " (in 'string', line 36, column 8 to column 57)", + " (in 'string', line 37, column 8 to column 48)", + " (in 'string', line 38, column 8 to column 36)", + " (in 'string', line 39, column 8 to column 58)", + " (in 'string', line 41, column 10 to column 30)", + " (in 'string', line 40, column 23 to line 42, column 9)", + " (in 'string', line 40, column 8 to line 42, column 9)", + " (in 'string', line 43, column 8 to column 72)", + " (in 'string', line 35, column 26 to line 44, column 7)", + " (in 'string', line 35, column 6 to line 50, column 7)", + " (in 'string', line 31, column 19 to line 51, column 5)", + " (in 'string', line 31, column 4 to line 51, column 5)", + " (in 'string', line 53, column 4 to column 33)", + " (in 'string', line 55, column 6 to column 25)", + " (in 'string', line 56, column 13 to column 14)", + " (in 'string', line 56, column 6 to column 31)", + " (in 'string', line 62, column 8 to column 26)", + " (in 'string', line 61, column 13 to line 63, column 7)", + " (in 'string', line 58, column 15 to column 16)", + " (in 'string', line 58, column 8 to column 44)", + " (in 'string', line 59, column 8 to column 30)", + " (in 'string', line 60, column 8 to column 71)", + " (in 'string', line 57, column 25 to line 61, column 7)", + " (in 'string', line 57, column 6 to line 63, column 7)", + " (in 'string', line 54, column 20 to line 64, column 5)", + " (in 'string', line 54, column 4 to line 64, column 5)", + " (in 'string', line 66, column 4 to column 17)", + " (in 'string', line 67, column 4 to column 27)", + " (in 'string', line 69, column 13 to column 14)", + " (in 'string', line 69, column 6 to column 30)", + " (in 'string', line 70, column 13 to column 14)", + " (in 'string', line 70, column 6 to column 29)", + " (in 'string', line 71, column 6 to column 41)", + " (in 'string', line 68, column 19 to line 72, column 5)", + " (in 'string', line 68, column 4 to line 72, column 5)", + " (in 'string', line 87, column 10 to column 59)", + " (in 'string', line 88, column 10 to line 90, column 44)", + " (in 'string', line 86, column 27 to line 91, column 9)", + " (in 'string', line 86, column 8 to line 91, column 9)", + " (in 'string', line 85, column 20 to line 92, column 7)", + " (in 'string', line 85, column 6 to line 92, column 7)", + " (in 'string', line 84, column 11 to line 93, column 5)", + " (in 'string', line 78, column 10 to column 59)", + " (in 'string', line 79, column 10 to line 81, column 44)", + " (in 'string', line 77, column 27 to line 82, column 9)", + " (in 'string', line 77, column 8 to line 82, column 9)", + " (in 'string', line 76, column 20 to line 83, column 7)", + " (in 'string', line 76, column 6 to line 83, column 7)", + " (in 'string', line 75, column 27 to line 84, column 5)", + " (in 'string', line 75, column 4 to line 93, column 5)", + " (in 'string', line 94, column 4 to column 18)", + " (in 'string', line 15, column 41 to line 95, column 3)", + " (in 'string', line 104, column 4 to column 23)", + " (in 'string', line 105, column 4 to column 20)", + " (in 'string', line 106, column 4 to column 21)", + " (in 'string', line 107, column 11 to column 12)", + " (in 'string', line 107, column 4 to column 21)", + " (in 'string', line 108, column 11 to column 12)", + " (in 'string', line 108, column 14 to column 15)", + " (in 'string', line 108, column 4 to column 24)", + " (in 'string', line 109, column 11 to column 12)", + " (in 'string', line 109, column 4 to column 16)", + " (in 'string', line 110, column 11 to column 12)", + " (in 'string', line 110, column 4 to column 16)", + " (in 'string', line 111, column 11 to column 12)", + " (in 'string', line 111, column 14 to column 15)", + " (in 'string', line 111, column 4 to column 19)", + " (in 'string', line 112, column 11 to column 12)", + " (in 'string', line 112, column 14 to column 17)", + " (in 'string', line 112, column 4 to column 21)", + " (in 'string', line 113, column 11 to column 12)", + " (in 'string', line 113, column 4 to column 19)", + " (in 'string', line 117, column 6 to column 55)", + " (in 'string', line 128, column 8 to column 19)", + " (in 'string', line 129, column 8 to column 34)", + " (in 'string', line 131, column 10 to column 30)", + " (in 'string', line 130, column 23 to line 132, column 9)", + " (in 'string', line 130, column 8 to line 132, column 9)", + " (in 'string', line 127, column 13 to line 133, column 7)", + " (in 'string', line 120, column 8 to column 57)", + " (in 'string', line 121, column 8 to column 48)", + " (in 'string', line 122, column 8 to column 36)", + " (in 'string', line 123, column 8 to column 58)", + " (in 'string', line 125, column 10 to column 30)", + " (in 'string', line 124, column 23 to line 126, column 9)", + " (in 'string', line 124, column 8 to line 126, column 9)", + " (in 'string', line 119, column 26 to line 127, column 7)", + " (in 'string', line 119, column 6 to line 133, column 7)", + " (in 'string', line 115, column 19 to line 134, column 5)", + " (in 'string', line 115, column 4 to line 134, column 5)", + " (in 'string', line 136, column 4 to column 36)", + " (in 'string', line 138, column 6 to column 25)", + " (in 'string', line 139, column 13 to column 14)", + " (in 'string', line 139, column 6 to column 31)", + " (in 'string', line 145, column 8 to column 27)", + " (in 'string', line 144, column 13 to line 146, column 7)", + " (in 'string', line 141, column 15 to column 16)", + " (in 'string', line 141, column 8 to column 44)", + " (in 'string', line 142, column 8 to column 30)", + " (in 'string', line 143, column 8 to column 71)", + " (in 'string', line 140, column 25 to line 144, column 7)", + " (in 'string', line 140, column 6 to line 146, column 7)", + " (in 'string', line 137, column 20 to line 147, column 5)", + " (in 'string', line 137, column 4 to line 147, column 5)", + " (in 'string', line 149, column 4 to column 17)", + " (in 'string', line 150, column 4 to column 27)", + " (in 'string', line 152, column 13 to column 14)", + " (in 'string', line 152, column 6 to column 30)", + " (in 'string', line 153, column 13 to column 14)", + " (in 'string', line 153, column 6 to column 29)", + " (in 'string', line 154, column 6 to column 41)", + " (in 'string', line 151, column 19 to line 155, column 5)", + " (in 'string', line 151, column 4 to line 155, column 5)", + " (in 'string', line 157, column 4 to column 23)", + " (in 'string', line 102, column 37 to line 158, column 3)"}; +template , + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t, stan::base_type_t, + stan::base_type_t, stan::base_type_t, + stan::promote_args_t, + stan::base_type_t, stan::base_type_t, + stan::base_type_t>>,-1,-1> +glm_approx_loglik(const T0__& y_arg__, const std::vector& y_miss, + const T2__& a1_arg__, const T3__& P1_arg__, const T4__& + Ht_arg__, const T5__& Tt_arg__, const T6__& Rt_arg__, + const T7__& xreg_arg__, const int& distribution, + const std::vector& u, const T10__& y_original_arg__, + const T11__& xbeta_fixed_arg__, std::ostream* pstream__); template -Eigen::Matrix, stan::value_type_t, -stan::value_type_t, stan::value_type_t, -stan::value_type_t, stan::promote_args_t, -stan::value_type_t, stan::value_type_t, -stan::value_type_t>>, -1, -1> + typename T5__, typename T6__, typename T7__, + stan::require_all_t, + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t, stan::base_type_t, + stan::base_type_t, stan::base_type_t, + stan::promote_args_t, + stan::base_type_t>>,-1,-1> +glm_approx_smoother(const T0__& y_arg__, const std::vector& y_miss, + const T2__& a1_arg__, const T3__& P1_arg__, const T4__& + Ht_arg__, const T5__& Tt_arg__, const T6__& Rt_arg__, + const T7__& xreg_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex>*> +Eigen::Matrix, + stan::base_type_t, stan::base_type_t, + stan::base_type_t, stan::base_type_t, + stan::promote_args_t, + stan::base_type_t, stan::base_type_t, + stan::base_type_t>>,-1,-1> glm_approx_loglik(const T0__& y_arg__, const std::vector& y_miss, - const T2__& a1_arg__, const T3__& P1_arg__, - const T4__& Ht_arg__, const T5__& Tt_arg__, - const T6__& Rt_arg__, const T7__& xreg_arg__, - const int& distribution, const std::vector& u, - const T10__& y_original_arg__, + const T2__& a1_arg__, const T3__& P1_arg__, const T4__& + Ht_arg__, const T5__& Tt_arg__, const T6__& Rt_arg__, + const T7__& xreg_arg__, const int& distribution, + const std::vector& u, const T10__& y_original_arg__, const T11__& xbeta_fixed_arg__, std::ostream* pstream__) { - using local_scalar_t__ = stan::promote_args_t, - stan::value_type_t, - stan::value_type_t, - stan::value_type_t, - stan::value_type_t, stan::promote_args_t, - stan::value_type_t, - stan::value_type_t, - stan::value_type_t>>; - const auto& y = to_ref(y_arg__); - const auto& a1 = to_ref(a1_arg__); - const auto& P1 = to_ref(P1_arg__); - const auto& Ht = to_ref(Ht_arg__); - const auto& Tt = to_ref(Tt_arg__); - const auto& Rt = to_ref(Rt_arg__); - const auto& xreg = to_ref(xreg_arg__); - const auto& y_original = to_ref(y_original_arg__); - const auto& xbeta_fixed = to_ref(xbeta_fixed_arg__); - const static bool propto__ = true; + using local_scalar_t__ = stan::promote_args_t, + stan::base_type_t, + stan::base_type_t, + stan::base_type_t, + stan::base_type_t, + stan::promote_args_t, + stan::base_type_t, + stan::base_type_t, + stan::base_type_t>>; + int current_statement__ = 0; + const auto& y = stan::math::to_ref(y_arg__); + const auto& a1 = stan::math::to_ref(a1_arg__); + const auto& P1 = stan::math::to_ref(P1_arg__); + const auto& Ht = stan::math::to_ref(Ht_arg__); + const auto& Tt = stan::math::to_ref(Tt_arg__); + const auto& Rt = stan::math::to_ref(Rt_arg__); + const auto& xreg = stan::math::to_ref(xreg_arg__); + const auto& y_original = stan::math::to_ref(y_original_arg__); + const auto& xbeta_fixed = stan::math::to_ref(xbeta_fixed_arg__); + static constexpr bool propto__ = true; + // suppress unused var warning (void) propto__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; try { - int k; - k = std::numeric_limits::min(); - + int k = std::numeric_limits::min(); current_statement__ = 208; - k = rows(xreg); - int n; - n = std::numeric_limits::min(); - + k = stan::math::rows(xreg); + int n = std::numeric_limits::min(); current_statement__ = 209; - n = rows(y); - int m; - m = std::numeric_limits::min(); - + n = stan::math::rows(y); + int m = std::numeric_limits::min(); current_statement__ = 210; - m = rows(a1); + m = stan::math::rows(a1); current_statement__ = 211; - validate_non_negative_index("loglik", "n", n); - Eigen::Matrix loglik; - loglik = Eigen::Matrix(n, 2); - stan::math::fill(loglik, DUMMY_VAR__); - + stan::math::validate_non_negative_index("loglik", "n", n); + Eigen::Matrix loglik = + Eigen::Matrix::Constant(n, 2, DUMMY_VAR__); current_statement__ = 212; - assign(loglik, nil_index_list(), - rep_matrix(stan::math::negative_infinity(), n, 2), + stan::model::assign(loglik, + stan::math::rep_matrix(stan::math::negative_infinity(), n, 2), "assigning variable loglik"); current_statement__ = 213; - validate_non_negative_index("x", "m", m); - Eigen::Matrix x; - x = Eigen::Matrix(m); - stan::math::fill(x, DUMMY_VAR__); - + stan::math::validate_non_negative_index("x", "m", m); + Eigen::Matrix x = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 214; - assign(x, nil_index_list(), a1, "assigning variable x"); + stan::model::assign(x, a1, "assigning variable x"); current_statement__ = 215; - validate_non_negative_index("P", "m", m); + stan::math::validate_non_negative_index("P", "m", m); current_statement__ = 216; - validate_non_negative_index("P", "m", m); - Eigen::Matrix P; - P = Eigen::Matrix(m, m); - stan::math::fill(P, DUMMY_VAR__); - + stan::math::validate_non_negative_index("P", "m", m); + Eigen::Matrix P = + Eigen::Matrix::Constant(m, m, DUMMY_VAR__); current_statement__ = 217; - assign(P, nil_index_list(), P1, "assigning variable P"); + stan::model::assign(P, P1, "assigning variable P"); current_statement__ = 218; - validate_non_negative_index("v", "n", n); - Eigen::Matrix v; - v = Eigen::Matrix(n); - stan::math::fill(v, DUMMY_VAR__); - + stan::math::validate_non_negative_index("v", "n", n); + Eigen::Matrix v = + Eigen::Matrix::Constant(n, DUMMY_VAR__); current_statement__ = 220; - validate_non_negative_index("F", "n", n); - Eigen::Matrix F; - F = Eigen::Matrix(n); - stan::math::fill(F, DUMMY_VAR__); - + stan::math::validate_non_negative_index("F", "n", n); + Eigen::Matrix F = + Eigen::Matrix::Constant(n, DUMMY_VAR__); current_statement__ = 222; - validate_non_negative_index("K", "m", m); + stan::math::validate_non_negative_index("K", "m", m); current_statement__ = 223; - validate_non_negative_index("K", "n", n); - Eigen::Matrix K; - K = Eigen::Matrix(m, n); - stan::math::fill(K, DUMMY_VAR__); - + stan::math::validate_non_negative_index("K", "n", n); + Eigen::Matrix K = + Eigen::Matrix::Constant(m, n, DUMMY_VAR__); current_statement__ = 225; - validate_non_negative_index("r", "m", m); + stan::math::validate_non_negative_index("r", "m", m); current_statement__ = 226; - validate_non_negative_index("r", "n + 1", (n + 1)); - Eigen::Matrix r; - r = Eigen::Matrix(m, (n + 1)); - stan::math::fill(r, DUMMY_VAR__); - + stan::math::validate_non_negative_index("r", "n + 1", (n + 1)); + Eigen::Matrix r = + Eigen::Matrix::Constant(m, (n + 1), + DUMMY_VAR__); current_statement__ = 228; - validate_non_negative_index("tmpr", "m", m); - Eigen::Matrix tmpr; - tmpr = Eigen::Matrix(m); - stan::math::fill(tmpr, DUMMY_VAR__); - - local_scalar_t__ log2pi; - log2pi = DUMMY_VAR__; - + stan::math::validate_non_negative_index("tmpr", "m", m); + Eigen::Matrix tmpr = + Eigen::Matrix::Constant(m, DUMMY_VAR__); + local_scalar_t__ log2pi = DUMMY_VAR__; current_statement__ = 230; log2pi = stan::math::log((2 * stan::math::pi())); current_statement__ = 249; for (int t = 1; t <= n; ++t) { current_statement__ = 231; - assign(F, cons_list(index_uni(t), nil_index_list()), - (quad_form( - rvalue(P, - cons_list(index_min_max(1, k), - cons_list(index_min_max(1, k), nil_index_list())), "P"), - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg")) + - Ht[(t - 1)]), "assigning variable F"); + stan::model::assign(F, + (stan::math::quad_form( + stan::model::rvalue(P, "P", stan::model::index_min_max(1, k), + stan::model::index_min_max(1, k)), + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t))) + + stan::model::rvalue(Ht, "Ht", stan::model::index_uni(t))), + "assigning variable F", stan::model::index_uni(t)); current_statement__ = 247; - if (logical_eq(y_miss[(t - 1)], 0)) { + if (stan::math::logical_eq( + stan::model::rvalue(y_miss, "y_miss", stan::model::index_uni(t)), + 0)) { current_statement__ = 238; - assign(v, cons_list(index_uni(t), nil_index_list()), - (y[(t - 1)] - - dot_product( - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg"), - head(x, k))), "assigning variable v"); + stan::model::assign(v, + (stan::model::rvalue(y, "y", stan::model::index_uni(t)) - + stan::math::dot_product( + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t)), stan::math::head(x, k))), + "assigning variable v", stan::model::index_uni(t)); current_statement__ = 239; - assign(K, - cons_list(index_omni(), cons_list(index_uni(t), nil_index_list())), - divide( - multiply( - rvalue(P, - cons_list(index_min_max(1, m), - cons_list(index_min_max(1, k), nil_index_list())), "P"), - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg")), - F[(t - 1)]), "assigning variable K"); + stan::model::assign(K, + stan::math::divide( + stan::math::multiply( + stan::model::rvalue(P, "P", stan::model::index_min_max(1, m), + stan::model::index_min_max(1, k)), + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t))), + stan::model::rvalue(F, "F", stan::model::index_uni(t))), + "assigning variable K", stan::model::index_omni(), + stan::model::index_uni(t)); current_statement__ = 240; - assign(x, nil_index_list(), - multiply(Tt, - add(stan::model::deep_copy(x), - multiply( - rvalue(K, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "K"), - v[(t - 1)]))), "assigning variable x"); + stan::model::assign(x, + stan::math::multiply(Tt, + stan::math::add(stan::model::deep_copy(x), + stan::math::multiply( + stan::model::rvalue(K, "K", stan::model::index_omni(), + stan::model::index_uni(t)), + stan::model::rvalue(v, "v", stan::model::index_uni(t))))), + "assigning variable x"); current_statement__ = 241; - assign(P, nil_index_list(), - quad_form_sym( - subtract(stan::model::deep_copy(P), - multiply( - multiply( - rvalue(K, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "K"), - transpose( - rvalue(K, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "K"))), - F[(t - 1)])), transpose(Tt)), "assigning variable P"); + stan::model::assign(P, + stan::math::quad_form_sym( + stan::math::subtract(stan::model::deep_copy(P), + stan::math::multiply( + stan::math::multiply( + stan::model::rvalue(K, "K", stan::model::index_omni(), + stan::model::index_uni(t)), + stan::math::transpose( + stan::model::rvalue(K, "K", stan::model::index_omni(), + stan::model::index_uni(t)))), + stan::model::rvalue(F, "F", stan::model::index_uni(t)))), + stan::math::transpose(Tt)), "assigning variable P"); current_statement__ = 244; for (int i = 1; i <= m; ++i) { current_statement__ = 242; - assign(P, - cons_list(index_uni(i), - cons_list(index_uni(i), nil_index_list())), - (rvalue(P, - cons_list(index_uni(i), - cons_list(index_uni(i), nil_index_list())), "P") + - rvalue(Rt, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "Rt")), - "assigning variable P");} + stan::model::assign(P, + (stan::model::rvalue(P, "P", stan::model::index_uni(i), + stan::model::index_uni(i)) + + stan::model::rvalue(Rt, "Rt", stan::model::index_uni(i), + stan::model::index_uni(t))), "assigning variable P", + stan::model::index_uni(i), stan::model::index_uni(i)); + } current_statement__ = 245; - assign(loglik, - cons_list(index_uni(t), cons_list(index_uni(1), nil_index_list())), - (-0.5 * - ((log2pi + stan::math::log(F[(t - 1)])) + - ((v[(t - 1)] * v[(t - 1)]) / F[(t - 1)]))), - "assigning variable loglik"); + stan::model::assign(loglik, (-0.5 * ((log2pi + + stan::math::log( + stan::model::rvalue(F, "F", stan::model::index_uni(t)))) + + ((stan::model::rvalue(v, "v", stan::model::index_uni(t)) * + stan::model::rvalue(v, "v", stan::model::index_uni(t))) / + stan::model::rvalue(F, "F", stan::model::index_uni(t))))), + "assigning variable loglik", stan::model::index_uni(t), + stan::model::index_uni(1)); } else { current_statement__ = 232; - assign(x, nil_index_list(), multiply(Tt, stan::model::deep_copy(x)), + stan::model::assign(x, + stan::math::multiply(Tt, stan::model::deep_copy(x)), "assigning variable x"); current_statement__ = 233; - assign(P, nil_index_list(), - quad_form_sym(stan::model::deep_copy(P), transpose(Tt)), - "assigning variable P"); + stan::model::assign(P, + stan::math::quad_form_sym(stan::model::deep_copy(P), + stan::math::transpose(Tt)), "assigning variable P"); current_statement__ = 236; for (int i = 1; i <= m; ++i) { current_statement__ = 234; - assign(P, - cons_list(index_uni(i), - cons_list(index_uni(i), nil_index_list())), - (rvalue(P, - cons_list(index_uni(i), - cons_list(index_uni(i), nil_index_list())), "P") + - rvalue(Rt, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "Rt")), - "assigning variable P");} - }} + stan::model::assign(P, + (stan::model::rvalue(P, "P", stan::model::index_uni(i), + stan::model::index_uni(i)) + + stan::model::rvalue(Rt, "Rt", stan::model::index_uni(i), + stan::model::index_uni(t))), "assigning variable P", + stan::model::index_uni(i), stan::model::index_uni(i)); + } + } + } current_statement__ = 250; - assign(r, - cons_list(index_omni(), - cons_list(index_uni((n + 1)), nil_index_list())), rep_vector(0.0, m), - "assigning variable r"); + stan::model::assign(r, stan::math::rep_vector(0.0, m), + "assigning variable r", stan::model::index_omni(), + stan::model::index_uni((n + 1))); current_statement__ = 263; for (int tt = 1; tt <= n; ++tt) { - int t; - t = std::numeric_limits::min(); - + int t = std::numeric_limits::min(); current_statement__ = 251; t = ((n + 1) - tt); current_statement__ = 252; - validate_non_negative_index("tmp", "m", m); - Eigen::Matrix tmp; - tmp = Eigen::Matrix(m); - stan::math::fill(tmp, DUMMY_VAR__); - + stan::math::validate_non_negative_index("tmp", "m", m); + Eigen::Matrix tmp = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 253; - assign(tmp, nil_index_list(), - rvalue(r, - cons_list(index_omni(), - cons_list(index_uni((t + 1)), nil_index_list())), "r"), - "assigning variable tmp"); + stan::model::assign(tmp, + stan::model::rvalue(r, "r", stan::model::index_omni(), + stan::model::index_uni((t + 1))), "assigning variable tmp"); current_statement__ = 261; - if (logical_eq(y_miss[(t - 1)], 0)) { + if (stan::math::logical_eq( + stan::model::rvalue(y_miss, "y_miss", stan::model::index_uni(t)), + 0)) { current_statement__ = 256; - validate_non_negative_index("tmp2", "m", m); - Eigen::Matrix tmp2; - tmp2 = Eigen::Matrix(m); - stan::math::fill(tmp2, DUMMY_VAR__); - + stan::math::validate_non_negative_index("tmp2", "m", m); + Eigen::Matrix tmp2 = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 257; - assign(tmp2, nil_index_list(), rep_vector(0.0, m), + stan::model::assign(tmp2, stan::math::rep_vector(0.0, m), "assigning variable tmp2"); current_statement__ = 258; - assign(tmp2, cons_list(index_min_max(1, k), nil_index_list()), - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg"), - "assigning variable tmp2"); + stan::model::assign(tmp2, + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t)), "assigning variable tmp2", + stan::model::index_min_max(1, k)); current_statement__ = 259; - assign(r, - cons_list(index_omni(), cons_list(index_uni(t), nil_index_list())), - add(divide(multiply(tmp2, v[(t - 1)]), F[(t - 1)]), - multiply( - transpose( - subtract(Tt, - multiply( - multiply(Tt, - rvalue(K, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "K")), - transpose(tmp2)))), tmp)), "assigning variable r"); + stan::model::assign(r, + stan::math::add( + stan::math::divide( + stan::math::multiply(tmp2, + stan::model::rvalue(v, "v", stan::model::index_uni(t))), + stan::model::rvalue(F, "F", stan::model::index_uni(t))), + stan::math::multiply( + stan::math::transpose( + stan::math::subtract(Tt, + stan::math::multiply( + stan::math::multiply(Tt, + stan::model::rvalue(K, "K", stan::model::index_omni(), + stan::model::index_uni(t))), + stan::math::transpose(tmp2)))), tmp)), + "assigning variable r", stan::model::index_omni(), + stan::model::index_uni(t)); } else { current_statement__ = 254; - assign(r, - cons_list(index_omni(), cons_list(index_uni(t), nil_index_list())), - multiply(transpose(Tt), tmp), "assigning variable r"); - }} + stan::model::assign(r, + stan::math::multiply(stan::math::transpose(Tt), tmp), + "assigning variable r", stan::model::index_omni(), + stan::model::index_uni(t)); + } + } current_statement__ = 264; - assign(tmpr, nil_index_list(), - rvalue(r, - cons_list(index_omni(), cons_list(index_uni(1), nil_index_list())), - "r"), "assigning variable tmpr"); + stan::model::assign(tmpr, + stan::model::rvalue(r, "r", stan::model::index_omni(), + stan::model::index_uni(1)), "assigning variable tmpr"); current_statement__ = 265; - assign(r, - cons_list(index_omni(), cons_list(index_uni(1), nil_index_list())), - add(a1, multiply(P1, tmpr)), "assigning variable r"); + stan::model::assign(r, + stan::math::add(a1, stan::math::multiply(P1, tmpr)), + "assigning variable r", stan::model::index_omni(), + stan::model::index_uni(1)); current_statement__ = 272; for (int t = 2; t <= n; ++t) { current_statement__ = 266; - validate_non_negative_index("tmp", "m", m); - Eigen::Matrix tmp; - tmp = Eigen::Matrix(m); - stan::math::fill(tmp, DUMMY_VAR__); - + stan::math::validate_non_negative_index("tmp", "m", m); + Eigen::Matrix tmp = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 267; - assign(tmp, nil_index_list(), - rvalue(r, - cons_list(index_omni(), - cons_list(index_uni((t - 1)), nil_index_list())), "r"), - "assigning variable tmp"); + stan::model::assign(tmp, + stan::model::rvalue(r, "r", stan::model::index_omni(), + stan::model::index_uni((t - 1))), "assigning variable tmp"); current_statement__ = 268; - validate_non_negative_index("tmp2", "m", m); - Eigen::Matrix tmp2; - tmp2 = Eigen::Matrix(m); - stan::math::fill(tmp2, DUMMY_VAR__); - + stan::math::validate_non_negative_index("tmp2", "m", m); + Eigen::Matrix tmp2 = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 269; - assign(tmp2, nil_index_list(), - rvalue(r, - cons_list(index_omni(), cons_list(index_uni(t), nil_index_list())), - "r"), "assigning variable tmp2"); + stan::model::assign(tmp2, + stan::model::rvalue(r, "r", stan::model::index_omni(), + stan::model::index_uni(t)), "assigning variable tmp2"); current_statement__ = 270; - assign(r, - cons_list(index_omni(), cons_list(index_uni(t), nil_index_list())), - add(multiply(Tt, tmp), - elt_multiply( - rvalue(Rt, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "Rt"), tmp2)), - "assigning variable r");} + stan::model::assign(r, + stan::math::add(stan::math::multiply(Tt, tmp), + stan::math::elt_multiply( + stan::model::rvalue(Rt, "Rt", stan::model::index_omni(), + stan::model::index_uni(t)), tmp2)), "assigning variable r", + stan::model::index_omni(), stan::model::index_uni(t)); + } current_statement__ = 287; - if (logical_eq(distribution, 1)) { + if (stan::math::logical_eq(distribution, 1)) { current_statement__ = 285; for (int t = 1; t <= n; ++t) { current_statement__ = 283; - if (logical_eq(y_miss[(t - 1)], 0)) { - local_scalar_t__ xbeta_rw; - xbeta_rw = DUMMY_VAR__; - + if (stan::math::logical_eq( + stan::model::rvalue(y_miss, "y_miss", stan::model::index_uni(t)), + 0)) { + local_scalar_t__ xbeta_rw = DUMMY_VAR__; current_statement__ = 280; - xbeta_rw = dot_product( - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), - "xreg"), - rvalue(r, - cons_list(index_min_max(1, k), - cons_list(index_uni(t), nil_index_list())), "r")); + xbeta_rw = stan::math::dot_product( + stan::model::rvalue(xreg, "xreg", + stan::model::index_omni(), stan::model::index_uni(t)), + stan::model::rvalue(r, "r", + stan::model::index_min_max(1, k), + stan::model::index_uni(t))); current_statement__ = 281; - assign(loglik, - cons_list(index_uni(t), - cons_list(index_uni(2), nil_index_list())), - (((y_original[(t - 1)] * (xbeta_rw + xbeta_fixed[(t - 1)])) - - (u[(t - 1)] * - stan::math::exp((xbeta_rw + xbeta_fixed[(t - 1)])))) + - ((0.5 * pow((y[(t - 1)] - xbeta_rw), 2)) / Ht[(t - 1)])), - "assigning variable loglik"); - } } + stan::model::assign(loglik, + (((stan::model::rvalue(y_original, "y_original", + stan::model::index_uni(t)) * (xbeta_rw + + stan::model::rvalue(xbeta_fixed, "xbeta_fixed", + stan::model::index_uni(t)))) - + (stan::model::rvalue(u, "u", stan::model::index_uni(t)) * + stan::math::exp((xbeta_rw + + stan::model::rvalue(xbeta_fixed, "xbeta_fixed", + stan::model::index_uni(t)))))) + ((0.5 * + stan::math::pow( + (stan::model::rvalue(y, "y", stan::model::index_uni(t)) - + xbeta_rw), 2)) / + stan::model::rvalue(Ht, "Ht", stan::model::index_uni(t)))), + "assigning variable loglik", stan::model::index_uni(t), + stan::model::index_uni(2)); + } + } } else { current_statement__ = 278; for (int t = 1; t <= n; ++t) { current_statement__ = 276; - if (logical_eq(y_miss[(t - 1)], 0)) { - local_scalar_t__ xbeta_rw; - xbeta_rw = DUMMY_VAR__; - + if (stan::math::logical_eq( + stan::model::rvalue(y_miss, "y_miss", stan::model::index_uni(t)), + 0)) { + local_scalar_t__ xbeta_rw = DUMMY_VAR__; current_statement__ = 273; - xbeta_rw = dot_product( - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), - "xreg"), - rvalue(r, - cons_list(index_min_max(1, k), - cons_list(index_uni(t), nil_index_list())), "r")); + xbeta_rw = stan::math::dot_product( + stan::model::rvalue(xreg, "xreg", + stan::model::index_omni(), stan::model::index_uni(t)), + stan::model::rvalue(r, "r", + stan::model::index_min_max(1, k), + stan::model::index_uni(t))); current_statement__ = 274; - assign(loglik, - cons_list(index_uni(t), - cons_list(index_uni(2), nil_index_list())), - (((y_original[(t - 1)] * (xbeta_rw + xbeta_fixed[(t - 1)])) - - (u[(t - 1)] * - stan::math::log1p( - stan::math::exp((xbeta_rw + xbeta_fixed[(t - 1)]))))) + - ((0.5 * pow((y[(t - 1)] - xbeta_rw), 2)) / Ht[(t - 1)])), - "assigning variable loglik"); - } } + stan::model::assign(loglik, + (((stan::model::rvalue(y_original, "y_original", + stan::model::index_uni(t)) * (xbeta_rw + + stan::model::rvalue(xbeta_fixed, "xbeta_fixed", + stan::model::index_uni(t)))) - + (stan::model::rvalue(u, "u", stan::model::index_uni(t)) * + stan::math::log1p( + stan::math::exp((xbeta_rw + + stan::model::rvalue(xbeta_fixed, "xbeta_fixed", + stan::model::index_uni(t))))))) + ((0.5 * + stan::math::pow( + (stan::model::rvalue(y, "y", stan::model::index_uni(t)) - + xbeta_rw), 2)) / + stan::model::rvalue(Ht, "Ht", stan::model::index_uni(t)))), + "assigning variable loglik", stan::model::index_uni(t), + stan::model::index_uni(2)); + } + } } current_statement__ = 288; return loglik; } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } - -} -struct glm_approx_loglik_functor__ { -template -Eigen::Matrix, stan::value_type_t, -stan::value_type_t, stan::value_type_t, -stan::value_type_t, stan::promote_args_t, -stan::value_type_t, stan::value_type_t, -stan::value_type_t>>, -1, -1> -operator()(const T0__& y, const std::vector& y_miss, const T2__& a1, - const T3__& P1, const T4__& Ht, const T5__& Tt, const T6__& Rt, - const T7__& xreg, const int& distribution, - const std::vector& u, const T10__& y_original, - const T11__& xbeta_fixed, std::ostream* pstream__) const -{ -return glm_approx_loglik(y, y_miss, a1, P1, Ht, Tt, Rt, xreg, distribution, - u, y_original, xbeta_fixed, pstream__); } -}; template -Eigen::Matrix, stan::value_type_t, -stan::value_type_t, stan::value_type_t, -stan::value_type_t, stan::promote_args_t, -stan::value_type_t>>, -1, -1> + typename T5__, typename T6__, typename T7__, + stan::require_all_t, + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>*> +Eigen::Matrix, + stan::base_type_t, stan::base_type_t, + stan::base_type_t, stan::base_type_t, + stan::promote_args_t, + stan::base_type_t>>,-1,-1> glm_approx_smoother(const T0__& y_arg__, const std::vector& y_miss, - const T2__& a1_arg__, const T3__& P1_arg__, - const T4__& Ht_arg__, const T5__& Tt_arg__, - const T6__& Rt_arg__, const T7__& xreg_arg__, - std::ostream* pstream__) { - using local_scalar_t__ = stan::promote_args_t, - stan::value_type_t, - stan::value_type_t, - stan::value_type_t, - stan::value_type_t, stan::promote_args_t, - stan::value_type_t>>; - const auto& y = to_ref(y_arg__); - const auto& a1 = to_ref(a1_arg__); - const auto& P1 = to_ref(P1_arg__); - const auto& Ht = to_ref(Ht_arg__); - const auto& Tt = to_ref(Tt_arg__); - const auto& Rt = to_ref(Rt_arg__); - const auto& xreg = to_ref(xreg_arg__); - const static bool propto__ = true; + const T2__& a1_arg__, const T3__& P1_arg__, const T4__& + Ht_arg__, const T5__& Tt_arg__, const T6__& Rt_arg__, + const T7__& xreg_arg__, std::ostream* pstream__) { + using local_scalar_t__ = stan::promote_args_t, + stan::base_type_t, + stan::base_type_t, + stan::base_type_t, + stan::base_type_t, + stan::promote_args_t, + stan::base_type_t>>; + int current_statement__ = 0; + const auto& y = stan::math::to_ref(y_arg__); + const auto& a1 = stan::math::to_ref(a1_arg__); + const auto& P1 = stan::math::to_ref(P1_arg__); + const auto& Ht = stan::math::to_ref(Ht_arg__); + const auto& Tt = stan::math::to_ref(Tt_arg__); + const auto& Rt = stan::math::to_ref(Rt_arg__); + const auto& xreg = stan::math::to_ref(xreg_arg__); + static constexpr bool propto__ = true; + // suppress unused var warning (void) propto__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; try { - int k; - k = std::numeric_limits::min(); - + int k = std::numeric_limits::min(); current_statement__ = 290; - k = rows(xreg); - int n; - n = std::numeric_limits::min(); - + k = stan::math::rows(xreg); + int n = std::numeric_limits::min(); current_statement__ = 291; - n = rows(y); - int m; - m = std::numeric_limits::min(); - + n = stan::math::rows(y); + int m = std::numeric_limits::min(); current_statement__ = 292; - m = rows(a1); + m = stan::math::rows(a1); current_statement__ = 293; - validate_non_negative_index("x", "m", m); - Eigen::Matrix x; - x = Eigen::Matrix(m); - stan::math::fill(x, DUMMY_VAR__); - + stan::math::validate_non_negative_index("x", "m", m); + Eigen::Matrix x = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 294; - assign(x, nil_index_list(), a1, "assigning variable x"); + stan::model::assign(x, a1, "assigning variable x"); current_statement__ = 295; - validate_non_negative_index("P", "m", m); + stan::math::validate_non_negative_index("P", "m", m); current_statement__ = 296; - validate_non_negative_index("P", "m", m); - Eigen::Matrix P; - P = Eigen::Matrix(m, m); - stan::math::fill(P, DUMMY_VAR__); - + stan::math::validate_non_negative_index("P", "m", m); + Eigen::Matrix P = + Eigen::Matrix::Constant(m, m, DUMMY_VAR__); current_statement__ = 297; - assign(P, nil_index_list(), P1, "assigning variable P"); + stan::model::assign(P, P1, "assigning variable P"); current_statement__ = 298; - validate_non_negative_index("v", "n", n); - Eigen::Matrix v; - v = Eigen::Matrix(n); - stan::math::fill(v, DUMMY_VAR__); - + stan::math::validate_non_negative_index("v", "n", n); + Eigen::Matrix v = + Eigen::Matrix::Constant(n, DUMMY_VAR__); current_statement__ = 300; - validate_non_negative_index("F", "n", n); - Eigen::Matrix F; - F = Eigen::Matrix(n); - stan::math::fill(F, DUMMY_VAR__); - + stan::math::validate_non_negative_index("F", "n", n); + Eigen::Matrix F = + Eigen::Matrix::Constant(n, DUMMY_VAR__); current_statement__ = 302; - validate_non_negative_index("K", "m", m); + stan::math::validate_non_negative_index("K", "m", m); current_statement__ = 303; - validate_non_negative_index("K", "n", n); - Eigen::Matrix K; - K = Eigen::Matrix(m, n); - stan::math::fill(K, DUMMY_VAR__); - + stan::math::validate_non_negative_index("K", "n", n); + Eigen::Matrix K = + Eigen::Matrix::Constant(m, n, DUMMY_VAR__); current_statement__ = 305; - validate_non_negative_index("r", "m", m); + stan::math::validate_non_negative_index("r", "m", m); current_statement__ = 306; - validate_non_negative_index("r", "n + 1", (n + 1)); - Eigen::Matrix r; - r = Eigen::Matrix(m, (n + 1)); - stan::math::fill(r, DUMMY_VAR__); - + stan::math::validate_non_negative_index("r", "n + 1", (n + 1)); + Eigen::Matrix r = + Eigen::Matrix::Constant(m, (n + 1), + DUMMY_VAR__); current_statement__ = 308; - validate_non_negative_index("tmpr", "m", m); - Eigen::Matrix tmpr; - tmpr = Eigen::Matrix(m); - stan::math::fill(tmpr, DUMMY_VAR__); - + stan::math::validate_non_negative_index("tmpr", "m", m); + Eigen::Matrix tmpr = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 327; for (int t = 1; t <= n; ++t) { current_statement__ = 310; - assign(F, cons_list(index_uni(t), nil_index_list()), - (quad_form( - rvalue(P, - cons_list(index_min_max(1, k), - cons_list(index_min_max(1, k), nil_index_list())), "P"), - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg")) + - Ht[(t - 1)]), "assigning variable F"); + stan::model::assign(F, + (stan::math::quad_form( + stan::model::rvalue(P, "P", stan::model::index_min_max(1, k), + stan::model::index_min_max(1, k)), + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t))) + + stan::model::rvalue(Ht, "Ht", stan::model::index_uni(t))), + "assigning variable F", stan::model::index_uni(t)); current_statement__ = 325; - if (logical_eq(y_miss[(t - 1)], 0)) { + if (stan::math::logical_eq( + stan::model::rvalue(y_miss, "y_miss", stan::model::index_uni(t)), + 0)) { current_statement__ = 317; - assign(v, cons_list(index_uni(t), nil_index_list()), - (y[(t - 1)] - - dot_product( - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg"), - head(x, k))), "assigning variable v"); + stan::model::assign(v, + (stan::model::rvalue(y, "y", stan::model::index_uni(t)) - + stan::math::dot_product( + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t)), stan::math::head(x, k))), + "assigning variable v", stan::model::index_uni(t)); current_statement__ = 318; - assign(K, - cons_list(index_omni(), cons_list(index_uni(t), nil_index_list())), - divide( - multiply( - rvalue(P, - cons_list(index_min_max(1, m), - cons_list(index_min_max(1, k), nil_index_list())), "P"), - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg")), - F[(t - 1)]), "assigning variable K"); + stan::model::assign(K, + stan::math::divide( + stan::math::multiply( + stan::model::rvalue(P, "P", stan::model::index_min_max(1, m), + stan::model::index_min_max(1, k)), + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t))), + stan::model::rvalue(F, "F", stan::model::index_uni(t))), + "assigning variable K", stan::model::index_omni(), + stan::model::index_uni(t)); current_statement__ = 319; - assign(x, nil_index_list(), - multiply(Tt, - add(stan::model::deep_copy(x), - multiply( - rvalue(K, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "K"), - v[(t - 1)]))), "assigning variable x"); + stan::model::assign(x, + stan::math::multiply(Tt, + stan::math::add(stan::model::deep_copy(x), + stan::math::multiply( + stan::model::rvalue(K, "K", stan::model::index_omni(), + stan::model::index_uni(t)), + stan::model::rvalue(v, "v", stan::model::index_uni(t))))), + "assigning variable x"); current_statement__ = 320; - assign(P, nil_index_list(), - quad_form_sym( - subtract(stan::model::deep_copy(P), - multiply( - multiply( - rvalue(K, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "K"), - transpose( - rvalue(K, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "K"))), - F[(t - 1)])), transpose(Tt)), "assigning variable P"); + stan::model::assign(P, + stan::math::quad_form_sym( + stan::math::subtract(stan::model::deep_copy(P), + stan::math::multiply( + stan::math::multiply( + stan::model::rvalue(K, "K", stan::model::index_omni(), + stan::model::index_uni(t)), + stan::math::transpose( + stan::model::rvalue(K, "K", stan::model::index_omni(), + stan::model::index_uni(t)))), + stan::model::rvalue(F, "F", stan::model::index_uni(t)))), + stan::math::transpose(Tt)), "assigning variable P"); current_statement__ = 323; for (int i = 1; i <= m; ++i) { current_statement__ = 321; - assign(P, - cons_list(index_uni(i), - cons_list(index_uni(i), nil_index_list())), - (rvalue(P, - cons_list(index_uni(i), - cons_list(index_uni(i), nil_index_list())), "P") + - rvalue(Rt, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "Rt")), - "assigning variable P");} + stan::model::assign(P, + (stan::model::rvalue(P, "P", stan::model::index_uni(i), + stan::model::index_uni(i)) + + stan::model::rvalue(Rt, "Rt", stan::model::index_uni(i), + stan::model::index_uni(t))), "assigning variable P", + stan::model::index_uni(i), stan::model::index_uni(i)); + } } else { current_statement__ = 311; - assign(x, nil_index_list(), multiply(Tt, stan::model::deep_copy(x)), + stan::model::assign(x, + stan::math::multiply(Tt, stan::model::deep_copy(x)), "assigning variable x"); current_statement__ = 312; - assign(P, nil_index_list(), - quad_form_sym(stan::model::deep_copy(P), transpose(Tt)), - "assigning variable P"); + stan::model::assign(P, + stan::math::quad_form_sym(stan::model::deep_copy(P), + stan::math::transpose(Tt)), "assigning variable P"); current_statement__ = 315; for (int i = 1; i <= m; ++i) { current_statement__ = 313; - assign(P, - cons_list(index_uni(i), - cons_list(index_uni(i), nil_index_list())), - (rvalue(P, - cons_list(index_uni(i), - cons_list(index_uni(i), nil_index_list())), "P") + - rvalue(Rt, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "Rt")), - "assigning variable P");} - }} + stan::model::assign(P, + (stan::model::rvalue(P, "P", stan::model::index_uni(i), + stan::model::index_uni(i)) + + stan::model::rvalue(Rt, "Rt", stan::model::index_uni(i), + stan::model::index_uni(t))), "assigning variable P", + stan::model::index_uni(i), stan::model::index_uni(i)); + } + } + } current_statement__ = 328; - assign(r, - cons_list(index_omni(), - cons_list(index_uni((n + 1)), nil_index_list())), rep_vector(0.0, m), - "assigning variable r"); + stan::model::assign(r, stan::math::rep_vector(0.0, m), + "assigning variable r", stan::model::index_omni(), + stan::model::index_uni((n + 1))); current_statement__ = 341; for (int tt = 1; tt <= n; ++tt) { - int t; - t = std::numeric_limits::min(); - + int t = std::numeric_limits::min(); current_statement__ = 329; t = ((n + 1) - tt); current_statement__ = 330; - validate_non_negative_index("tmp", "m", m); - Eigen::Matrix tmp; - tmp = Eigen::Matrix(m); - stan::math::fill(tmp, DUMMY_VAR__); - + stan::math::validate_non_negative_index("tmp", "m", m); + Eigen::Matrix tmp = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 331; - assign(tmp, nil_index_list(), - rvalue(r, - cons_list(index_omni(), - cons_list(index_uni((t + 1)), nil_index_list())), "r"), - "assigning variable tmp"); + stan::model::assign(tmp, + stan::model::rvalue(r, "r", stan::model::index_omni(), + stan::model::index_uni((t + 1))), "assigning variable tmp"); current_statement__ = 339; - if (logical_eq(y_miss[(t - 1)], 0)) { + if (stan::math::logical_eq( + stan::model::rvalue(y_miss, "y_miss", stan::model::index_uni(t)), + 0)) { current_statement__ = 334; - validate_non_negative_index("tmp2", "m", m); - Eigen::Matrix tmp2; - tmp2 = Eigen::Matrix(m); - stan::math::fill(tmp2, DUMMY_VAR__); - + stan::math::validate_non_negative_index("tmp2", "m", m); + Eigen::Matrix tmp2 = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 335; - assign(tmp2, nil_index_list(), rep_vector(0.0, m), + stan::model::assign(tmp2, stan::math::rep_vector(0.0, m), "assigning variable tmp2"); current_statement__ = 336; - assign(tmp2, cons_list(index_min_max(1, k), nil_index_list()), - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg"), - "assigning variable tmp2"); + stan::model::assign(tmp2, + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t)), "assigning variable tmp2", + stan::model::index_min_max(1, k)); current_statement__ = 337; - assign(r, - cons_list(index_omni(), cons_list(index_uni(t), nil_index_list())), - add(divide(multiply(tmp2, v[(t - 1)]), F[(t - 1)]), - multiply( - transpose( - subtract(Tt, - multiply( - multiply(Tt, - rvalue(K, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "K")), - transpose(tmp2)))), tmp)), "assigning variable r"); + stan::model::assign(r, + stan::math::add( + stan::math::divide( + stan::math::multiply(tmp2, + stan::model::rvalue(v, "v", stan::model::index_uni(t))), + stan::model::rvalue(F, "F", stan::model::index_uni(t))), + stan::math::multiply( + stan::math::transpose( + stan::math::subtract(Tt, + stan::math::multiply( + stan::math::multiply(Tt, + stan::model::rvalue(K, "K", stan::model::index_omni(), + stan::model::index_uni(t))), + stan::math::transpose(tmp2)))), tmp)), + "assigning variable r", stan::model::index_omni(), + stan::model::index_uni(t)); } else { current_statement__ = 332; - assign(r, - cons_list(index_omni(), cons_list(index_uni(t), nil_index_list())), - multiply(transpose(Tt), tmp), "assigning variable r"); - }} + stan::model::assign(r, + stan::math::multiply(stan::math::transpose(Tt), tmp), + "assigning variable r", stan::model::index_omni(), + stan::model::index_uni(t)); + } + } current_statement__ = 342; - assign(tmpr, nil_index_list(), - rvalue(r, - cons_list(index_omni(), cons_list(index_uni(1), nil_index_list())), - "r"), "assigning variable tmpr"); + stan::model::assign(tmpr, + stan::model::rvalue(r, "r", stan::model::index_omni(), + stan::model::index_uni(1)), "assigning variable tmpr"); current_statement__ = 343; - assign(r, - cons_list(index_omni(), cons_list(index_uni(1), nil_index_list())), - add(a1, multiply(P1, tmpr)), "assigning variable r"); + stan::model::assign(r, + stan::math::add(a1, stan::math::multiply(P1, tmpr)), + "assigning variable r", stan::model::index_omni(), + stan::model::index_uni(1)); current_statement__ = 350; for (int t = 2; t <= n; ++t) { current_statement__ = 344; - validate_non_negative_index("tmp", "m", m); - Eigen::Matrix tmp; - tmp = Eigen::Matrix(m); - stan::math::fill(tmp, DUMMY_VAR__); - + stan::math::validate_non_negative_index("tmp", "m", m); + Eigen::Matrix tmp = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 345; - assign(tmp, nil_index_list(), - rvalue(r, - cons_list(index_omni(), - cons_list(index_uni((t - 1)), nil_index_list())), "r"), - "assigning variable tmp"); + stan::model::assign(tmp, + stan::model::rvalue(r, "r", stan::model::index_omni(), + stan::model::index_uni((t - 1))), "assigning variable tmp"); current_statement__ = 346; - validate_non_negative_index("tmp2", "m", m); - Eigen::Matrix tmp2; - tmp2 = Eigen::Matrix(m); - stan::math::fill(tmp2, DUMMY_VAR__); - + stan::math::validate_non_negative_index("tmp2", "m", m); + Eigen::Matrix tmp2 = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 347; - assign(tmp2, nil_index_list(), - rvalue(r, - cons_list(index_omni(), cons_list(index_uni(t), nil_index_list())), - "r"), "assigning variable tmp2"); + stan::model::assign(tmp2, + stan::model::rvalue(r, "r", stan::model::index_omni(), + stan::model::index_uni(t)), "assigning variable tmp2"); current_statement__ = 348; - assign(r, - cons_list(index_omni(), cons_list(index_uni(t), nil_index_list())), - add(multiply(Tt, tmp), - elt_multiply( - rvalue(Rt, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "Rt"), tmp2)), - "assigning variable r");} + stan::model::assign(r, + stan::math::add(stan::math::multiply(Tt, tmp), + stan::math::elt_multiply( + stan::model::rvalue(Rt, "Rt", stan::model::index_omni(), + stan::model::index_uni(t)), tmp2)), "assigning variable r", + stan::model::index_omni(), stan::model::index_uni(t)); + } current_statement__ = 351; - return rvalue(r, - cons_list(index_min_max(1, m), - cons_list(index_min_max(1, n), nil_index_list())), "r"); + return stan::model::rvalue(r, "r", stan::model::index_min_max(1, m), + stan::model::index_min_max(1, n)); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } - -} -struct glm_approx_smoother_functor__ { -template -Eigen::Matrix, stan::value_type_t, -stan::value_type_t, stan::value_type_t, -stan::value_type_t, stan::promote_args_t, -stan::value_type_t>>, -1, -1> -operator()(const T0__& y, const std::vector& y_miss, const T2__& a1, - const T3__& P1, const T4__& Ht, const T5__& Tt, const T6__& Rt, - const T7__& xreg, std::ostream* pstream__) const -{ -return glm_approx_smoother(y, y_miss, a1, P1, Ht, Tt, Rt, xreg, pstream__); } -}; #include class model_walker_glm final : public model_base_crtp { private: @@ -1159,9 +1111,9 @@ class model_walker_glm final : public model_base_crtp { int k; int n; int n_lfo; - Eigen::Matrix xreg_fixed; - Eigen::Matrix xreg_rw; - Eigen::Matrix y; + Eigen::Matrix xreg_fixed_data__; + Eigen::Matrix xreg_rw_data__; + Eigen::Matrix y_data__; std::vector y_miss; double beta_fixed_mean; double beta_fixed_sd; @@ -1175,134 +1127,126 @@ class model_walker_glm final : public model_base_crtp { double sigma_rw2_rate; double nu_mean; double nu_sd; - Eigen::Matrix Ht; - Eigen::Matrix y_original; + Eigen::Matrix Ht_data__; + Eigen::Matrix y_original_data__; std::vector u; int distribution; int N; - Eigen::Matrix gamma_rw1; - Eigen::Matrix gamma_rw2; + Eigen::Matrix gamma_rw1_data__; + Eigen::Matrix gamma_rw2_data__; std::vector obs_idx; - Eigen::Matrix a1; - Eigen::Matrix P1; - Eigen::Matrix Tt; + Eigen::Matrix a1_data__; + Eigen::Matrix P1_data__; + Eigen::Matrix Tt_data__; int beta_rw_2dim__; int nu_2dim__; int y_fit_1dim__; int y_rep_1dim__; - + Eigen::Map> xreg_fixed{nullptr, 0, 0}; + Eigen::Map> xreg_rw{nullptr, 0, 0}; + Eigen::Map> y{nullptr, 0}; + Eigen::Map> Ht{nullptr, 0}; + Eigen::Map> y_original{nullptr, 0}; + Eigen::Map> gamma_rw1{nullptr, 0, 0}; + Eigen::Map> gamma_rw2{nullptr, 0, 0}; + Eigen::Map> a1{nullptr, 0}; + Eigen::Map> P1{nullptr, 0, 0}; + Eigen::Map> Tt{nullptr, 0, 0}; public: - ~model_walker_glm() { } - - inline std::string model_name() const final { return "model_walker_glm"; } - inline std::vector model_compile_info() const noexcept { - return std::vector{"stanc_version = stanc3 v2.26.1-4-gd72b68b7-dirty", "stancflags = "}; - } - - - model_walker_glm(stan::io::var_context& context__, - unsigned int random_seed__ = 0, - std::ostream* pstream__ = nullptr) : model_base_crtp(0) { - using local_scalar_t__ = double ; - boost::ecuyer1988 base_rng__ = - stan::services::util::create_rng(random_seed__, 0); - (void) base_rng__; // suppress unused var warning - static const char* function__ = "model_walker_glm_namespace::model_walker_glm"; - (void) function__; // suppress unused var warning + ~model_walker_glm() {} + model_walker_glm(stan::io::var_context& context__, unsigned int + random_seed__ = 0, std::ostream* pstream__ = nullptr) + : model_base_crtp(0) { + int current_statement__ = 0; + using local_scalar_t__ = double; + boost::ecuyer1988 base_rng__ = + stan::services::util::create_rng(random_seed__, 0); + // suppress unused var warning + (void) base_rng__; + static constexpr const char* function__ = + "model_walker_glm_namespace::model_walker_glm"; + // suppress unused var warning + (void) function__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; try { - int pos__; - pos__ = std::numeric_limits::min(); - + int pos__ = std::numeric_limits::min(); pos__ = 1; current_statement__ = 117; - context__.validate_dims("data initialization","k_fixed","int", - context__.to_vec()); + context__.validate_dims("data initialization", "k_fixed", "int", + std::vector{}); k_fixed = std::numeric_limits::min(); - current_statement__ = 117; k_fixed = context__.vals_i("k_fixed")[(1 - 1)]; current_statement__ = 117; - current_statement__ = 117; - check_greater_or_equal(function__, "k_fixed", k_fixed, 0); + stan::math::check_greater_or_equal(function__, "k_fixed", k_fixed, 0); current_statement__ = 118; - context__.validate_dims("data initialization","k_rw1","int", - context__.to_vec()); + context__.validate_dims("data initialization", "k_rw1", "int", + std::vector{}); k_rw1 = std::numeric_limits::min(); - current_statement__ = 118; k_rw1 = context__.vals_i("k_rw1")[(1 - 1)]; current_statement__ = 118; - current_statement__ = 118; - check_greater_or_equal(function__, "k_rw1", k_rw1, 0); + stan::math::check_greater_or_equal(function__, "k_rw1", k_rw1, 0); current_statement__ = 119; - context__.validate_dims("data initialization","k_rw2","int", - context__.to_vec()); + context__.validate_dims("data initialization", "k_rw2", "int", + std::vector{}); k_rw2 = std::numeric_limits::min(); - current_statement__ = 119; k_rw2 = context__.vals_i("k_rw2")[(1 - 1)]; current_statement__ = 119; - current_statement__ = 119; - check_greater_or_equal(function__, "k_rw2", k_rw2, 0); + stan::math::check_greater_or_equal(function__, "k_rw2", k_rw2, 0); current_statement__ = 120; - context__.validate_dims("data initialization","m","int", - context__.to_vec()); + context__.validate_dims("data initialization", "m", "int", + std::vector{}); m = std::numeric_limits::min(); - current_statement__ = 120; m = context__.vals_i("m")[(1 - 1)]; current_statement__ = 120; - current_statement__ = 120; - check_greater_or_equal(function__, "m", m, 0); + stan::math::check_greater_or_equal(function__, "m", m, 0); current_statement__ = 121; - context__.validate_dims("data initialization","k","int", - context__.to_vec()); + context__.validate_dims("data initialization", "k", "int", + std::vector{}); k = std::numeric_limits::min(); - current_statement__ = 121; k = context__.vals_i("k")[(1 - 1)]; current_statement__ = 121; - current_statement__ = 121; - check_greater_or_equal(function__, "k", k, 0); + stan::math::check_greater_or_equal(function__, "k", k, 0); current_statement__ = 122; - context__.validate_dims("data initialization","n","int", - context__.to_vec()); + context__.validate_dims("data initialization", "n", "int", + std::vector{}); n = std::numeric_limits::min(); - current_statement__ = 122; n = context__.vals_i("n")[(1 - 1)]; current_statement__ = 122; - current_statement__ = 122; - check_greater_or_equal(function__, "n", n, 1); + stan::math::check_greater_or_equal(function__, "n", n, 1); current_statement__ = 123; - context__.validate_dims("data initialization","n_lfo","int", - context__.to_vec()); + context__.validate_dims("data initialization", "n_lfo", "int", + std::vector{}); n_lfo = std::numeric_limits::min(); - current_statement__ = 123; n_lfo = context__.vals_i("n_lfo")[(1 - 1)]; current_statement__ = 123; - current_statement__ = 123; - check_greater_or_equal(function__, "n_lfo", n_lfo, 1); + stan::math::check_greater_or_equal(function__, "n_lfo", n_lfo, 1); current_statement__ = 124; - validate_non_negative_index("xreg_fixed", "n", n); + stan::math::validate_non_negative_index("xreg_fixed", "n", n); current_statement__ = 125; - validate_non_negative_index("xreg_fixed", "k_fixed", k_fixed); + stan::math::validate_non_negative_index("xreg_fixed", "k_fixed", + k_fixed); current_statement__ = 126; - context__.validate_dims("data initialization","xreg_fixed","double", - context__.to_vec(n, k_fixed)); - xreg_fixed = Eigen::Matrix(n, k_fixed); - stan::math::fill(xreg_fixed, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "xreg_fixed", "double", + std::vector{static_cast(n), + static_cast(k_fixed)}); + xreg_fixed_data__ = Eigen::Matrix::Constant(n, k_fixed, + std::numeric_limits::quiet_NaN()); + new (&xreg_fixed) + Eigen::Map>(xreg_fixed_data__.data(), n, + k_fixed); { std::vector xreg_fixed_flat__; current_statement__ = 126; - assign(xreg_fixed_flat__, nil_index_list(), - context__.vals_r("xreg_fixed"), - "assigning variable xreg_fixed_flat__"); + xreg_fixed_flat__ = context__.vals_r("xreg_fixed"); current_statement__ = 126; pos__ = 1; current_statement__ = 126; @@ -1310,28 +1254,29 @@ class model_walker_glm final : public model_base_crtp { current_statement__ = 126; for (int sym2__ = 1; sym2__ <= n; ++sym2__) { current_statement__ = 126; - assign(xreg_fixed, - cons_list(index_uni(sym2__), - cons_list(index_uni(sym1__), nil_index_list())), - xreg_fixed_flat__[(pos__ - 1)], "assigning variable xreg_fixed"); + stan::model::assign(xreg_fixed, xreg_fixed_flat__[(pos__ - 1)], + "assigning variable xreg_fixed", + stan::model::index_uni(sym2__), stan::model::index_uni(sym1__)); current_statement__ = 126; - pos__ = (pos__ + 1);}} + pos__ = (pos__ + 1); + } + } } current_statement__ = 127; - validate_non_negative_index("xreg_rw", "k", k); + stan::math::validate_non_negative_index("xreg_rw", "k", k); current_statement__ = 128; - validate_non_negative_index("xreg_rw", "n", n); + stan::math::validate_non_negative_index("xreg_rw", "n", n); current_statement__ = 129; - context__.validate_dims("data initialization","xreg_rw","double", - context__.to_vec(k, n)); - xreg_rw = Eigen::Matrix(k, n); - stan::math::fill(xreg_rw, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "xreg_rw", "double", + std::vector{static_cast(k), static_cast(n)}); + xreg_rw_data__ = Eigen::Matrix::Constant(k, n, + std::numeric_limits::quiet_NaN()); + new (&xreg_rw) + Eigen::Map>(xreg_rw_data__.data(), k, n); { std::vector xreg_rw_flat__; current_statement__ = 129; - assign(xreg_rw_flat__, nil_index_list(), context__.vals_r("xreg_rw"), - "assigning variable xreg_rw_flat__"); + xreg_rw_flat__ = context__.vals_r("xreg_rw"); current_statement__ = 129; pos__ = 1; current_statement__ = 129; @@ -1339,260 +1284,232 @@ class model_walker_glm final : public model_base_crtp { current_statement__ = 129; for (int sym2__ = 1; sym2__ <= k; ++sym2__) { current_statement__ = 129; - assign(xreg_rw, - cons_list(index_uni(sym2__), - cons_list(index_uni(sym1__), nil_index_list())), - xreg_rw_flat__[(pos__ - 1)], "assigning variable xreg_rw"); + stan::model::assign(xreg_rw, xreg_rw_flat__[(pos__ - 1)], + "assigning variable xreg_rw", stan::model::index_uni(sym2__), + stan::model::index_uni(sym1__)); current_statement__ = 129; - pos__ = (pos__ + 1);}} + pos__ = (pos__ + 1); + } + } } current_statement__ = 130; - validate_non_negative_index("y", "n", n); + stan::math::validate_non_negative_index("y", "n", n); current_statement__ = 131; - context__.validate_dims("data initialization","y","double", - context__.to_vec(n)); - y = Eigen::Matrix(n); - stan::math::fill(y, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "y", "double", + std::vector{static_cast(n)}); + y_data__ = Eigen::Matrix::Constant(n, + std::numeric_limits::quiet_NaN()); + new (&y) Eigen::Map>(y_data__.data(), n); { std::vector y_flat__; current_statement__ = 131; - assign(y_flat__, nil_index_list(), context__.vals_r("y"), - "assigning variable y_flat__"); + y_flat__ = context__.vals_r("y"); current_statement__ = 131; pos__ = 1; current_statement__ = 131; for (int sym1__ = 1; sym1__ <= n; ++sym1__) { current_statement__ = 131; - assign(y, cons_list(index_uni(sym1__), nil_index_list()), - y_flat__[(pos__ - 1)], "assigning variable y"); + stan::model::assign(y, y_flat__[(pos__ - 1)], + "assigning variable y", stan::model::index_uni(sym1__)); current_statement__ = 131; - pos__ = (pos__ + 1);} + pos__ = (pos__ + 1); + } } current_statement__ = 132; - validate_non_negative_index("y_miss", "n", n); + stan::math::validate_non_negative_index("y_miss", "n", n); current_statement__ = 133; - context__.validate_dims("data initialization","y_miss","int", - context__.to_vec(n)); + context__.validate_dims("data initialization", "y_miss", "int", + std::vector{static_cast(n)}); y_miss = std::vector(n, std::numeric_limits::min()); - current_statement__ = 133; - assign(y_miss, nil_index_list(), context__.vals_i("y_miss"), - "assigning variable y_miss"); + y_miss = context__.vals_i("y_miss"); current_statement__ = 133; - for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - current_statement__ = 133; - current_statement__ = 133; - check_greater_or_equal(function__, "y_miss[sym1__]", - y_miss[(sym1__ - 1)], 0);} + stan::math::check_greater_or_equal(function__, "y_miss", y_miss, 0); current_statement__ = 134; - context__.validate_dims("data initialization","beta_fixed_mean", - "double",context__.to_vec()); + context__.validate_dims("data initialization", "beta_fixed_mean", + "double", std::vector{}); beta_fixed_mean = std::numeric_limits::quiet_NaN(); - current_statement__ = 134; beta_fixed_mean = context__.vals_r("beta_fixed_mean")[(1 - 1)]; current_statement__ = 135; - context__.validate_dims("data initialization","beta_fixed_sd","double", - context__.to_vec()); + context__.validate_dims("data initialization", "beta_fixed_sd", + "double", std::vector{}); beta_fixed_sd = std::numeric_limits::quiet_NaN(); - current_statement__ = 135; beta_fixed_sd = context__.vals_r("beta_fixed_sd")[(1 - 1)]; current_statement__ = 135; - current_statement__ = 135; - check_greater_or_equal(function__, "beta_fixed_sd", beta_fixed_sd, 0); + stan::math::check_greater_or_equal(function__, "beta_fixed_sd", + beta_fixed_sd, 0); current_statement__ = 136; - context__.validate_dims("data initialization","beta_rw1_mean","double", - context__.to_vec()); + context__.validate_dims("data initialization", "beta_rw1_mean", + "double", std::vector{}); beta_rw1_mean = std::numeric_limits::quiet_NaN(); - current_statement__ = 136; beta_rw1_mean = context__.vals_r("beta_rw1_mean")[(1 - 1)]; current_statement__ = 137; - context__.validate_dims("data initialization","beta_rw1_sd","double", - context__.to_vec()); + context__.validate_dims("data initialization", "beta_rw1_sd", "double", + std::vector{}); beta_rw1_sd = std::numeric_limits::quiet_NaN(); - current_statement__ = 137; beta_rw1_sd = context__.vals_r("beta_rw1_sd")[(1 - 1)]; current_statement__ = 137; - current_statement__ = 137; - check_greater_or_equal(function__, "beta_rw1_sd", beta_rw1_sd, 0); + stan::math::check_greater_or_equal(function__, "beta_rw1_sd", + beta_rw1_sd, 0); current_statement__ = 138; - context__.validate_dims("data initialization","beta_rw2_mean","double", - context__.to_vec()); + context__.validate_dims("data initialization", "beta_rw2_mean", + "double", std::vector{}); beta_rw2_mean = std::numeric_limits::quiet_NaN(); - current_statement__ = 138; beta_rw2_mean = context__.vals_r("beta_rw2_mean")[(1 - 1)]; current_statement__ = 139; - context__.validate_dims("data initialization","beta_rw2_sd","double", - context__.to_vec()); + context__.validate_dims("data initialization", "beta_rw2_sd", "double", + std::vector{}); beta_rw2_sd = std::numeric_limits::quiet_NaN(); - current_statement__ = 139; beta_rw2_sd = context__.vals_r("beta_rw2_sd")[(1 - 1)]; current_statement__ = 139; - current_statement__ = 139; - check_greater_or_equal(function__, "beta_rw2_sd", beta_rw2_sd, 0); + stan::math::check_greater_or_equal(function__, "beta_rw2_sd", + beta_rw2_sd, 0); current_statement__ = 140; - context__.validate_dims("data initialization","sigma_rw1_shape", - "double",context__.to_vec()); + context__.validate_dims("data initialization", "sigma_rw1_shape", + "double", std::vector{}); sigma_rw1_shape = std::numeric_limits::quiet_NaN(); - current_statement__ = 140; sigma_rw1_shape = context__.vals_r("sigma_rw1_shape")[(1 - 1)]; current_statement__ = 140; - current_statement__ = 140; - check_greater_or_equal(function__, "sigma_rw1_shape", sigma_rw1_shape, - 0); + stan::math::check_greater_or_equal(function__, "sigma_rw1_shape", + sigma_rw1_shape, 0); current_statement__ = 141; - context__.validate_dims("data initialization","sigma_rw2_shape", - "double",context__.to_vec()); + context__.validate_dims("data initialization", "sigma_rw2_shape", + "double", std::vector{}); sigma_rw2_shape = std::numeric_limits::quiet_NaN(); - current_statement__ = 141; sigma_rw2_shape = context__.vals_r("sigma_rw2_shape")[(1 - 1)]; current_statement__ = 141; - current_statement__ = 141; - check_greater_or_equal(function__, "sigma_rw2_shape", sigma_rw2_shape, - 0); + stan::math::check_greater_or_equal(function__, "sigma_rw2_shape", + sigma_rw2_shape, 0); current_statement__ = 142; - context__.validate_dims("data initialization","sigma_rw1_rate", - "double",context__.to_vec()); + context__.validate_dims("data initialization", "sigma_rw1_rate", + "double", std::vector{}); sigma_rw1_rate = std::numeric_limits::quiet_NaN(); - current_statement__ = 142; sigma_rw1_rate = context__.vals_r("sigma_rw1_rate")[(1 - 1)]; current_statement__ = 142; - current_statement__ = 142; - check_greater_or_equal(function__, "sigma_rw1_rate", sigma_rw1_rate, 0); + stan::math::check_greater_or_equal(function__, "sigma_rw1_rate", + sigma_rw1_rate, 0); current_statement__ = 143; - context__.validate_dims("data initialization","sigma_rw2_rate", - "double",context__.to_vec()); + context__.validate_dims("data initialization", "sigma_rw2_rate", + "double", std::vector{}); sigma_rw2_rate = std::numeric_limits::quiet_NaN(); - current_statement__ = 143; sigma_rw2_rate = context__.vals_r("sigma_rw2_rate")[(1 - 1)]; current_statement__ = 143; - current_statement__ = 143; - check_greater_or_equal(function__, "sigma_rw2_rate", sigma_rw2_rate, 0); + stan::math::check_greater_or_equal(function__, "sigma_rw2_rate", + sigma_rw2_rate, 0); current_statement__ = 144; - context__.validate_dims("data initialization","nu_mean","double", - context__.to_vec()); + context__.validate_dims("data initialization", "nu_mean", "double", + std::vector{}); nu_mean = std::numeric_limits::quiet_NaN(); - current_statement__ = 144; nu_mean = context__.vals_r("nu_mean")[(1 - 1)]; current_statement__ = 144; - current_statement__ = 144; - check_greater_or_equal(function__, "nu_mean", nu_mean, 0); + stan::math::check_greater_or_equal(function__, "nu_mean", nu_mean, 0); current_statement__ = 145; - context__.validate_dims("data initialization","nu_sd","double", - context__.to_vec()); + context__.validate_dims("data initialization", "nu_sd", "double", + std::vector{}); nu_sd = std::numeric_limits::quiet_NaN(); - current_statement__ = 145; nu_sd = context__.vals_r("nu_sd")[(1 - 1)]; current_statement__ = 145; - current_statement__ = 145; - check_greater_or_equal(function__, "nu_sd", nu_sd, 0); + stan::math::check_greater_or_equal(function__, "nu_sd", nu_sd, 0); current_statement__ = 146; - validate_non_negative_index("Ht", "n", n); + stan::math::validate_non_negative_index("Ht", "n", n); current_statement__ = 147; - context__.validate_dims("data initialization","Ht","double", - context__.to_vec(n)); - Ht = Eigen::Matrix(n); - stan::math::fill(Ht, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "Ht", "double", + std::vector{static_cast(n)}); + Ht_data__ = Eigen::Matrix::Constant(n, + std::numeric_limits::quiet_NaN()); + new (&Ht) Eigen::Map>(Ht_data__.data(), n); { std::vector Ht_flat__; current_statement__ = 147; - assign(Ht_flat__, nil_index_list(), context__.vals_r("Ht"), - "assigning variable Ht_flat__"); + Ht_flat__ = context__.vals_r("Ht"); current_statement__ = 147; pos__ = 1; current_statement__ = 147; for (int sym1__ = 1; sym1__ <= n; ++sym1__) { current_statement__ = 147; - assign(Ht, cons_list(index_uni(sym1__), nil_index_list()), - Ht_flat__[(pos__ - 1)], "assigning variable Ht"); + stan::model::assign(Ht, Ht_flat__[(pos__ - 1)], + "assigning variable Ht", stan::model::index_uni(sym1__)); current_statement__ = 147; - pos__ = (pos__ + 1);} + pos__ = (pos__ + 1); + } } current_statement__ = 148; - validate_non_negative_index("y_original", "n", n); + stan::math::validate_non_negative_index("y_original", "n", n); current_statement__ = 149; - context__.validate_dims("data initialization","y_original","double", - context__.to_vec(n)); - y_original = Eigen::Matrix(n); - stan::math::fill(y_original, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "y_original", "double", + std::vector{static_cast(n)}); + y_original_data__ = Eigen::Matrix::Constant(n, + std::numeric_limits::quiet_NaN()); + new (&y_original) + Eigen::Map>(y_original_data__.data(), n); { std::vector y_original_flat__; current_statement__ = 149; - assign(y_original_flat__, nil_index_list(), - context__.vals_r("y_original"), - "assigning variable y_original_flat__"); + y_original_flat__ = context__.vals_r("y_original"); current_statement__ = 149; pos__ = 1; current_statement__ = 149; for (int sym1__ = 1; sym1__ <= n; ++sym1__) { current_statement__ = 149; - assign(y_original, cons_list(index_uni(sym1__), nil_index_list()), - y_original_flat__[(pos__ - 1)], "assigning variable y_original"); + stan::model::assign(y_original, y_original_flat__[(pos__ - 1)], + "assigning variable y_original", stan::model::index_uni(sym1__)); current_statement__ = 149; - pos__ = (pos__ + 1);} + pos__ = (pos__ + 1); + } } current_statement__ = 150; - validate_non_negative_index("u", "n", n); + stan::math::validate_non_negative_index("u", "n", n); current_statement__ = 151; - context__.validate_dims("data initialization","u","int", - context__.to_vec(n)); + context__.validate_dims("data initialization", "u", "int", + std::vector{static_cast(n)}); u = std::vector(n, std::numeric_limits::min()); - current_statement__ = 151; - assign(u, nil_index_list(), context__.vals_i("u"), - "assigning variable u"); + u = context__.vals_i("u"); current_statement__ = 151; - for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - current_statement__ = 151; - current_statement__ = 151; - check_greater_or_equal(function__, "u[sym1__]", u[(sym1__ - 1)], 0);} + stan::math::check_greater_or_equal(function__, "u", u, 0); current_statement__ = 152; - context__.validate_dims("data initialization","distribution","int", - context__.to_vec()); + context__.validate_dims("data initialization", "distribution", "int", + std::vector{}); distribution = std::numeric_limits::min(); - current_statement__ = 152; distribution = context__.vals_i("distribution")[(1 - 1)]; current_statement__ = 153; - context__.validate_dims("data initialization","N","int", - context__.to_vec()); + context__.validate_dims("data initialization", "N", "int", + std::vector{}); N = std::numeric_limits::min(); - current_statement__ = 153; N = context__.vals_i("N")[(1 - 1)]; current_statement__ = 153; - current_statement__ = 153; - check_greater_or_equal(function__, "N", N, 0); + stan::math::check_greater_or_equal(function__, "N", N, 0); current_statement__ = 154; - validate_non_negative_index("gamma_rw1", "k_rw1", k_rw1); + stan::math::validate_non_negative_index("gamma_rw1", "k_rw1", k_rw1); current_statement__ = 155; - validate_non_negative_index("gamma_rw1", "n", n); + stan::math::validate_non_negative_index("gamma_rw1", "n", n); current_statement__ = 156; - context__.validate_dims("data initialization","gamma_rw1","double", - context__.to_vec(k_rw1, n)); - gamma_rw1 = Eigen::Matrix(k_rw1, n); - stan::math::fill(gamma_rw1, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "gamma_rw1", "double", + std::vector{static_cast(k_rw1), + static_cast(n)}); + gamma_rw1_data__ = Eigen::Matrix::Constant(k_rw1, n, + std::numeric_limits::quiet_NaN()); + new (&gamma_rw1) + Eigen::Map>(gamma_rw1_data__.data(), + k_rw1, n); { std::vector gamma_rw1_flat__; current_statement__ = 156; - assign(gamma_rw1_flat__, nil_index_list(), - context__.vals_r("gamma_rw1"), - "assigning variable gamma_rw1_flat__"); + gamma_rw1_flat__ = context__.vals_r("gamma_rw1"); current_statement__ = 156; pos__ = 1; current_statement__ = 156; @@ -1600,29 +1517,31 @@ class model_walker_glm final : public model_base_crtp { current_statement__ = 156; for (int sym2__ = 1; sym2__ <= k_rw1; ++sym2__) { current_statement__ = 156; - assign(gamma_rw1, - cons_list(index_uni(sym2__), - cons_list(index_uni(sym1__), nil_index_list())), - gamma_rw1_flat__[(pos__ - 1)], "assigning variable gamma_rw1"); + stan::model::assign(gamma_rw1, gamma_rw1_flat__[(pos__ - 1)], + "assigning variable gamma_rw1", stan::model::index_uni(sym2__), + stan::model::index_uni(sym1__)); current_statement__ = 156; - pos__ = (pos__ + 1);}} + pos__ = (pos__ + 1); + } + } } current_statement__ = 157; - validate_non_negative_index("gamma_rw2", "k_rw2", k_rw2); + stan::math::validate_non_negative_index("gamma_rw2", "k_rw2", k_rw2); current_statement__ = 158; - validate_non_negative_index("gamma_rw2", "n", n); + stan::math::validate_non_negative_index("gamma_rw2", "n", n); current_statement__ = 159; - context__.validate_dims("data initialization","gamma_rw2","double", - context__.to_vec(k_rw2, n)); - gamma_rw2 = Eigen::Matrix(k_rw2, n); - stan::math::fill(gamma_rw2, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "gamma_rw2", "double", + std::vector{static_cast(k_rw2), + static_cast(n)}); + gamma_rw2_data__ = Eigen::Matrix::Constant(k_rw2, n, + std::numeric_limits::quiet_NaN()); + new (&gamma_rw2) + Eigen::Map>(gamma_rw2_data__.data(), + k_rw2, n); { std::vector gamma_rw2_flat__; current_statement__ = 159; - assign(gamma_rw2_flat__, nil_index_list(), - context__.vals_r("gamma_rw2"), - "assigning variable gamma_rw2_flat__"); + gamma_rw2_flat__ = context__.vals_r("gamma_rw2"); current_statement__ = 159; pos__ = 1; current_statement__ = 159; @@ -1630,1217 +1549,1147 @@ class model_walker_glm final : public model_base_crtp { current_statement__ = 159; for (int sym2__ = 1; sym2__ <= k_rw2; ++sym2__) { current_statement__ = 159; - assign(gamma_rw2, - cons_list(index_uni(sym2__), - cons_list(index_uni(sym1__), nil_index_list())), - gamma_rw2_flat__[(pos__ - 1)], "assigning variable gamma_rw2"); + stan::model::assign(gamma_rw2, gamma_rw2_flat__[(pos__ - 1)], + "assigning variable gamma_rw2", stan::model::index_uni(sym2__), + stan::model::index_uni(sym1__)); current_statement__ = 159; - pos__ = (pos__ + 1);}} + pos__ = (pos__ + 1); + } + } } current_statement__ = 160; - validate_non_negative_index("obs_idx", - "n_lfo - sum(y_miss[1 : n_lfo])", - (n_lfo - - sum( - rvalue(y_miss, - cons_list(index_min_max(1, n_lfo), - nil_index_list()), "y_miss")))); + stan::math::validate_non_negative_index("obs_idx", + "n_lfo - sum(y_miss[1 : n_lfo])", (n_lfo - + stan::math::sum( + stan::model::rvalue(y_miss, "y_miss", + stan::model::index_min_max(1, n_lfo))))); current_statement__ = 161; obs_idx = std::vector((n_lfo - - sum( - rvalue(y_miss, - cons_list(index_min_max(1, n_lfo), - nil_index_list()), "y_miss"))), std::numeric_limits::min()); - + stan::math::sum( + stan::model::rvalue(y_miss, "y_miss", + stan::model::index_min_max(1, n_lfo)))), + std::numeric_limits::min()); current_statement__ = 162; - validate_non_negative_index("a1", "m", m); + stan::math::validate_non_negative_index("a1", "m", m); current_statement__ = 163; - a1 = Eigen::Matrix(m); - stan::math::fill(a1, std::numeric_limits::quiet_NaN()); - + a1_data__ = Eigen::Matrix::Constant(m, + std::numeric_limits::quiet_NaN()); + new (&a1) Eigen::Map>(a1_data__.data(), m); current_statement__ = 164; - validate_non_negative_index("P1", "m", m); + stan::math::validate_non_negative_index("P1", "m", m); current_statement__ = 165; - validate_non_negative_index("P1", "m", m); + stan::math::validate_non_negative_index("P1", "m", m); current_statement__ = 166; - P1 = Eigen::Matrix(m, m); - stan::math::fill(P1, std::numeric_limits::quiet_NaN()); - + P1_data__ = Eigen::Matrix::Constant(m, m, + std::numeric_limits::quiet_NaN()); + new (&P1) Eigen::Map>(P1_data__.data(), m, + m); current_statement__ = 166; - assign(P1, nil_index_list(), rep_matrix(0.0, m, m), + stan::model::assign(P1, stan::math::rep_matrix(0.0, m, m), "assigning variable P1"); current_statement__ = 167; - validate_non_negative_index("Tt", "m", m); + stan::math::validate_non_negative_index("Tt", "m", m); current_statement__ = 168; - validate_non_negative_index("Tt", "m", m); + stan::math::validate_non_negative_index("Tt", "m", m); current_statement__ = 169; - Tt = Eigen::Matrix(m, m); - stan::math::fill(Tt, std::numeric_limits::quiet_NaN()); - + Tt_data__ = Eigen::Matrix::Constant(m, m, + std::numeric_limits::quiet_NaN()); + new (&Tt) Eigen::Map>(Tt_data__.data(), m, + m); current_statement__ = 169; - assign(Tt, nil_index_list(), diag_matrix(rep_vector(1.0, m)), + stan::model::assign(Tt, + stan::math::diag_matrix(stan::math::rep_vector(1.0, m)), "assigning variable Tt"); { - int ii; - ii = std::numeric_limits::min(); - + int ii = std::numeric_limits::min(); current_statement__ = 170; ii = 0; current_statement__ = 176; for (int i = 1; i <= n_lfo; ++i) { current_statement__ = 174; - if (logical_eq(y_miss[(i - 1)], 0)) { + if (stan::math::logical_eq( + stan::model::rvalue(y_miss, "y_miss", + stan::model::index_uni(i)), 0)) { current_statement__ = 171; ii = (ii + 1); current_statement__ = 172; - assign(obs_idx, cons_list(index_uni(ii), nil_index_list()), i, - "assigning variable obs_idx"); - } } + stan::model::assign(obs_idx, i, "assigning variable obs_idx", + stan::model::index_uni(ii)); + } + } } current_statement__ = 180; - if (logical_gt(k_rw2, 0)) { + if (stan::math::logical_gt(k_rw2, 0)) { current_statement__ = 178; - assign(Tt, - cons_list(index_min_max((k_rw1 + 1), k), - cons_list(index_min_max((k + 1), m), nil_index_list())), - diag_matrix(rep_vector(1.0, k_rw2)), "assigning variable Tt"); - } + stan::model::assign(Tt, + stan::math::diag_matrix(stan::math::rep_vector(1.0, k_rw2)), + "assigning variable Tt", + stan::model::index_min_max((k_rw1 + 1), k), + stan::model::index_min_max((k + 1), m)); + } current_statement__ = 184; for (int i = 1; i <= k_rw1; ++i) { current_statement__ = 181; - assign(a1, cons_list(index_uni(i), nil_index_list()), beta_rw1_mean, - "assigning variable a1"); + stan::model::assign(a1, beta_rw1_mean, "assigning variable a1", + stan::model::index_uni(i)); current_statement__ = 182; - assign(P1, - cons_list(index_uni(i), cons_list(index_uni(i), nil_index_list())), - pow(beta_rw1_sd, 2), "assigning variable P1");} + stan::model::assign(P1, stan::math::pow(beta_rw1_sd, 2), + "assigning variable P1", stan::model::index_uni(i), + stan::model::index_uni(i)); + } current_statement__ = 188; for (int i = (k_rw1 + 1); i <= k; ++i) { current_statement__ = 185; - assign(a1, cons_list(index_uni(i), nil_index_list()), beta_rw2_mean, - "assigning variable a1"); + stan::model::assign(a1, beta_rw2_mean, "assigning variable a1", + stan::model::index_uni(i)); current_statement__ = 186; - assign(P1, - cons_list(index_uni(i), cons_list(index_uni(i), nil_index_list())), - pow(beta_rw2_sd, 2), "assigning variable P1");} + stan::model::assign(P1, stan::math::pow(beta_rw2_sd, 2), + "assigning variable P1", stan::model::index_uni(i), + stan::model::index_uni(i)); + } current_statement__ = 192; for (int i = (k + 1); i <= m; ++i) { current_statement__ = 189; - assign(a1, cons_list(index_uni(i), nil_index_list()), nu_mean, - "assigning variable a1"); + stan::model::assign(a1, nu_mean, "assigning variable a1", + stan::model::index_uni(i)); current_statement__ = 190; - assign(P1, - cons_list(index_uni(i), cons_list(index_uni(i), nil_index_list())), - pow(nu_sd, 2), "assigning variable P1");} + stan::model::assign(P1, stan::math::pow(nu_sd, 2), + "assigning variable P1", stan::model::index_uni(i), + stan::model::index_uni(i)); + } current_statement__ = 193; - validate_non_negative_index("beta_fixed", "k_fixed", k_fixed); + stan::math::validate_non_negative_index("beta_fixed", "k_fixed", + k_fixed); current_statement__ = 194; - validate_non_negative_index("sigma_rw1", "k_rw1", k_rw1); + stan::math::validate_non_negative_index("sigma_rw1", "k_rw1", k_rw1); current_statement__ = 195; - validate_non_negative_index("sigma_rw2", "k_rw2", k_rw2); + stan::math::validate_non_negative_index("sigma_rw2", "k_rw2", k_rw2); current_statement__ = 196; - validate_non_negative_index("Rt", "m", m); + stan::math::validate_non_negative_index("Rt", "m", m); current_statement__ = 197; - validate_non_negative_index("Rt", "n", n); + stan::math::validate_non_negative_index("Rt", "n", n); current_statement__ = 198; - validate_non_negative_index("xbeta", "n", n); + stan::math::validate_non_negative_index("xbeta", "n", n); current_statement__ = 199; - validate_non_negative_index("y_", "n", n); + stan::math::validate_non_negative_index("y_", "n", n); current_statement__ = 200; - validate_non_negative_index("loglik", "n", n); + stan::math::validate_non_negative_index("loglik", "n", n); current_statement__ = 201; - validate_non_negative_index("beta_rw", "k", k); + stan::math::validate_non_negative_index("beta_rw", "k", k); current_statement__ = 202; beta_rw_2dim__ = std::numeric_limits::min(); - current_statement__ = 202; - beta_rw_2dim__ = (n * logical_eq(n_lfo, n)); + beta_rw_2dim__ = (n * stan::math::logical_eq(n_lfo, n)); current_statement__ = 202; - validate_non_negative_index("beta_rw", "n * (n_lfo == n)", - beta_rw_2dim__); + stan::math::validate_non_negative_index("beta_rw", "n * (n_lfo == n)", + beta_rw_2dim__); current_statement__ = 203; - validate_non_negative_index("nu", "k_rw2", k_rw2); + stan::math::validate_non_negative_index("nu", "k_rw2", k_rw2); current_statement__ = 204; nu_2dim__ = std::numeric_limits::min(); - current_statement__ = 204; - nu_2dim__ = (n * logical_eq(n_lfo, n)); + nu_2dim__ = (n * stan::math::logical_eq(n_lfo, n)); current_statement__ = 204; - validate_non_negative_index("nu", "n * (n_lfo == n)", nu_2dim__); + stan::math::validate_non_negative_index("nu", "n * (n_lfo == n)", + nu_2dim__); current_statement__ = 205; y_fit_1dim__ = std::numeric_limits::min(); - current_statement__ = 205; - y_fit_1dim__ = (n * logical_eq(n_lfo, n)); + y_fit_1dim__ = (n * stan::math::logical_eq(n_lfo, n)); current_statement__ = 205; - validate_non_negative_index("y_fit", "n * (n_lfo == n)", y_fit_1dim__); + stan::math::validate_non_negative_index("y_fit", "n * (n_lfo == n)", + y_fit_1dim__); current_statement__ = 206; y_rep_1dim__ = std::numeric_limits::min(); - current_statement__ = 206; - y_rep_1dim__ = (n * logical_eq(n_lfo, n)); + y_rep_1dim__ = (n * stan::math::logical_eq(n_lfo, n)); current_statement__ = 206; - validate_non_negative_index("y_rep", "n * (n_lfo == n)", y_rep_1dim__); + stan::math::validate_non_negative_index("y_rep", "n * (n_lfo == n)", + y_rep_1dim__); current_statement__ = 207; - validate_non_negative_index("log_lik", "n", n); + stan::math::validate_non_negative_index("log_lik", "n", n); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); - } - num_params_r__ = 0U; - - try { - num_params_r__ += k_fixed; - num_params_r__ += k_rw1; - num_params_r__ += k_rw2; - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } + num_params_r__ = k_fixed + k_rw1 + k_rw2; + } + inline std::string model_name() const final { + return "model_walker_glm"; + } + inline std::vector model_compile_info() const noexcept { + return std::vector{"stanc_version = stanc3 v2.32.2", + "stancflags = --allow-undefined"}; } - template * = nullptr, stan::require_vector_like_vt* = nullptr> - inline stan::scalar_type_t log_prob_impl(VecR& params_r__, - VecI& params_i__, - std::ostream* pstream__ = nullptr) const { + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline stan::scalar_type_t + log_prob_impl(VecR& params_r__, VecI& params_i__, std::ostream* + pstream__ = nullptr) const { using T__ = stan::scalar_type_t; using local_scalar_t__ = T__; T__ lp__(0.0); stan::math::accumulator lp_accum__; - static const char* function__ = "model_walker_glm_namespace::log_prob"; -(void) function__; // suppress unused var warning - stan::io::reader in__(params_r__, params_i__); + stan::io::deserializer in__(params_r__, params_i__); + int current_statement__ = 0; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; + static constexpr const char* function__ = + "model_walker_glm_namespace::log_prob"; + // suppress unused var warning + (void) function__; try { - Eigen::Matrix beta_fixed; - beta_fixed = Eigen::Matrix(k_fixed); - stan::math::fill(beta_fixed, DUMMY_VAR__); - + Eigen::Matrix beta_fixed = + Eigen::Matrix::Constant(k_fixed, DUMMY_VAR__); current_statement__ = 1; - beta_fixed = in__.vector(k_fixed); - std::vector sigma_rw1; - sigma_rw1 = std::vector(k_rw1, DUMMY_VAR__); - - current_statement__ = 2; - for (int sym1__ = 1; sym1__ <= k_rw1; ++sym1__) { - current_statement__ = 2; - assign(sigma_rw1, cons_list(index_uni(sym1__), nil_index_list()), - in__.scalar(), "assigning variable sigma_rw1");} + beta_fixed = in__.template read< + Eigen::Matrix>(k_fixed); + std::vector sigma_rw1 = + std::vector(k_rw1, DUMMY_VAR__); current_statement__ = 2; - for (int sym1__ = 1; sym1__ <= k_rw1; ++sym1__) { - current_statement__ = 2; - if (jacobian__) { - current_statement__ = 2; - assign(sigma_rw1, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(sigma_rw1[(sym1__ - 1)], 0, lp__), - "assigning variable sigma_rw1"); - } else { - current_statement__ = 2; - assign(sigma_rw1, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(sigma_rw1[(sym1__ - 1)], 0), - "assigning variable sigma_rw1"); - }} - std::vector sigma_rw2; - sigma_rw2 = std::vector(k_rw2, DUMMY_VAR__); - + sigma_rw1 = in__.template read_constrain_lb< + std::vector, jacobian__>(0, lp__, + k_rw1); + std::vector sigma_rw2 = + std::vector(k_rw2, DUMMY_VAR__); current_statement__ = 3; - for (int sym1__ = 1; sym1__ <= k_rw2; ++sym1__) { - current_statement__ = 3; - assign(sigma_rw2, cons_list(index_uni(sym1__), nil_index_list()), - in__.scalar(), "assigning variable sigma_rw2");} - current_statement__ = 3; - for (int sym1__ = 1; sym1__ <= k_rw2; ++sym1__) { - current_statement__ = 3; - if (jacobian__) { - current_statement__ = 3; - assign(sigma_rw2, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(sigma_rw2[(sym1__ - 1)], 0, lp__), - "assigning variable sigma_rw2"); - } else { - current_statement__ = 3; - assign(sigma_rw2, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(sigma_rw2[(sym1__ - 1)], 0), - "assigning variable sigma_rw2"); - }} - Eigen::Matrix Rt; - Rt = Eigen::Matrix(m, n); - stan::math::fill(Rt, DUMMY_VAR__); - + sigma_rw2 = in__.template read_constrain_lb< + std::vector, jacobian__>(0, lp__, + k_rw2); + Eigen::Matrix Rt = + Eigen::Matrix::Constant(m, n, DUMMY_VAR__); current_statement__ = 4; - assign(Rt, nil_index_list(), rep_matrix(0.0, m, n), + stan::model::assign(Rt, stan::math::rep_matrix(0.0, m, n), "assigning variable Rt"); - Eigen::Matrix xbeta; - xbeta = Eigen::Matrix(n); - stan::math::fill(xbeta, DUMMY_VAR__); - - Eigen::Matrix y_; - y_ = Eigen::Matrix(n); - stan::math::fill(y_, DUMMY_VAR__); - - Eigen::Matrix loglik; - loglik = Eigen::Matrix(n, 2); - stan::math::fill(loglik, DUMMY_VAR__); - - current_statement__ = 12; - if (logical_gt(k_fixed, 0)) { - current_statement__ = 10; - assign(xbeta, nil_index_list(), multiply(xreg_fixed, beta_fixed), + Eigen::Matrix xbeta = + Eigen::Matrix::Constant(n, DUMMY_VAR__); + Eigen::Matrix y_ = + Eigen::Matrix::Constant(n, DUMMY_VAR__); + Eigen::Matrix loglik = + Eigen::Matrix::Constant(n, 2, DUMMY_VAR__); + current_statement__ = 18; + if (stan::math::logical_gt(k_fixed, 0)) { + current_statement__ = 16; + stan::model::assign(xbeta, + stan::math::multiply(xreg_fixed, beta_fixed), "assigning variable xbeta"); } else { - current_statement__ = 8; - assign(xbeta, nil_index_list(), rep_vector(0.0, n), + current_statement__ = 14; + stan::model::assign(xbeta, stan::math::rep_vector(0.0, n), "assigning variable xbeta"); } - current_statement__ = 13; - assign(y_, nil_index_list(), subtract(y, xbeta), + current_statement__ = 19; + stan::model::assign(y_, stan::math::subtract(y, xbeta), "assigning variable y_"); - current_statement__ = 21; + current_statement__ = 27; for (int t = 1; t <= n; ++t) { - current_statement__ = 16; + current_statement__ = 22; for (int i = 1; i <= k_rw1; ++i) { - current_statement__ = 14; - assign(Rt, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), - pow( - (rvalue(gamma_rw1, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "gamma_rw1") * - sigma_rw1[(i - 1)]), 2), "assigning variable Rt");} - current_statement__ = 19; + current_statement__ = 20; + stan::model::assign(Rt, + stan::math::pow( + (stan::model::rvalue(gamma_rw1, "gamma_rw1", + stan::model::index_uni(i), stan::model::index_uni(t)) * + stan::model::rvalue(sigma_rw1, "sigma_rw1", + stan::model::index_uni(i))), 2), "assigning variable Rt", + stan::model::index_uni(i), stan::model::index_uni(t)); + } + current_statement__ = 25; for (int i = 1; i <= k_rw2; ++i) { - current_statement__ = 17; - assign(Rt, - cons_list(index_uni((k + i)), - cons_list(index_uni(t), nil_index_list())), - pow( - (rvalue(gamma_rw2, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "gamma_rw2") * - sigma_rw2[(i - 1)]), 2), "assigning variable Rt");}} - current_statement__ = 22; - assign(loglik, nil_index_list(), + current_statement__ = 23; + stan::model::assign(Rt, + stan::math::pow( + (stan::model::rvalue(gamma_rw2, "gamma_rw2", + stan::model::index_uni(i), stan::model::index_uni(t)) * + stan::model::rvalue(sigma_rw2, "sigma_rw2", + stan::model::index_uni(i))), 2), "assigning variable Rt", + stan::model::index_uni((k + i)), stan::model::index_uni(t)); + } + } + current_statement__ = 28; + stan::model::assign(loglik, glm_approx_loglik(y_, y_miss, a1, P1, Ht, Tt, Rt, xreg_rw, distribution, u, y_original, xbeta, pstream__), "assigning variable loglik"); { current_statement__ = 113; - lp_accum__.add( - normal_lpdf(beta_fixed, beta_fixed_mean, beta_fixed_sd)); + lp_accum__.add(stan::math::normal_lpdf(beta_fixed, + beta_fixed_mean, beta_fixed_sd)); current_statement__ = 114; - lp_accum__.add( - gamma_lpdf(sigma_rw1, sigma_rw1_shape, sigma_rw1_rate)); + lp_accum__.add(stan::math::gamma_lpdf(sigma_rw1, + sigma_rw1_shape, sigma_rw1_rate)); current_statement__ = 115; - lp_accum__.add( - gamma_lpdf(sigma_rw2, sigma_rw2_shape, sigma_rw2_rate)); + lp_accum__.add(stan::math::gamma_lpdf(sigma_rw2, + sigma_rw2_shape, sigma_rw2_rate)); current_statement__ = 116; - lp_accum__.add( - sum( - rvalue(loglik, - cons_list(index_multi(obs_idx), - cons_list(index_min_max(1, 2), nil_index_list())), "loglik"))); + lp_accum__.add(stan::math::sum( + stan::model::rvalue(loglik, "loglik", + stan::model::index_multi(obs_idx), + stan::model::index_min_max(1, 2)))); } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } lp_accum__.add(lp__); return lp_accum__.sum(); - } // log_prob_impl() - - template * = nullptr, stan::require_vector_like_vt* = nullptr, stan::require_std_vector_vt* = nullptr> - inline void write_array_impl(RNG& base_rng__, VecR& params_r__, - VecI& params_i__, VecVar& vars__, - const bool emit_transformed_parameters__ = true, - const bool emit_generated_quantities__ = true, - std::ostream* pstream__ = nullptr) const { + } + template * = nullptr, stan::require_vector_like_vt* = nullptr, stan::require_vector_vt* = nullptr> + inline void + write_array_impl(RNG& base_rng__, VecR& params_r__, VecI& params_i__, + VecVar& vars__, const bool + emit_transformed_parameters__ = true, const bool + emit_generated_quantities__ = true, std::ostream* + pstream__ = nullptr) const { using local_scalar_t__ = double; - vars__.resize(0); - stan::io::reader in__(params_r__, params_i__); - static const char* function__ = "model_walker_glm_namespace::write_array"; -(void) function__; // suppress unused var warning - (void) function__; // suppress unused var warning + stan::io::deserializer in__(params_r__, params_i__); + stan::io::serializer out__(vars__); + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; double lp__ = 0.0; - (void) lp__; // dummy to suppress unused var warning + // suppress unused var warning + (void) lp__; + int current_statement__ = 0; stan::math::accumulator lp_accum__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; + constexpr bool jacobian__ = false; + static constexpr const char* function__ = + "model_walker_glm_namespace::write_array"; + // suppress unused var warning + (void) function__; try { - Eigen::Matrix beta_fixed; - beta_fixed = Eigen::Matrix(k_fixed); - stan::math::fill(beta_fixed, std::numeric_limits::quiet_NaN()); - + Eigen::Matrix beta_fixed = + Eigen::Matrix::Constant(k_fixed, + std::numeric_limits::quiet_NaN()); current_statement__ = 1; - beta_fixed = in__.vector(k_fixed); - std::vector sigma_rw1; - sigma_rw1 = std::vector(k_rw1, std::numeric_limits::quiet_NaN()); - + beta_fixed = in__.template read< + Eigen::Matrix>(k_fixed); + std::vector sigma_rw1 = + std::vector(k_rw1, std::numeric_limits::quiet_NaN()); current_statement__ = 2; - for (int sym1__ = 1; sym1__ <= k_rw1; ++sym1__) { - current_statement__ = 2; - assign(sigma_rw1, cons_list(index_uni(sym1__), nil_index_list()), - in__.scalar(), "assigning variable sigma_rw1");} - current_statement__ = 2; - for (int sym1__ = 1; sym1__ <= k_rw1; ++sym1__) { - current_statement__ = 2; - assign(sigma_rw1, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(sigma_rw1[(sym1__ - 1)], 0), - "assigning variable sigma_rw1");} - std::vector sigma_rw2; - sigma_rw2 = std::vector(k_rw2, std::numeric_limits::quiet_NaN()); - - current_statement__ = 3; - for (int sym1__ = 1; sym1__ <= k_rw2; ++sym1__) { - current_statement__ = 3; - assign(sigma_rw2, cons_list(index_uni(sym1__), nil_index_list()), - in__.scalar(), "assigning variable sigma_rw2");} + sigma_rw1 = in__.template read_constrain_lb< + std::vector, jacobian__>(0, lp__, + k_rw1); + std::vector sigma_rw2 = + std::vector(k_rw2, std::numeric_limits::quiet_NaN()); current_statement__ = 3; - for (int sym1__ = 1; sym1__ <= k_rw2; ++sym1__) { - current_statement__ = 3; - assign(sigma_rw2, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(sigma_rw2[(sym1__ - 1)], 0), - "assigning variable sigma_rw2");} - Eigen::Matrix Rt; - Rt = Eigen::Matrix(m, n); - stan::math::fill(Rt, std::numeric_limits::quiet_NaN()); - - Eigen::Matrix xbeta; - xbeta = Eigen::Matrix(n); - stan::math::fill(xbeta, std::numeric_limits::quiet_NaN()); - - Eigen::Matrix y_; - y_ = Eigen::Matrix(n); - stan::math::fill(y_, std::numeric_limits::quiet_NaN()); - - Eigen::Matrix loglik; - loglik = Eigen::Matrix(n, 2); - stan::math::fill(loglik, std::numeric_limits::quiet_NaN()); - - for (int sym1__ = 1; sym1__ <= k_fixed; ++sym1__) { - vars__.emplace_back(beta_fixed[(sym1__ - 1)]);} - for (int sym1__ = 1; sym1__ <= k_rw1; ++sym1__) { - vars__.emplace_back(sigma_rw1[(sym1__ - 1)]);} - for (int sym1__ = 1; sym1__ <= k_rw2; ++sym1__) { - vars__.emplace_back(sigma_rw2[(sym1__ - 1)]);} - if (logical_negation((primitive_value(emit_transformed_parameters__) || - primitive_value(emit_generated_quantities__)))) { + sigma_rw2 = in__.template read_constrain_lb< + std::vector, jacobian__>(0, lp__, + k_rw2); + Eigen::Matrix Rt = + Eigen::Matrix::Constant(m, n, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix xbeta = + Eigen::Matrix::Constant(n, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix y_ = + Eigen::Matrix::Constant(n, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix loglik = + Eigen::Matrix::Constant(n, 2, + std::numeric_limits::quiet_NaN()); + out__.write(beta_fixed); + out__.write(sigma_rw1); + out__.write(sigma_rw2); + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { return ; - } + } current_statement__ = 4; - assign(Rt, nil_index_list(), rep_matrix(0.0, m, n), + stan::model::assign(Rt, stan::math::rep_matrix(0.0, m, n), "assigning variable Rt"); - current_statement__ = 12; - if (logical_gt(k_fixed, 0)) { - current_statement__ = 10; - assign(xbeta, nil_index_list(), multiply(xreg_fixed, beta_fixed), + current_statement__ = 18; + if (stan::math::logical_gt(k_fixed, 0)) { + current_statement__ = 16; + stan::model::assign(xbeta, + stan::math::multiply(xreg_fixed, beta_fixed), "assigning variable xbeta"); } else { - current_statement__ = 8; - assign(xbeta, nil_index_list(), rep_vector(0.0, n), + current_statement__ = 14; + stan::model::assign(xbeta, stan::math::rep_vector(0.0, n), "assigning variable xbeta"); } - current_statement__ = 13; - assign(y_, nil_index_list(), subtract(y, xbeta), + current_statement__ = 19; + stan::model::assign(y_, stan::math::subtract(y, xbeta), "assigning variable y_"); - current_statement__ = 21; + current_statement__ = 27; for (int t = 1; t <= n; ++t) { - current_statement__ = 16; + current_statement__ = 22; for (int i = 1; i <= k_rw1; ++i) { - current_statement__ = 14; - assign(Rt, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), - pow( - (rvalue(gamma_rw1, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "gamma_rw1") * - sigma_rw1[(i - 1)]), 2), "assigning variable Rt");} - current_statement__ = 19; + current_statement__ = 20; + stan::model::assign(Rt, + stan::math::pow( + (stan::model::rvalue(gamma_rw1, "gamma_rw1", + stan::model::index_uni(i), stan::model::index_uni(t)) * + stan::model::rvalue(sigma_rw1, "sigma_rw1", + stan::model::index_uni(i))), 2), "assigning variable Rt", + stan::model::index_uni(i), stan::model::index_uni(t)); + } + current_statement__ = 25; for (int i = 1; i <= k_rw2; ++i) { - current_statement__ = 17; - assign(Rt, - cons_list(index_uni((k + i)), - cons_list(index_uni(t), nil_index_list())), - pow( - (rvalue(gamma_rw2, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "gamma_rw2") * - sigma_rw2[(i - 1)]), 2), "assigning variable Rt");}} - current_statement__ = 22; - assign(loglik, nil_index_list(), + current_statement__ = 23; + stan::model::assign(Rt, + stan::math::pow( + (stan::model::rvalue(gamma_rw2, "gamma_rw2", + stan::model::index_uni(i), stan::model::index_uni(t)) * + stan::model::rvalue(sigma_rw2, "sigma_rw2", + stan::model::index_uni(i))), 2), "assigning variable Rt", + stan::model::index_uni((k + i)), stan::model::index_uni(t)); + } + } + current_statement__ = 28; + stan::model::assign(loglik, glm_approx_loglik(y_, y_miss, a1, P1, Ht, Tt, Rt, xreg_rw, distribution, u, y_original, xbeta, pstream__), "assigning variable loglik"); if (emit_transformed_parameters__) { - for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - for (int sym2__ = 1; sym2__ <= m; ++sym2__) { - vars__.emplace_back( - rvalue(Rt, - cons_list(index_uni(sym2__), - cons_list(index_uni(sym1__), nil_index_list())), "Rt"));}} - for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - vars__.emplace_back(xbeta[(sym1__ - 1)]);} - for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - vars__.emplace_back(y_[(sym1__ - 1)]);} - for (int sym1__ = 1; sym1__ <= 2; ++sym1__) { - for (int sym2__ = 1; sym2__ <= n; ++sym2__) { - vars__.emplace_back( - rvalue(loglik, - cons_list(index_uni(sym2__), - cons_list(index_uni(sym1__), nil_index_list())), "loglik")); - }} - } - if (logical_negation(emit_generated_quantities__)) { + out__.write(Rt); + out__.write(xbeta); + out__.write(y_); + out__.write(loglik); + } + if (stan::math::logical_negation(emit_generated_quantities__)) { return ; - } - Eigen::Matrix beta_rw; - beta_rw = Eigen::Matrix(k, beta_rw_2dim__); - stan::math::fill(beta_rw, std::numeric_limits::quiet_NaN()); - - Eigen::Matrix nu; - nu = Eigen::Matrix(k_rw2, nu_2dim__); - stan::math::fill(nu, std::numeric_limits::quiet_NaN()); - - double weights; - weights = std::numeric_limits::quiet_NaN(); - - Eigen::Matrix y_fit; - y_fit = Eigen::Matrix(y_fit_1dim__); - stan::math::fill(y_fit, std::numeric_limits::quiet_NaN()); - - Eigen::Matrix y_rep; - y_rep = Eigen::Matrix(y_rep_1dim__); - stan::math::fill(y_rep, std::numeric_limits::quiet_NaN()); - - Eigen::Matrix log_lik; - log_lik = Eigen::Matrix(n); - stan::math::fill(log_lik, std::numeric_limits::quiet_NaN()); - - current_statement__ = 28; - assign(log_lik, nil_index_list(), - add( - rvalue(loglik, - cons_list(index_omni(), - cons_list(index_uni(1), nil_index_list())), "loglik"), - rvalue(loglik, - cons_list(index_omni(), - cons_list(index_uni(2), nil_index_list())), "loglik")), - "assigning variable log_lik"); + } + Eigen::Matrix beta_rw = + Eigen::Matrix::Constant(k, beta_rw_2dim__, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix nu = + Eigen::Matrix::Constant(k_rw2, nu_2dim__, + std::numeric_limits::quiet_NaN()); + double weights = std::numeric_limits::quiet_NaN(); + Eigen::Matrix y_fit = + Eigen::Matrix::Constant(y_fit_1dim__, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix y_rep = + Eigen::Matrix::Constant(y_rep_1dim__, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix log_lik = + Eigen::Matrix::Constant(n, + std::numeric_limits::quiet_NaN()); + current_statement__ = 13; + stan::model::assign(log_lik, + stan::math::add( + stan::model::rvalue(loglik, "loglik", stan::model::index_omni(), + stan::model::index_uni(1)), + stan::model::rvalue(loglik, "loglik", stan::model::index_omni(), + stan::model::index_uni(2))), "assigning variable log_lik"); current_statement__ = 112; - if (logical_eq(n_lfo, n)) { + if (stan::math::logical_eq(n_lfo, n)) { current_statement__ = 29; - validate_non_negative_index("y_rep_j", "n", n); - Eigen::Matrix y_rep_j; - y_rep_j = Eigen::Matrix(n); - stan::math::fill(y_rep_j, std::numeric_limits::quiet_NaN()); - + stan::math::validate_non_negative_index("y_rep_j", "n", n); + Eigen::Matrix y_rep_j = + Eigen::Matrix::Constant(n, + std::numeric_limits::quiet_NaN()); current_statement__ = 31; - validate_non_negative_index("beta_j", "k", k); + stan::math::validate_non_negative_index("beta_j", "k", k); current_statement__ = 32; - validate_non_negative_index("beta_j", "n", n); - Eigen::Matrix beta_j; - beta_j = Eigen::Matrix(k, n); - stan::math::fill(beta_j, std::numeric_limits::quiet_NaN()); - + stan::math::validate_non_negative_index("beta_j", "n", n); + Eigen::Matrix beta_j = + Eigen::Matrix::Constant(k, n, + std::numeric_limits::quiet_NaN()); current_statement__ = 34; - validate_non_negative_index("nu_j", "k_rw2", k_rw2); + stan::math::validate_non_negative_index("nu_j", "k_rw2", k_rw2); current_statement__ = 35; - validate_non_negative_index("nu_j", "n", n); - Eigen::Matrix nu_j; - nu_j = Eigen::Matrix(k_rw2, n); - stan::math::fill(nu_j, std::numeric_limits::quiet_NaN()); - + stan::math::validate_non_negative_index("nu_j", "n", n); + Eigen::Matrix nu_j = + Eigen::Matrix::Constant(k_rw2, n, + std::numeric_limits::quiet_NaN()); current_statement__ = 37; - validate_non_negative_index("beta_array", "k", k); + stan::math::validate_non_negative_index("beta_array", "k", k); current_statement__ = 38; - validate_non_negative_index("beta_array", "n", n); + stan::math::validate_non_negative_index("beta_array", "n", n); current_statement__ = 39; - validate_non_negative_index("beta_array", "N", N); - std::vector>> beta_array; - beta_array = std::vector>>(k, std::vector>(n, std::vector(N, std::numeric_limits::quiet_NaN()))); - + stan::math::validate_non_negative_index("beta_array", "N", N); + std::vector>> beta_array = + std::vector>>(k, + std::vector>(n, + std::vector(N, + std::numeric_limits::quiet_NaN()))); current_statement__ = 41; - validate_non_negative_index("nu_array", "k_rw2", k_rw2); + stan::math::validate_non_negative_index("nu_array", "k_rw2", k_rw2); current_statement__ = 42; - validate_non_negative_index("nu_array", "n", n); + stan::math::validate_non_negative_index("nu_array", "n", n); current_statement__ = 43; - validate_non_negative_index("nu_array", "N", N); - std::vector>> nu_array; - nu_array = std::vector>>(k_rw2, std::vector>(n, std::vector(N, std::numeric_limits::quiet_NaN()))); - + stan::math::validate_non_negative_index("nu_array", "N", N); + std::vector>> nu_array = + std::vector>>(k_rw2, + std::vector>(n, + std::vector(N, + std::numeric_limits::quiet_NaN()))); current_statement__ = 45; - validate_non_negative_index("w", "N", N); - Eigen::Matrix w; - w = Eigen::Matrix(N); - stan::math::fill(w, std::numeric_limits::quiet_NaN()); - + stan::math::validate_non_negative_index("w", "N", N); + Eigen::Matrix w = + Eigen::Matrix::Constant(N, + std::numeric_limits::quiet_NaN()); current_statement__ = 46; - assign(w, nil_index_list(), rep_vector(0.0, N), + stan::model::assign(w, stan::math::rep_vector(0.0, N), "assigning variable w"); current_statement__ = 89; for (int j = 1; j <= N; ++j) { current_statement__ = 49; for (int i = 1; i <= k_rw1; ++i) { current_statement__ = 47; - assign(beta_j, - cons_list(index_uni(i), - cons_list(index_uni(1), nil_index_list())), - normal_rng(beta_rw1_mean, beta_rw1_sd, base_rng__), - "assigning variable beta_j");} + stan::model::assign(beta_j, + stan::math::normal_rng(beta_rw1_mean, beta_rw1_sd, base_rng__), + "assigning variable beta_j", stan::model::index_uni(i), + stan::model::index_uni(1)); + } current_statement__ = 53; for (int i = 1; i <= k_rw2; ++i) { current_statement__ = 50; - assign(beta_j, - cons_list(index_uni((k_rw1 + i)), - cons_list(index_uni(1), nil_index_list())), - normal_rng(beta_rw2_mean, beta_rw2_sd, base_rng__), - "assigning variable beta_j"); + stan::model::assign(beta_j, + stan::math::normal_rng(beta_rw2_mean, beta_rw2_sd, base_rng__), + "assigning variable beta_j", + stan::model::index_uni((k_rw1 + i)), stan::model::index_uni(1)); current_statement__ = 51; - assign(nu_j, - cons_list(index_uni(i), - cons_list(index_uni(1), nil_index_list())), - normal_rng(nu_mean, nu_sd, base_rng__), - "assigning variable nu_j");} + stan::model::assign(nu_j, + stan::math::normal_rng(nu_mean, nu_sd, base_rng__), + "assigning variable nu_j", stan::model::index_uni(i), + stan::model::index_uni(1)); + } current_statement__ = 62; for (int t = 1; t <= (n - 1); ++t) { current_statement__ = 56; for (int i = 1; i <= k_rw1; ++i) { current_statement__ = 54; - assign(beta_j, - cons_list(index_uni(i), - cons_list(index_uni((t + 1)), nil_index_list())), - normal_rng( - rvalue(beta_j, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "beta_j"), - (rvalue(gamma_rw1, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), - "gamma_rw1") * sigma_rw1[(i - 1)]), base_rng__), - "assigning variable beta_j");} + stan::model::assign(beta_j, + stan::math::normal_rng( + stan::model::rvalue(beta_j, "beta_j", + stan::model::index_uni(i), stan::model::index_uni(t)), + (stan::model::rvalue(gamma_rw1, "gamma_rw1", + stan::model::index_uni(i), stan::model::index_uni(t)) * + stan::model::rvalue(sigma_rw1, "sigma_rw1", + stan::model::index_uni(i))), base_rng__), + "assigning variable beta_j", stan::model::index_uni(i), + stan::model::index_uni((t + 1))); + } current_statement__ = 60; for (int i = 1; i <= k_rw2; ++i) { current_statement__ = 57; - assign(beta_j, - cons_list(index_uni((k_rw1 + i)), - cons_list(index_uni((t + 1)), nil_index_list())), - (rvalue(beta_j, - cons_list(index_uni((k_rw1 + i)), - cons_list(index_uni(t), nil_index_list())), "beta_j") + - rvalue(nu_j, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "nu_j")), - "assigning variable beta_j"); + stan::model::assign(beta_j, + (stan::model::rvalue(beta_j, "beta_j", + stan::model::index_uni((k_rw1 + i)), + stan::model::index_uni(t)) + + stan::model::rvalue(nu_j, "nu_j", stan::model::index_uni(i), + stan::model::index_uni(t))), "assigning variable beta_j", + stan::model::index_uni((k_rw1 + i)), + stan::model::index_uni((t + 1))); current_statement__ = 58; - assign(nu_j, - cons_list(index_uni(i), - cons_list(index_uni((t + 1)), nil_index_list())), - normal_rng( - rvalue(nu_j, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "nu_j"), - (rvalue(gamma_rw2, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), - "gamma_rw2") * sigma_rw2[(i - 1)]), base_rng__), - "assigning variable nu_j");}} + stan::model::assign(nu_j, + stan::math::normal_rng( + stan::model::rvalue(nu_j, "nu_j", + stan::model::index_uni(i), stan::model::index_uni(t)), + (stan::model::rvalue(gamma_rw2, "gamma_rw2", + stan::model::index_uni(i), stan::model::index_uni(t)) * + stan::model::rvalue(sigma_rw2, "sigma_rw2", + stan::model::index_uni(i))), base_rng__), + "assigning variable nu_j", stan::model::index_uni(i), + stan::model::index_uni((t + 1))); + } + } current_statement__ = 65; for (int t = 1; t <= n; ++t) { current_statement__ = 63; - assign(y_rep_j, cons_list(index_uni(t), nil_index_list()), - normal_rng( - dot_product( - rvalue(xreg_rw, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg_rw"), - rvalue(beta_j, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "beta_j")), - stan::math::sqrt(Ht[(t - 1)]), base_rng__), - "assigning variable y_rep_j");} + stan::model::assign(y_rep_j, + stan::math::normal_rng( + stan::math::dot_product( + stan::model::rvalue(xreg_rw, "xreg_rw", + stan::model::index_omni(), stan::model::index_uni(t)), + stan::model::rvalue(beta_j, "beta_j", + stan::model::index_omni(), stan::model::index_uni(t))), + stan::math::sqrt( + stan::model::rvalue(Ht, "Ht", stan::model::index_uni(t))), + base_rng__), "assigning variable y_rep_j", + stan::model::index_uni(t)); + } { current_statement__ = 66; - validate_non_negative_index("states", "m", m); + stan::math::validate_non_negative_index("states", "m", m); current_statement__ = 67; - validate_non_negative_index("states", "n", n); - Eigen::Matrix states; - states = Eigen::Matrix(m, n); - stan::math::fill(states, std::numeric_limits::quiet_NaN()); - + stan::math::validate_non_negative_index("states", "n", n); + Eigen::Matrix states = + Eigen::Matrix::Constant(m, n, + std::numeric_limits::quiet_NaN()); current_statement__ = 68; - assign(states, nil_index_list(), - glm_approx_smoother(subtract(y_, y_rep_j), y_miss, a1, P1, Ht, - Tt, Rt, xreg_rw, pstream__), "assigning variable states"); + stan::model::assign(states, + glm_approx_smoother(stan::math::subtract(y_, y_rep_j), y_miss, + a1, P1, Ht, Tt, Rt, xreg_rw, pstream__), + "assigning variable states"); current_statement__ = 69; - assign(beta_j, nil_index_list(), - add(stan::model::deep_copy(beta_j), - rvalue(states, - cons_list(index_min_max(1, k), - cons_list(index_min_max(1, n), nil_index_list())), - "states")), "assigning variable beta_j"); + stan::model::assign(beta_j, + stan::math::add(stan::model::deep_copy(beta_j), + stan::model::rvalue(states, "states", + stan::model::index_min_max(1, k), + stan::model::index_min_max(1, n))), + "assigning variable beta_j"); current_statement__ = 71; - if (logical_gt(k_rw2, 0)) { + if (stan::math::logical_gt(k_rw2, 0)) { current_statement__ = 70; - assign(nu_j, nil_index_list(), - add(stan::model::deep_copy(nu_j), - rvalue(states, - cons_list(index_min_max((k + 1), m), - cons_list(index_min_max(1, n), nil_index_list())), - "states")), "assigning variable nu_j"); - } + stan::model::assign(nu_j, + stan::math::add(stan::model::deep_copy(nu_j), + stan::model::rvalue(states, "states", + stan::model::index_min_max((k + 1), m), + stan::model::index_min_max(1, n))), + "assigning variable nu_j"); + } } current_statement__ = 73; - assign(beta_array, - cons_list(index_min_max(1, k), - cons_list(index_min_max(1, n), - cons_list(index_uni(j), nil_index_list()))), - to_array_2d(beta_j), "assigning variable beta_array"); + stan::model::assign(beta_array, stan::math::to_array_2d(beta_j), + "assigning variable beta_array", + stan::model::index_min_max(1, k), + stan::model::index_min_max(1, n), stan::model::index_uni(j)); current_statement__ = 75; - if (logical_gt(k_rw2, 0)) { + if (stan::math::logical_gt(k_rw2, 0)) { current_statement__ = 74; - assign(nu_array, - cons_list(index_min_max(1, k_rw2), - cons_list(index_min_max(1, n), - cons_list(index_uni(j), nil_index_list()))), - to_array_2d(nu_j), "assigning variable nu_array"); - } + stan::model::assign(nu_array, stan::math::to_array_2d(nu_j), + "assigning variable nu_array", + stan::model::index_min_max(1, k_rw2), + stan::model::index_min_max(1, n), stan::model::index_uni(j)); + } current_statement__ = 76; - assign(w, cons_list(index_uni(j), nil_index_list()), - -sum( - rvalue(loglik, - cons_list(index_multi(obs_idx), - cons_list(index_uni(2), nil_index_list())), "loglik")), - "assigning variable w"); + stan::model::assign(w, + -stan::math::sum( + stan::model::rvalue(loglik, "loglik", + stan::model::index_multi(obs_idx), stan::model::index_uni(2))), + "assigning variable w", stan::model::index_uni(j)); current_statement__ = 87; - if (logical_eq(distribution, 1)) { + if (stan::math::logical_eq(distribution, 1)) { current_statement__ = 85; for (int t = 1; t <= n; ++t) { - double xbeta_tmp; - xbeta_tmp = std::numeric_limits::quiet_NaN(); - + double xbeta_tmp = std::numeric_limits::quiet_NaN(); current_statement__ = 82; - xbeta_tmp = (xbeta[(t - 1)] + - dot_product( - rvalue(xreg_rw, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), - "xreg_rw"), - rvalue(beta_j, - cons_list(index_min_max(1, k), - cons_list(index_uni(t), nil_index_list())), - "beta_j"))); + xbeta_tmp = (stan::model::rvalue(xbeta, "xbeta", + stan::model::index_uni(t)) + + + stan::math::dot_product( + stan::model::rvalue(xreg_rw, "xreg_rw", + stan::model::index_omni(), stan::model::index_uni(t)), + stan::model::rvalue(beta_j, "beta_j", + stan::model::index_min_max(1, k), + stan::model::index_uni(t)))); current_statement__ = 83; - assign(w, cons_list(index_uni(j), nil_index_list()), - (w[(j - 1)] + - (((y_original[(t - 1)] * xbeta_tmp) - - (u[(t - 1)] * stan::math::exp(xbeta_tmp))) + - ((0.5 * pow((y[(t - 1)] - xbeta_tmp), 2)) / Ht[(t - 1)]))), - "assigning variable w");} + stan::model::assign(w, + (stan::model::rvalue(w, "w", stan::model::index_uni(j)) + + (((stan::model::rvalue(y_original, "y_original", + stan::model::index_uni(t)) * xbeta_tmp) - + (stan::model::rvalue(u, "u", stan::model::index_uni(t)) * + stan::math::exp(xbeta_tmp))) + ((0.5 * + stan::math::pow( + (stan::model::rvalue(y, "y", stan::model::index_uni(t)) - + xbeta_tmp), 2)) / + stan::model::rvalue(Ht, "Ht", stan::model::index_uni(t))))), + "assigning variable w", stan::model::index_uni(j)); + } } else { current_statement__ = 80; for (int t = 1; t <= n; ++t) { - double xbeta_tmp; - xbeta_tmp = std::numeric_limits::quiet_NaN(); - + double xbeta_tmp = std::numeric_limits::quiet_NaN(); current_statement__ = 77; - xbeta_tmp = (xbeta[(t - 1)] + - dot_product( - rvalue(xreg_rw, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), - "xreg_rw"), - rvalue(beta_j, - cons_list(index_min_max(1, k), - cons_list(index_uni(t), nil_index_list())), - "beta_j"))); + xbeta_tmp = (stan::model::rvalue(xbeta, "xbeta", + stan::model::index_uni(t)) + + + stan::math::dot_product( + stan::model::rvalue(xreg_rw, "xreg_rw", + stan::model::index_omni(), stan::model::index_uni(t)), + stan::model::rvalue(beta_j, "beta_j", + stan::model::index_min_max(1, k), + stan::model::index_uni(t)))); current_statement__ = 78; - assign(w, cons_list(index_uni(j), nil_index_list()), - (w[(j - 1)] + - (((y_original[(t - 1)] * xbeta_tmp) - - (u[(t - 1)] * - stan::math::log1p(stan::math::exp(xbeta_tmp)))) + - ((0.5 * pow((y[(t - 1)] - xbeta_tmp), 2)) / Ht[(t - 1)]))), - "assigning variable w");} - }} + stan::model::assign(w, + (stan::model::rvalue(w, "w", stan::model::index_uni(j)) + + (((stan::model::rvalue(y_original, "y_original", + stan::model::index_uni(t)) * xbeta_tmp) - + (stan::model::rvalue(u, "u", stan::model::index_uni(t)) * + stan::math::log1p(stan::math::exp(xbeta_tmp)))) + ((0.5 * + stan::math::pow( + (stan::model::rvalue(y, "y", stan::model::index_uni(t)) - + xbeta_tmp), 2)) / + stan::model::rvalue(Ht, "Ht", stan::model::index_uni(t))))), + "assigning variable w", stan::model::index_uni(j)); + } + } + } { - int index; - index = std::numeric_limits::min(); - + int index = std::numeric_limits::min(); current_statement__ = 91; - validate_non_negative_index("expw", "N", N); - Eigen::Matrix expw; - expw = Eigen::Matrix(N); - stan::math::fill(expw, std::numeric_limits::quiet_NaN()); - + stan::math::validate_non_negative_index("expw", "N", N); + Eigen::Matrix expw = + Eigen::Matrix::Constant(N, + std::numeric_limits::quiet_NaN()); current_statement__ = 92; - assign(expw, nil_index_list(), stan::math::exp(w), + stan::model::assign(expw, stan::math::exp(w), "assigning variable expw"); current_statement__ = 93; - weights = mean(expw); + weights = stan::math::mean(expw); current_statement__ = 94; - index = categorical_rng(divide(expw, sum(expw)), base_rng__); + index = stan::math::categorical_rng( + stan::math::divide(expw, stan::math::sum(expw)), + base_rng__); current_statement__ = 95; - assign(beta_rw, nil_index_list(), - to_matrix( - rvalue(beta_array, - cons_list(index_omni(), - cons_list(index_omni(), - cons_list(index_uni(index), nil_index_list()))), - "beta_array")), "assigning variable beta_rw"); + stan::model::assign(beta_rw, + stan::math::to_matrix( + stan::model::rvalue(beta_array, "beta_array", + stan::model::index_omni(), stan::model::index_omni(), + stan::model::index_uni(index))), "assigning variable beta_rw"); current_statement__ = 97; - if (logical_gt(k_rw2, 0)) { + if (stan::math::logical_gt(k_rw2, 0)) { current_statement__ = 96; - assign(nu, nil_index_list(), - to_matrix( - rvalue(nu_array, - cons_list(index_omni(), - cons_list(index_omni(), - cons_list(index_uni(index), nil_index_list()))), - "nu_array")), "assigning variable nu"); - } + stan::model::assign(nu, + stan::math::to_matrix( + stan::model::rvalue(nu_array, "nu_array", + stan::model::index_omni(), stan::model::index_omni(), + stan::model::index_uni(index))), "assigning variable nu"); + } current_statement__ = 109; - if (logical_eq(distribution, 1)) { + if (stan::math::logical_eq(distribution, 1)) { current_statement__ = 107; for (int t = 1; t <= n; ++t) { current_statement__ = 104; - assign(y_fit, cons_list(index_uni(t), nil_index_list()), - (u[(t - 1)] * - stan::math::exp( - (xbeta[(t - 1)] + - dot_product( - rvalue(xreg_rw, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), - "xreg_rw"), - rvalue(beta_rw, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), - "beta_rw"))))), "assigning variable y_fit"); + stan::model::assign(y_fit, + (stan::model::rvalue(u, "u", stan::model::index_uni(t)) * + stan::math::exp( + (stan::model::rvalue(xbeta, "xbeta", + stan::model::index_uni(t)) + + stan::math::dot_product( + stan::model::rvalue(xreg_rw, "xreg_rw", + stan::model::index_omni(), stan::model::index_uni(t)), + stan::model::rvalue(beta_rw, "beta_rw", + stan::model::index_omni(), stan::model::index_uni(t)))))), + "assigning variable y_fit", stan::model::index_uni(t)); current_statement__ = 105; - assign(y_rep, cons_list(index_uni(t), nil_index_list()), - poisson_rng(y_fit[(t - 1)], base_rng__), - "assigning variable y_rep");} + stan::model::assign(y_rep, + stan::math::poisson_rng( + stan::model::rvalue(y_fit, "y_fit", + stan::model::index_uni(t)), base_rng__), + "assigning variable y_rep", stan::model::index_uni(t)); + } } else { current_statement__ = 102; for (int t = 1; t <= n; ++t) { - double tmp; - tmp = std::numeric_limits::quiet_NaN(); - + double tmp = std::numeric_limits::quiet_NaN(); current_statement__ = 98; tmp = stan::math::exp( - (xbeta[(t - 1)] + - dot_product( - rvalue(xreg_rw, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), - "xreg_rw"), - rvalue(beta_rw, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), - "beta_rw")))); + (stan::model::rvalue(xbeta, "xbeta", + stan::model::index_uni(t)) + + stan::math::dot_product( + stan::model::rvalue(xreg_rw, "xreg_rw", + stan::model::index_omni(), + stan::model::index_uni(t)), + stan::model::rvalue(beta_rw, "beta_rw", + stan::model::index_omni(), + stan::model::index_uni(t))))); current_statement__ = 99; - assign(y_fit, cons_list(index_uni(t), nil_index_list()), - (tmp / (1.0 + tmp)), "assigning variable y_fit"); + stan::model::assign(y_fit, (tmp / (1.0 + tmp)), + "assigning variable y_fit", stan::model::index_uni(t)); current_statement__ = 100; - assign(y_rep, cons_list(index_uni(t), nil_index_list()), - binomial_rng(u[(t - 1)], y_fit[(t - 1)], base_rng__), - "assigning variable y_rep");} + stan::model::assign(y_rep, + stan::math::binomial_rng( + stan::model::rvalue(u, "u", stan::model::index_uni(t)), + stan::model::rvalue(y_fit, "y_fit", + stan::model::index_uni(t)), base_rng__), + "assigning variable y_rep", stan::model::index_uni(t)); + } } } - } - for (int sym1__ = 1; sym1__ <= beta_rw_2dim__; ++sym1__) { - for (int sym2__ = 1; sym2__ <= k; ++sym2__) { - vars__.emplace_back( - rvalue(beta_rw, - cons_list(index_uni(sym2__), - cons_list(index_uni(sym1__), nil_index_list())), "beta_rw")); - }} - for (int sym1__ = 1; sym1__ <= nu_2dim__; ++sym1__) { - for (int sym2__ = 1; sym2__ <= k_rw2; ++sym2__) { - vars__.emplace_back( - rvalue(nu, - cons_list(index_uni(sym2__), - cons_list(index_uni(sym1__), nil_index_list())), "nu"));}} - vars__.emplace_back(weights); - for (int sym1__ = 1; sym1__ <= y_fit_1dim__; ++sym1__) { - vars__.emplace_back(y_fit[(sym1__ - 1)]);} - for (int sym1__ = 1; sym1__ <= y_rep_1dim__; ++sym1__) { - vars__.emplace_back(y_rep[(sym1__ - 1)]);} - for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - vars__.emplace_back(log_lik[(sym1__ - 1)]);} + } + out__.write(beta_rw); + out__.write(nu); + out__.write(weights); + out__.write(y_fit); + out__.write(y_rep); + out__.write(log_lik); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } - } // write_array_impl() - - template * = nullptr, stan::require_vector_like_vt* = nullptr> - inline void transform_inits_impl(const stan::io::var_context& context__, - VecI& params_i__, VecVar& vars__, - std::ostream* pstream__ = nullptr) const { + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline void + unconstrain_array_impl(const VecVar& params_r__, const VecI& params_i__, + VecVar& vars__, std::ostream* pstream__ = nullptr) const { using local_scalar_t__ = double; - vars__.clear(); - vars__.reserve(num_params_r__); - + stan::io::deserializer in__(params_r__, params_i__); + stan::io::serializer out__(vars__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; try { - int pos__; - pos__ = std::numeric_limits::min(); - + int pos__ = std::numeric_limits::min(); pos__ = 1; - Eigen::Matrix beta_fixed; - beta_fixed = Eigen::Matrix(k_fixed); - stan::math::fill(beta_fixed, std::numeric_limits::quiet_NaN()); - + Eigen::Matrix beta_fixed = + Eigen::Matrix::Constant(k_fixed, DUMMY_VAR__); + current_statement__ = 1; + stan::model::assign(beta_fixed, + in__.read>(k_fixed), + "assigning variable beta_fixed"); + out__.write(beta_fixed); + std::vector sigma_rw1 = + std::vector(k_rw1, DUMMY_VAR__); + current_statement__ = 2; + stan::model::assign(sigma_rw1, + in__.read>(k_rw1), + "assigning variable sigma_rw1"); + out__.write_free_lb(0, sigma_rw1); + std::vector sigma_rw2 = + std::vector(k_rw2, DUMMY_VAR__); + current_statement__ = 3; + stan::model::assign(sigma_rw2, + in__.read>(k_rw2), + "assigning variable sigma_rw2"); + out__.write_free_lb(0, sigma_rw2); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + template * = nullptr> + inline void + transform_inits_impl(const stan::io::var_context& context__, VecVar& + vars__, std::ostream* pstream__ = nullptr) const { + using local_scalar_t__ = double; + stan::io::serializer out__(vars__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 1; + context__.validate_dims("parameter initialization", "beta_fixed", + "double", std::vector{static_cast(k_fixed)}); + current_statement__ = 2; + context__.validate_dims("parameter initialization", "sigma_rw1", + "double", std::vector{static_cast(k_rw1)}); + current_statement__ = 3; + context__.validate_dims("parameter initialization", "sigma_rw2", + "double", std::vector{static_cast(k_rw2)}); + int pos__ = std::numeric_limits::min(); + pos__ = 1; + Eigen::Matrix beta_fixed = + Eigen::Matrix::Constant(k_fixed, DUMMY_VAR__); { std::vector beta_fixed_flat__; current_statement__ = 1; - assign(beta_fixed_flat__, nil_index_list(), - context__.vals_r("beta_fixed"), - "assigning variable beta_fixed_flat__"); + beta_fixed_flat__ = context__.vals_r("beta_fixed"); current_statement__ = 1; pos__ = 1; current_statement__ = 1; for (int sym1__ = 1; sym1__ <= k_fixed; ++sym1__) { current_statement__ = 1; - assign(beta_fixed, cons_list(index_uni(sym1__), nil_index_list()), - beta_fixed_flat__[(pos__ - 1)], "assigning variable beta_fixed"); + stan::model::assign(beta_fixed, beta_fixed_flat__[(pos__ - 1)], + "assigning variable beta_fixed", stan::model::index_uni(sym1__)); current_statement__ = 1; - pos__ = (pos__ + 1);} + pos__ = (pos__ + 1); + } } - std::vector sigma_rw1; - sigma_rw1 = std::vector(k_rw1, std::numeric_limits::quiet_NaN()); - + out__.write(beta_fixed); + std::vector sigma_rw1 = + std::vector(k_rw1, DUMMY_VAR__); current_statement__ = 2; - assign(sigma_rw1, nil_index_list(), context__.vals_r("sigma_rw1"), - "assigning variable sigma_rw1"); - std::vector sigma_rw1_free__; - sigma_rw1_free__ = std::vector(k_rw1, std::numeric_limits::quiet_NaN()); - - current_statement__ = 2; - for (int sym1__ = 1; sym1__ <= k_rw1; ++sym1__) { - current_statement__ = 2; - assign(sigma_rw1_free__, - cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_free(sigma_rw1[(sym1__ - 1)], 0), - "assigning variable sigma_rw1_free__");} - std::vector sigma_rw2; - sigma_rw2 = std::vector(k_rw2, std::numeric_limits::quiet_NaN()); - - current_statement__ = 3; - assign(sigma_rw2, nil_index_list(), context__.vals_r("sigma_rw2"), - "assigning variable sigma_rw2"); - std::vector sigma_rw2_free__; - sigma_rw2_free__ = std::vector(k_rw2, std::numeric_limits::quiet_NaN()); - + sigma_rw1 = context__.vals_r("sigma_rw1"); + out__.write_free_lb(0, sigma_rw1); + std::vector sigma_rw2 = + std::vector(k_rw2, DUMMY_VAR__); current_statement__ = 3; - for (int sym1__ = 1; sym1__ <= k_rw2; ++sym1__) { - current_statement__ = 3; - assign(sigma_rw2_free__, - cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_free(sigma_rw2[(sym1__ - 1)], 0), - "assigning variable sigma_rw2_free__");} - for (int sym1__ = 1; sym1__ <= k_fixed; ++sym1__) { - vars__.emplace_back(beta_fixed[(sym1__ - 1)]);} - for (int sym1__ = 1; sym1__ <= k_rw1; ++sym1__) { - vars__.emplace_back(sigma_rw1_free__[(sym1__ - 1)]);} - for (int sym1__ = 1; sym1__ <= k_rw2; ++sym1__) { - vars__.emplace_back(sigma_rw2_free__[(sym1__ - 1)]);} + sigma_rw2 = context__.vals_r("sigma_rw2"); + out__.write_free_lb(0, sigma_rw2); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } - } // transform_inits_impl() - - inline void get_param_names(std::vector& names__) const { - - names__.clear(); - names__.emplace_back("beta_fixed"); - names__.emplace_back("sigma_rw1"); - names__.emplace_back("sigma_rw2"); - names__.emplace_back("Rt"); - names__.emplace_back("xbeta"); - names__.emplace_back("y_"); - names__.emplace_back("loglik"); - names__.emplace_back("beta_rw"); - names__.emplace_back("nu"); - names__.emplace_back("weights"); - names__.emplace_back("y_fit"); - names__.emplace_back("y_rep"); - names__.emplace_back("log_lik"); - } // get_param_names() - - inline void get_dims(std::vector>& dimss__) const { - dimss__.clear(); - dimss__.emplace_back(std::vector{static_cast(k_fixed)}); - - dimss__.emplace_back(std::vector{static_cast(k_rw1)}); - - dimss__.emplace_back(std::vector{static_cast(k_rw2)}); - - dimss__.emplace_back(std::vector{static_cast(m), - static_cast(n)}); - - dimss__.emplace_back(std::vector{static_cast(n)}); - - dimss__.emplace_back(std::vector{static_cast(n)}); - - dimss__.emplace_back(std::vector{static_cast(n), - static_cast(2)}); - - dimss__.emplace_back(std::vector{static_cast(k), - static_cast(beta_rw_2dim__) - }); - - dimss__.emplace_back(std::vector{static_cast(k_rw2), - static_cast(nu_2dim__)}); - - dimss__.emplace_back(std::vector{}); - - dimss__.emplace_back(std::vector{ - static_cast(y_fit_1dim__)}); - - dimss__.emplace_back(std::vector{ - static_cast(y_rep_1dim__)}); - - dimss__.emplace_back(std::vector{static_cast(n)}); - - } // get_dims() - - inline void constrained_param_names( - std::vector& param_names__, - bool emit_transformed_parameters__ = true, - bool emit_generated_quantities__ = true) const - final { - + } + inline void + get_param_names(std::vector& names__, const bool + emit_transformed_parameters__ = true, const bool + emit_generated_quantities__ = true) const { + names__ = std::vector{"beta_fixed", "sigma_rw1", + "sigma_rw2"}; + if (emit_transformed_parameters__) { + std::vector temp{"Rt", "xbeta", "y_", "loglik"}; + names__.reserve(names__.size() + temp.size()); + names__.insert(names__.end(), temp.begin(), temp.end()); + } + if (emit_generated_quantities__) { + std::vector + temp{"beta_rw", "nu", "weights", "y_fit", "y_rep", "log_lik"}; + names__.reserve(names__.size() + temp.size()); + names__.insert(names__.end(), temp.begin(), temp.end()); + } + } + inline void + get_dims(std::vector>& dimss__, const bool + emit_transformed_parameters__ = true, const bool + emit_generated_quantities__ = true) const { + dimss__ = std::vector>{std::vector{static_cast< + size_t>( + k_fixed)}, + std::vector{static_cast(k_rw1)}, + std::vector{static_cast(k_rw2)}}; + if (emit_transformed_parameters__) { + std::vector> + temp{std::vector{static_cast(m), + static_cast(n)}, + std::vector{static_cast(n)}, + std::vector{static_cast(n)}, + std::vector{static_cast(n), + static_cast(2)}}; + dimss__.reserve(dimss__.size() + temp.size()); + dimss__.insert(dimss__.end(), temp.begin(), temp.end()); + } + if (emit_generated_quantities__) { + std::vector> + temp{std::vector{static_cast(k), + static_cast(beta_rw_2dim__)}, + std::vector{static_cast(k_rw2), + static_cast(nu_2dim__)}, std::vector{}, + std::vector{static_cast(y_fit_1dim__)}, + std::vector{static_cast(y_rep_1dim__)}, + std::vector{static_cast(n)}}; + dimss__.reserve(dimss__.size() + temp.size()); + dimss__.insert(dimss__.end(), temp.begin(), temp.end()); + } + } + inline void + constrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { for (int sym1__ = 1; sym1__ <= k_fixed; ++sym1__) { - { - param_names__.emplace_back(std::string() + "beta_fixed" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "beta_fixed" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= k_rw1; ++sym1__) { - { - param_names__.emplace_back(std::string() + "sigma_rw1" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "sigma_rw1" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= k_rw2; ++sym1__) { - { - param_names__.emplace_back(std::string() + "sigma_rw2" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "sigma_rw2" + '.' + + std::to_string(sym1__)); + } if (emit_transformed_parameters__) { for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - for (int sym2__ = 1; sym2__ <= m; ++sym2__) { - { - param_names__.emplace_back(std::string() + "Rt" + '.' + std::to_string(sym2__) + '.' + std::to_string(sym1__)); - }} - }} + for (int sym2__ = 1; sym2__ <= m; ++sym2__) { + param_names__.emplace_back(std::string() + "Rt" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - param_names__.emplace_back(std::string() + "xbeta" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "xbeta" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - param_names__.emplace_back(std::string() + "y_" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "y_" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= 2; ++sym1__) { - { - for (int sym2__ = 1; sym2__ <= n; ++sym2__) { - { - param_names__.emplace_back(std::string() + "loglik" + '.' + std::to_string(sym2__) + '.' + std::to_string(sym1__)); - }} - }} + for (int sym2__ = 1; sym2__ <= n; ++sym2__) { + param_names__.emplace_back(std::string() + "loglik" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } } - if (emit_generated_quantities__) { for (int sym1__ = 1; sym1__ <= beta_rw_2dim__; ++sym1__) { - { - for (int sym2__ = 1; sym2__ <= k; ++sym2__) { - { - param_names__.emplace_back(std::string() + "beta_rw" + '.' + std::to_string(sym2__) + '.' + std::to_string(sym1__)); - }} - }} + for (int sym2__ = 1; sym2__ <= k; ++sym2__) { + param_names__.emplace_back(std::string() + "beta_rw" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } for (int sym1__ = 1; sym1__ <= nu_2dim__; ++sym1__) { - { - for (int sym2__ = 1; sym2__ <= k_rw2; ++sym2__) { - { - param_names__.emplace_back(std::string() + "nu" + '.' + std::to_string(sym2__) + '.' + std::to_string(sym1__)); - }} - }} + for (int sym2__ = 1; sym2__ <= k_rw2; ++sym2__) { + param_names__.emplace_back(std::string() + "nu" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } param_names__.emplace_back(std::string() + "weights"); for (int sym1__ = 1; sym1__ <= y_fit_1dim__; ++sym1__) { - { - param_names__.emplace_back(std::string() + "y_fit" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "y_fit" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= y_rep_1dim__; ++sym1__) { - { - param_names__.emplace_back(std::string() + "y_rep" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "y_rep" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - param_names__.emplace_back(std::string() + "log_lik" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "log_lik" + '.' + + std::to_string(sym1__)); + } } - - } // constrained_param_names() - - inline void unconstrained_param_names( - std::vector& param_names__, - bool emit_transformed_parameters__ = true, - bool emit_generated_quantities__ = true) const - final { - + } + inline void + unconstrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { for (int sym1__ = 1; sym1__ <= k_fixed; ++sym1__) { - { - param_names__.emplace_back(std::string() + "beta_fixed" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "beta_fixed" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= k_rw1; ++sym1__) { - { - param_names__.emplace_back(std::string() + "sigma_rw1" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "sigma_rw1" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= k_rw2; ++sym1__) { - { - param_names__.emplace_back(std::string() + "sigma_rw2" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "sigma_rw2" + '.' + + std::to_string(sym1__)); + } if (emit_transformed_parameters__) { for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - for (int sym2__ = 1; sym2__ <= m; ++sym2__) { - { - param_names__.emplace_back(std::string() + "Rt" + '.' + std::to_string(sym2__) + '.' + std::to_string(sym1__)); - }} - }} + for (int sym2__ = 1; sym2__ <= m; ++sym2__) { + param_names__.emplace_back(std::string() + "Rt" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - param_names__.emplace_back(std::string() + "xbeta" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "xbeta" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - param_names__.emplace_back(std::string() + "y_" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "y_" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= 2; ++sym1__) { - { - for (int sym2__ = 1; sym2__ <= n; ++sym2__) { - { - param_names__.emplace_back(std::string() + "loglik" + '.' + std::to_string(sym2__) + '.' + std::to_string(sym1__)); - }} - }} + for (int sym2__ = 1; sym2__ <= n; ++sym2__) { + param_names__.emplace_back(std::string() + "loglik" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } } - if (emit_generated_quantities__) { for (int sym1__ = 1; sym1__ <= beta_rw_2dim__; ++sym1__) { - { - for (int sym2__ = 1; sym2__ <= k; ++sym2__) { - { - param_names__.emplace_back(std::string() + "beta_rw" + '.' + std::to_string(sym2__) + '.' + std::to_string(sym1__)); - }} - }} + for (int sym2__ = 1; sym2__ <= k; ++sym2__) { + param_names__.emplace_back(std::string() + "beta_rw" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } for (int sym1__ = 1; sym1__ <= nu_2dim__; ++sym1__) { - { - for (int sym2__ = 1; sym2__ <= k_rw2; ++sym2__) { - { - param_names__.emplace_back(std::string() + "nu" + '.' + std::to_string(sym2__) + '.' + std::to_string(sym1__)); - }} - }} + for (int sym2__ = 1; sym2__ <= k_rw2; ++sym2__) { + param_names__.emplace_back(std::string() + "nu" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } param_names__.emplace_back(std::string() + "weights"); for (int sym1__ = 1; sym1__ <= y_fit_1dim__; ++sym1__) { - { - param_names__.emplace_back(std::string() + "y_fit" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "y_fit" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= y_rep_1dim__; ++sym1__) { - { - param_names__.emplace_back(std::string() + "y_rep" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "y_rep" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - param_names__.emplace_back(std::string() + "log_lik" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "log_lik" + '.' + + std::to_string(sym1__)); + } } - - } // unconstrained_param_names() - + } inline std::string get_constrained_sizedtypes() const { - stringstream s__; - s__ << "[{\"name\":\"beta_fixed\",\"type\":{\"name\":\"vector\",\"length\":" << k_fixed << "},\"block\":\"parameters\"},{\"name\":\"sigma_rw1\",\"type\":{\"name\":\"array\",\"length\":" << k_rw1 << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"sigma_rw2\",\"type\":{\"name\":\"array\",\"length\":" << k_rw2 << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"Rt\",\"type\":{\"name\":\"matrix\",\"rows\":" << m << ",\"cols\":" << n << "},\"block\":\"transformed_parameters\"},{\"name\":\"xbeta\",\"type\":{\"name\":\"vector\",\"length\":" << n << "},\"block\":\"transformed_parameters\"},{\"name\":\"y_\",\"type\":{\"name\":\"vector\",\"length\":" << n << "},\"block\":\"transformed_parameters\"},{\"name\":\"loglik\",\"type\":{\"name\":\"matrix\",\"rows\":" << n << ",\"cols\":" << 2 << "},\"block\":\"transformed_parameters\"},{\"name\":\"beta_rw\",\"type\":{\"name\":\"matrix\",\"rows\":" << k << ",\"cols\":" << beta_rw_2dim__ << "},\"block\":\"generated_quantities\"},{\"name\":\"nu\",\"type\":{\"name\":\"matrix\",\"rows\":" << k_rw2 << ",\"cols\":" << nu_2dim__ << "},\"block\":\"generated_quantities\"},{\"name\":\"weights\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"y_fit\",\"type\":{\"name\":\"vector\",\"length\":" << y_fit_1dim__ << "},\"block\":\"generated_quantities\"},{\"name\":\"y_rep\",\"type\":{\"name\":\"vector\",\"length\":" << y_rep_1dim__ << "},\"block\":\"generated_quantities\"},{\"name\":\"log_lik\",\"type\":{\"name\":\"vector\",\"length\":" << n << "},\"block\":\"generated_quantities\"}]"; - return s__.str(); - } // get_constrained_sizedtypes() - + return std::string("[{\"name\":\"beta_fixed\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(k_fixed) + "},\"block\":\"parameters\"},{\"name\":\"sigma_rw1\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(k_rw1) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"sigma_rw2\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(k_rw2) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"Rt\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(m) + ",\"cols\":" + std::to_string(n) + "},\"block\":\"transformed_parameters\"},{\"name\":\"xbeta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n) + "},\"block\":\"transformed_parameters\"},{\"name\":\"y_\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n) + "},\"block\":\"transformed_parameters\"},{\"name\":\"loglik\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(n) + ",\"cols\":" + std::to_string(2) + "},\"block\":\"transformed_parameters\"},{\"name\":\"beta_rw\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(k) + ",\"cols\":" + std::to_string(beta_rw_2dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"nu\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(k_rw2) + ",\"cols\":" + std::to_string(nu_2dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"weights\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"y_fit\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(y_fit_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"y_rep\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(y_rep_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"log_lik\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n) + "},\"block\":\"generated_quantities\"}]"); + } inline std::string get_unconstrained_sizedtypes() const { - stringstream s__; - s__ << "[{\"name\":\"beta_fixed\",\"type\":{\"name\":\"vector\",\"length\":" << k_fixed << "},\"block\":\"parameters\"},{\"name\":\"sigma_rw1\",\"type\":{\"name\":\"array\",\"length\":" << k_rw1 << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"sigma_rw2\",\"type\":{\"name\":\"array\",\"length\":" << k_rw2 << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"Rt\",\"type\":{\"name\":\"matrix\",\"rows\":" << m << ",\"cols\":" << n << "},\"block\":\"transformed_parameters\"},{\"name\":\"xbeta\",\"type\":{\"name\":\"vector\",\"length\":" << n << "},\"block\":\"transformed_parameters\"},{\"name\":\"y_\",\"type\":{\"name\":\"vector\",\"length\":" << n << "},\"block\":\"transformed_parameters\"},{\"name\":\"loglik\",\"type\":{\"name\":\"matrix\",\"rows\":" << n << ",\"cols\":" << 2 << "},\"block\":\"transformed_parameters\"},{\"name\":\"beta_rw\",\"type\":{\"name\":\"matrix\",\"rows\":" << k << ",\"cols\":" << beta_rw_2dim__ << "},\"block\":\"generated_quantities\"},{\"name\":\"nu\",\"type\":{\"name\":\"matrix\",\"rows\":" << k_rw2 << ",\"cols\":" << nu_2dim__ << "},\"block\":\"generated_quantities\"},{\"name\":\"weights\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"y_fit\",\"type\":{\"name\":\"vector\",\"length\":" << y_fit_1dim__ << "},\"block\":\"generated_quantities\"},{\"name\":\"y_rep\",\"type\":{\"name\":\"vector\",\"length\":" << y_rep_1dim__ << "},\"block\":\"generated_quantities\"},{\"name\":\"log_lik\",\"type\":{\"name\":\"vector\",\"length\":" << n << "},\"block\":\"generated_quantities\"}]"; - return s__.str(); - } // get_unconstrained_sizedtypes() - - - // Begin method overload boilerplate - template - inline void write_array(RNG& base_rng, - Eigen::Matrix& params_r, - Eigen::Matrix& vars, - const bool emit_transformed_parameters = true, - const bool emit_generated_quantities = true, - std::ostream* pstream = nullptr) const { - std::vector vars_vec(vars.size()); - std::vector params_i; - write_array_impl(base_rng, params_r, params_i, vars_vec, - emit_transformed_parameters, emit_generated_quantities, pstream); - vars.resize(vars_vec.size()); - for (int i = 0; i < vars.size(); ++i) { - vars.coeffRef(i) = vars_vec[i]; - } - } - template - inline void write_array(RNG& base_rng, std::vector& params_r, - std::vector& params_i, - std::vector& vars, - bool emit_transformed_parameters = true, - bool emit_generated_quantities = true, - std::ostream* pstream = nullptr) const { - write_array_impl(base_rng, params_r, params_i, vars, emit_transformed_parameters, emit_generated_quantities, pstream); - } - template - inline T_ log_prob(Eigen::Matrix& params_r, - std::ostream* pstream = nullptr) const { - Eigen::Matrix params_i; - return log_prob_impl(params_r, params_i, pstream); - } - template - inline T__ log_prob(std::vector& params_r, - std::vector& params_i, - std::ostream* pstream = nullptr) const { - return log_prob_impl(params_r, params_i, pstream); - } - - inline void transform_inits(const stan::io::var_context& context, - Eigen::Matrix& params_r, - std::ostream* pstream = nullptr) const final { - std::vector params_r_vec(params_r.size()); - std::vector params_i; - transform_inits_impl(context, params_i, params_r_vec, pstream); - params_r.resize(params_r_vec.size()); - for (int i = 0; i < params_r.size(); ++i) { - params_r.coeffRef(i) = params_r_vec[i]; - } - } - inline void transform_inits(const stan::io::var_context& context, - std::vector& params_i, - std::vector& vars, - std::ostream* pstream = nullptr) const final { - transform_inits_impl(context, params_i, vars, pstream); - } + return std::string("[{\"name\":\"beta_fixed\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(k_fixed) + "},\"block\":\"parameters\"},{\"name\":\"sigma_rw1\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(k_rw1) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"sigma_rw2\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(k_rw2) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"Rt\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(m) + ",\"cols\":" + std::to_string(n) + "},\"block\":\"transformed_parameters\"},{\"name\":\"xbeta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n) + "},\"block\":\"transformed_parameters\"},{\"name\":\"y_\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n) + "},\"block\":\"transformed_parameters\"},{\"name\":\"loglik\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(n) + ",\"cols\":" + std::to_string(2) + "},\"block\":\"transformed_parameters\"},{\"name\":\"beta_rw\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(k) + ",\"cols\":" + std::to_string(beta_rw_2dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"nu\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(k_rw2) + ",\"cols\":" + std::to_string(nu_2dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"weights\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"y_fit\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(y_fit_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"y_rep\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(y_rep_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"log_lik\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n) + "},\"block\":\"generated_quantities\"}]"); + } + // Begin method overload boilerplate + template inline void + write_array(RNG& base_rng, Eigen::Matrix& params_r, + Eigen::Matrix& vars, const bool + emit_transformed_parameters = true, const bool + emit_generated_quantities = true, std::ostream* + pstream = nullptr) const { + const size_t num_params__ = ((k_fixed + k_rw1) + k_rw2); + const size_t num_transformed = emit_transformed_parameters * (((((m * n) + + n) + n) + (n * 2))); + const size_t num_gen_quantities = emit_generated_quantities * (((((((k * + beta_rw_2dim__) + (k_rw2 * nu_2dim__)) + 1) + y_fit_1dim__) + + y_rep_1dim__) + n)); + const size_t num_to_write = num_params__ + num_transformed + + num_gen_quantities; + std::vector params_i; + vars = Eigen::Matrix::Constant(num_to_write, + std::numeric_limits::quiet_NaN()); + write_array_impl(base_rng, params_r, params_i, vars, + emit_transformed_parameters, emit_generated_quantities, pstream); + } + template inline void + write_array(RNG& base_rng, std::vector& params_r, std::vector& + params_i, std::vector& vars, bool + emit_transformed_parameters = true, bool + emit_generated_quantities = true, std::ostream* + pstream = nullptr) const { + const size_t num_params__ = ((k_fixed + k_rw1) + k_rw2); + const size_t num_transformed = emit_transformed_parameters * (((((m * n) + + n) + n) + (n * 2))); + const size_t num_gen_quantities = emit_generated_quantities * (((((((k * + beta_rw_2dim__) + (k_rw2 * nu_2dim__)) + 1) + y_fit_1dim__) + + y_rep_1dim__) + n)); + const size_t num_to_write = num_params__ + num_transformed + + num_gen_quantities; + vars = std::vector(num_to_write, + std::numeric_limits::quiet_NaN()); + write_array_impl(base_rng, params_r, params_i, vars, + emit_transformed_parameters, emit_generated_quantities, pstream); + } + template inline T_ + log_prob(Eigen::Matrix& params_r, std::ostream* pstream = nullptr) const { + Eigen::Matrix params_i; + return log_prob_impl(params_r, params_i, pstream); + } + template inline T_ + log_prob(std::vector& params_r, std::vector& params_i, + std::ostream* pstream = nullptr) const { + return log_prob_impl(params_r, params_i, pstream); + } + inline void + transform_inits(const stan::io::var_context& context, + Eigen::Matrix& params_r, std::ostream* + pstream = nullptr) const final { + std::vector params_r_vec(params_r.size()); + std::vector params_i; + transform_inits(context, params_i, params_r_vec, pstream); + params_r = Eigen::Map>(params_r_vec.data(), + params_r_vec.size()); + } + inline void + transform_inits(const stan::io::var_context& context, std::vector& + params_i, std::vector& vars, std::ostream* + pstream__ = nullptr) const { + vars.resize(num_params_r__); + transform_inits_impl(context, vars, pstream__); + } + inline void + unconstrain_array(const std::vector& params_constrained, + std::vector& params_unconstrained, std::ostream* + pstream = nullptr) const { + const std::vector params_i; + params_unconstrained = std::vector(num_params_r__, + std::numeric_limits::quiet_NaN()); + unconstrain_array_impl(params_constrained, params_i, + params_unconstrained, pstream); + } + inline void + unconstrain_array(const Eigen::Matrix& params_constrained, + Eigen::Matrix& params_unconstrained, + std::ostream* pstream = nullptr) const { + const std::vector params_i; + params_unconstrained = Eigen::Matrix::Constant(num_params_r__, + std::numeric_limits::quiet_NaN()); + unconstrain_array_impl(params_constrained, params_i, + params_unconstrained, pstream); + } }; } using stan_model = model_walker_glm_namespace::model_walker_glm; #ifndef USING_R // Boilerplate -stan::model::model_base& new_model( - stan::io::var_context& data_context, - unsigned int seed, - std::ostream* msg_stream) { +stan::model::model_base& +new_model(stan::io::var_context& data_context, unsigned int seed, + std::ostream* msg_stream) { stan_model* m = new stan_model(data_context, seed, msg_stream); return *m; } diff --git a/src/stanExports_walker_lm.h b/src/stanExports_walker_lm.h index 6f13ae4..6d07fbb 100644 --- a/src/stanExports_walker_lm.h +++ b/src/stanExports_walker_lm.h @@ -21,828 +21,779 @@ #define USE_STANC3 #endif #include -// Code generated by stanc v2.26.1-4-gd72b68b7-dirty +// Code generated by stanc v2.32.2 #include namespace model_walker_lm_namespace { -inline void validate_positive_index(const char* var_name, const char* expr, - int val) { - if (val < 1) { - std::stringstream msg; - msg << "Found dimension size less than one in simplex declaration" - << "; variable=" << var_name << "; dimension size expression=" << expr - << "; expression value=" << val; - std::string msg_str(msg.str()); - throw std::invalid_argument(msg_str.c_str()); - } -} -inline void validate_unit_vector_index(const char* var_name, const char* expr, - int val) { - if (val <= 1) { - std::stringstream msg; - if (val == 1) { - msg << "Found dimension size one in unit vector declaration." - << " One-dimensional unit vector is discrete" - << " but the target distribution must be continuous." - << " variable=" << var_name << "; dimension size expression=" << expr; - } else { - msg << "Found dimension size less than one in unit vector declaration" - << "; variable=" << var_name << "; dimension size expression=" << expr - << "; expression value=" << val; - } - std::string msg_str(msg.str()); - throw std::invalid_argument(msg_str.c_str()); - } -} -using std::istream; -using std::string; -using std::stringstream; -using std::vector; -using std::pow; -using stan::io::dump; -using stan::math::lgamma; using stan::model::model_base_crtp; -using stan::model::rvalue; -using stan::model::cons_list; -using stan::model::index_uni; -using stan::model::index_max; -using stan::model::index_min; -using stan::model::index_min_max; -using stan::model::index_multi; -using stan::model::index_omni; -using stan::model::nil_index_list; using namespace stan::math; -using stan::math::pow; stan::math::profile_map profiles__; -static int current_statement__= 0; -static const std::vector locations_array__ = {" (found before start of program)", - " (in 'string', line 169, column 2 to column 29)", - " (in 'string', line 170, column 2 to column 39)", - " (in 'string', line 171, column 2 to column 39)", - " (in 'string', line 172, column 2 to column 24)", - " (in 'string', line 175, column 2 to column 20)", - " (in 'string', line 176, column 2 to column 42)", - " (in 'string', line 177, column 2 to column 18)", - " (in 'string', line 178, column 2 to column 15)", - " (in 'string', line 183, column 4 to column 31)", - " (in 'string', line 182, column 9 to line 184, column 3)", - " (in 'string', line 181, column 4 to column 36)", - " (in 'string', line 180, column 19 to line 182, column 3)", - " (in 'string', line 180, column 2 to line 184, column 3)", - " (in 'string', line 185, column 2 to column 17)", - " (in 'string', line 188, column 6 to column 52)", - " (in 'string', line 187, column 22 to line 189, column 5)", - " (in 'string', line 187, column 4 to line 189, column 5)", - " (in 'string', line 191, column 6 to column 56)", - " (in 'string', line 190, column 22 to line 192, column 5)", - " (in 'string', line 190, column 4 to line 192, column 5)", - " (in 'string', line 186, column 17 to line 193, column 3)", - " (in 'string', line 186, column 2 to line 193, column 3)", - " (in 'string', line 194, column 2 to column 86)", - " (in 'string', line 207, column 2 to column 33)", - " (in 'string', line 208, column 2 to column 38)", - " (in 'string', line 209, column 2 to column 37)", - " (in 'string', line 210, column 2 to column 33)", - " (in 'string', line 216, column 6 to column 61)", - " (in 'string', line 215, column 22 to line 217, column 5)", - " (in 'string', line 215, column 4 to line 217, column 5)", - " (in 'string', line 219, column 6 to column 69)", - " (in 'string', line 220, column 6 to column 44)", - " (in 'string', line 218, column 22 to line 221, column 5)", - " (in 'string', line 218, column 4 to line 221, column 5)", - " (in 'string', line 225, column 8 to column 86)", - " (in 'string', line 224, column 24 to line 226, column 7)", - " (in 'string', line 224, column 6 to line 226, column 7)", - " (in 'string', line 228, column 8 to column 67)", - " (in 'string', line 229, column 8 to column 76)", - " (in 'string', line 227, column 24 to line 230, column 7)", - " (in 'string', line 227, column 6 to line 230, column 7)", - " (in 'string', line 223, column 25 to line 231, column 5)", - " (in 'string', line 223, column 4 to line 231, column 5)", - " (in 'string', line 234, column 6 to column 91)", - " (in 'string', line 233, column 18 to line 235, column 5)", - " (in 'string', line 233, column 4 to line 235, column 5)", - " (in 'string', line 238, column 13 to column 14)", - " (in 'string', line 238, column 16 to column 17)", - " (in 'string', line 238, column 6 to line 239, column 44)", - " (in 'string', line 240, column 6 to column 34)", - " (in 'string', line 241, column 20 to column 49)", - " (in 'string', line 241, column 6 to column 49)", - " (in 'string', line 237, column 4 to line 242, column 5)", - " (in 'string', line 246, column 6 to column 68)", - " (in 'string', line 247, column 6 to column 60)", - " (in 'string', line 245, column 18 to line 248, column 5)", - " (in 'string', line 245, column 4 to line 248, column 5)", - " (in 'string', line 212, column 17 to line 249, column 3)", - " (in 'string', line 212, column 2 to line 249, column 3)", - " (in 'string', line 197, column 2 to column 54)", - " (in 'string', line 198, column 2 to column 47)", - " (in 'string', line 199, column 2 to column 53)", - " (in 'string', line 200, column 2 to column 53)", - " (in 'string', line 204, column 2 to column 34)", - " (in 'string', line 103, column 2 to column 23)", - " (in 'string', line 104, column 2 to column 21)", - " (in 'string', line 105, column 2 to column 21)", - " (in 'string', line 106, column 2 to column 17)", - " (in 'string', line 107, column 2 to column 17)", - " (in 'string', line 108, column 2 to column 17)", - " (in 'string', line 109, column 2 to column 21)", - " (in 'string', line 110, column 9 to column 10)", - " (in 'string', line 110, column 12 to column 19)", - " (in 'string', line 110, column 2 to column 32)", - " (in 'string', line 111, column 9 to column 10)", - " (in 'string', line 111, column 12 to column 13)", - " (in 'string', line 111, column 2 to column 23)", - " (in 'string', line 112, column 9 to column 10)", - " (in 'string', line 112, column 2 to column 14)", - " (in 'string', line 113, column 8 to column 9)", - " (in 'string', line 113, column 2 to column 31)", - " (in 'string', line 114, column 2 to column 30)", - " (in 'string', line 115, column 2 to column 29)", - " (in 'string', line 117, column 2 to column 23)", - " (in 'string', line 118, column 2 to column 30)", - " (in 'string', line 119, column 2 to column 21)", - " (in 'string', line 120, column 2 to column 28)", - " (in 'string', line 121, column 2 to column 21)", - " (in 'string', line 122, column 2 to column 28)", - " (in 'string', line 124, column 2 to column 32)", - " (in 'string', line 125, column 2 to column 32)", - " (in 'string', line 126, column 2 to column 31)", - " (in 'string', line 127, column 2 to column 31)", - " (in 'string', line 129, column 2 to column 24)", - " (in 'string', line 130, column 2 to column 22)", - " (in 'string', line 131, column 9 to column 10)", - " (in 'string', line 131, column 2 to column 20)", - " (in 'string', line 132, column 9 to column 14)", - " (in 'string', line 132, column 16 to column 17)", - " (in 'string', line 132, column 2 to column 29)", - " (in 'string', line 133, column 9 to column 14)", - " (in 'string', line 133, column 16 to column 17)", - " (in 'string', line 133, column 2 to column 29)", - " (in 'string', line 137, column 8 to column 36)", - " (in 'string', line 137, column 2 to column 50)", - " (in 'string', line 138, column 9 to column 10)", - " (in 'string', line 138, column 2 to column 15)", - " (in 'string', line 139, column 9 to column 10)", - " (in 'string', line 139, column 12 to column 13)", - " (in 'string', line 139, column 2 to column 42)", - " (in 'string', line 140, column 9 to column 10)", - " (in 'string', line 140, column 12 to column 13)", - " (in 'string', line 140, column 2 to column 52)", - " (in 'string', line 141, column 9 to column 10)", - " (in 'string', line 141, column 2 to column 42)", - " (in 'string', line 144, column 4 to column 15)", - " (in 'string', line 147, column 8 to column 20)", - " (in 'string', line 148, column 8 to column 24)", - " (in 'string', line 146, column 25 to line 149, column 7)", - " (in 'string', line 146, column 6 to line 149, column 7)", - " (in 'string', line 145, column 22 to line 150, column 5)", - " (in 'string', line 145, column 4 to line 150, column 5)", - " (in 'string', line 143, column 2 to line 151, column 3)", - " (in 'string', line 153, column 4 to column 67)", - " (in 'string', line 152, column 16 to line 154, column 3)", - " (in 'string', line 152, column 2 to line 154, column 3)", - " (in 'string', line 156, column 4 to column 26)", - " (in 'string', line 157, column 4 to column 29)", - " (in 'string', line 155, column 20 to line 158, column 3)", - " (in 'string', line 155, column 2 to line 158, column 3)", - " (in 'string', line 160, column 4 to column 26)", - " (in 'string', line 161, column 4 to column 29)", - " (in 'string', line 159, column 26 to line 162, column 3)", - " (in 'string', line 159, column 2 to line 162, column 3)", - " (in 'string', line 164, column 4 to column 20)", - " (in 'string', line 165, column 4 to column 23)", - " (in 'string', line 163, column 22 to line 166, column 3)", - " (in 'string', line 163, column 2 to line 166, column 3)", - " (in 'string', line 169, column 9 to column 16)", - " (in 'string', line 170, column 8 to column 13)", - " (in 'string', line 171, column 8 to column 13)", - " (in 'string', line 175, column 9 to column 10)", - " (in 'string', line 176, column 9 to column 10)", - " (in 'string', line 176, column 12 to column 13)", - " (in 'string', line 177, column 9 to column 10)", - " (in 'string', line 178, column 9 to column 10)", - " (in 'string', line 207, column 9 to column 25)", - " (in 'string', line 208, column 9 to column 10)", - " (in 'string', line 208, column 12 to column 28)", - " (in 'string', line 209, column 9 to column 14)", - " (in 'string', line 209, column 16 to column 32)", - " (in 'string', line 210, column 9 to column 25)", - " (in 'string', line 9, column 4 to column 23)", - " (in 'string', line 10, column 4 to column 20)", - " (in 'string', line 11, column 4 to column 21)", - " (in 'string', line 12, column 11 to column 12)", - " (in 'string', line 12, column 4 to column 58)", - " (in 'string', line 14, column 11 to column 12)", - " (in 'string', line 14, column 4 to column 21)", - " (in 'string', line 15, column 11 to column 12)", - " (in 'string', line 15, column 14 to column 15)", - " (in 'string', line 15, column 4 to column 24)", - " (in 'string', line 17, column 4 to column 30)", - " (in 'string', line 20, column 6 to column 68)", - " (in 'string', line 32, column 8 to column 19)", - " (in 'string', line 33, column 8 to column 34)", - " (in 'string', line 35, column 10 to column 30)", - " (in 'string', line 34, column 23 to line 36, column 9)", - " (in 'string', line 34, column 8 to line 36, column 9)", - " (in 'string', line 31, column 13 to line 37, column 7)", - " (in 'string', line 23, column 8 to column 59)", - " (in 'string', line 24, column 15 to column 16)", - " (in 'string', line 24, column 8 to column 50)", - " (in 'string', line 25, column 8 to column 29)", - " (in 'string', line 26, column 8 to column 47)", - " (in 'string', line 28, column 10 to column 30)", - " (in 'string', line 27, column 23 to line 29, column 9)", - " (in 'string', line 27, column 8 to line 29, column 9)", - " (in 'string', line 30, column 8 to column 57)", - " (in 'string', line 22, column 26 to line 31, column 7)", - " (in 'string', line 22, column 6 to line 37, column 7)", - " (in 'string', line 19, column 19 to line 38, column 5)", - " (in 'string', line 19, column 4 to line 38, column 5)", - " (in 'string', line 39, column 4 to column 18)", - " (in 'string', line 7, column 54 to line 41, column 3)", - " (in 'string', line 46, column 4 to column 23)", - " (in 'string', line 47, column 4 to column 20)", - " (in 'string', line 48, column 4 to column 21)", - " (in 'string', line 49, column 11 to column 12)", - " (in 'string', line 49, column 4 to column 21)", - " (in 'string', line 50, column 11 to column 12)", - " (in 'string', line 50, column 14 to column 15)", - " (in 'string', line 50, column 4 to column 24)", - " (in 'string', line 51, column 11 to column 12)", - " (in 'string', line 51, column 4 to column 16)", - " (in 'string', line 52, column 11 to column 12)", - " (in 'string', line 52, column 4 to column 16)", - " (in 'string', line 53, column 11 to column 12)", - " (in 'string', line 53, column 14 to column 15)", - " (in 'string', line 53, column 4 to column 19)", - " (in 'string', line 54, column 11 to column 12)", - " (in 'string', line 54, column 14 to column 19)", - " (in 'string', line 54, column 4 to column 23)", - " (in 'string', line 55, column 11 to column 12)", - " (in 'string', line 55, column 4 to column 19)", - " (in 'string', line 59, column 6 to column 66)", - " (in 'string', line 70, column 8 to column 19)", - " (in 'string', line 71, column 8 to column 34)", - " (in 'string', line 73, column 10 to column 30)", - " (in 'string', line 72, column 23 to line 74, column 9)", - " (in 'string', line 72, column 8 to line 74, column 9)", - " (in 'string', line 69, column 13 to line 75, column 7)", - " (in 'string', line 62, column 8 to column 57)", - " (in 'string', line 63, column 8 to column 48)", - " (in 'string', line 64, column 8 to column 36)", - " (in 'string', line 65, column 8 to column 58)", - " (in 'string', line 67, column 10 to column 30)", - " (in 'string', line 66, column 23 to line 68, column 9)", - " (in 'string', line 66, column 8 to line 68, column 9)", - " (in 'string', line 61, column 44 to line 69, column 7)", - " (in 'string', line 61, column 6 to line 75, column 7)", - " (in 'string', line 57, column 19 to line 76, column 5)", - " (in 'string', line 57, column 4 to line 76, column 5)", - " (in 'string', line 78, column 4 to column 33)", - " (in 'string', line 80, column 6 to column 25)", - " (in 'string', line 81, column 13 to column 14)", - " (in 'string', line 81, column 6 to column 31)", - " (in 'string', line 87, column 8 to column 26)", - " (in 'string', line 86, column 13 to line 88, column 7)", - " (in 'string', line 83, column 15 to column 16)", - " (in 'string', line 83, column 8 to column 44)", - " (in 'string', line 84, column 8 to column 30)", - " (in 'string', line 85, column 8 to column 71)", - " (in 'string', line 82, column 43 to line 86, column 7)", - " (in 'string', line 82, column 6 to line 88, column 7)", - " (in 'string', line 79, column 20 to line 89, column 5)", - " (in 'string', line 79, column 4 to line 89, column 5)", - " (in 'string', line 91, column 4 to column 17)", - " (in 'string', line 92, column 4 to column 27)", - " (in 'string', line 94, column 13 to column 14)", - " (in 'string', line 94, column 6 to column 30)", - " (in 'string', line 95, column 13 to column 14)", - " (in 'string', line 95, column 6 to column 29)", - " (in 'string', line 96, column 6 to column 41)", - " (in 'string', line 93, column 19 to line 97, column 5)", - " (in 'string', line 93, column 4 to line 97, column 5)", - " (in 'string', line 98, column 4 to column 23)", - " (in 'string', line 44, column 53 to line 99, column 3)"}; +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'string', line 169, column 2 to column 29)", + " (in 'string', line 170, column 2 to column 39)", + " (in 'string', line 171, column 2 to column 39)", + " (in 'string', line 172, column 2 to column 24)", + " (in 'string', line 175, column 2 to column 20)", + " (in 'string', line 176, column 2 to column 42)", + " (in 'string', line 177, column 2 to column 18)", + " (in 'string', line 178, column 2 to column 15)", + " (in 'string', line 207, column 2 to column 33)", + " (in 'string', line 208, column 2 to column 38)", + " (in 'string', line 209, column 2 to column 37)", + " (in 'string', line 210, column 2 to column 33)", + " (in 'string', line 183, column 4 to column 31)", + " (in 'string', line 182, column 9 to line 184, column 3)", + " (in 'string', line 181, column 4 to column 36)", + " (in 'string', line 180, column 19 to line 182, column 3)", + " (in 'string', line 180, column 2 to line 184, column 3)", + " (in 'string', line 185, column 2 to column 17)", + " (in 'string', line 188, column 6 to column 52)", + " (in 'string', line 187, column 22 to line 189, column 5)", + " (in 'string', line 187, column 4 to line 189, column 5)", + " (in 'string', line 191, column 6 to column 56)", + " (in 'string', line 190, column 22 to line 192, column 5)", + " (in 'string', line 190, column 4 to line 192, column 5)", + " (in 'string', line 186, column 17 to line 193, column 3)", + " (in 'string', line 186, column 2 to line 193, column 3)", + " (in 'string', line 194, column 2 to column 86)", + " (in 'string', line 216, column 6 to column 61)", + " (in 'string', line 215, column 22 to line 217, column 5)", + " (in 'string', line 215, column 4 to line 217, column 5)", + " (in 'string', line 219, column 6 to column 69)", + " (in 'string', line 220, column 6 to column 44)", + " (in 'string', line 218, column 22 to line 221, column 5)", + " (in 'string', line 218, column 4 to line 221, column 5)", + " (in 'string', line 225, column 8 to column 86)", + " (in 'string', line 224, column 24 to line 226, column 7)", + " (in 'string', line 224, column 6 to line 226, column 7)", + " (in 'string', line 228, column 8 to column 67)", + " (in 'string', line 229, column 8 to column 76)", + " (in 'string', line 227, column 24 to line 230, column 7)", + " (in 'string', line 227, column 6 to line 230, column 7)", + " (in 'string', line 223, column 25 to line 231, column 5)", + " (in 'string', line 223, column 4 to line 231, column 5)", + " (in 'string', line 234, column 6 to column 91)", + " (in 'string', line 233, column 18 to line 235, column 5)", + " (in 'string', line 233, column 4 to line 235, column 5)", + " (in 'string', line 238, column 13 to column 14)", + " (in 'string', line 238, column 16 to column 17)", + " (in 'string', line 238, column 6 to line 239, column 44)", + " (in 'string', line 240, column 6 to column 34)", + " (in 'string', line 241, column 20 to column 49)", + " (in 'string', line 241, column 6 to column 49)", + " (in 'string', line 237, column 4 to line 242, column 5)", + " (in 'string', line 246, column 6 to column 68)", + " (in 'string', line 247, column 6 to column 60)", + " (in 'string', line 245, column 18 to line 248, column 5)", + " (in 'string', line 245, column 4 to line 248, column 5)", + " (in 'string', line 212, column 17 to line 249, column 3)", + " (in 'string', line 212, column 2 to line 249, column 3)", + " (in 'string', line 197, column 2 to column 54)", + " (in 'string', line 198, column 2 to column 47)", + " (in 'string', line 199, column 2 to column 53)", + " (in 'string', line 200, column 2 to column 53)", + " (in 'string', line 204, column 2 to column 34)", + " (in 'string', line 103, column 2 to column 23)", + " (in 'string', line 104, column 2 to column 21)", + " (in 'string', line 105, column 2 to column 21)", + " (in 'string', line 106, column 2 to column 17)", + " (in 'string', line 107, column 2 to column 17)", + " (in 'string', line 108, column 2 to column 17)", + " (in 'string', line 109, column 2 to column 21)", + " (in 'string', line 110, column 9 to column 10)", + " (in 'string', line 110, column 12 to column 19)", + " (in 'string', line 110, column 2 to column 32)", + " (in 'string', line 111, column 9 to column 10)", + " (in 'string', line 111, column 12 to column 13)", + " (in 'string', line 111, column 2 to column 23)", + " (in 'string', line 112, column 9 to column 10)", + " (in 'string', line 112, column 2 to column 14)", + " (in 'string', line 113, column 8 to column 9)", + " (in 'string', line 113, column 2 to column 31)", + " (in 'string', line 114, column 2 to column 30)", + " (in 'string', line 115, column 2 to column 29)", + " (in 'string', line 117, column 2 to column 23)", + " (in 'string', line 118, column 2 to column 30)", + " (in 'string', line 119, column 2 to column 21)", + " (in 'string', line 120, column 2 to column 28)", + " (in 'string', line 121, column 2 to column 21)", + " (in 'string', line 122, column 2 to column 28)", + " (in 'string', line 124, column 2 to column 32)", + " (in 'string', line 125, column 2 to column 32)", + " (in 'string', line 126, column 2 to column 31)", + " (in 'string', line 127, column 2 to column 31)", + " (in 'string', line 129, column 2 to column 24)", + " (in 'string', line 130, column 2 to column 22)", + " (in 'string', line 131, column 9 to column 10)", + " (in 'string', line 131, column 2 to column 20)", + " (in 'string', line 132, column 9 to column 14)", + " (in 'string', line 132, column 16 to column 17)", + " (in 'string', line 132, column 2 to column 29)", + " (in 'string', line 133, column 9 to column 14)", + " (in 'string', line 133, column 16 to column 17)", + " (in 'string', line 133, column 2 to column 29)", + " (in 'string', line 137, column 8 to column 36)", + " (in 'string', line 137, column 2 to column 50)", + " (in 'string', line 138, column 9 to column 10)", + " (in 'string', line 138, column 2 to column 15)", + " (in 'string', line 139, column 9 to column 10)", + " (in 'string', line 139, column 12 to column 13)", + " (in 'string', line 139, column 2 to column 42)", + " (in 'string', line 140, column 9 to column 10)", + " (in 'string', line 140, column 12 to column 13)", + " (in 'string', line 140, column 2 to column 52)", + " (in 'string', line 141, column 9 to column 10)", + " (in 'string', line 141, column 2 to column 42)", + " (in 'string', line 144, column 4 to column 15)", + " (in 'string', line 147, column 8 to column 20)", + " (in 'string', line 148, column 8 to column 24)", + " (in 'string', line 146, column 25 to line 149, column 7)", + " (in 'string', line 146, column 6 to line 149, column 7)", + " (in 'string', line 145, column 22 to line 150, column 5)", + " (in 'string', line 145, column 4 to line 150, column 5)", + " (in 'string', line 143, column 2 to line 151, column 3)", + " (in 'string', line 153, column 4 to column 67)", + " (in 'string', line 152, column 16 to line 154, column 3)", + " (in 'string', line 152, column 2 to line 154, column 3)", + " (in 'string', line 156, column 4 to column 26)", + " (in 'string', line 157, column 4 to column 29)", + " (in 'string', line 155, column 20 to line 158, column 3)", + " (in 'string', line 155, column 2 to line 158, column 3)", + " (in 'string', line 160, column 4 to column 26)", + " (in 'string', line 161, column 4 to column 29)", + " (in 'string', line 159, column 26 to line 162, column 3)", + " (in 'string', line 159, column 2 to line 162, column 3)", + " (in 'string', line 164, column 4 to column 20)", + " (in 'string', line 165, column 4 to column 23)", + " (in 'string', line 163, column 22 to line 166, column 3)", + " (in 'string', line 163, column 2 to line 166, column 3)", + " (in 'string', line 169, column 9 to column 16)", + " (in 'string', line 170, column 8 to column 13)", + " (in 'string', line 171, column 8 to column 13)", + " (in 'string', line 175, column 9 to column 10)", + " (in 'string', line 176, column 9 to column 10)", + " (in 'string', line 176, column 12 to column 13)", + " (in 'string', line 177, column 9 to column 10)", + " (in 'string', line 178, column 9 to column 10)", + " (in 'string', line 207, column 9 to column 25)", + " (in 'string', line 208, column 9 to column 10)", + " (in 'string', line 208, column 12 to column 28)", + " (in 'string', line 209, column 9 to column 14)", + " (in 'string', line 209, column 16 to column 32)", + " (in 'string', line 210, column 9 to column 25)", + " (in 'string', line 9, column 4 to column 23)", + " (in 'string', line 10, column 4 to column 20)", + " (in 'string', line 11, column 4 to column 21)", + " (in 'string', line 12, column 11 to column 12)", + " (in 'string', line 12, column 4 to column 58)", + " (in 'string', line 14, column 11 to column 12)", + " (in 'string', line 14, column 4 to column 21)", + " (in 'string', line 15, column 11 to column 12)", + " (in 'string', line 15, column 14 to column 15)", + " (in 'string', line 15, column 4 to column 24)", + " (in 'string', line 17, column 4 to column 30)", + " (in 'string', line 20, column 6 to column 68)", + " (in 'string', line 32, column 8 to column 19)", + " (in 'string', line 33, column 8 to column 34)", + " (in 'string', line 35, column 10 to column 30)", + " (in 'string', line 34, column 23 to line 36, column 9)", + " (in 'string', line 34, column 8 to line 36, column 9)", + " (in 'string', line 31, column 13 to line 37, column 7)", + " (in 'string', line 23, column 8 to column 59)", + " (in 'string', line 24, column 15 to column 16)", + " (in 'string', line 24, column 8 to column 50)", + " (in 'string', line 25, column 8 to column 29)", + " (in 'string', line 26, column 8 to column 47)", + " (in 'string', line 28, column 10 to column 30)", + " (in 'string', line 27, column 23 to line 29, column 9)", + " (in 'string', line 27, column 8 to line 29, column 9)", + " (in 'string', line 30, column 8 to column 57)", + " (in 'string', line 22, column 26 to line 31, column 7)", + " (in 'string', line 22, column 6 to line 37, column 7)", + " (in 'string', line 19, column 19 to line 38, column 5)", + " (in 'string', line 19, column 4 to line 38, column 5)", + " (in 'string', line 39, column 4 to column 18)", + " (in 'string', line 7, column 54 to line 41, column 3)", + " (in 'string', line 46, column 4 to column 23)", + " (in 'string', line 47, column 4 to column 20)", + " (in 'string', line 48, column 4 to column 21)", + " (in 'string', line 49, column 11 to column 12)", + " (in 'string', line 49, column 4 to column 21)", + " (in 'string', line 50, column 11 to column 12)", + " (in 'string', line 50, column 14 to column 15)", + " (in 'string', line 50, column 4 to column 24)", + " (in 'string', line 51, column 11 to column 12)", + " (in 'string', line 51, column 4 to column 16)", + " (in 'string', line 52, column 11 to column 12)", + " (in 'string', line 52, column 4 to column 16)", + " (in 'string', line 53, column 11 to column 12)", + " (in 'string', line 53, column 14 to column 15)", + " (in 'string', line 53, column 4 to column 19)", + " (in 'string', line 54, column 11 to column 12)", + " (in 'string', line 54, column 14 to column 19)", + " (in 'string', line 54, column 4 to column 23)", + " (in 'string', line 55, column 11 to column 12)", + " (in 'string', line 55, column 4 to column 19)", + " (in 'string', line 59, column 6 to column 66)", + " (in 'string', line 70, column 8 to column 19)", + " (in 'string', line 71, column 8 to column 34)", + " (in 'string', line 73, column 10 to column 30)", + " (in 'string', line 72, column 23 to line 74, column 9)", + " (in 'string', line 72, column 8 to line 74, column 9)", + " (in 'string', line 69, column 13 to line 75, column 7)", + " (in 'string', line 62, column 8 to column 57)", + " (in 'string', line 63, column 8 to column 48)", + " (in 'string', line 64, column 8 to column 36)", + " (in 'string', line 65, column 8 to column 58)", + " (in 'string', line 67, column 10 to column 30)", + " (in 'string', line 66, column 23 to line 68, column 9)", + " (in 'string', line 66, column 8 to line 68, column 9)", + " (in 'string', line 61, column 44 to line 69, column 7)", + " (in 'string', line 61, column 6 to line 75, column 7)", + " (in 'string', line 57, column 19 to line 76, column 5)", + " (in 'string', line 57, column 4 to line 76, column 5)", + " (in 'string', line 78, column 4 to column 33)", + " (in 'string', line 80, column 6 to column 25)", + " (in 'string', line 81, column 13 to column 14)", + " (in 'string', line 81, column 6 to column 31)", + " (in 'string', line 87, column 8 to column 26)", + " (in 'string', line 86, column 13 to line 88, column 7)", + " (in 'string', line 83, column 15 to column 16)", + " (in 'string', line 83, column 8 to column 44)", + " (in 'string', line 84, column 8 to column 30)", + " (in 'string', line 85, column 8 to column 71)", + " (in 'string', line 82, column 43 to line 86, column 7)", + " (in 'string', line 82, column 6 to line 88, column 7)", + " (in 'string', line 79, column 20 to line 89, column 5)", + " (in 'string', line 79, column 4 to line 89, column 5)", + " (in 'string', line 91, column 4 to column 17)", + " (in 'string', line 92, column 4 to column 27)", + " (in 'string', line 94, column 13 to column 14)", + " (in 'string', line 94, column 6 to column 30)", + " (in 'string', line 95, column 13 to column 14)", + " (in 'string', line 95, column 6 to column 29)", + " (in 'string', line 96, column 6 to column 41)", + " (in 'string', line 93, column 19 to line 97, column 5)", + " (in 'string', line 93, column 4 to line 97, column 5)", + " (in 'string', line 98, column 4 to column 23)", + " (in 'string', line 44, column 53 to line 99, column 3)"}; +template , + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t, stan::base_type_t, T4__, + stan::base_type_t, + stan::promote_args_t, + stan::base_type_t, stan::base_type_t>>,-1,1> +gaussian_filter(const T0__& y_arg__, const std::vector& y_miss, + const T2__& a1_arg__, const T3__& P1_arg__, const T4__& Ht, + const T5__& Tt_arg__, const T6__& Rt_arg__, const T7__& + xreg_arg__, const T8__& gamma2_y_arg__, std::ostream* + pstream__); +template , + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t, stan::base_type_t, T4__, + stan::base_type_t, + stan::promote_args_t, + stan::base_type_t, stan::base_type_t>>,-1,-1> +gaussian_smoother(const T0__& y_arg__, const std::vector& y_miss, + const T2__& a1_arg__, const T3__& P1_arg__, const T4__& Ht, + const T5__& Tt_arg__, const T6__& Rt_arg__, const T7__& + xreg_arg__, const T8__& gamma2_y_arg__, std::ostream* + pstream__); template -Eigen::Matrix, stan::value_type_t, -stan::value_type_t, T4__, -stan::value_type_t, stan::promote_args_t, -stan::value_type_t, -stan::value_type_t>>, -1, 1> + typename T5__, typename T6__, typename T7__, typename T8__, + stan::require_all_t, + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex>*> +Eigen::Matrix, + stan::base_type_t, stan::base_type_t, T4__, + stan::base_type_t, + stan::promote_args_t, + stan::base_type_t, stan::base_type_t>>,-1,1> gaussian_filter(const T0__& y_arg__, const std::vector& y_miss, const T2__& a1_arg__, const T3__& P1_arg__, const T4__& Ht, - const T5__& Tt_arg__, const T6__& Rt_arg__, - const T7__& xreg_arg__, const T8__& gamma2_y_arg__, - std::ostream* pstream__) { - using local_scalar_t__ = stan::promote_args_t, - stan::value_type_t, - stan::value_type_t, - T4__, - stan::value_type_t, stan::promote_args_t, - stan::value_type_t, - stan::value_type_t>>; - const auto& y = to_ref(y_arg__); - const auto& a1 = to_ref(a1_arg__); - const auto& P1 = to_ref(P1_arg__); - const auto& Tt = to_ref(Tt_arg__); - const auto& Rt = to_ref(Rt_arg__); - const auto& xreg = to_ref(xreg_arg__); - const auto& gamma2_y = to_ref(gamma2_y_arg__); - const static bool propto__ = true; + const T5__& Tt_arg__, const T6__& Rt_arg__, const T7__& + xreg_arg__, const T8__& gamma2_y_arg__, std::ostream* + pstream__) { + using local_scalar_t__ = stan::promote_args_t, + stan::base_type_t, + stan::base_type_t, T4__, + stan::base_type_t, + stan::promote_args_t, + stan::base_type_t, + stan::base_type_t>>; + int current_statement__ = 0; + const auto& y = stan::math::to_ref(y_arg__); + const auto& a1 = stan::math::to_ref(a1_arg__); + const auto& P1 = stan::math::to_ref(P1_arg__); + const auto& Tt = stan::math::to_ref(Tt_arg__); + const auto& Rt = stan::math::to_ref(Rt_arg__); + const auto& xreg = stan::math::to_ref(xreg_arg__); + const auto& gamma2_y = stan::math::to_ref(gamma2_y_arg__); + static constexpr bool propto__ = true; + // suppress unused var warning (void) propto__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; try { - int k; - k = std::numeric_limits::min(); - + int k = std::numeric_limits::min(); current_statement__ = 153; - k = rows(xreg); - int n; - n = std::numeric_limits::min(); - + k = stan::math::rows(xreg); + int n = std::numeric_limits::min(); current_statement__ = 154; - n = rows(y); - int m; - m = std::numeric_limits::min(); - + n = stan::math::rows(y); + int m = std::numeric_limits::min(); current_statement__ = 155; - m = rows(a1); + m = stan::math::rows(a1); current_statement__ = 156; - validate_non_negative_index("loglik", "n", n); - Eigen::Matrix loglik; - loglik = Eigen::Matrix(n); - stan::math::fill(loglik, DUMMY_VAR__); - + stan::math::validate_non_negative_index("loglik", "n", n); + Eigen::Matrix loglik = + Eigen::Matrix::Constant(n, DUMMY_VAR__); current_statement__ = 157; - assign(loglik, nil_index_list(), - rep_vector(stan::math::negative_infinity(), n), + stan::model::assign(loglik, + stan::math::rep_vector(stan::math::negative_infinity(), n), "assigning variable loglik"); current_statement__ = 158; - validate_non_negative_index("x", "m", m); - Eigen::Matrix x; - x = Eigen::Matrix(m); - stan::math::fill(x, DUMMY_VAR__); - + stan::math::validate_non_negative_index("x", "m", m); + Eigen::Matrix x = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 159; - assign(x, nil_index_list(), a1, "assigning variable x"); + stan::model::assign(x, a1, "assigning variable x"); current_statement__ = 160; - validate_non_negative_index("P", "m", m); + stan::math::validate_non_negative_index("P", "m", m); current_statement__ = 161; - validate_non_negative_index("P", "m", m); - Eigen::Matrix P; - P = Eigen::Matrix(m, m); - stan::math::fill(P, DUMMY_VAR__); - + stan::math::validate_non_negative_index("P", "m", m); + Eigen::Matrix P = + Eigen::Matrix::Constant(m, m, DUMMY_VAR__); current_statement__ = 162; - assign(P, nil_index_list(), P1, "assigning variable P"); - local_scalar_t__ log2pi; - log2pi = DUMMY_VAR__; - + stan::model::assign(P, P1, "assigning variable P"); + local_scalar_t__ log2pi = DUMMY_VAR__; current_statement__ = 163; log2pi = stan::math::log((2 * stan::math::pi())); current_statement__ = 183; for (int t = 1; t <= n; ++t) { - local_scalar_t__ F; - F = DUMMY_VAR__; - + local_scalar_t__ F = DUMMY_VAR__; current_statement__ = 164; - F = (quad_form( - rvalue(P, - cons_list(index_min_max(1, k), - cons_list(index_min_max(1, k), nil_index_list())), "P"), - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg")) + - (gamma2_y[(t - 1)] * Ht)); + F = (stan::math::quad_form( + stan::model::rvalue(P, "P", stan::model::index_min_max(1, k), + stan::model::index_min_max(1, k)), + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t))) + + + (stan::model::rvalue(gamma2_y, "gamma2_y", stan::model::index_uni(t)) + * Ht)); current_statement__ = 181; - if (logical_eq(y_miss[(t - 1)], 0)) { - local_scalar_t__ v; - v = DUMMY_VAR__; - + if (stan::math::logical_eq( + stan::model::rvalue(y_miss, "y_miss", stan::model::index_uni(t)), + 0)) { + local_scalar_t__ v = DUMMY_VAR__; current_statement__ = 171; - v = (y[(t - 1)] - - dot_product( - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg"), - head(x, k))); + v = (stan::model::rvalue(y, "y", stan::model::index_uni(t)) - + stan::math::dot_product( + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t)), stan::math::head(x, k))); current_statement__ = 172; - validate_non_negative_index("K", "m", m); - Eigen::Matrix K; - K = Eigen::Matrix(m); - stan::math::fill(K, DUMMY_VAR__); - + stan::math::validate_non_negative_index("K", "m", m); + Eigen::Matrix K = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 173; - assign(K, nil_index_list(), - divide( - multiply( - rvalue(P, - cons_list(index_min_max(1, m), - cons_list(index_min_max(1, k), nil_index_list())), "P"), - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg")), F), - "assigning variable K"); + stan::model::assign(K, + stan::math::divide( + stan::math::multiply( + stan::model::rvalue(P, "P", stan::model::index_min_max(1, m), + stan::model::index_min_max(1, k)), + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t))), F), "assigning variable K"); current_statement__ = 174; - assign(x, nil_index_list(), - multiply(Tt, add(stan::model::deep_copy(x), multiply(K, v))), - "assigning variable x"); + stan::model::assign(x, + stan::math::multiply(Tt, + stan::math::add(stan::model::deep_copy(x), + stan::math::multiply(K, v))), "assigning variable x"); current_statement__ = 175; - assign(P, nil_index_list(), - quad_form_sym( - subtract(stan::model::deep_copy(P), - multiply(multiply(K, transpose(K)), F)), transpose(Tt)), - "assigning variable P"); + stan::model::assign(P, + stan::math::quad_form_sym( + stan::math::subtract(stan::model::deep_copy(P), + stan::math::multiply( + stan::math::multiply(K, stan::math::transpose(K)), F)), + stan::math::transpose(Tt)), "assigning variable P"); current_statement__ = 178; for (int i = 1; i <= m; ++i) { current_statement__ = 176; - assign(P, - cons_list(index_uni(i), - cons_list(index_uni(i), nil_index_list())), - (rvalue(P, - cons_list(index_uni(i), - cons_list(index_uni(i), nil_index_list())), "P") + - rvalue(Rt, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "Rt")), - "assigning variable P");} + stan::model::assign(P, + (stan::model::rvalue(P, "P", stan::model::index_uni(i), + stan::model::index_uni(i)) + + stan::model::rvalue(Rt, "Rt", stan::model::index_uni(i), + stan::model::index_uni(t))), "assigning variable P", + stan::model::index_uni(i), stan::model::index_uni(i)); + } current_statement__ = 179; - assign(loglik, cons_list(index_uni(t), nil_index_list()), - (-0.5 * ((log2pi + stan::math::log(F)) + ((v * v) / F))), - "assigning variable loglik"); + stan::model::assign(loglik, (-0.5 * ((log2pi + stan::math::log(F)) + + ((v * v) / F))), "assigning variable loglik", + stan::model::index_uni(t)); } else { current_statement__ = 165; - assign(x, nil_index_list(), multiply(Tt, stan::model::deep_copy(x)), + stan::model::assign(x, + stan::math::multiply(Tt, stan::model::deep_copy(x)), "assigning variable x"); current_statement__ = 166; - assign(P, nil_index_list(), - quad_form_sym(stan::model::deep_copy(P), transpose(Tt)), - "assigning variable P"); + stan::model::assign(P, + stan::math::quad_form_sym(stan::model::deep_copy(P), + stan::math::transpose(Tt)), "assigning variable P"); current_statement__ = 169; for (int i = 1; i <= m; ++i) { current_statement__ = 167; - assign(P, - cons_list(index_uni(i), - cons_list(index_uni(i), nil_index_list())), - (rvalue(P, - cons_list(index_uni(i), - cons_list(index_uni(i), nil_index_list())), "P") + - rvalue(Rt, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "Rt")), - "assigning variable P");} - }} + stan::model::assign(P, + (stan::model::rvalue(P, "P", stan::model::index_uni(i), + stan::model::index_uni(i)) + + stan::model::rvalue(Rt, "Rt", stan::model::index_uni(i), + stan::model::index_uni(t))), "assigning variable P", + stan::model::index_uni(i), stan::model::index_uni(i)); + } + } + } current_statement__ = 184; return loglik; } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } - } -struct gaussian_filter_functor__ { template -Eigen::Matrix, stan::value_type_t, -stan::value_type_t, T4__, -stan::value_type_t, stan::promote_args_t, -stan::value_type_t, -stan::value_type_t>>, -1, 1> -operator()(const T0__& y, const std::vector& y_miss, const T2__& a1, - const T3__& P1, const T4__& Ht, const T5__& Tt, const T6__& Rt, - const T7__& xreg, const T8__& gamma2_y, std::ostream* pstream__) const -{ -return gaussian_filter(y, y_miss, a1, P1, Ht, Tt, Rt, xreg, gamma2_y, - pstream__); -} -}; -template -Eigen::Matrix, stan::value_type_t, -stan::value_type_t, T4__, -stan::value_type_t, stan::promote_args_t, -stan::value_type_t, -stan::value_type_t>>, -1, -1> + typename T5__, typename T6__, typename T7__, typename T8__, + stan::require_all_t, + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex>*> +Eigen::Matrix, + stan::base_type_t, stan::base_type_t, T4__, + stan::base_type_t, + stan::promote_args_t, + stan::base_type_t, stan::base_type_t>>,-1,-1> gaussian_smoother(const T0__& y_arg__, const std::vector& y_miss, const T2__& a1_arg__, const T3__& P1_arg__, const T4__& Ht, - const T5__& Tt_arg__, const T6__& Rt_arg__, - const T7__& xreg_arg__, const T8__& gamma2_y_arg__, - std::ostream* pstream__) { - using local_scalar_t__ = stan::promote_args_t, - stan::value_type_t, - stan::value_type_t, - T4__, - stan::value_type_t, stan::promote_args_t, - stan::value_type_t, - stan::value_type_t>>; - const auto& y = to_ref(y_arg__); - const auto& a1 = to_ref(a1_arg__); - const auto& P1 = to_ref(P1_arg__); - const auto& Tt = to_ref(Tt_arg__); - const auto& Rt = to_ref(Rt_arg__); - const auto& xreg = to_ref(xreg_arg__); - const auto& gamma2_y = to_ref(gamma2_y_arg__); - const static bool propto__ = true; + const T5__& Tt_arg__, const T6__& Rt_arg__, const T7__& + xreg_arg__, const T8__& gamma2_y_arg__, std::ostream* + pstream__) { + using local_scalar_t__ = stan::promote_args_t, + stan::base_type_t, + stan::base_type_t, T4__, + stan::base_type_t, + stan::promote_args_t, + stan::base_type_t, + stan::base_type_t>>; + int current_statement__ = 0; + const auto& y = stan::math::to_ref(y_arg__); + const auto& a1 = stan::math::to_ref(a1_arg__); + const auto& P1 = stan::math::to_ref(P1_arg__); + const auto& Tt = stan::math::to_ref(Tt_arg__); + const auto& Rt = stan::math::to_ref(Rt_arg__); + const auto& xreg = stan::math::to_ref(xreg_arg__); + const auto& gamma2_y = stan::math::to_ref(gamma2_y_arg__); + static constexpr bool propto__ = true; + // suppress unused var warning (void) propto__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; try { - int k; - k = std::numeric_limits::min(); - + int k = std::numeric_limits::min(); current_statement__ = 186; - k = rows(xreg); - int n; - n = std::numeric_limits::min(); - + k = stan::math::rows(xreg); + int n = std::numeric_limits::min(); current_statement__ = 187; - n = rows(y); - int m; - m = std::numeric_limits::min(); - + n = stan::math::rows(y); + int m = std::numeric_limits::min(); current_statement__ = 188; - m = rows(a1); + m = stan::math::rows(a1); current_statement__ = 189; - validate_non_negative_index("x", "m", m); - Eigen::Matrix x; - x = Eigen::Matrix(m); - stan::math::fill(x, DUMMY_VAR__); - + stan::math::validate_non_negative_index("x", "m", m); + Eigen::Matrix x = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 190; - assign(x, nil_index_list(), a1, "assigning variable x"); + stan::model::assign(x, a1, "assigning variable x"); current_statement__ = 191; - validate_non_negative_index("P", "m", m); + stan::math::validate_non_negative_index("P", "m", m); current_statement__ = 192; - validate_non_negative_index("P", "m", m); - Eigen::Matrix P; - P = Eigen::Matrix(m, m); - stan::math::fill(P, DUMMY_VAR__); - + stan::math::validate_non_negative_index("P", "m", m); + Eigen::Matrix P = + Eigen::Matrix::Constant(m, m, DUMMY_VAR__); current_statement__ = 193; - assign(P, nil_index_list(), P1, "assigning variable P"); + stan::model::assign(P, P1, "assigning variable P"); current_statement__ = 194; - validate_non_negative_index("v", "n", n); - Eigen::Matrix v; - v = Eigen::Matrix(n); - stan::math::fill(v, DUMMY_VAR__); - + stan::math::validate_non_negative_index("v", "n", n); + Eigen::Matrix v = + Eigen::Matrix::Constant(n, DUMMY_VAR__); current_statement__ = 196; - validate_non_negative_index("F", "n", n); - Eigen::Matrix F; - F = Eigen::Matrix(n); - stan::math::fill(F, DUMMY_VAR__); - + stan::math::validate_non_negative_index("F", "n", n); + Eigen::Matrix F = + Eigen::Matrix::Constant(n, DUMMY_VAR__); current_statement__ = 198; - validate_non_negative_index("K", "m", m); + stan::math::validate_non_negative_index("K", "m", m); current_statement__ = 199; - validate_non_negative_index("K", "n", n); - Eigen::Matrix K; - K = Eigen::Matrix(m, n); - stan::math::fill(K, DUMMY_VAR__); - + stan::math::validate_non_negative_index("K", "n", n); + Eigen::Matrix K = + Eigen::Matrix::Constant(m, n, DUMMY_VAR__); current_statement__ = 201; - validate_non_negative_index("r", "m", m); + stan::math::validate_non_negative_index("r", "m", m); current_statement__ = 202; - validate_non_negative_index("r", "n + 1", (n + 1)); - Eigen::Matrix r; - r = Eigen::Matrix(m, (n + 1)); - stan::math::fill(r, DUMMY_VAR__); - + stan::math::validate_non_negative_index("r", "n + 1", (n + 1)); + Eigen::Matrix r = + Eigen::Matrix::Constant(m, (n + 1), + DUMMY_VAR__); current_statement__ = 204; - validate_non_negative_index("tmpr", "m", m); - Eigen::Matrix tmpr; - tmpr = Eigen::Matrix(m); - stan::math::fill(tmpr, DUMMY_VAR__); - + stan::math::validate_non_negative_index("tmpr", "m", m); + Eigen::Matrix tmpr = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 223; for (int t = 1; t <= n; ++t) { current_statement__ = 206; - assign(F, cons_list(index_uni(t), nil_index_list()), - (quad_form( - rvalue(P, - cons_list(index_min_max(1, k), - cons_list(index_min_max(1, k), nil_index_list())), "P"), - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg")) + - (gamma2_y[(t - 1)] * Ht)), "assigning variable F"); + stan::model::assign(F, + (stan::math::quad_form( + stan::model::rvalue(P, "P", stan::model::index_min_max(1, k), + stan::model::index_min_max(1, k)), + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t))) + + (stan::model::rvalue(gamma2_y, "gamma2_y", stan::model::index_uni(t)) + * Ht)), "assigning variable F", stan::model::index_uni(t)); current_statement__ = 221; - if ((primitive_value(logical_eq(y_miss[(t - 1)], 0)) && - primitive_value(logical_gt(F[(t - 1)], 1.0e-12)))) { + if ((stan::math::primitive_value( + stan::math::logical_eq( + stan::model::rvalue(y_miss, "y_miss", + stan::model::index_uni(t)), 0)) + && + stan::math::primitive_value( + stan::math::logical_gt( + stan::model::rvalue(F, "F", stan::model::index_uni(t)), 1.0e-12)))) { current_statement__ = 213; - assign(v, cons_list(index_uni(t), nil_index_list()), - (y[(t - 1)] - - dot_product( - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg"), - head(x, k))), "assigning variable v"); + stan::model::assign(v, + (stan::model::rvalue(y, "y", stan::model::index_uni(t)) - + stan::math::dot_product( + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t)), stan::math::head(x, k))), + "assigning variable v", stan::model::index_uni(t)); current_statement__ = 214; - assign(K, - cons_list(index_omni(), cons_list(index_uni(t), nil_index_list())), - divide( - multiply( - rvalue(P, - cons_list(index_min_max(1, m), - cons_list(index_min_max(1, k), nil_index_list())), "P"), - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg")), - F[(t - 1)]), "assigning variable K"); + stan::model::assign(K, + stan::math::divide( + stan::math::multiply( + stan::model::rvalue(P, "P", stan::model::index_min_max(1, m), + stan::model::index_min_max(1, k)), + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t))), + stan::model::rvalue(F, "F", stan::model::index_uni(t))), + "assigning variable K", stan::model::index_omni(), + stan::model::index_uni(t)); current_statement__ = 215; - assign(x, nil_index_list(), - multiply(Tt, - add(stan::model::deep_copy(x), - multiply( - rvalue(K, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "K"), - v[(t - 1)]))), "assigning variable x"); + stan::model::assign(x, + stan::math::multiply(Tt, + stan::math::add(stan::model::deep_copy(x), + stan::math::multiply( + stan::model::rvalue(K, "K", stan::model::index_omni(), + stan::model::index_uni(t)), + stan::model::rvalue(v, "v", stan::model::index_uni(t))))), + "assigning variable x"); current_statement__ = 216; - assign(P, nil_index_list(), - quad_form_sym( - subtract(stan::model::deep_copy(P), - multiply( - multiply( - rvalue(K, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "K"), - transpose( - rvalue(K, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "K"))), - F[(t - 1)])), transpose(Tt)), "assigning variable P"); + stan::model::assign(P, + stan::math::quad_form_sym( + stan::math::subtract(stan::model::deep_copy(P), + stan::math::multiply( + stan::math::multiply( + stan::model::rvalue(K, "K", stan::model::index_omni(), + stan::model::index_uni(t)), + stan::math::transpose( + stan::model::rvalue(K, "K", stan::model::index_omni(), + stan::model::index_uni(t)))), + stan::model::rvalue(F, "F", stan::model::index_uni(t)))), + stan::math::transpose(Tt)), "assigning variable P"); current_statement__ = 219; for (int i = 1; i <= m; ++i) { current_statement__ = 217; - assign(P, - cons_list(index_uni(i), - cons_list(index_uni(i), nil_index_list())), - (rvalue(P, - cons_list(index_uni(i), - cons_list(index_uni(i), nil_index_list())), "P") + - rvalue(Rt, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "Rt")), - "assigning variable P");} + stan::model::assign(P, + (stan::model::rvalue(P, "P", stan::model::index_uni(i), + stan::model::index_uni(i)) + + stan::model::rvalue(Rt, "Rt", stan::model::index_uni(i), + stan::model::index_uni(t))), "assigning variable P", + stan::model::index_uni(i), stan::model::index_uni(i)); + } } else { current_statement__ = 207; - assign(x, nil_index_list(), multiply(Tt, stan::model::deep_copy(x)), + stan::model::assign(x, + stan::math::multiply(Tt, stan::model::deep_copy(x)), "assigning variable x"); current_statement__ = 208; - assign(P, nil_index_list(), - quad_form_sym(stan::model::deep_copy(P), transpose(Tt)), - "assigning variable P"); + stan::model::assign(P, + stan::math::quad_form_sym(stan::model::deep_copy(P), + stan::math::transpose(Tt)), "assigning variable P"); current_statement__ = 211; for (int i = 1; i <= m; ++i) { current_statement__ = 209; - assign(P, - cons_list(index_uni(i), - cons_list(index_uni(i), nil_index_list())), - (rvalue(P, - cons_list(index_uni(i), - cons_list(index_uni(i), nil_index_list())), "P") + - rvalue(Rt, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "Rt")), - "assigning variable P");} - }} + stan::model::assign(P, + (stan::model::rvalue(P, "P", stan::model::index_uni(i), + stan::model::index_uni(i)) + + stan::model::rvalue(Rt, "Rt", stan::model::index_uni(i), + stan::model::index_uni(t))), "assigning variable P", + stan::model::index_uni(i), stan::model::index_uni(i)); + } + } + } current_statement__ = 224; - assign(r, - cons_list(index_omni(), - cons_list(index_uni((n + 1)), nil_index_list())), rep_vector(0.0, m), - "assigning variable r"); + stan::model::assign(r, stan::math::rep_vector(0.0, m), + "assigning variable r", stan::model::index_omni(), + stan::model::index_uni((n + 1))); current_statement__ = 237; for (int tt = 1; tt <= n; ++tt) { - int t; - t = std::numeric_limits::min(); - + int t = std::numeric_limits::min(); current_statement__ = 225; t = ((n + 1) - tt); current_statement__ = 226; - validate_non_negative_index("tmp", "m", m); - Eigen::Matrix tmp; - tmp = Eigen::Matrix(m); - stan::math::fill(tmp, DUMMY_VAR__); - + stan::math::validate_non_negative_index("tmp", "m", m); + Eigen::Matrix tmp = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 227; - assign(tmp, nil_index_list(), - rvalue(r, - cons_list(index_omni(), - cons_list(index_uni((t + 1)), nil_index_list())), "r"), - "assigning variable tmp"); + stan::model::assign(tmp, + stan::model::rvalue(r, "r", stan::model::index_omni(), + stan::model::index_uni((t + 1))), "assigning variable tmp"); current_statement__ = 235; - if ((primitive_value(logical_eq(y_miss[(t - 1)], 0)) && - primitive_value(logical_gt(F[(t - 1)], 1.0e-12)))) { + if ((stan::math::primitive_value( + stan::math::logical_eq( + stan::model::rvalue(y_miss, "y_miss", + stan::model::index_uni(t)), 0)) + && + stan::math::primitive_value( + stan::math::logical_gt( + stan::model::rvalue(F, "F", stan::model::index_uni(t)), 1.0e-12)))) { current_statement__ = 230; - validate_non_negative_index("tmp2", "m", m); - Eigen::Matrix tmp2; - tmp2 = Eigen::Matrix(m); - stan::math::fill(tmp2, DUMMY_VAR__); - + stan::math::validate_non_negative_index("tmp2", "m", m); + Eigen::Matrix tmp2 = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 231; - assign(tmp2, nil_index_list(), rep_vector(0.0, m), + stan::model::assign(tmp2, stan::math::rep_vector(0.0, m), "assigning variable tmp2"); current_statement__ = 232; - assign(tmp2, cons_list(index_min_max(1, k), nil_index_list()), - rvalue(xreg, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg"), - "assigning variable tmp2"); + stan::model::assign(tmp2, + stan::model::rvalue(xreg, "xreg", stan::model::index_omni(), + stan::model::index_uni(t)), "assigning variable tmp2", + stan::model::index_min_max(1, k)); current_statement__ = 233; - assign(r, - cons_list(index_omni(), cons_list(index_uni(t), nil_index_list())), - add(divide(multiply(tmp2, v[(t - 1)]), F[(t - 1)]), - multiply( - transpose( - subtract(Tt, - multiply( - multiply(Tt, - rvalue(K, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "K")), - transpose(tmp2)))), tmp)), "assigning variable r"); + stan::model::assign(r, + stan::math::add( + stan::math::divide( + stan::math::multiply(tmp2, + stan::model::rvalue(v, "v", stan::model::index_uni(t))), + stan::model::rvalue(F, "F", stan::model::index_uni(t))), + stan::math::multiply( + stan::math::transpose( + stan::math::subtract(Tt, + stan::math::multiply( + stan::math::multiply(Tt, + stan::model::rvalue(K, "K", stan::model::index_omni(), + stan::model::index_uni(t))), + stan::math::transpose(tmp2)))), tmp)), + "assigning variable r", stan::model::index_omni(), + stan::model::index_uni(t)); } else { current_statement__ = 228; - assign(r, - cons_list(index_omni(), cons_list(index_uni(t), nil_index_list())), - multiply(transpose(Tt), tmp), "assigning variable r"); - }} + stan::model::assign(r, + stan::math::multiply(stan::math::transpose(Tt), tmp), + "assigning variable r", stan::model::index_omni(), + stan::model::index_uni(t)); + } + } current_statement__ = 238; - assign(tmpr, nil_index_list(), - rvalue(r, - cons_list(index_omni(), cons_list(index_uni(1), nil_index_list())), - "r"), "assigning variable tmpr"); + stan::model::assign(tmpr, + stan::model::rvalue(r, "r", stan::model::index_omni(), + stan::model::index_uni(1)), "assigning variable tmpr"); current_statement__ = 239; - assign(r, - cons_list(index_omni(), cons_list(index_uni(1), nil_index_list())), - add(a1, multiply(P1, tmpr)), "assigning variable r"); + stan::model::assign(r, + stan::math::add(a1, stan::math::multiply(P1, tmpr)), + "assigning variable r", stan::model::index_omni(), + stan::model::index_uni(1)); current_statement__ = 246; for (int t = 2; t <= n; ++t) { current_statement__ = 240; - validate_non_negative_index("tmp", "m", m); - Eigen::Matrix tmp; - tmp = Eigen::Matrix(m); - stan::math::fill(tmp, DUMMY_VAR__); - + stan::math::validate_non_negative_index("tmp", "m", m); + Eigen::Matrix tmp = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 241; - assign(tmp, nil_index_list(), - rvalue(r, - cons_list(index_omni(), - cons_list(index_uni((t - 1)), nil_index_list())), "r"), - "assigning variable tmp"); + stan::model::assign(tmp, + stan::model::rvalue(r, "r", stan::model::index_omni(), + stan::model::index_uni((t - 1))), "assigning variable tmp"); current_statement__ = 242; - validate_non_negative_index("tmp2", "m", m); - Eigen::Matrix tmp2; - tmp2 = Eigen::Matrix(m); - stan::math::fill(tmp2, DUMMY_VAR__); - + stan::math::validate_non_negative_index("tmp2", "m", m); + Eigen::Matrix tmp2 = + Eigen::Matrix::Constant(m, DUMMY_VAR__); current_statement__ = 243; - assign(tmp2, nil_index_list(), - rvalue(r, - cons_list(index_omni(), cons_list(index_uni(t), nil_index_list())), - "r"), "assigning variable tmp2"); + stan::model::assign(tmp2, + stan::model::rvalue(r, "r", stan::model::index_omni(), + stan::model::index_uni(t)), "assigning variable tmp2"); current_statement__ = 244; - assign(r, - cons_list(index_omni(), cons_list(index_uni(t), nil_index_list())), - add(multiply(Tt, tmp), - elt_multiply( - rvalue(Rt, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "Rt"), tmp2)), - "assigning variable r");} + stan::model::assign(r, + stan::math::add(stan::math::multiply(Tt, tmp), + stan::math::elt_multiply( + stan::model::rvalue(Rt, "Rt", stan::model::index_omni(), + stan::model::index_uni(t)), tmp2)), "assigning variable r", + stan::model::index_omni(), stan::model::index_uni(t)); + } current_statement__ = 247; - return rvalue(r, - cons_list(index_min_max(1, m), - cons_list(index_min_max(1, n), nil_index_list())), "r"); + return stan::model::rvalue(r, "r", stan::model::index_min_max(1, m), + stan::model::index_min_max(1, n)); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } - } -struct gaussian_smoother_functor__ { -template -Eigen::Matrix, stan::value_type_t, -stan::value_type_t, T4__, -stan::value_type_t, stan::promote_args_t, -stan::value_type_t, -stan::value_type_t>>, -1, -1> -operator()(const T0__& y, const std::vector& y_miss, const T2__& a1, - const T3__& P1, const T4__& Ht, const T5__& Tt, const T6__& Rt, - const T7__& xreg, const T8__& gamma2_y, std::ostream* pstream__) const -{ -return gaussian_smoother(y, y_miss, a1, P1, Ht, Tt, Rt, xreg, gamma2_y, - pstream__); -} -}; #include class model_walker_lm final : public model_base_crtp { private: @@ -853,9 +804,9 @@ class model_walker_lm final : public model_base_crtp { int k; int n; int n_lfo; - Eigen::Matrix xreg_fixed; - Eigen::Matrix xreg_rw; - Eigen::Matrix y; + Eigen::Matrix xreg_fixed_data__; + Eigen::Matrix xreg_rw_data__; + Eigen::Matrix y_data__; std::vector y_miss; double sigma_y_shape; double sigma_y_rate; @@ -871,131 +822,123 @@ class model_walker_lm final : public model_base_crtp { double sigma_rw2_rate; double nu_mean; double nu_sd; - Eigen::Matrix gamma_y; - Eigen::Matrix gamma_rw1; - Eigen::Matrix gamma_rw2; + Eigen::Matrix gamma_y_data__; + Eigen::Matrix gamma_rw1_data__; + Eigen::Matrix gamma_rw2_data__; std::vector obs_idx; - Eigen::Matrix a1; - Eigen::Matrix P1; - Eigen::Matrix Tt; - Eigen::Matrix gamma2_y; + Eigen::Matrix a1_data__; + Eigen::Matrix P1_data__; + Eigen::Matrix Tt_data__; + Eigen::Matrix gamma2_y_data__; int y_rep_1dim__; int beta_rw_2dim__; int nu_2dim__; int y_fit_1dim__; - + Eigen::Map> xreg_fixed{nullptr, 0, 0}; + Eigen::Map> xreg_rw{nullptr, 0, 0}; + Eigen::Map> y{nullptr, 0}; + Eigen::Map> gamma_y{nullptr, 0}; + Eigen::Map> gamma_rw1{nullptr, 0, 0}; + Eigen::Map> gamma_rw2{nullptr, 0, 0}; + Eigen::Map> a1{nullptr, 0}; + Eigen::Map> P1{nullptr, 0, 0}; + Eigen::Map> Tt{nullptr, 0, 0}; + Eigen::Map> gamma2_y{nullptr, 0}; public: - ~model_walker_lm() { } - - inline std::string model_name() const final { return "model_walker_lm"; } - inline std::vector model_compile_info() const noexcept { - return std::vector{"stanc_version = stanc3 v2.26.1-4-gd72b68b7-dirty", "stancflags = "}; - } - - - model_walker_lm(stan::io::var_context& context__, - unsigned int random_seed__ = 0, - std::ostream* pstream__ = nullptr) : model_base_crtp(0) { - using local_scalar_t__ = double ; - boost::ecuyer1988 base_rng__ = - stan::services::util::create_rng(random_seed__, 0); - (void) base_rng__; // suppress unused var warning - static const char* function__ = "model_walker_lm_namespace::model_walker_lm"; - (void) function__; // suppress unused var warning + ~model_walker_lm() {} + model_walker_lm(stan::io::var_context& context__, unsigned int + random_seed__ = 0, std::ostream* pstream__ = nullptr) + : model_base_crtp(0) { + int current_statement__ = 0; + using local_scalar_t__ = double; + boost::ecuyer1988 base_rng__ = + stan::services::util::create_rng(random_seed__, 0); + // suppress unused var warning + (void) base_rng__; + static constexpr const char* function__ = + "model_walker_lm_namespace::model_walker_lm"; + // suppress unused var warning + (void) function__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; try { - int pos__; - pos__ = std::numeric_limits::min(); - + int pos__ = std::numeric_limits::min(); pos__ = 1; current_statement__ = 65; - context__.validate_dims("data initialization","k_fixed","int", - context__.to_vec()); + context__.validate_dims("data initialization", "k_fixed", "int", + std::vector{}); k_fixed = std::numeric_limits::min(); - current_statement__ = 65; k_fixed = context__.vals_i("k_fixed")[(1 - 1)]; current_statement__ = 65; - current_statement__ = 65; - check_greater_or_equal(function__, "k_fixed", k_fixed, 0); + stan::math::check_greater_or_equal(function__, "k_fixed", k_fixed, 0); current_statement__ = 66; - context__.validate_dims("data initialization","k_rw1","int", - context__.to_vec()); + context__.validate_dims("data initialization", "k_rw1", "int", + std::vector{}); k_rw1 = std::numeric_limits::min(); - current_statement__ = 66; k_rw1 = context__.vals_i("k_rw1")[(1 - 1)]; current_statement__ = 66; - current_statement__ = 66; - check_greater_or_equal(function__, "k_rw1", k_rw1, 0); + stan::math::check_greater_or_equal(function__, "k_rw1", k_rw1, 0); current_statement__ = 67; - context__.validate_dims("data initialization","k_rw2","int", - context__.to_vec()); + context__.validate_dims("data initialization", "k_rw2", "int", + std::vector{}); k_rw2 = std::numeric_limits::min(); - current_statement__ = 67; k_rw2 = context__.vals_i("k_rw2")[(1 - 1)]; current_statement__ = 67; - current_statement__ = 67; - check_greater_or_equal(function__, "k_rw2", k_rw2, 0); + stan::math::check_greater_or_equal(function__, "k_rw2", k_rw2, 0); current_statement__ = 68; - context__.validate_dims("data initialization","m","int", - context__.to_vec()); + context__.validate_dims("data initialization", "m", "int", + std::vector{}); m = std::numeric_limits::min(); - current_statement__ = 68; m = context__.vals_i("m")[(1 - 1)]; current_statement__ = 68; - current_statement__ = 68; - check_greater_or_equal(function__, "m", m, 0); + stan::math::check_greater_or_equal(function__, "m", m, 0); current_statement__ = 69; - context__.validate_dims("data initialization","k","int", - context__.to_vec()); + context__.validate_dims("data initialization", "k", "int", + std::vector{}); k = std::numeric_limits::min(); - current_statement__ = 69; k = context__.vals_i("k")[(1 - 1)]; current_statement__ = 69; - current_statement__ = 69; - check_greater_or_equal(function__, "k", k, 0); + stan::math::check_greater_or_equal(function__, "k", k, 0); current_statement__ = 70; - context__.validate_dims("data initialization","n","int", - context__.to_vec()); + context__.validate_dims("data initialization", "n", "int", + std::vector{}); n = std::numeric_limits::min(); - current_statement__ = 70; n = context__.vals_i("n")[(1 - 1)]; current_statement__ = 70; - current_statement__ = 70; - check_greater_or_equal(function__, "n", n, 1); + stan::math::check_greater_or_equal(function__, "n", n, 1); current_statement__ = 71; - context__.validate_dims("data initialization","n_lfo","int", - context__.to_vec()); + context__.validate_dims("data initialization", "n_lfo", "int", + std::vector{}); n_lfo = std::numeric_limits::min(); - current_statement__ = 71; n_lfo = context__.vals_i("n_lfo")[(1 - 1)]; current_statement__ = 71; - current_statement__ = 71; - check_greater_or_equal(function__, "n_lfo", n_lfo, 1); + stan::math::check_greater_or_equal(function__, "n_lfo", n_lfo, 1); current_statement__ = 72; - validate_non_negative_index("xreg_fixed", "n", n); + stan::math::validate_non_negative_index("xreg_fixed", "n", n); current_statement__ = 73; - validate_non_negative_index("xreg_fixed", "k_fixed", k_fixed); + stan::math::validate_non_negative_index("xreg_fixed", "k_fixed", + k_fixed); current_statement__ = 74; - context__.validate_dims("data initialization","xreg_fixed","double", - context__.to_vec(n, k_fixed)); - xreg_fixed = Eigen::Matrix(n, k_fixed); - stan::math::fill(xreg_fixed, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "xreg_fixed", "double", + std::vector{static_cast(n), + static_cast(k_fixed)}); + xreg_fixed_data__ = Eigen::Matrix::Constant(n, k_fixed, + std::numeric_limits::quiet_NaN()); + new (&xreg_fixed) + Eigen::Map>(xreg_fixed_data__.data(), n, + k_fixed); { std::vector xreg_fixed_flat__; current_statement__ = 74; - assign(xreg_fixed_flat__, nil_index_list(), - context__.vals_r("xreg_fixed"), - "assigning variable xreg_fixed_flat__"); + xreg_fixed_flat__ = context__.vals_r("xreg_fixed"); current_statement__ = 74; pos__ = 1; current_statement__ = 74; @@ -1003,28 +946,29 @@ class model_walker_lm final : public model_base_crtp { current_statement__ = 74; for (int sym2__ = 1; sym2__ <= n; ++sym2__) { current_statement__ = 74; - assign(xreg_fixed, - cons_list(index_uni(sym2__), - cons_list(index_uni(sym1__), nil_index_list())), - xreg_fixed_flat__[(pos__ - 1)], "assigning variable xreg_fixed"); + stan::model::assign(xreg_fixed, xreg_fixed_flat__[(pos__ - 1)], + "assigning variable xreg_fixed", + stan::model::index_uni(sym2__), stan::model::index_uni(sym1__)); current_statement__ = 74; - pos__ = (pos__ + 1);}} + pos__ = (pos__ + 1); + } + } } current_statement__ = 75; - validate_non_negative_index("xreg_rw", "k", k); + stan::math::validate_non_negative_index("xreg_rw", "k", k); current_statement__ = 76; - validate_non_negative_index("xreg_rw", "n", n); + stan::math::validate_non_negative_index("xreg_rw", "n", n); current_statement__ = 77; - context__.validate_dims("data initialization","xreg_rw","double", - context__.to_vec(k, n)); - xreg_rw = Eigen::Matrix(k, n); - stan::math::fill(xreg_rw, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "xreg_rw", "double", + std::vector{static_cast(k), static_cast(n)}); + xreg_rw_data__ = Eigen::Matrix::Constant(k, n, + std::numeric_limits::quiet_NaN()); + new (&xreg_rw) + Eigen::Map>(xreg_rw_data__.data(), k, n); { std::vector xreg_rw_flat__; current_statement__ = 77; - assign(xreg_rw_flat__, nil_index_list(), context__.vals_r("xreg_rw"), - "assigning variable xreg_rw_flat__"); + xreg_rw_flat__ = context__.vals_r("xreg_rw"); current_statement__ = 77; pos__ = 1; current_statement__ = 77; @@ -1032,224 +976,203 @@ class model_walker_lm final : public model_base_crtp { current_statement__ = 77; for (int sym2__ = 1; sym2__ <= k; ++sym2__) { current_statement__ = 77; - assign(xreg_rw, - cons_list(index_uni(sym2__), - cons_list(index_uni(sym1__), nil_index_list())), - xreg_rw_flat__[(pos__ - 1)], "assigning variable xreg_rw"); + stan::model::assign(xreg_rw, xreg_rw_flat__[(pos__ - 1)], + "assigning variable xreg_rw", stan::model::index_uni(sym2__), + stan::model::index_uni(sym1__)); current_statement__ = 77; - pos__ = (pos__ + 1);}} + pos__ = (pos__ + 1); + } + } } current_statement__ = 78; - validate_non_negative_index("y", "n", n); + stan::math::validate_non_negative_index("y", "n", n); current_statement__ = 79; - context__.validate_dims("data initialization","y","double", - context__.to_vec(n)); - y = Eigen::Matrix(n); - stan::math::fill(y, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "y", "double", + std::vector{static_cast(n)}); + y_data__ = Eigen::Matrix::Constant(n, + std::numeric_limits::quiet_NaN()); + new (&y) Eigen::Map>(y_data__.data(), n); { std::vector y_flat__; current_statement__ = 79; - assign(y_flat__, nil_index_list(), context__.vals_r("y"), - "assigning variable y_flat__"); + y_flat__ = context__.vals_r("y"); current_statement__ = 79; pos__ = 1; current_statement__ = 79; for (int sym1__ = 1; sym1__ <= n; ++sym1__) { current_statement__ = 79; - assign(y, cons_list(index_uni(sym1__), nil_index_list()), - y_flat__[(pos__ - 1)], "assigning variable y"); + stan::model::assign(y, y_flat__[(pos__ - 1)], + "assigning variable y", stan::model::index_uni(sym1__)); current_statement__ = 79; - pos__ = (pos__ + 1);} + pos__ = (pos__ + 1); + } } current_statement__ = 80; - validate_non_negative_index("y_miss", "n", n); + stan::math::validate_non_negative_index("y_miss", "n", n); current_statement__ = 81; - context__.validate_dims("data initialization","y_miss","int", - context__.to_vec(n)); + context__.validate_dims("data initialization", "y_miss", "int", + std::vector{static_cast(n)}); y_miss = std::vector(n, std::numeric_limits::min()); - current_statement__ = 81; - assign(y_miss, nil_index_list(), context__.vals_i("y_miss"), - "assigning variable y_miss"); + y_miss = context__.vals_i("y_miss"); current_statement__ = 81; - for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - current_statement__ = 81; - current_statement__ = 81; - check_greater_or_equal(function__, "y_miss[sym1__]", - y_miss[(sym1__ - 1)], 0);} + stan::math::check_greater_or_equal(function__, "y_miss", y_miss, 0); current_statement__ = 82; - context__.validate_dims("data initialization","sigma_y_shape","double", - context__.to_vec()); + context__.validate_dims("data initialization", "sigma_y_shape", + "double", std::vector{}); sigma_y_shape = std::numeric_limits::quiet_NaN(); - current_statement__ = 82; sigma_y_shape = context__.vals_r("sigma_y_shape")[(1 - 1)]; current_statement__ = 82; - current_statement__ = 82; - check_greater_or_equal(function__, "sigma_y_shape", sigma_y_shape, 0); + stan::math::check_greater_or_equal(function__, "sigma_y_shape", + sigma_y_shape, 0); current_statement__ = 83; - context__.validate_dims("data initialization","sigma_y_rate","double", - context__.to_vec()); + context__.validate_dims("data initialization", "sigma_y_rate", + "double", std::vector{}); sigma_y_rate = std::numeric_limits::quiet_NaN(); - current_statement__ = 83; sigma_y_rate = context__.vals_r("sigma_y_rate")[(1 - 1)]; current_statement__ = 83; - current_statement__ = 83; - check_greater_or_equal(function__, "sigma_y_rate", sigma_y_rate, 0); + stan::math::check_greater_or_equal(function__, "sigma_y_rate", + sigma_y_rate, 0); current_statement__ = 84; - context__.validate_dims("data initialization","beta_fixed_mean", - "double",context__.to_vec()); + context__.validate_dims("data initialization", "beta_fixed_mean", + "double", std::vector{}); beta_fixed_mean = std::numeric_limits::quiet_NaN(); - current_statement__ = 84; beta_fixed_mean = context__.vals_r("beta_fixed_mean")[(1 - 1)]; current_statement__ = 85; - context__.validate_dims("data initialization","beta_fixed_sd","double", - context__.to_vec()); + context__.validate_dims("data initialization", "beta_fixed_sd", + "double", std::vector{}); beta_fixed_sd = std::numeric_limits::quiet_NaN(); - current_statement__ = 85; beta_fixed_sd = context__.vals_r("beta_fixed_sd")[(1 - 1)]; current_statement__ = 85; - current_statement__ = 85; - check_greater_or_equal(function__, "beta_fixed_sd", beta_fixed_sd, 0); + stan::math::check_greater_or_equal(function__, "beta_fixed_sd", + beta_fixed_sd, 0); current_statement__ = 86; - context__.validate_dims("data initialization","beta_rw1_mean","double", - context__.to_vec()); + context__.validate_dims("data initialization", "beta_rw1_mean", + "double", std::vector{}); beta_rw1_mean = std::numeric_limits::quiet_NaN(); - current_statement__ = 86; beta_rw1_mean = context__.vals_r("beta_rw1_mean")[(1 - 1)]; current_statement__ = 87; - context__.validate_dims("data initialization","beta_rw1_sd","double", - context__.to_vec()); + context__.validate_dims("data initialization", "beta_rw1_sd", "double", + std::vector{}); beta_rw1_sd = std::numeric_limits::quiet_NaN(); - current_statement__ = 87; beta_rw1_sd = context__.vals_r("beta_rw1_sd")[(1 - 1)]; current_statement__ = 87; - current_statement__ = 87; - check_greater_or_equal(function__, "beta_rw1_sd", beta_rw1_sd, 0); + stan::math::check_greater_or_equal(function__, "beta_rw1_sd", + beta_rw1_sd, 0); current_statement__ = 88; - context__.validate_dims("data initialization","beta_rw2_mean","double", - context__.to_vec()); + context__.validate_dims("data initialization", "beta_rw2_mean", + "double", std::vector{}); beta_rw2_mean = std::numeric_limits::quiet_NaN(); - current_statement__ = 88; beta_rw2_mean = context__.vals_r("beta_rw2_mean")[(1 - 1)]; current_statement__ = 89; - context__.validate_dims("data initialization","beta_rw2_sd","double", - context__.to_vec()); + context__.validate_dims("data initialization", "beta_rw2_sd", "double", + std::vector{}); beta_rw2_sd = std::numeric_limits::quiet_NaN(); - current_statement__ = 89; beta_rw2_sd = context__.vals_r("beta_rw2_sd")[(1 - 1)]; current_statement__ = 89; - current_statement__ = 89; - check_greater_or_equal(function__, "beta_rw2_sd", beta_rw2_sd, 0); + stan::math::check_greater_or_equal(function__, "beta_rw2_sd", + beta_rw2_sd, 0); current_statement__ = 90; - context__.validate_dims("data initialization","sigma_rw1_shape", - "double",context__.to_vec()); + context__.validate_dims("data initialization", "sigma_rw1_shape", + "double", std::vector{}); sigma_rw1_shape = std::numeric_limits::quiet_NaN(); - current_statement__ = 90; sigma_rw1_shape = context__.vals_r("sigma_rw1_shape")[(1 - 1)]; current_statement__ = 90; - current_statement__ = 90; - check_greater_or_equal(function__, "sigma_rw1_shape", sigma_rw1_shape, - 0); + stan::math::check_greater_or_equal(function__, "sigma_rw1_shape", + sigma_rw1_shape, 0); current_statement__ = 91; - context__.validate_dims("data initialization","sigma_rw2_shape", - "double",context__.to_vec()); + context__.validate_dims("data initialization", "sigma_rw2_shape", + "double", std::vector{}); sigma_rw2_shape = std::numeric_limits::quiet_NaN(); - current_statement__ = 91; sigma_rw2_shape = context__.vals_r("sigma_rw2_shape")[(1 - 1)]; current_statement__ = 91; - current_statement__ = 91; - check_greater_or_equal(function__, "sigma_rw2_shape", sigma_rw2_shape, - 0); + stan::math::check_greater_or_equal(function__, "sigma_rw2_shape", + sigma_rw2_shape, 0); current_statement__ = 92; - context__.validate_dims("data initialization","sigma_rw1_rate", - "double",context__.to_vec()); + context__.validate_dims("data initialization", "sigma_rw1_rate", + "double", std::vector{}); sigma_rw1_rate = std::numeric_limits::quiet_NaN(); - current_statement__ = 92; sigma_rw1_rate = context__.vals_r("sigma_rw1_rate")[(1 - 1)]; current_statement__ = 92; - current_statement__ = 92; - check_greater_or_equal(function__, "sigma_rw1_rate", sigma_rw1_rate, 0); + stan::math::check_greater_or_equal(function__, "sigma_rw1_rate", + sigma_rw1_rate, 0); current_statement__ = 93; - context__.validate_dims("data initialization","sigma_rw2_rate", - "double",context__.to_vec()); + context__.validate_dims("data initialization", "sigma_rw2_rate", + "double", std::vector{}); sigma_rw2_rate = std::numeric_limits::quiet_NaN(); - current_statement__ = 93; sigma_rw2_rate = context__.vals_r("sigma_rw2_rate")[(1 - 1)]; current_statement__ = 93; - current_statement__ = 93; - check_greater_or_equal(function__, "sigma_rw2_rate", sigma_rw2_rate, 0); + stan::math::check_greater_or_equal(function__, "sigma_rw2_rate", + sigma_rw2_rate, 0); current_statement__ = 94; - context__.validate_dims("data initialization","nu_mean","double", - context__.to_vec()); + context__.validate_dims("data initialization", "nu_mean", "double", + std::vector{}); nu_mean = std::numeric_limits::quiet_NaN(); - current_statement__ = 94; nu_mean = context__.vals_r("nu_mean")[(1 - 1)]; current_statement__ = 94; - current_statement__ = 94; - check_greater_or_equal(function__, "nu_mean", nu_mean, 0); + stan::math::check_greater_or_equal(function__, "nu_mean", nu_mean, 0); current_statement__ = 95; - context__.validate_dims("data initialization","nu_sd","double", - context__.to_vec()); + context__.validate_dims("data initialization", "nu_sd", "double", + std::vector{}); nu_sd = std::numeric_limits::quiet_NaN(); - current_statement__ = 95; nu_sd = context__.vals_r("nu_sd")[(1 - 1)]; current_statement__ = 95; - current_statement__ = 95; - check_greater_or_equal(function__, "nu_sd", nu_sd, 0); + stan::math::check_greater_or_equal(function__, "nu_sd", nu_sd, 0); current_statement__ = 96; - validate_non_negative_index("gamma_y", "n", n); + stan::math::validate_non_negative_index("gamma_y", "n", n); current_statement__ = 97; - context__.validate_dims("data initialization","gamma_y","double", - context__.to_vec(n)); - gamma_y = Eigen::Matrix(n); - stan::math::fill(gamma_y, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "gamma_y", "double", + std::vector{static_cast(n)}); + gamma_y_data__ = Eigen::Matrix::Constant(n, + std::numeric_limits::quiet_NaN()); + new (&gamma_y) + Eigen::Map>(gamma_y_data__.data(), n); { std::vector gamma_y_flat__; current_statement__ = 97; - assign(gamma_y_flat__, nil_index_list(), context__.vals_r("gamma_y"), - "assigning variable gamma_y_flat__"); + gamma_y_flat__ = context__.vals_r("gamma_y"); current_statement__ = 97; pos__ = 1; current_statement__ = 97; for (int sym1__ = 1; sym1__ <= n; ++sym1__) { current_statement__ = 97; - assign(gamma_y, cons_list(index_uni(sym1__), nil_index_list()), - gamma_y_flat__[(pos__ - 1)], "assigning variable gamma_y"); + stan::model::assign(gamma_y, gamma_y_flat__[(pos__ - 1)], + "assigning variable gamma_y", stan::model::index_uni(sym1__)); current_statement__ = 97; - pos__ = (pos__ + 1);} + pos__ = (pos__ + 1); + } } current_statement__ = 98; - validate_non_negative_index("gamma_rw1", "k_rw1", k_rw1); + stan::math::validate_non_negative_index("gamma_rw1", "k_rw1", k_rw1); current_statement__ = 99; - validate_non_negative_index("gamma_rw1", "n", n); + stan::math::validate_non_negative_index("gamma_rw1", "n", n); current_statement__ = 100; - context__.validate_dims("data initialization","gamma_rw1","double", - context__.to_vec(k_rw1, n)); - gamma_rw1 = Eigen::Matrix(k_rw1, n); - stan::math::fill(gamma_rw1, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "gamma_rw1", "double", + std::vector{static_cast(k_rw1), + static_cast(n)}); + gamma_rw1_data__ = Eigen::Matrix::Constant(k_rw1, n, + std::numeric_limits::quiet_NaN()); + new (&gamma_rw1) + Eigen::Map>(gamma_rw1_data__.data(), + k_rw1, n); { std::vector gamma_rw1_flat__; current_statement__ = 100; - assign(gamma_rw1_flat__, nil_index_list(), - context__.vals_r("gamma_rw1"), - "assigning variable gamma_rw1_flat__"); + gamma_rw1_flat__ = context__.vals_r("gamma_rw1"); current_statement__ = 100; pos__ = 1; current_statement__ = 100; @@ -1257,29 +1180,31 @@ class model_walker_lm final : public model_base_crtp { current_statement__ = 100; for (int sym2__ = 1; sym2__ <= k_rw1; ++sym2__) { current_statement__ = 100; - assign(gamma_rw1, - cons_list(index_uni(sym2__), - cons_list(index_uni(sym1__), nil_index_list())), - gamma_rw1_flat__[(pos__ - 1)], "assigning variable gamma_rw1"); + stan::model::assign(gamma_rw1, gamma_rw1_flat__[(pos__ - 1)], + "assigning variable gamma_rw1", stan::model::index_uni(sym2__), + stan::model::index_uni(sym1__)); current_statement__ = 100; - pos__ = (pos__ + 1);}} + pos__ = (pos__ + 1); + } + } } current_statement__ = 101; - validate_non_negative_index("gamma_rw2", "k_rw2", k_rw2); + stan::math::validate_non_negative_index("gamma_rw2", "k_rw2", k_rw2); current_statement__ = 102; - validate_non_negative_index("gamma_rw2", "n", n); + stan::math::validate_non_negative_index("gamma_rw2", "n", n); current_statement__ = 103; - context__.validate_dims("data initialization","gamma_rw2","double", - context__.to_vec(k_rw2, n)); - gamma_rw2 = Eigen::Matrix(k_rw2, n); - stan::math::fill(gamma_rw2, std::numeric_limits::quiet_NaN()); - + context__.validate_dims("data initialization", "gamma_rw2", "double", + std::vector{static_cast(k_rw2), + static_cast(n)}); + gamma_rw2_data__ = Eigen::Matrix::Constant(k_rw2, n, + std::numeric_limits::quiet_NaN()); + new (&gamma_rw2) + Eigen::Map>(gamma_rw2_data__.data(), + k_rw2, n); { std::vector gamma_rw2_flat__; current_statement__ = 103; - assign(gamma_rw2_flat__, nil_index_list(), - context__.vals_r("gamma_rw2"), - "assigning variable gamma_rw2_flat__"); + gamma_rw2_flat__ = context__.vals_r("gamma_rw2"); current_statement__ = 103; pos__ = 1; current_statement__ = 103; @@ -1287,1023 +1212,957 @@ class model_walker_lm final : public model_base_crtp { current_statement__ = 103; for (int sym2__ = 1; sym2__ <= k_rw2; ++sym2__) { current_statement__ = 103; - assign(gamma_rw2, - cons_list(index_uni(sym2__), - cons_list(index_uni(sym1__), nil_index_list())), - gamma_rw2_flat__[(pos__ - 1)], "assigning variable gamma_rw2"); + stan::model::assign(gamma_rw2, gamma_rw2_flat__[(pos__ - 1)], + "assigning variable gamma_rw2", stan::model::index_uni(sym2__), + stan::model::index_uni(sym1__)); current_statement__ = 103; - pos__ = (pos__ + 1);}} + pos__ = (pos__ + 1); + } + } } current_statement__ = 104; - validate_non_negative_index("obs_idx", - "n_lfo - sum(y_miss[1 : n_lfo])", - (n_lfo - - sum( - rvalue(y_miss, - cons_list(index_min_max(1, n_lfo), - nil_index_list()), "y_miss")))); + stan::math::validate_non_negative_index("obs_idx", + "n_lfo - sum(y_miss[1 : n_lfo])", (n_lfo - + stan::math::sum( + stan::model::rvalue(y_miss, "y_miss", + stan::model::index_min_max(1, n_lfo))))); current_statement__ = 105; obs_idx = std::vector((n_lfo - - sum( - rvalue(y_miss, - cons_list(index_min_max(1, n_lfo), - nil_index_list()), "y_miss"))), std::numeric_limits::min()); - + stan::math::sum( + stan::model::rvalue(y_miss, "y_miss", + stan::model::index_min_max(1, n_lfo)))), + std::numeric_limits::min()); current_statement__ = 106; - validate_non_negative_index("a1", "m", m); + stan::math::validate_non_negative_index("a1", "m", m); current_statement__ = 107; - a1 = Eigen::Matrix(m); - stan::math::fill(a1, std::numeric_limits::quiet_NaN()); - + a1_data__ = Eigen::Matrix::Constant(m, + std::numeric_limits::quiet_NaN()); + new (&a1) Eigen::Map>(a1_data__.data(), m); current_statement__ = 108; - validate_non_negative_index("P1", "m", m); + stan::math::validate_non_negative_index("P1", "m", m); current_statement__ = 109; - validate_non_negative_index("P1", "m", m); + stan::math::validate_non_negative_index("P1", "m", m); current_statement__ = 110; - P1 = Eigen::Matrix(m, m); - stan::math::fill(P1, std::numeric_limits::quiet_NaN()); - + P1_data__ = Eigen::Matrix::Constant(m, m, + std::numeric_limits::quiet_NaN()); + new (&P1) Eigen::Map>(P1_data__.data(), m, + m); current_statement__ = 110; - assign(P1, nil_index_list(), rep_matrix(0.0, m, m), + stan::model::assign(P1, stan::math::rep_matrix(0.0, m, m), "assigning variable P1"); current_statement__ = 111; - validate_non_negative_index("Tt", "m", m); + stan::math::validate_non_negative_index("Tt", "m", m); current_statement__ = 112; - validate_non_negative_index("Tt", "m", m); + stan::math::validate_non_negative_index("Tt", "m", m); current_statement__ = 113; - Tt = Eigen::Matrix(m, m); - stan::math::fill(Tt, std::numeric_limits::quiet_NaN()); - + Tt_data__ = Eigen::Matrix::Constant(m, m, + std::numeric_limits::quiet_NaN()); + new (&Tt) Eigen::Map>(Tt_data__.data(), m, + m); current_statement__ = 113; - assign(Tt, nil_index_list(), diag_matrix(rep_vector(1.0, m)), + stan::model::assign(Tt, + stan::math::diag_matrix(stan::math::rep_vector(1.0, m)), "assigning variable Tt"); current_statement__ = 114; - validate_non_negative_index("gamma2_y", "n", n); + stan::math::validate_non_negative_index("gamma2_y", "n", n); current_statement__ = 115; - gamma2_y = Eigen::Matrix(n); - stan::math::fill(gamma2_y, std::numeric_limits::quiet_NaN()); - + gamma2_y_data__ = Eigen::Matrix::Constant(n, + std::numeric_limits::quiet_NaN()); + new (&gamma2_y) + Eigen::Map>(gamma2_y_data__.data(), n); current_statement__ = 115; - assign(gamma2_y, nil_index_list(), elt_multiply(gamma_y, gamma_y), + stan::model::assign(gamma2_y, + stan::math::elt_multiply(gamma_y, gamma_y), "assigning variable gamma2_y"); { - int ii; - ii = std::numeric_limits::min(); - + int ii = std::numeric_limits::min(); current_statement__ = 116; ii = 0; current_statement__ = 122; for (int i = 1; i <= n_lfo; ++i) { current_statement__ = 120; - if (logical_eq(y_miss[(i - 1)], 0)) { + if (stan::math::logical_eq( + stan::model::rvalue(y_miss, "y_miss", + stan::model::index_uni(i)), 0)) { current_statement__ = 117; ii = (ii + 1); current_statement__ = 118; - assign(obs_idx, cons_list(index_uni(ii), nil_index_list()), i, - "assigning variable obs_idx"); - } } + stan::model::assign(obs_idx, i, "assigning variable obs_idx", + stan::model::index_uni(ii)); + } + } } current_statement__ = 126; - if (logical_gt(k_rw2, 0)) { + if (stan::math::logical_gt(k_rw2, 0)) { current_statement__ = 124; - assign(Tt, - cons_list(index_min_max((k_rw1 + 1), k), - cons_list(index_min_max((k + 1), m), nil_index_list())), - diag_matrix(rep_vector(1.0, k_rw2)), "assigning variable Tt"); - } + stan::model::assign(Tt, + stan::math::diag_matrix(stan::math::rep_vector(1.0, k_rw2)), + "assigning variable Tt", + stan::model::index_min_max((k_rw1 + 1), k), + stan::model::index_min_max((k + 1), m)); + } current_statement__ = 130; for (int i = 1; i <= k_rw1; ++i) { current_statement__ = 127; - assign(a1, cons_list(index_uni(i), nil_index_list()), beta_rw1_mean, - "assigning variable a1"); + stan::model::assign(a1, beta_rw1_mean, "assigning variable a1", + stan::model::index_uni(i)); current_statement__ = 128; - assign(P1, - cons_list(index_uni(i), cons_list(index_uni(i), nil_index_list())), - pow(beta_rw1_sd, 2), "assigning variable P1");} + stan::model::assign(P1, stan::math::pow(beta_rw1_sd, 2), + "assigning variable P1", stan::model::index_uni(i), + stan::model::index_uni(i)); + } current_statement__ = 134; for (int i = (k_rw1 + 1); i <= k; ++i) { current_statement__ = 131; - assign(a1, cons_list(index_uni(i), nil_index_list()), beta_rw2_mean, - "assigning variable a1"); + stan::model::assign(a1, beta_rw2_mean, "assigning variable a1", + stan::model::index_uni(i)); current_statement__ = 132; - assign(P1, - cons_list(index_uni(i), cons_list(index_uni(i), nil_index_list())), - pow(beta_rw2_sd, 2), "assigning variable P1");} + stan::model::assign(P1, stan::math::pow(beta_rw2_sd, 2), + "assigning variable P1", stan::model::index_uni(i), + stan::model::index_uni(i)); + } current_statement__ = 138; for (int i = (k + 1); i <= m; ++i) { current_statement__ = 135; - assign(a1, cons_list(index_uni(i), nil_index_list()), nu_mean, - "assigning variable a1"); + stan::model::assign(a1, nu_mean, "assigning variable a1", + stan::model::index_uni(i)); current_statement__ = 136; - assign(P1, - cons_list(index_uni(i), cons_list(index_uni(i), nil_index_list())), - pow(nu_sd, 2), "assigning variable P1");} + stan::model::assign(P1, stan::math::pow(nu_sd, 2), + "assigning variable P1", stan::model::index_uni(i), + stan::model::index_uni(i)); + } current_statement__ = 139; - validate_non_negative_index("beta_fixed", "k_fixed", k_fixed); + stan::math::validate_non_negative_index("beta_fixed", "k_fixed", + k_fixed); current_statement__ = 140; - validate_non_negative_index("sigma_rw1", "k_rw1", k_rw1); + stan::math::validate_non_negative_index("sigma_rw1", "k_rw1", k_rw1); current_statement__ = 141; - validate_non_negative_index("sigma_rw2", "k_rw2", k_rw2); + stan::math::validate_non_negative_index("sigma_rw2", "k_rw2", k_rw2); current_statement__ = 142; - validate_non_negative_index("log_lik", "n", n); + stan::math::validate_non_negative_index("log_lik", "n", n); current_statement__ = 143; - validate_non_negative_index("Rt", "m", m); + stan::math::validate_non_negative_index("Rt", "m", m); current_statement__ = 144; - validate_non_negative_index("Rt", "n", n); + stan::math::validate_non_negative_index("Rt", "n", n); current_statement__ = 145; - validate_non_negative_index("xbeta", "n", n); + stan::math::validate_non_negative_index("xbeta", "n", n); current_statement__ = 146; - validate_non_negative_index("y_", "n", n); + stan::math::validate_non_negative_index("y_", "n", n); current_statement__ = 147; y_rep_1dim__ = std::numeric_limits::min(); - current_statement__ = 147; - y_rep_1dim__ = (n * logical_eq(n_lfo, n)); + y_rep_1dim__ = (n * stan::math::logical_eq(n_lfo, n)); current_statement__ = 147; - validate_non_negative_index("y_rep", "n * (n_lfo == n)", y_rep_1dim__); + stan::math::validate_non_negative_index("y_rep", "n * (n_lfo == n)", + y_rep_1dim__); current_statement__ = 148; - validate_non_negative_index("beta_rw", "k", k); + stan::math::validate_non_negative_index("beta_rw", "k", k); current_statement__ = 149; beta_rw_2dim__ = std::numeric_limits::min(); - current_statement__ = 149; - beta_rw_2dim__ = (n * logical_eq(n_lfo, n)); + beta_rw_2dim__ = (n * stan::math::logical_eq(n_lfo, n)); current_statement__ = 149; - validate_non_negative_index("beta_rw", "n * (n_lfo == n)", - beta_rw_2dim__); + stan::math::validate_non_negative_index("beta_rw", "n * (n_lfo == n)", + beta_rw_2dim__); current_statement__ = 150; - validate_non_negative_index("nu", "k_rw2", k_rw2); + stan::math::validate_non_negative_index("nu", "k_rw2", k_rw2); current_statement__ = 151; nu_2dim__ = std::numeric_limits::min(); - current_statement__ = 151; - nu_2dim__ = (n * logical_eq(n_lfo, n)); + nu_2dim__ = (n * stan::math::logical_eq(n_lfo, n)); current_statement__ = 151; - validate_non_negative_index("nu", "n * (n_lfo == n)", nu_2dim__); + stan::math::validate_non_negative_index("nu", "n * (n_lfo == n)", + nu_2dim__); current_statement__ = 152; y_fit_1dim__ = std::numeric_limits::min(); - current_statement__ = 152; - y_fit_1dim__ = (n * logical_eq(n_lfo, n)); + y_fit_1dim__ = (n * stan::math::logical_eq(n_lfo, n)); current_statement__ = 152; - validate_non_negative_index("y_fit", "n * (n_lfo == n)", y_fit_1dim__); + stan::math::validate_non_negative_index("y_fit", "n * (n_lfo == n)", + y_fit_1dim__); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); - } - num_params_r__ = 0U; - - try { - num_params_r__ += k_fixed; - num_params_r__ += k_rw1; - num_params_r__ += k_rw2; - num_params_r__ += 1; - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } + num_params_r__ = k_fixed + k_rw1 + k_rw2 + 1; + } + inline std::string model_name() const final { + return "model_walker_lm"; } - template * = nullptr, stan::require_vector_like_vt* = nullptr> - inline stan::scalar_type_t log_prob_impl(VecR& params_r__, - VecI& params_i__, - std::ostream* pstream__ = nullptr) const { + inline std::vector model_compile_info() const noexcept { + return std::vector{"stanc_version = stanc3 v2.32.2", + "stancflags = --allow-undefined"}; + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline stan::scalar_type_t + log_prob_impl(VecR& params_r__, VecI& params_i__, std::ostream* + pstream__ = nullptr) const { using T__ = stan::scalar_type_t; using local_scalar_t__ = T__; T__ lp__(0.0); stan::math::accumulator lp_accum__; - static const char* function__ = "model_walker_lm_namespace::log_prob"; -(void) function__; // suppress unused var warning - stan::io::reader in__(params_r__, params_i__); + stan::io::deserializer in__(params_r__, params_i__); + int current_statement__ = 0; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; + static constexpr const char* function__ = + "model_walker_lm_namespace::log_prob"; + // suppress unused var warning + (void) function__; try { - Eigen::Matrix beta_fixed; - beta_fixed = Eigen::Matrix(k_fixed); - stan::math::fill(beta_fixed, DUMMY_VAR__); - + Eigen::Matrix beta_fixed = + Eigen::Matrix::Constant(k_fixed, DUMMY_VAR__); current_statement__ = 1; - beta_fixed = in__.vector(k_fixed); - std::vector sigma_rw1; - sigma_rw1 = std::vector(k_rw1, DUMMY_VAR__); - + beta_fixed = in__.template read< + Eigen::Matrix>(k_fixed); + std::vector sigma_rw1 = + std::vector(k_rw1, DUMMY_VAR__); current_statement__ = 2; - for (int sym1__ = 1; sym1__ <= k_rw1; ++sym1__) { - current_statement__ = 2; - assign(sigma_rw1, cons_list(index_uni(sym1__), nil_index_list()), - in__.scalar(), "assigning variable sigma_rw1");} - current_statement__ = 2; - for (int sym1__ = 1; sym1__ <= k_rw1; ++sym1__) { - current_statement__ = 2; - if (jacobian__) { - current_statement__ = 2; - assign(sigma_rw1, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(sigma_rw1[(sym1__ - 1)], 0, lp__), - "assigning variable sigma_rw1"); - } else { - current_statement__ = 2; - assign(sigma_rw1, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(sigma_rw1[(sym1__ - 1)], 0), - "assigning variable sigma_rw1"); - }} - std::vector sigma_rw2; - sigma_rw2 = std::vector(k_rw2, DUMMY_VAR__); - - current_statement__ = 3; - for (int sym1__ = 1; sym1__ <= k_rw2; ++sym1__) { - current_statement__ = 3; - assign(sigma_rw2, cons_list(index_uni(sym1__), nil_index_list()), - in__.scalar(), "assigning variable sigma_rw2");} + sigma_rw1 = in__.template read_constrain_lb< + std::vector, jacobian__>(0, lp__, + k_rw1); + std::vector sigma_rw2 = + std::vector(k_rw2, DUMMY_VAR__); current_statement__ = 3; - for (int sym1__ = 1; sym1__ <= k_rw2; ++sym1__) { - current_statement__ = 3; - if (jacobian__) { - current_statement__ = 3; - assign(sigma_rw2, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(sigma_rw2[(sym1__ - 1)], 0, lp__), - "assigning variable sigma_rw2"); - } else { - current_statement__ = 3; - assign(sigma_rw2, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(sigma_rw2[(sym1__ - 1)], 0), - "assigning variable sigma_rw2"); - }} - local_scalar_t__ sigma_y; - sigma_y = DUMMY_VAR__; - + sigma_rw2 = in__.template read_constrain_lb< + std::vector, jacobian__>(0, lp__, + k_rw2); + local_scalar_t__ sigma_y = DUMMY_VAR__; current_statement__ = 4; - sigma_y = in__.scalar(); - current_statement__ = 4; - if (jacobian__) { - current_statement__ = 4; - sigma_y = stan::math::lb_constrain(sigma_y, 0, lp__); - } else { - current_statement__ = 4; - sigma_y = stan::math::lb_constrain(sigma_y, 0); - } - Eigen::Matrix log_lik; - log_lik = Eigen::Matrix(n); - stan::math::fill(log_lik, DUMMY_VAR__); - - Eigen::Matrix Rt; - Rt = Eigen::Matrix(m, n); - stan::math::fill(Rt, DUMMY_VAR__); - + sigma_y = in__.template read_constrain_lb(0, lp__); + Eigen::Matrix log_lik = + Eigen::Matrix::Constant(n, DUMMY_VAR__); + Eigen::Matrix Rt = + Eigen::Matrix::Constant(m, n, DUMMY_VAR__); current_statement__ = 6; - assign(Rt, nil_index_list(), rep_matrix(0.0, m, n), + stan::model::assign(Rt, stan::math::rep_matrix(0.0, m, n), "assigning variable Rt"); - Eigen::Matrix xbeta; - xbeta = Eigen::Matrix(n); - stan::math::fill(xbeta, DUMMY_VAR__); - - Eigen::Matrix y_; - y_ = Eigen::Matrix(n); - stan::math::fill(y_, DUMMY_VAR__); - - current_statement__ = 13; - if (logical_gt(k_fixed, 0)) { - current_statement__ = 11; - assign(xbeta, nil_index_list(), multiply(xreg_fixed, beta_fixed), + Eigen::Matrix xbeta = + Eigen::Matrix::Constant(n, DUMMY_VAR__); + Eigen::Matrix y_ = + Eigen::Matrix::Constant(n, DUMMY_VAR__); + current_statement__ = 17; + if (stan::math::logical_gt(k_fixed, 0)) { + current_statement__ = 15; + stan::model::assign(xbeta, + stan::math::multiply(xreg_fixed, beta_fixed), "assigning variable xbeta"); } else { - current_statement__ = 9; - assign(xbeta, nil_index_list(), rep_vector(0.0, n), + current_statement__ = 13; + stan::model::assign(xbeta, stan::math::rep_vector(0.0, n), "assigning variable xbeta"); } - current_statement__ = 14; - assign(y_, nil_index_list(), subtract(y, xbeta), + current_statement__ = 18; + stan::model::assign(y_, stan::math::subtract(y, xbeta), "assigning variable y_"); - current_statement__ = 22; + current_statement__ = 26; for (int t = 1; t <= n; ++t) { - current_statement__ = 17; + current_statement__ = 21; for (int i = 1; i <= k_rw1; ++i) { - current_statement__ = 15; - assign(Rt, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), - pow( - (rvalue(gamma_rw1, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "gamma_rw1") * - sigma_rw1[(i - 1)]), 2), "assigning variable Rt");} - current_statement__ = 20; + current_statement__ = 19; + stan::model::assign(Rt, + stan::math::pow( + (stan::model::rvalue(gamma_rw1, "gamma_rw1", + stan::model::index_uni(i), stan::model::index_uni(t)) * + stan::model::rvalue(sigma_rw1, "sigma_rw1", + stan::model::index_uni(i))), 2), "assigning variable Rt", + stan::model::index_uni(i), stan::model::index_uni(t)); + } + current_statement__ = 24; for (int i = 1; i <= k_rw2; ++i) { - current_statement__ = 18; - assign(Rt, - cons_list(index_uni((k + i)), - cons_list(index_uni(t), nil_index_list())), - pow( - (rvalue(gamma_rw2, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "gamma_rw2") * - sigma_rw2[(i - 1)]), 2), "assigning variable Rt");}} - current_statement__ = 23; - assign(log_lik, nil_index_list(), - gaussian_filter(y_, y_miss, a1, P1, pow(sigma_y, 2), Tt, Rt, xreg_rw, - gamma2_y, pstream__), "assigning variable log_lik"); + current_statement__ = 22; + stan::model::assign(Rt, + stan::math::pow( + (stan::model::rvalue(gamma_rw2, "gamma_rw2", + stan::model::index_uni(i), stan::model::index_uni(t)) * + stan::model::rvalue(sigma_rw2, "sigma_rw2", + stan::model::index_uni(i))), 2), "assigning variable Rt", + stan::model::index_uni((k + i)), stan::model::index_uni(t)); + } + } + current_statement__ = 27; + stan::model::assign(log_lik, + gaussian_filter(y_, y_miss, a1, P1, stan::math::pow(sigma_y, 2), Tt, + Rt, xreg_rw, gamma2_y, pstream__), "assigning variable log_lik"); { current_statement__ = 60; - lp_accum__.add( - normal_lpdf(beta_fixed, beta_fixed_mean, beta_fixed_sd)); + lp_accum__.add(stan::math::normal_lpdf(beta_fixed, + beta_fixed_mean, beta_fixed_sd)); current_statement__ = 61; - lp_accum__.add( - gamma_lpdf(sigma_y, sigma_y_shape, sigma_y_rate)); + lp_accum__.add(stan::math::gamma_lpdf(sigma_y, + sigma_y_shape, sigma_y_rate)); current_statement__ = 62; - lp_accum__.add( - gamma_lpdf(sigma_rw1, sigma_rw1_shape, sigma_rw1_rate)); + lp_accum__.add(stan::math::gamma_lpdf(sigma_rw1, + sigma_rw1_shape, sigma_rw1_rate)); current_statement__ = 63; - lp_accum__.add( - gamma_lpdf(sigma_rw2, sigma_rw2_shape, sigma_rw2_rate)); + lp_accum__.add(stan::math::gamma_lpdf(sigma_rw2, + sigma_rw2_shape, sigma_rw2_rate)); current_statement__ = 64; - lp_accum__.add( - sum( - rvalue(log_lik, - cons_list(index_multi(obs_idx), nil_index_list()), "log_lik"))); + lp_accum__.add(stan::math::sum( + stan::model::rvalue(log_lik, "log_lik", + stan::model::index_multi(obs_idx)))); } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } lp_accum__.add(lp__); return lp_accum__.sum(); - } // log_prob_impl() - - template * = nullptr, stan::require_vector_like_vt* = nullptr, stan::require_std_vector_vt* = nullptr> - inline void write_array_impl(RNG& base_rng__, VecR& params_r__, - VecI& params_i__, VecVar& vars__, - const bool emit_transformed_parameters__ = true, - const bool emit_generated_quantities__ = true, - std::ostream* pstream__ = nullptr) const { + } + template * = nullptr, stan::require_vector_like_vt* = nullptr, stan::require_vector_vt* = nullptr> + inline void + write_array_impl(RNG& base_rng__, VecR& params_r__, VecI& params_i__, + VecVar& vars__, const bool + emit_transformed_parameters__ = true, const bool + emit_generated_quantities__ = true, std::ostream* + pstream__ = nullptr) const { using local_scalar_t__ = double; - vars__.resize(0); - stan::io::reader in__(params_r__, params_i__); - static const char* function__ = "model_walker_lm_namespace::write_array"; -(void) function__; // suppress unused var warning - (void) function__; // suppress unused var warning + stan::io::deserializer in__(params_r__, params_i__); + stan::io::serializer out__(vars__); + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; double lp__ = 0.0; - (void) lp__; // dummy to suppress unused var warning + // suppress unused var warning + (void) lp__; + int current_statement__ = 0; stan::math::accumulator lp_accum__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - (void) DUMMY_VAR__; // suppress unused var warning - + // suppress unused var warning + (void) DUMMY_VAR__; + constexpr bool jacobian__ = false; + static constexpr const char* function__ = + "model_walker_lm_namespace::write_array"; + // suppress unused var warning + (void) function__; try { - Eigen::Matrix beta_fixed; - beta_fixed = Eigen::Matrix(k_fixed); - stan::math::fill(beta_fixed, std::numeric_limits::quiet_NaN()); - + Eigen::Matrix beta_fixed = + Eigen::Matrix::Constant(k_fixed, + std::numeric_limits::quiet_NaN()); current_statement__ = 1; - beta_fixed = in__.vector(k_fixed); - std::vector sigma_rw1; - sigma_rw1 = std::vector(k_rw1, std::numeric_limits::quiet_NaN()); - + beta_fixed = in__.template read< + Eigen::Matrix>(k_fixed); + std::vector sigma_rw1 = + std::vector(k_rw1, std::numeric_limits::quiet_NaN()); current_statement__ = 2; - for (int sym1__ = 1; sym1__ <= k_rw1; ++sym1__) { - current_statement__ = 2; - assign(sigma_rw1, cons_list(index_uni(sym1__), nil_index_list()), - in__.scalar(), "assigning variable sigma_rw1");} - current_statement__ = 2; - for (int sym1__ = 1; sym1__ <= k_rw1; ++sym1__) { - current_statement__ = 2; - assign(sigma_rw1, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(sigma_rw1[(sym1__ - 1)], 0), - "assigning variable sigma_rw1");} - std::vector sigma_rw2; - sigma_rw2 = std::vector(k_rw2, std::numeric_limits::quiet_NaN()); - - current_statement__ = 3; - for (int sym1__ = 1; sym1__ <= k_rw2; ++sym1__) { - current_statement__ = 3; - assign(sigma_rw2, cons_list(index_uni(sym1__), nil_index_list()), - in__.scalar(), "assigning variable sigma_rw2");} + sigma_rw1 = in__.template read_constrain_lb< + std::vector, jacobian__>(0, lp__, + k_rw1); + std::vector sigma_rw2 = + std::vector(k_rw2, std::numeric_limits::quiet_NaN()); current_statement__ = 3; - for (int sym1__ = 1; sym1__ <= k_rw2; ++sym1__) { - current_statement__ = 3; - assign(sigma_rw2, cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_constrain(sigma_rw2[(sym1__ - 1)], 0), - "assigning variable sigma_rw2");} - double sigma_y; - sigma_y = std::numeric_limits::quiet_NaN(); - - current_statement__ = 4; - sigma_y = in__.scalar(); + sigma_rw2 = in__.template read_constrain_lb< + std::vector, jacobian__>(0, lp__, + k_rw2); + double sigma_y = std::numeric_limits::quiet_NaN(); current_statement__ = 4; - sigma_y = stan::math::lb_constrain(sigma_y, 0); - Eigen::Matrix log_lik; - log_lik = Eigen::Matrix(n); - stan::math::fill(log_lik, std::numeric_limits::quiet_NaN()); - - Eigen::Matrix Rt; - Rt = Eigen::Matrix(m, n); - stan::math::fill(Rt, std::numeric_limits::quiet_NaN()); - - Eigen::Matrix xbeta; - xbeta = Eigen::Matrix(n); - stan::math::fill(xbeta, std::numeric_limits::quiet_NaN()); - - Eigen::Matrix y_; - y_ = Eigen::Matrix(n); - stan::math::fill(y_, std::numeric_limits::quiet_NaN()); - - for (int sym1__ = 1; sym1__ <= k_fixed; ++sym1__) { - vars__.emplace_back(beta_fixed[(sym1__ - 1)]);} - for (int sym1__ = 1; sym1__ <= k_rw1; ++sym1__) { - vars__.emplace_back(sigma_rw1[(sym1__ - 1)]);} - for (int sym1__ = 1; sym1__ <= k_rw2; ++sym1__) { - vars__.emplace_back(sigma_rw2[(sym1__ - 1)]);} - vars__.emplace_back(sigma_y); - if (logical_negation((primitive_value(emit_transformed_parameters__) || - primitive_value(emit_generated_quantities__)))) { + sigma_y = in__.template read_constrain_lb(0, lp__); + Eigen::Matrix log_lik = + Eigen::Matrix::Constant(n, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix Rt = + Eigen::Matrix::Constant(m, n, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix xbeta = + Eigen::Matrix::Constant(n, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix y_ = + Eigen::Matrix::Constant(n, + std::numeric_limits::quiet_NaN()); + out__.write(beta_fixed); + out__.write(sigma_rw1); + out__.write(sigma_rw2); + out__.write(sigma_y); + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { return ; - } + } current_statement__ = 6; - assign(Rt, nil_index_list(), rep_matrix(0.0, m, n), + stan::model::assign(Rt, stan::math::rep_matrix(0.0, m, n), "assigning variable Rt"); - current_statement__ = 13; - if (logical_gt(k_fixed, 0)) { - current_statement__ = 11; - assign(xbeta, nil_index_list(), multiply(xreg_fixed, beta_fixed), + current_statement__ = 17; + if (stan::math::logical_gt(k_fixed, 0)) { + current_statement__ = 15; + stan::model::assign(xbeta, + stan::math::multiply(xreg_fixed, beta_fixed), "assigning variable xbeta"); } else { - current_statement__ = 9; - assign(xbeta, nil_index_list(), rep_vector(0.0, n), + current_statement__ = 13; + stan::model::assign(xbeta, stan::math::rep_vector(0.0, n), "assigning variable xbeta"); } - current_statement__ = 14; - assign(y_, nil_index_list(), subtract(y, xbeta), + current_statement__ = 18; + stan::model::assign(y_, stan::math::subtract(y, xbeta), "assigning variable y_"); - current_statement__ = 22; + current_statement__ = 26; for (int t = 1; t <= n; ++t) { - current_statement__ = 17; + current_statement__ = 21; for (int i = 1; i <= k_rw1; ++i) { - current_statement__ = 15; - assign(Rt, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), - pow( - (rvalue(gamma_rw1, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "gamma_rw1") * - sigma_rw1[(i - 1)]), 2), "assigning variable Rt");} - current_statement__ = 20; + current_statement__ = 19; + stan::model::assign(Rt, + stan::math::pow( + (stan::model::rvalue(gamma_rw1, "gamma_rw1", + stan::model::index_uni(i), stan::model::index_uni(t)) * + stan::model::rvalue(sigma_rw1, "sigma_rw1", + stan::model::index_uni(i))), 2), "assigning variable Rt", + stan::model::index_uni(i), stan::model::index_uni(t)); + } + current_statement__ = 24; for (int i = 1; i <= k_rw2; ++i) { - current_statement__ = 18; - assign(Rt, - cons_list(index_uni((k + i)), - cons_list(index_uni(t), nil_index_list())), - pow( - (rvalue(gamma_rw2, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "gamma_rw2") * - sigma_rw2[(i - 1)]), 2), "assigning variable Rt");}} - current_statement__ = 23; - assign(log_lik, nil_index_list(), - gaussian_filter(y_, y_miss, a1, P1, pow(sigma_y, 2), Tt, Rt, xreg_rw, - gamma2_y, pstream__), "assigning variable log_lik"); + current_statement__ = 22; + stan::model::assign(Rt, + stan::math::pow( + (stan::model::rvalue(gamma_rw2, "gamma_rw2", + stan::model::index_uni(i), stan::model::index_uni(t)) * + stan::model::rvalue(sigma_rw2, "sigma_rw2", + stan::model::index_uni(i))), 2), "assigning variable Rt", + stan::model::index_uni((k + i)), stan::model::index_uni(t)); + } + } + current_statement__ = 27; + stan::model::assign(log_lik, + gaussian_filter(y_, y_miss, a1, P1, stan::math::pow(sigma_y, 2), Tt, + Rt, xreg_rw, gamma2_y, pstream__), "assigning variable log_lik"); if (emit_transformed_parameters__) { - for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - vars__.emplace_back(log_lik[(sym1__ - 1)]);} - for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - for (int sym2__ = 1; sym2__ <= m; ++sym2__) { - vars__.emplace_back( - rvalue(Rt, - cons_list(index_uni(sym2__), - cons_list(index_uni(sym1__), nil_index_list())), "Rt"));}} - for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - vars__.emplace_back(xbeta[(sym1__ - 1)]);} - for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - vars__.emplace_back(y_[(sym1__ - 1)]);} - } - if (logical_negation(emit_generated_quantities__)) { + out__.write(log_lik); + out__.write(Rt); + out__.write(xbeta); + out__.write(y_); + } + if (stan::math::logical_negation(emit_generated_quantities__)) { return ; - } - Eigen::Matrix y_rep; - y_rep = Eigen::Matrix(y_rep_1dim__); - stan::math::fill(y_rep, std::numeric_limits::quiet_NaN()); - - Eigen::Matrix beta_rw; - beta_rw = Eigen::Matrix(k, beta_rw_2dim__); - stan::math::fill(beta_rw, std::numeric_limits::quiet_NaN()); - - Eigen::Matrix nu; - nu = Eigen::Matrix(k_rw2, nu_2dim__); - stan::math::fill(nu, std::numeric_limits::quiet_NaN()); - - Eigen::Matrix y_fit; - y_fit = Eigen::Matrix(y_fit_1dim__); - stan::math::fill(y_fit, std::numeric_limits::quiet_NaN()); - + } + Eigen::Matrix y_rep = + Eigen::Matrix::Constant(y_rep_1dim__, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix beta_rw = + Eigen::Matrix::Constant(k, beta_rw_2dim__, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix nu = + Eigen::Matrix::Constant(k_rw2, nu_2dim__, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix y_fit = + Eigen::Matrix::Constant(y_fit_1dim__, + std::numeric_limits::quiet_NaN()); current_statement__ = 59; - if (logical_eq(n_lfo, n)) { + if (stan::math::logical_eq(n_lfo, n)) { current_statement__ = 30; for (int i = 1; i <= k_rw1; ++i) { current_statement__ = 28; - assign(beta_rw, - cons_list(index_uni(i), - cons_list(index_uni(1), nil_index_list())), - normal_rng(beta_rw1_mean, beta_rw1_sd, base_rng__), - "assigning variable beta_rw");} + stan::model::assign(beta_rw, + stan::math::normal_rng(beta_rw1_mean, beta_rw1_sd, base_rng__), + "assigning variable beta_rw", stan::model::index_uni(i), + stan::model::index_uni(1)); + } current_statement__ = 34; for (int i = 1; i <= k_rw2; ++i) { current_statement__ = 31; - assign(beta_rw, - cons_list(index_uni((k_rw1 + i)), - cons_list(index_uni(1), nil_index_list())), - normal_rng(beta_rw2_mean, beta_rw2_sd, base_rng__), - "assigning variable beta_rw"); + stan::model::assign(beta_rw, + stan::math::normal_rng(beta_rw2_mean, beta_rw2_sd, base_rng__), + "assigning variable beta_rw", + stan::model::index_uni((k_rw1 + i)), stan::model::index_uni(1)); current_statement__ = 32; - assign(nu, - cons_list(index_uni(i), - cons_list(index_uni(1), nil_index_list())), - normal_rng(nu_mean, nu_sd, base_rng__), "assigning variable nu"); + stan::model::assign(nu, + stan::math::normal_rng(nu_mean, nu_sd, base_rng__), + "assigning variable nu", stan::model::index_uni(i), + stan::model::index_uni(1)); } current_statement__ = 43; for (int t = 1; t <= (n - 1); ++t) { current_statement__ = 37; for (int i = 1; i <= k_rw1; ++i) { current_statement__ = 35; - assign(beta_rw, - cons_list(index_uni(i), - cons_list(index_uni((t + 1)), nil_index_list())), - normal_rng( - rvalue(beta_rw, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "beta_rw"), - (rvalue(gamma_rw1, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "gamma_rw1") - * sigma_rw1[(i - 1)]), base_rng__), - "assigning variable beta_rw");} + stan::model::assign(beta_rw, + stan::math::normal_rng( + stan::model::rvalue(beta_rw, "beta_rw", + stan::model::index_uni(i), stan::model::index_uni(t)), + (stan::model::rvalue(gamma_rw1, "gamma_rw1", + stan::model::index_uni(i), stan::model::index_uni(t)) * + stan::model::rvalue(sigma_rw1, "sigma_rw1", + stan::model::index_uni(i))), base_rng__), + "assigning variable beta_rw", stan::model::index_uni(i), + stan::model::index_uni((t + 1))); + } current_statement__ = 41; for (int i = 1; i <= k_rw2; ++i) { current_statement__ = 38; - assign(beta_rw, - cons_list(index_uni((k_rw1 + i)), - cons_list(index_uni((t + 1)), nil_index_list())), - (rvalue(beta_rw, - cons_list(index_uni((k_rw1 + i)), - cons_list(index_uni(t), nil_index_list())), "beta_rw") + - rvalue(nu, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "nu")), - "assigning variable beta_rw"); + stan::model::assign(beta_rw, + (stan::model::rvalue(beta_rw, "beta_rw", + stan::model::index_uni((k_rw1 + i)), + stan::model::index_uni(t)) + + stan::model::rvalue(nu, "nu", stan::model::index_uni(i), + stan::model::index_uni(t))), "assigning variable beta_rw", + stan::model::index_uni((k_rw1 + i)), + stan::model::index_uni((t + 1))); current_statement__ = 39; - assign(nu, - cons_list(index_uni(i), - cons_list(index_uni((t + 1)), nil_index_list())), - normal_rng( - rvalue(nu, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "nu"), - (rvalue(gamma_rw2, - cons_list(index_uni(i), - cons_list(index_uni(t), nil_index_list())), "gamma_rw2") - * sigma_rw2[(i - 1)]), base_rng__), "assigning variable nu"); - }} + stan::model::assign(nu, + stan::math::normal_rng( + stan::model::rvalue(nu, "nu", stan::model::index_uni(i), + stan::model::index_uni(t)), + (stan::model::rvalue(gamma_rw2, "gamma_rw2", + stan::model::index_uni(i), stan::model::index_uni(t)) * + stan::model::rvalue(sigma_rw2, "sigma_rw2", + stan::model::index_uni(i))), base_rng__), + "assigning variable nu", stan::model::index_uni(i), + stan::model::index_uni((t + 1))); + } + } current_statement__ = 46; for (int t = 1; t <= n; ++t) { current_statement__ = 44; - assign(y_rep, cons_list(index_uni(t), nil_index_list()), - normal_rng( - dot_product( - rvalue(xreg_rw, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg_rw"), - rvalue(beta_rw, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "beta_rw")), - (gamma_y[(t - 1)] * sigma_y), base_rng__), - "assigning variable y_rep");} + stan::model::assign(y_rep, + stan::math::normal_rng( + stan::math::dot_product( + stan::model::rvalue(xreg_rw, "xreg_rw", + stan::model::index_omni(), stan::model::index_uni(t)), + stan::model::rvalue(beta_rw, "beta_rw", + stan::model::index_omni(), stan::model::index_uni(t))), + (stan::model::rvalue(gamma_y, "gamma_y", + stan::model::index_uni(t)) * sigma_y), base_rng__), + "assigning variable y_rep", stan::model::index_uni(t)); + } { current_statement__ = 47; - validate_non_negative_index("states", "m", m); + stan::math::validate_non_negative_index("states", "m", m); current_statement__ = 48; - validate_non_negative_index("states", "n", n); - Eigen::Matrix states; - states = Eigen::Matrix(m, n); - stan::math::fill(states, std::numeric_limits::quiet_NaN()); - + stan::math::validate_non_negative_index("states", "n", n); + Eigen::Matrix states = + Eigen::Matrix::Constant(m, n, + std::numeric_limits::quiet_NaN()); current_statement__ = 49; - assign(states, nil_index_list(), - gaussian_smoother(subtract(y_, y_rep), y_miss, a1, P1, - pow(sigma_y, 2), Tt, Rt, xreg_rw, gamma2_y, pstream__), - "assigning variable states"); + stan::model::assign(states, + gaussian_smoother(stan::math::subtract(y_, y_rep), y_miss, a1, + P1, stan::math::pow(sigma_y, 2), Tt, Rt, xreg_rw, gamma2_y, + pstream__), "assigning variable states"); current_statement__ = 50; - assign(beta_rw, nil_index_list(), - add(stan::model::deep_copy(beta_rw), - rvalue(states, - cons_list(index_min_max(1, k), - cons_list(index_min_max(1, n), nil_index_list())), - "states")), "assigning variable beta_rw"); + stan::model::assign(beta_rw, + stan::math::add(stan::model::deep_copy(beta_rw), + stan::model::rvalue(states, "states", + stan::model::index_min_max(1, k), + stan::model::index_min_max(1, n))), + "assigning variable beta_rw"); current_statement__ = 52; - if (logical_gt(k_rw2, 0)) { + if (stan::math::logical_gt(k_rw2, 0)) { current_statement__ = 51; - assign(nu, nil_index_list(), - add(stan::model::deep_copy(nu), - rvalue(states, - cons_list(index_min_max((k + 1), m), - cons_list(index_min_max(1, n), nil_index_list())), - "states")), "assigning variable nu"); - } + stan::model::assign(nu, + stan::math::add(stan::model::deep_copy(nu), + stan::model::rvalue(states, "states", + stan::model::index_min_max((k + 1), m), + stan::model::index_min_max(1, n))), "assigning variable nu"); + } } current_statement__ = 57; for (int t = 1; t <= n; ++t) { current_statement__ = 54; - assign(y_fit, cons_list(index_uni(t), nil_index_list()), - (xbeta[(t - 1)] + - dot_product( - rvalue(xreg_rw, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "xreg_rw"), - rvalue(beta_rw, - cons_list(index_omni(), - cons_list(index_uni(t), nil_index_list())), "beta_rw"))), - "assigning variable y_fit"); + stan::model::assign(y_fit, + (stan::model::rvalue(xbeta, "xbeta", stan::model::index_uni(t)) + + stan::math::dot_product( + stan::model::rvalue(xreg_rw, "xreg_rw", + stan::model::index_omni(), stan::model::index_uni(t)), + stan::model::rvalue(beta_rw, "beta_rw", + stan::model::index_omni(), stan::model::index_uni(t)))), + "assigning variable y_fit", stan::model::index_uni(t)); current_statement__ = 55; - assign(y_rep, cons_list(index_uni(t), nil_index_list()), - normal_rng(y_fit[(t - 1)], (gamma_y[(t - 1)] * sigma_y), - base_rng__), "assigning variable y_rep");} - } - for (int sym1__ = 1; sym1__ <= y_rep_1dim__; ++sym1__) { - vars__.emplace_back(y_rep[(sym1__ - 1)]);} - for (int sym1__ = 1; sym1__ <= beta_rw_2dim__; ++sym1__) { - for (int sym2__ = 1; sym2__ <= k; ++sym2__) { - vars__.emplace_back( - rvalue(beta_rw, - cons_list(index_uni(sym2__), - cons_list(index_uni(sym1__), nil_index_list())), "beta_rw")); - }} - for (int sym1__ = 1; sym1__ <= nu_2dim__; ++sym1__) { - for (int sym2__ = 1; sym2__ <= k_rw2; ++sym2__) { - vars__.emplace_back( - rvalue(nu, - cons_list(index_uni(sym2__), - cons_list(index_uni(sym1__), nil_index_list())), "nu"));}} - for (int sym1__ = 1; sym1__ <= y_fit_1dim__; ++sym1__) { - vars__.emplace_back(y_fit[(sym1__ - 1)]);} + stan::model::assign(y_rep, + stan::math::normal_rng( + stan::model::rvalue(y_fit, "y_fit", stan::model::index_uni(t)), + (stan::model::rvalue(gamma_y, "gamma_y", + stan::model::index_uni(t)) * sigma_y), base_rng__), + "assigning variable y_rep", stan::model::index_uni(t)); + } + } + out__.write(y_rep); + out__.write(beta_rw); + out__.write(nu); + out__.write(y_fit); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline void + unconstrain_array_impl(const VecVar& params_r__, const VecI& params_i__, + VecVar& vars__, std::ostream* pstream__ = nullptr) const { + using local_scalar_t__ = double; + stan::io::deserializer in__(params_r__, params_i__); + stan::io::serializer out__(vars__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + int pos__ = std::numeric_limits::min(); + pos__ = 1; + Eigen::Matrix beta_fixed = + Eigen::Matrix::Constant(k_fixed, DUMMY_VAR__); + current_statement__ = 1; + stan::model::assign(beta_fixed, + in__.read>(k_fixed), + "assigning variable beta_fixed"); + out__.write(beta_fixed); + std::vector sigma_rw1 = + std::vector(k_rw1, DUMMY_VAR__); + current_statement__ = 2; + stan::model::assign(sigma_rw1, + in__.read>(k_rw1), + "assigning variable sigma_rw1"); + out__.write_free_lb(0, sigma_rw1); + std::vector sigma_rw2 = + std::vector(k_rw2, DUMMY_VAR__); + current_statement__ = 3; + stan::model::assign(sigma_rw2, + in__.read>(k_rw2), + "assigning variable sigma_rw2"); + out__.write_free_lb(0, sigma_rw2); + local_scalar_t__ sigma_y = DUMMY_VAR__; + current_statement__ = 4; + sigma_y = in__.read(); + out__.write_free_lb(0, sigma_y); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } - } // write_array_impl() - - template * = nullptr, stan::require_vector_like_vt* = nullptr> - inline void transform_inits_impl(const stan::io::var_context& context__, - VecI& params_i__, VecVar& vars__, - std::ostream* pstream__ = nullptr) const { + } + template * = nullptr> + inline void + transform_inits_impl(const stan::io::var_context& context__, VecVar& + vars__, std::ostream* pstream__ = nullptr) const { using local_scalar_t__ = double; - vars__.clear(); - vars__.reserve(num_params_r__); - + stan::io::serializer out__(vars__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; try { - int pos__; - pos__ = std::numeric_limits::min(); - + current_statement__ = 1; + context__.validate_dims("parameter initialization", "beta_fixed", + "double", std::vector{static_cast(k_fixed)}); + current_statement__ = 2; + context__.validate_dims("parameter initialization", "sigma_rw1", + "double", std::vector{static_cast(k_rw1)}); + current_statement__ = 3; + context__.validate_dims("parameter initialization", "sigma_rw2", + "double", std::vector{static_cast(k_rw2)}); + current_statement__ = 4; + context__.validate_dims("parameter initialization", "sigma_y", + "double", std::vector{}); + int pos__ = std::numeric_limits::min(); pos__ = 1; - Eigen::Matrix beta_fixed; - beta_fixed = Eigen::Matrix(k_fixed); - stan::math::fill(beta_fixed, std::numeric_limits::quiet_NaN()); - + Eigen::Matrix beta_fixed = + Eigen::Matrix::Constant(k_fixed, DUMMY_VAR__); { std::vector beta_fixed_flat__; current_statement__ = 1; - assign(beta_fixed_flat__, nil_index_list(), - context__.vals_r("beta_fixed"), - "assigning variable beta_fixed_flat__"); + beta_fixed_flat__ = context__.vals_r("beta_fixed"); current_statement__ = 1; pos__ = 1; current_statement__ = 1; for (int sym1__ = 1; sym1__ <= k_fixed; ++sym1__) { current_statement__ = 1; - assign(beta_fixed, cons_list(index_uni(sym1__), nil_index_list()), - beta_fixed_flat__[(pos__ - 1)], "assigning variable beta_fixed"); + stan::model::assign(beta_fixed, beta_fixed_flat__[(pos__ - 1)], + "assigning variable beta_fixed", stan::model::index_uni(sym1__)); current_statement__ = 1; - pos__ = (pos__ + 1);} + pos__ = (pos__ + 1); + } } - std::vector sigma_rw1; - sigma_rw1 = std::vector(k_rw1, std::numeric_limits::quiet_NaN()); - + out__.write(beta_fixed); + std::vector sigma_rw1 = + std::vector(k_rw1, DUMMY_VAR__); current_statement__ = 2; - assign(sigma_rw1, nil_index_list(), context__.vals_r("sigma_rw1"), - "assigning variable sigma_rw1"); - std::vector sigma_rw1_free__; - sigma_rw1_free__ = std::vector(k_rw1, std::numeric_limits::quiet_NaN()); - - current_statement__ = 2; - for (int sym1__ = 1; sym1__ <= k_rw1; ++sym1__) { - current_statement__ = 2; - assign(sigma_rw1_free__, - cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_free(sigma_rw1[(sym1__ - 1)], 0), - "assigning variable sigma_rw1_free__");} - std::vector sigma_rw2; - sigma_rw2 = std::vector(k_rw2, std::numeric_limits::quiet_NaN()); - - current_statement__ = 3; - assign(sigma_rw2, nil_index_list(), context__.vals_r("sigma_rw2"), - "assigning variable sigma_rw2"); - std::vector sigma_rw2_free__; - sigma_rw2_free__ = std::vector(k_rw2, std::numeric_limits::quiet_NaN()); - + sigma_rw1 = context__.vals_r("sigma_rw1"); + out__.write_free_lb(0, sigma_rw1); + std::vector sigma_rw2 = + std::vector(k_rw2, DUMMY_VAR__); current_statement__ = 3; - for (int sym1__ = 1; sym1__ <= k_rw2; ++sym1__) { - current_statement__ = 3; - assign(sigma_rw2_free__, - cons_list(index_uni(sym1__), nil_index_list()), - stan::math::lb_free(sigma_rw2[(sym1__ - 1)], 0), - "assigning variable sigma_rw2_free__");} - double sigma_y; - sigma_y = std::numeric_limits::quiet_NaN(); - + sigma_rw2 = context__.vals_r("sigma_rw2"); + out__.write_free_lb(0, sigma_rw2); + local_scalar_t__ sigma_y = DUMMY_VAR__; current_statement__ = 4; sigma_y = context__.vals_r("sigma_y")[(1 - 1)]; - double sigma_y_free__; - sigma_y_free__ = std::numeric_limits::quiet_NaN(); - - current_statement__ = 4; - sigma_y_free__ = stan::math::lb_free(sigma_y, 0); - for (int sym1__ = 1; sym1__ <= k_fixed; ++sym1__) { - vars__.emplace_back(beta_fixed[(sym1__ - 1)]);} - for (int sym1__ = 1; sym1__ <= k_rw1; ++sym1__) { - vars__.emplace_back(sigma_rw1_free__[(sym1__ - 1)]);} - for (int sym1__ = 1; sym1__ <= k_rw2; ++sym1__) { - vars__.emplace_back(sigma_rw2_free__[(sym1__ - 1)]);} - vars__.emplace_back(sigma_y_free__); + out__.write_free_lb(0, sigma_y); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); - // Next line prevents compiler griping about no return - throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } - } // transform_inits_impl() - - inline void get_param_names(std::vector& names__) const { - - names__.clear(); - names__.emplace_back("beta_fixed"); - names__.emplace_back("sigma_rw1"); - names__.emplace_back("sigma_rw2"); - names__.emplace_back("sigma_y"); - names__.emplace_back("log_lik"); - names__.emplace_back("Rt"); - names__.emplace_back("xbeta"); - names__.emplace_back("y_"); - names__.emplace_back("y_rep"); - names__.emplace_back("beta_rw"); - names__.emplace_back("nu"); - names__.emplace_back("y_fit"); - } // get_param_names() - - inline void get_dims(std::vector>& dimss__) const { - dimss__.clear(); - dimss__.emplace_back(std::vector{static_cast(k_fixed)}); - - dimss__.emplace_back(std::vector{static_cast(k_rw1)}); - - dimss__.emplace_back(std::vector{static_cast(k_rw2)}); - - dimss__.emplace_back(std::vector{}); - - dimss__.emplace_back(std::vector{static_cast(n)}); - - dimss__.emplace_back(std::vector{static_cast(m), - static_cast(n)}); - - dimss__.emplace_back(std::vector{static_cast(n)}); - - dimss__.emplace_back(std::vector{static_cast(n)}); - - dimss__.emplace_back(std::vector{ - static_cast(y_rep_1dim__)}); - - dimss__.emplace_back(std::vector{static_cast(k), - static_cast(beta_rw_2dim__) - }); - - dimss__.emplace_back(std::vector{static_cast(k_rw2), - static_cast(nu_2dim__)}); - - dimss__.emplace_back(std::vector{ - static_cast(y_fit_1dim__)}); - - } // get_dims() - - inline void constrained_param_names( - std::vector& param_names__, - bool emit_transformed_parameters__ = true, - bool emit_generated_quantities__ = true) const - final { - + } + inline void + get_param_names(std::vector& names__, const bool + emit_transformed_parameters__ = true, const bool + emit_generated_quantities__ = true) const { + names__ = std::vector{"beta_fixed", "sigma_rw1", + "sigma_rw2", "sigma_y"}; + if (emit_transformed_parameters__) { + std::vector temp{"log_lik", "Rt", "xbeta", "y_"}; + names__.reserve(names__.size() + temp.size()); + names__.insert(names__.end(), temp.begin(), temp.end()); + } + if (emit_generated_quantities__) { + std::vector temp{"y_rep", "beta_rw", "nu", "y_fit"}; + names__.reserve(names__.size() + temp.size()); + names__.insert(names__.end(), temp.begin(), temp.end()); + } + } + inline void + get_dims(std::vector>& dimss__, const bool + emit_transformed_parameters__ = true, const bool + emit_generated_quantities__ = true) const { + dimss__ = std::vector>{std::vector{static_cast< + size_t>( + k_fixed)}, + std::vector{static_cast(k_rw1)}, + std::vector{static_cast(k_rw2)}, + std::vector{}}; + if (emit_transformed_parameters__) { + std::vector> + temp{std::vector{static_cast(n)}, + std::vector{static_cast(m), + static_cast(n)}, + std::vector{static_cast(n)}, + std::vector{static_cast(n)}}; + dimss__.reserve(dimss__.size() + temp.size()); + dimss__.insert(dimss__.end(), temp.begin(), temp.end()); + } + if (emit_generated_quantities__) { + std::vector> + temp{std::vector{static_cast(y_rep_1dim__)}, + std::vector{static_cast(k), + static_cast(beta_rw_2dim__)}, + std::vector{static_cast(k_rw2), + static_cast(nu_2dim__)}, + std::vector{static_cast(y_fit_1dim__)}}; + dimss__.reserve(dimss__.size() + temp.size()); + dimss__.insert(dimss__.end(), temp.begin(), temp.end()); + } + } + inline void + constrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { for (int sym1__ = 1; sym1__ <= k_fixed; ++sym1__) { - { - param_names__.emplace_back(std::string() + "beta_fixed" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "beta_fixed" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= k_rw1; ++sym1__) { - { - param_names__.emplace_back(std::string() + "sigma_rw1" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "sigma_rw1" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= k_rw2; ++sym1__) { - { - param_names__.emplace_back(std::string() + "sigma_rw2" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "sigma_rw2" + '.' + + std::to_string(sym1__)); + } param_names__.emplace_back(std::string() + "sigma_y"); if (emit_transformed_parameters__) { for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - param_names__.emplace_back(std::string() + "log_lik" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "log_lik" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - for (int sym2__ = 1; sym2__ <= m; ++sym2__) { - { - param_names__.emplace_back(std::string() + "Rt" + '.' + std::to_string(sym2__) + '.' + std::to_string(sym1__)); - }} - }} + for (int sym2__ = 1; sym2__ <= m; ++sym2__) { + param_names__.emplace_back(std::string() + "Rt" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - param_names__.emplace_back(std::string() + "xbeta" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "xbeta" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - param_names__.emplace_back(std::string() + "y_" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "y_" + '.' + + std::to_string(sym1__)); + } } - if (emit_generated_quantities__) { for (int sym1__ = 1; sym1__ <= y_rep_1dim__; ++sym1__) { - { - param_names__.emplace_back(std::string() + "y_rep" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "y_rep" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= beta_rw_2dim__; ++sym1__) { - { - for (int sym2__ = 1; sym2__ <= k; ++sym2__) { - { - param_names__.emplace_back(std::string() + "beta_rw" + '.' + std::to_string(sym2__) + '.' + std::to_string(sym1__)); - }} - }} + for (int sym2__ = 1; sym2__ <= k; ++sym2__) { + param_names__.emplace_back(std::string() + "beta_rw" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } for (int sym1__ = 1; sym1__ <= nu_2dim__; ++sym1__) { - { - for (int sym2__ = 1; sym2__ <= k_rw2; ++sym2__) { - { - param_names__.emplace_back(std::string() + "nu" + '.' + std::to_string(sym2__) + '.' + std::to_string(sym1__)); - }} - }} + for (int sym2__ = 1; sym2__ <= k_rw2; ++sym2__) { + param_names__.emplace_back(std::string() + "nu" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } for (int sym1__ = 1; sym1__ <= y_fit_1dim__; ++sym1__) { - { - param_names__.emplace_back(std::string() + "y_fit" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "y_fit" + '.' + + std::to_string(sym1__)); + } } - - } // constrained_param_names() - - inline void unconstrained_param_names( - std::vector& param_names__, - bool emit_transformed_parameters__ = true, - bool emit_generated_quantities__ = true) const - final { - + } + inline void + unconstrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { for (int sym1__ = 1; sym1__ <= k_fixed; ++sym1__) { - { - param_names__.emplace_back(std::string() + "beta_fixed" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "beta_fixed" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= k_rw1; ++sym1__) { - { - param_names__.emplace_back(std::string() + "sigma_rw1" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "sigma_rw1" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= k_rw2; ++sym1__) { - { - param_names__.emplace_back(std::string() + "sigma_rw2" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "sigma_rw2" + '.' + + std::to_string(sym1__)); + } param_names__.emplace_back(std::string() + "sigma_y"); if (emit_transformed_parameters__) { for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - param_names__.emplace_back(std::string() + "log_lik" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "log_lik" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - for (int sym2__ = 1; sym2__ <= m; ++sym2__) { - { - param_names__.emplace_back(std::string() + "Rt" + '.' + std::to_string(sym2__) + '.' + std::to_string(sym1__)); - }} - }} + for (int sym2__ = 1; sym2__ <= m; ++sym2__) { + param_names__.emplace_back(std::string() + "Rt" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - param_names__.emplace_back(std::string() + "xbeta" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "xbeta" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= n; ++sym1__) { - { - param_names__.emplace_back(std::string() + "y_" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "y_" + '.' + + std::to_string(sym1__)); + } } - if (emit_generated_quantities__) { for (int sym1__ = 1; sym1__ <= y_rep_1dim__; ++sym1__) { - { - param_names__.emplace_back(std::string() + "y_rep" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "y_rep" + '.' + + std::to_string(sym1__)); + } for (int sym1__ = 1; sym1__ <= beta_rw_2dim__; ++sym1__) { - { - for (int sym2__ = 1; sym2__ <= k; ++sym2__) { - { - param_names__.emplace_back(std::string() + "beta_rw" + '.' + std::to_string(sym2__) + '.' + std::to_string(sym1__)); - }} - }} + for (int sym2__ = 1; sym2__ <= k; ++sym2__) { + param_names__.emplace_back(std::string() + "beta_rw" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } for (int sym1__ = 1; sym1__ <= nu_2dim__; ++sym1__) { - { - for (int sym2__ = 1; sym2__ <= k_rw2; ++sym2__) { - { - param_names__.emplace_back(std::string() + "nu" + '.' + std::to_string(sym2__) + '.' + std::to_string(sym1__)); - }} - }} + for (int sym2__ = 1; sym2__ <= k_rw2; ++sym2__) { + param_names__.emplace_back(std::string() + "nu" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } for (int sym1__ = 1; sym1__ <= y_fit_1dim__; ++sym1__) { - { - param_names__.emplace_back(std::string() + "y_fit" + '.' + std::to_string(sym1__)); - }} + param_names__.emplace_back(std::string() + "y_fit" + '.' + + std::to_string(sym1__)); + } } - - } // unconstrained_param_names() - + } inline std::string get_constrained_sizedtypes() const { - stringstream s__; - s__ << "[{\"name\":\"beta_fixed\",\"type\":{\"name\":\"vector\",\"length\":" << k_fixed << "},\"block\":\"parameters\"},{\"name\":\"sigma_rw1\",\"type\":{\"name\":\"array\",\"length\":" << k_rw1 << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"sigma_rw2\",\"type\":{\"name\":\"array\",\"length\":" << k_rw2 << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"sigma_y\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"log_lik\",\"type\":{\"name\":\"vector\",\"length\":" << n << "},\"block\":\"transformed_parameters\"},{\"name\":\"Rt\",\"type\":{\"name\":\"matrix\",\"rows\":" << m << ",\"cols\":" << n << "},\"block\":\"transformed_parameters\"},{\"name\":\"xbeta\",\"type\":{\"name\":\"vector\",\"length\":" << n << "},\"block\":\"transformed_parameters\"},{\"name\":\"y_\",\"type\":{\"name\":\"vector\",\"length\":" << n << "},\"block\":\"transformed_parameters\"},{\"name\":\"y_rep\",\"type\":{\"name\":\"vector\",\"length\":" << y_rep_1dim__ << "},\"block\":\"generated_quantities\"},{\"name\":\"beta_rw\",\"type\":{\"name\":\"matrix\",\"rows\":" << k << ",\"cols\":" << beta_rw_2dim__ << "},\"block\":\"generated_quantities\"},{\"name\":\"nu\",\"type\":{\"name\":\"matrix\",\"rows\":" << k_rw2 << ",\"cols\":" << nu_2dim__ << "},\"block\":\"generated_quantities\"},{\"name\":\"y_fit\",\"type\":{\"name\":\"vector\",\"length\":" << y_fit_1dim__ << "},\"block\":\"generated_quantities\"}]"; - return s__.str(); - } // get_constrained_sizedtypes() - + return std::string("[{\"name\":\"beta_fixed\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(k_fixed) + "},\"block\":\"parameters\"},{\"name\":\"sigma_rw1\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(k_rw1) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"sigma_rw2\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(k_rw2) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"sigma_y\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"log_lik\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n) + "},\"block\":\"transformed_parameters\"},{\"name\":\"Rt\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(m) + ",\"cols\":" + std::to_string(n) + "},\"block\":\"transformed_parameters\"},{\"name\":\"xbeta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n) + "},\"block\":\"transformed_parameters\"},{\"name\":\"y_\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n) + "},\"block\":\"transformed_parameters\"},{\"name\":\"y_rep\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(y_rep_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"beta_rw\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(k) + ",\"cols\":" + std::to_string(beta_rw_2dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"nu\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(k_rw2) + ",\"cols\":" + std::to_string(nu_2dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"y_fit\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(y_fit_1dim__) + "},\"block\":\"generated_quantities\"}]"); + } inline std::string get_unconstrained_sizedtypes() const { - stringstream s__; - s__ << "[{\"name\":\"beta_fixed\",\"type\":{\"name\":\"vector\",\"length\":" << k_fixed << "},\"block\":\"parameters\"},{\"name\":\"sigma_rw1\",\"type\":{\"name\":\"array\",\"length\":" << k_rw1 << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"sigma_rw2\",\"type\":{\"name\":\"array\",\"length\":" << k_rw2 << ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"sigma_y\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"log_lik\",\"type\":{\"name\":\"vector\",\"length\":" << n << "},\"block\":\"transformed_parameters\"},{\"name\":\"Rt\",\"type\":{\"name\":\"matrix\",\"rows\":" << m << ",\"cols\":" << n << "},\"block\":\"transformed_parameters\"},{\"name\":\"xbeta\",\"type\":{\"name\":\"vector\",\"length\":" << n << "},\"block\":\"transformed_parameters\"},{\"name\":\"y_\",\"type\":{\"name\":\"vector\",\"length\":" << n << "},\"block\":\"transformed_parameters\"},{\"name\":\"y_rep\",\"type\":{\"name\":\"vector\",\"length\":" << y_rep_1dim__ << "},\"block\":\"generated_quantities\"},{\"name\":\"beta_rw\",\"type\":{\"name\":\"matrix\",\"rows\":" << k << ",\"cols\":" << beta_rw_2dim__ << "},\"block\":\"generated_quantities\"},{\"name\":\"nu\",\"type\":{\"name\":\"matrix\",\"rows\":" << k_rw2 << ",\"cols\":" << nu_2dim__ << "},\"block\":\"generated_quantities\"},{\"name\":\"y_fit\",\"type\":{\"name\":\"vector\",\"length\":" << y_fit_1dim__ << "},\"block\":\"generated_quantities\"}]"; - return s__.str(); - } // get_unconstrained_sizedtypes() - - - // Begin method overload boilerplate - template - inline void write_array(RNG& base_rng, - Eigen::Matrix& params_r, - Eigen::Matrix& vars, - const bool emit_transformed_parameters = true, - const bool emit_generated_quantities = true, - std::ostream* pstream = nullptr) const { - std::vector vars_vec(vars.size()); - std::vector params_i; - write_array_impl(base_rng, params_r, params_i, vars_vec, - emit_transformed_parameters, emit_generated_quantities, pstream); - vars.resize(vars_vec.size()); - for (int i = 0; i < vars.size(); ++i) { - vars.coeffRef(i) = vars_vec[i]; - } - } - template - inline void write_array(RNG& base_rng, std::vector& params_r, - std::vector& params_i, - std::vector& vars, - bool emit_transformed_parameters = true, - bool emit_generated_quantities = true, - std::ostream* pstream = nullptr) const { - write_array_impl(base_rng, params_r, params_i, vars, emit_transformed_parameters, emit_generated_quantities, pstream); - } - template - inline T_ log_prob(Eigen::Matrix& params_r, - std::ostream* pstream = nullptr) const { - Eigen::Matrix params_i; - return log_prob_impl(params_r, params_i, pstream); - } - template - inline T__ log_prob(std::vector& params_r, - std::vector& params_i, - std::ostream* pstream = nullptr) const { - return log_prob_impl(params_r, params_i, pstream); - } - - inline void transform_inits(const stan::io::var_context& context, - Eigen::Matrix& params_r, - std::ostream* pstream = nullptr) const final { - std::vector params_r_vec(params_r.size()); - std::vector params_i; - transform_inits_impl(context, params_i, params_r_vec, pstream); - params_r.resize(params_r_vec.size()); - for (int i = 0; i < params_r.size(); ++i) { - params_r.coeffRef(i) = params_r_vec[i]; - } - } - inline void transform_inits(const stan::io::var_context& context, - std::vector& params_i, - std::vector& vars, - std::ostream* pstream = nullptr) const final { - transform_inits_impl(context, params_i, vars, pstream); - } + return std::string("[{\"name\":\"beta_fixed\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(k_fixed) + "},\"block\":\"parameters\"},{\"name\":\"sigma_rw1\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(k_rw1) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"sigma_rw2\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(k_rw2) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"sigma_y\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"log_lik\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n) + "},\"block\":\"transformed_parameters\"},{\"name\":\"Rt\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(m) + ",\"cols\":" + std::to_string(n) + "},\"block\":\"transformed_parameters\"},{\"name\":\"xbeta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n) + "},\"block\":\"transformed_parameters\"},{\"name\":\"y_\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n) + "},\"block\":\"transformed_parameters\"},{\"name\":\"y_rep\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(y_rep_1dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"beta_rw\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(k) + ",\"cols\":" + std::to_string(beta_rw_2dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"nu\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(k_rw2) + ",\"cols\":" + std::to_string(nu_2dim__) + "},\"block\":\"generated_quantities\"},{\"name\":\"y_fit\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(y_fit_1dim__) + "},\"block\":\"generated_quantities\"}]"); + } + // Begin method overload boilerplate + template inline void + write_array(RNG& base_rng, Eigen::Matrix& params_r, + Eigen::Matrix& vars, const bool + emit_transformed_parameters = true, const bool + emit_generated_quantities = true, std::ostream* + pstream = nullptr) const { + const size_t num_params__ = (((k_fixed + k_rw1) + k_rw2) + 1); + const size_t num_transformed = emit_transformed_parameters * ((((n + (m * + n)) + n) + n)); + const size_t num_gen_quantities = emit_generated_quantities * + ((((y_rep_1dim__ + (k * beta_rw_2dim__)) + (k_rw2 * nu_2dim__)) + + y_fit_1dim__)); + const size_t num_to_write = num_params__ + num_transformed + + num_gen_quantities; + std::vector params_i; + vars = Eigen::Matrix::Constant(num_to_write, + std::numeric_limits::quiet_NaN()); + write_array_impl(base_rng, params_r, params_i, vars, + emit_transformed_parameters, emit_generated_quantities, pstream); + } + template inline void + write_array(RNG& base_rng, std::vector& params_r, std::vector& + params_i, std::vector& vars, bool + emit_transformed_parameters = true, bool + emit_generated_quantities = true, std::ostream* + pstream = nullptr) const { + const size_t num_params__ = (((k_fixed + k_rw1) + k_rw2) + 1); + const size_t num_transformed = emit_transformed_parameters * ((((n + (m * + n)) + n) + n)); + const size_t num_gen_quantities = emit_generated_quantities * + ((((y_rep_1dim__ + (k * beta_rw_2dim__)) + (k_rw2 * nu_2dim__)) + + y_fit_1dim__)); + const size_t num_to_write = num_params__ + num_transformed + + num_gen_quantities; + vars = std::vector(num_to_write, + std::numeric_limits::quiet_NaN()); + write_array_impl(base_rng, params_r, params_i, vars, + emit_transformed_parameters, emit_generated_quantities, pstream); + } + template inline T_ + log_prob(Eigen::Matrix& params_r, std::ostream* pstream = nullptr) const { + Eigen::Matrix params_i; + return log_prob_impl(params_r, params_i, pstream); + } + template inline T_ + log_prob(std::vector& params_r, std::vector& params_i, + std::ostream* pstream = nullptr) const { + return log_prob_impl(params_r, params_i, pstream); + } + inline void + transform_inits(const stan::io::var_context& context, + Eigen::Matrix& params_r, std::ostream* + pstream = nullptr) const final { + std::vector params_r_vec(params_r.size()); + std::vector params_i; + transform_inits(context, params_i, params_r_vec, pstream); + params_r = Eigen::Map>(params_r_vec.data(), + params_r_vec.size()); + } + inline void + transform_inits(const stan::io::var_context& context, std::vector& + params_i, std::vector& vars, std::ostream* + pstream__ = nullptr) const { + vars.resize(num_params_r__); + transform_inits_impl(context, vars, pstream__); + } + inline void + unconstrain_array(const std::vector& params_constrained, + std::vector& params_unconstrained, std::ostream* + pstream = nullptr) const { + const std::vector params_i; + params_unconstrained = std::vector(num_params_r__, + std::numeric_limits::quiet_NaN()); + unconstrain_array_impl(params_constrained, params_i, + params_unconstrained, pstream); + } + inline void + unconstrain_array(const Eigen::Matrix& params_constrained, + Eigen::Matrix& params_unconstrained, + std::ostream* pstream = nullptr) const { + const std::vector params_i; + params_unconstrained = Eigen::Matrix::Constant(num_params_r__, + std::numeric_limits::quiet_NaN()); + unconstrain_array_impl(params_constrained, params_i, + params_unconstrained, pstream); + } }; } using stan_model = model_walker_lm_namespace::model_walker_lm; #ifndef USING_R // Boilerplate -stan::model::model_base& new_model( - stan::io::var_context& data_context, - unsigned int seed, - std::ostream* msg_stream) { +stan::model::model_base& +new_model(stan::io::var_context& data_context, unsigned int seed, + std::ostream* msg_stream) { stan_model* m = new stan_model(data_context, seed, msg_stream); return *m; }