From 340d6a31b46a43669eaa386b8f86e26b3f087a45 Mon Sep 17 00:00:00 2001 From: Niko Huurre Date: Mon, 9 Jan 2023 12:31:26 +0200 Subject: [PATCH 01/13] Improve recursive UDF template cycle detection --- src/stan_math_backend/Transform_Mir.ml | 98 +++++++++-------- test/integration/good/code-gen/cpp.expected | 104 +++++++----------- .../good/code-gen/recursive-slicing.stan | 4 - 3 files changed, 95 insertions(+), 111 deletions(-) diff --git a/src/stan_math_backend/Transform_Mir.ml b/src/stan_math_backend/Transform_Mir.ml index 3cc074b7f4..4dee9ca371 100644 --- a/src/stan_math_backend/Transform_Mir.ml +++ b/src/stan_math_backend/Transform_Mir.ml @@ -39,27 +39,6 @@ let eigen_block_expr_fns = ["head"; "tail"; "segment"; "col"; "row"; "block"; "sub_row"; "sub_col"] |> String.Set.of_list -let eval_eigen_blocks e = - let open Expr.Fixed in - let f ({pattern; meta} as expr) = - match (pattern, UnsizedType.is_eigen_type (Expr.Typed.type_of expr)) with - | Indexed _, true -> - {meta; pattern= FunApp (StanLib ("eval", FnPlain, AoS), [expr])} - | FunApp (StanLib (fname, _, _), _), true - when Set.mem eigen_block_expr_fns fname -> - {meta; pattern= FunApp (StanLib ("eval", FnPlain, AoS), [expr])} - | _ -> expr in - rewrite_bottom_up ~f e - -let eval_udf_indexed_calls e = - let open Expr.Fixed in - let f ({pattern; _} as expr) = - match pattern with - | FunApp ((UserDefined (_, _) as kind), args) -> - {expr with pattern= FunApp (kind, List.map ~f:eval_eigen_blocks args)} - | _ -> expr in - rewrite_bottom_up ~f e - let opencl_trigger_restrictions = String.Map.of_alist_exn [ ( "bernoulli_lpmf" @@ -488,30 +467,59 @@ let trans_prog (p : Program.Typed.t) = (* Eval indexed eigen types in UDF calls to prevent infinite template expansion if the call is recursive *) - let possibly_recursive_fns = - List.filter_map - ~f:(function - | {fdname; fdargs; fdbody= None; _} -> Some (fdname, fdargs) | _ -> None - ) - p.functions_block - |> Set.Poly.of_list in - let rec map_stmt {Stmt.Fixed.pattern; meta} = - match pattern with - | NRFunApp ((UserDefined _ as kind), args) -> - { Stmt.Fixed.meta - ; pattern= NRFunApp (kind, List.map ~f:eval_eigen_blocks args) } - | _ -> - { Stmt.Fixed.pattern= - Stmt.Fixed.Pattern.map eval_udf_indexed_calls map_stmt pattern - ; meta } in - let eval_udf_indexed_stmts (s : 'a Program.fun_def) = - if Set.mem possibly_recursive_fns (s.fdname, s.fdargs) then - {s with fdbody= Option.map ~f:map_stmt s.fdbody} - else s in - let p = - { p with - functions_block= List.map ~f:eval_udf_indexed_stmts p.functions_block } - in + let callmap = Hashtbl.create (module String) in + let eval_eigen_cycles fun_args calls (f : _ Program.fun_def) = + let check_recursive name = + name = f.fdname + || Hashtbl.find callmap name + |> Option.value_map ~default:false ~f:(fun x -> Set.mem x f.fdname) + in + let open Expr.Fixed in + let rec eigen_expr = function + | {pattern= Var name; _} -> Set.mem fun_args name + | {pattern= Pattern.Indexed (e, _); _} -> eigen_expr e + | {pattern= FunApp (StanLib (fname, _, _), e :: _); _} -> + Set.mem eigen_block_expr_fns fname && eigen_expr e + | _ -> false in + let rec map_args name args = + let is_rec = check_recursive name in + List.map args ~f:(fun e -> + let e = rewrite_expr e in + if not (eigen_expr e) then e + else if is_rec then + {e with pattern= FunApp (StanLib ("eval", FnPlain, AoS), [e])} + else (Hash_set.add calls name ; e) ) + and rewrite_expr = function + | {pattern= FunApp ((UserDefined (name, _) as kind), args); _} as e -> + {e with pattern= FunApp (kind, map_args name args)} + | e -> {e with pattern= Pattern.map rewrite_expr e.pattern} in + let open Stmt.Fixed in + let rec rewrite_stmt = function + | {pattern= Pattern.NRFunApp ((UserDefined (name, _) as kind), args); _} + as s -> + {s with pattern= NRFunApp (kind, map_args name args)} + | s -> {s with pattern= Pattern.map rewrite_expr rewrite_stmt s.pattern} + in + Program.map_fun_def rewrite_stmt f in + let break_cycles (Program.{fdname; fdargs; _} as fd) = + let fun_args = + List.filter_map + ~f:(fun (_, n, t) -> + if UnsizedType.is_eigen_type t then Some n else None ) + fdargs + |> String.Set.of_list in + if Set.is_empty fun_args then fd + else + let calls = Hash_set.create (module String) in + let fndef = eval_eigen_cycles fun_args calls fd in + if not (Hash_set.is_empty calls) then ( + let calls = Hash_set.to_list calls |> String.Set.of_list in + Hashtbl.map_inplace callmap ~f:(fun x -> + if Set.mem x fdname then Set.union calls x else x ) ; + Hashtbl.update callmap fdname + ~f:(Option.value_map ~f:(Set.union calls) ~default:calls) ) ; + fndef in + let p = {p with functions_block= List.map ~f:break_cycles p.functions_block} in let init_pos = [ Stmt.Fixed.Pattern.Decl { decl_adtype= DataOnly diff --git a/test/integration/good/code-gen/cpp.expected b/test/integration/good/code-gen/cpp.expected index 1735f781be..fab8f1307d 100644 --- a/test/integration/good/code-gen/cpp.expected +++ b/test/integration/good/code-gen/cpp.expected @@ -21496,45 +21496,45 @@ using namespace stan::math; stan::math::profile_map profiles__; static constexpr std::array locations_array__ = {" (found before start of program)", - " (in 'recursive-slicing.stan', line 76, column 2 to column 22)", - " (in 'recursive-slicing.stan', line 79, column 2 to column 33)", - " (in 'recursive-slicing.stan', line 72, column 2 to column 8)", - " (in 'recursive-slicing.stan', line 73, column 2 to column 12)", - " (in 'recursive-slicing.stan', line 76, column 9 to column 14)", - " (in 'recursive-slicing.stan', line 79, column 9 to column 10)", - " (in 'recursive-slicing.stan', line 5, column 3 to column 31)", - " (in 'recursive-slicing.stan', line 10, column 6 to column 35)", - " (in 'recursive-slicing.stan', line 8, column 6 to column 30)", - " (in 'recursive-slicing.stan', line 7, column 3 to line 10, column 35)", - " (in 'recursive-slicing.stan', line 4, column 28 to line 11, column 2)", - " (in 'recursive-slicing.stan', line 18, column 4 to column 59)", - " (in 'recursive-slicing.stan', line 17, column 9 to line 19, column 3)", - " (in 'recursive-slicing.stan', line 16, column 4 to column 47)", - " (in 'recursive-slicing.stan', line 15, column 14 to line 17, column 3)", - " (in 'recursive-slicing.stan', line 15, column 2 to line 19, column 3)", - " (in 'recursive-slicing.stan', line 14, column 35 to line 20, column 1)", - " (in 'recursive-slicing.stan', line 24, column 2 to column 11)", - " (in 'recursive-slicing.stan', line 23, column 18 to line 25, column 1)", - " (in 'recursive-slicing.stan', line 28, column 2 to column 40)", - " (in 'recursive-slicing.stan', line 29, column 2 to column 23)", - " (in 'recursive-slicing.stan', line 27, column 16 to line 30, column 1)", - " (in 'recursive-slicing.stan', line 38, column 3 to column 31)", - " (in 'recursive-slicing.stan', line 43, column 6 to column 35)", - " (in 'recursive-slicing.stan', line 41, column 6 to column 30)", - " (in 'recursive-slicing.stan', line 40, column 3 to line 43, column 35)", - " (in 'recursive-slicing.stan', line 37, column 27 to line 44, column 3)", - " (in 'recursive-slicing.stan', line 46, column 2 to column 22)", - " (in 'recursive-slicing.stan', line 45, column 27 to line 47, column 1)", - " (in 'recursive-slicing.stan', line 52, column 3 to column 31)", - " (in 'recursive-slicing.stan', line 57, column 6 to column 28)", - " (in 'recursive-slicing.stan', line 55, column 6 to column 22)", - " (in 'recursive-slicing.stan', line 54, column 3 to line 57, column 28)", - " (in 'recursive-slicing.stan', line 51, column 24 to line 58, column 1)", - " (in 'recursive-slicing.stan', line 62, column 3 to column 31)", - " (in 'recursive-slicing.stan', line 67, column 6 to column 38)", - " (in 'recursive-slicing.stan', line 65, column 6 to column 30)", - " (in 'recursive-slicing.stan', line 64, column 3 to line 67, column 38)", - " (in 'recursive-slicing.stan', line 61, column 28 to line 68, column 3)"}; + " (in 'recursive-slicing.stan', line 72, column 2 to column 22)", + " (in 'recursive-slicing.stan', line 75, column 2 to column 33)", + " (in 'recursive-slicing.stan', line 68, column 2 to column 8)", + " (in 'recursive-slicing.stan', line 69, column 2 to column 12)", + " (in 'recursive-slicing.stan', line 72, column 9 to column 14)", + " (in 'recursive-slicing.stan', line 75, column 9 to column 10)", + " (in 'recursive-slicing.stan', line 4, column 3 to column 31)", + " (in 'recursive-slicing.stan', line 9, column 6 to column 35)", + " (in 'recursive-slicing.stan', line 7, column 6 to column 30)", + " (in 'recursive-slicing.stan', line 6, column 3 to line 9, column 35)", + " (in 'recursive-slicing.stan', line 3, column 28 to line 10, column 2)", + " (in 'recursive-slicing.stan', line 16, column 4 to column 59)", + " (in 'recursive-slicing.stan', line 15, column 9 to line 17, column 3)", + " (in 'recursive-slicing.stan', line 14, column 4 to column 47)", + " (in 'recursive-slicing.stan', line 13, column 14 to line 15, column 3)", + " (in 'recursive-slicing.stan', line 13, column 2 to line 17, column 3)", + " (in 'recursive-slicing.stan', line 12, column 35 to line 18, column 1)", + " (in 'recursive-slicing.stan', line 22, column 2 to column 11)", + " (in 'recursive-slicing.stan', line 21, column 18 to line 23, column 1)", + " (in 'recursive-slicing.stan', line 26, column 2 to column 40)", + " (in 'recursive-slicing.stan', line 27, column 2 to column 23)", + " (in 'recursive-slicing.stan', line 25, column 16 to line 28, column 1)", + " (in 'recursive-slicing.stan', line 36, column 3 to column 31)", + " (in 'recursive-slicing.stan', line 41, column 6 to column 35)", + " (in 'recursive-slicing.stan', line 39, column 6 to column 30)", + " (in 'recursive-slicing.stan', line 38, column 3 to line 41, column 35)", + " (in 'recursive-slicing.stan', line 35, column 27 to line 42, column 3)", + " (in 'recursive-slicing.stan', line 44, column 2 to column 22)", + " (in 'recursive-slicing.stan', line 43, column 27 to line 45, column 1)", + " (in 'recursive-slicing.stan', line 49, column 3 to column 31)", + " (in 'recursive-slicing.stan', line 54, column 6 to column 28)", + " (in 'recursive-slicing.stan', line 52, column 6 to column 22)", + " (in 'recursive-slicing.stan', line 51, column 3 to line 54, column 28)", + " (in 'recursive-slicing.stan', line 48, column 24 to line 55, column 1)", + " (in 'recursive-slicing.stan', line 58, column 3 to column 31)", + " (in 'recursive-slicing.stan', line 63, column 6 to column 38)", + " (in 'recursive-slicing.stan', line 61, column 6 to column 30)", + " (in 'recursive-slicing.stan', line 60, column 3 to line 63, column 38)", + " (in 'recursive-slicing.stan', line 57, column 28 to line 64, column 3)"}; struct test3_functor__ { template , @@ -21591,11 +21591,6 @@ template , stan::is_vt_not_complex>* = nullptr> Eigen::Matrix>,-1,1> -test2(const T0__& gamma_arg__, std::ostream* pstream__); -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,1> test2(const T0__& gamma_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; int current_statement__ = 0; @@ -21636,11 +21631,6 @@ template , stan::is_vt_not_complex>* = nullptr> Eigen::Matrix>,-1,-1> -matrix_pow(const T0__& a_arg__, const int& n, std::ostream* pstream__); -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,-1> matrix_pow(const T0__& a_arg__, const int& n, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; int current_statement__ = 0; @@ -21772,9 +21762,8 @@ test4(const T0__& gamma_arg__, std::ostream* pstream__) { } else { current_statement__ = 24; return test3( - stan::math::eval( - stan::model::rvalue(gamma, "gamma", - stan::model::index_min_max(1, (D - 1)))), pstream__); + stan::model::rvalue(gamma, "gamma", + stan::model::index_min_max(1, (D - 1))), pstream__); } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); @@ -21803,7 +21792,7 @@ test3(const T0__& gamma_arg__, std::ostream* pstream__) { (void) DUMMY_VAR__; try { current_statement__ = 28; - return test4(gamma, pstream__); + return test4(stan::math::eval(gamma), pstream__); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } @@ -21818,10 +21807,6 @@ test3_functor__::operator()(const T0__& gamma, std::ostream* pstream__) const { template , stan::is_vt_not_complex>* = nullptr> -void test6(const T0__& alpha_arg__, std::ostream* pstream__); -template , - stan::is_vt_not_complex>*> void test6(const T0__& alpha_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; int current_statement__ = 0; @@ -21866,11 +21851,6 @@ template , stan::is_vt_not_complex>* = nullptr> Eigen::Matrix>,-1,1> -test7(const T0__& gamma_arg__, std::ostream* pstream__); -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,1> test7(const T0__& gamma_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; int current_statement__ = 0; diff --git a/test/integration/good/code-gen/recursive-slicing.stan b/test/integration/good/code-gen/recursive-slicing.stan index 950620effa..1239925953 100644 --- a/test/integration/good/code-gen/recursive-slicing.stan +++ b/test/integration/good/code-gen/recursive-slicing.stan @@ -1,6 +1,5 @@ functions { // reported in stanc3#1224 -vector test2(vector gamma); vector test2(vector gamma) { int D = num_elements(gamma); @@ -10,7 +9,6 @@ vector test2(vector gamma); return test2(gamma[1:D - 1]); } // reported in cmdstan#1109 -matrix matrix_pow(matrix a, int n); matrix matrix_pow(matrix a, int n) { if (n == 0) { return diag_matrix(rep_vector(1, rows(a))); @@ -47,7 +45,6 @@ vector test3(vector gamma) { } // non-returning fun app -void test6(vector alpha); void test6(vector alpha){ int D = num_elements(alpha); @@ -57,7 +54,6 @@ void test6(vector alpha){ test6(alpha[1:D - 1]); } - vector test7(vector gamma) ; vector test7(vector gamma) { int D = num_elements(gamma); From b3c4da21c38cc628358dbc97243d3519b16eee32 Mon Sep 17 00:00:00 2001 From: Niko Huurre Date: Mon, 9 Jan 2023 13:15:42 +0200 Subject: [PATCH 02/13] skip pointless functors, forward-declare all functions --- src/stan_math_backend/Cpp.ml | 4 + src/stan_math_backend/Lower_expr.ml | 22 +- src/stan_math_backend/Lower_functions.ml | 281 +- .../code-gen/complex_numbers/cpp.expected | 326 +- test/integration/good/code-gen/cpp.expected | 4682 +++++------------ .../good/code-gen/expressions/cpp.expected | 145 +- test/integration/good/code-gen/lir.expected | 3358 ++++-------- .../good/code-gen/ode/cpp.expected | 285 +- .../standalone_functions/cpp.expected | 361 +- .../good/compiler-optimizations/cpp.expected | 693 +-- .../compiler-optimizations/cppO0.expected | 731 +-- .../compiler-optimizations/cppO1.expected | 674 +-- .../mem_patterns/cpp.expected | 149 +- 13 files changed, 3460 insertions(+), 8251 deletions(-) diff --git a/src/stan_math_backend/Cpp.ml b/src/stan_math_backend/Cpp.ml index 5259673bd6..68a894fd29 100644 --- a/src/stan_math_backend/Cpp.ml +++ b/src/stan_math_backend/Cpp.ml @@ -309,6 +309,10 @@ type fun_defn = ; body: stmt list option } [@@deriving make, sexp] +let split_fun_decl_defn (fn : fun_defn) = + ( {fn with body= None} + , {fn with templates_init= (fst fn.templates_init, false)} ) + type constructor = { args: (type_ * string) list ; init_list: (identifier * expr list) list diff --git a/src/stan_math_backend/Lower_expr.ml b/src/stan_math_backend/Lower_expr.ml index da7eeff940..0d0b763948 100644 --- a/src/stan_math_backend/Lower_expr.ml +++ b/src/stan_math_backend/Lower_expr.ml @@ -41,13 +41,19 @@ let functor_suffix = "_functor__" let reduce_sum_functor_suffix = "_rsfunctor__" let variadic_functor_suffix x = sprintf "_variadic%d_functor__" x -let functor_suffix_select hof = +type variadic = FixedArgs | ReduceSum | VariadicHOF of int +[@@deriving compare, hash] + +let functor_type hof = match Hashtbl.find Stan_math_signatures.stan_math_variadic_signatures hof with - | Some {required_fn_args; _} -> - variadic_functor_suffix (List.length required_fn_args) - | None when Stan_math_signatures.is_reduce_sum_fn hof -> - reduce_sum_functor_suffix - | None -> functor_suffix + | Some {required_fn_args; _} -> VariadicHOF (List.length required_fn_args) + | None when Stan_math_signatures.is_reduce_sum_fn hof -> ReduceSum + | None -> FixedArgs + +let functor_suffix_select = function + | VariadicHOF n -> variadic_functor_suffix n + | ReduceSum -> reduce_sum_functor_suffix + | FixedArgs -> functor_suffix (* retun true if the type of the expression is integer, real, or complex (e.g. not a container) *) @@ -292,7 +298,9 @@ and lower_functionals fname suffix es mem_pattern = pattern= FunApp ( StanLib - (name ^ functor_suffix_select fname, FnPlain, mem_pattern) + ( name ^ functor_suffix_select (functor_type fname) + , FnPlain + , mem_pattern ) , [] ) } | e -> e in let converted_es = List.map ~f:convert_hof_vars es in diff --git a/src/stan_math_backend/Lower_functions.ml b/src/stan_math_backend/Lower_functions.ml index 4cdefc2c0f..c91b122eb8 100644 --- a/src/stan_math_backend/Lower_functions.ml +++ b/src/stan_math_backend/Lower_functions.ml @@ -1,5 +1,4 @@ open Core_kernel -open Core_kernel.Poly open Middle open Lower_expr open Lower_stmt @@ -162,9 +161,9 @@ let mk_extra_args templates args = let lower_args extra_templates extra args variadic = let args, variadic_args = match variadic with - | `ReduceSum -> List.split_n args 3 - | `VariadicHOF x -> List.split_n args x - | `None -> (args, []) in + | ReduceSum -> List.split_n args 3 + | VariadicHOF x -> List.split_n args x + | FixedArgs -> (args, []) in let arg_strs = args @ mk_extra_args extra_templates extra @@ -172,29 +171,15 @@ let lower_args extra_templates extra args variadic = @ variadic_args in arg_strs -let add_functor_decl functors (name : string) - (param : template_parameter option) (f : fun_defn) = - let f existing = - match existing with - | None -> make_struct_defn ~param ~name ~body:[FunDef f] () - | Some sd -> {sd with body= sd.body @ [FunDef f]} in - Hashtbl.update functors name ~f - let extra_suffix_args fdsuffix = match fdsuffix with | Fun_kind.FnTarget -> (["lp__"; "lp_accum__"], ["T_lp__"; "T_lp_accum__"]) | FnRng -> (["base_rng__"], ["RNG"]) | FnLpdf _ | FnPlain -> ([], []) -(** This function produces the function and any functor definitions. - Functor {b declarations} need to be collated, and are therefore stored in the - functors hashtable *) -let lower_fun_def (functors : (string, struct_defn) Hashtbl.t) - (forward_decls : - (string * (UnsizedType.autodifftype * string * UnsizedType.t) list) - Hash_set.t ) (funs_used_in_reduce_sum : String.Set.t) - (variadic_fns : int list String.Map.t) - Program.{fdrt; fdname; fdsuffix; fdargs; fdbody; _} : fun_defn list = +let lower_fun_def (functors : Lower_expr.variadic list) + Program.{fdrt; fdname; fdsuffix; fdargs; fdbody; _} : + fun_defn * struct_defn list = let extra_arg_names, extra_template_names = extra_suffix_args fdsuffix in let template_parameter_and_arg_names is_possibly_eigen_expr variadic_fun_type = @@ -204,141 +189,98 @@ let lower_fun_def (functors : (string, struct_defn) Hashtbl.t) List.(map ~f:typename (template_param_names @ extra_template_names)) @ template_require_checks in match (fdsuffix, variadic_fun_type) with - | (FnLpdf _ | FnTarget), `None -> (Bool "propto__" :: template_params, args) + | (FnLpdf _ | FnTarget), FixedArgs -> + (Bool "propto__" :: template_params, args) | _ -> (template_params, args) in let template_params, templated_args = - template_parameter_and_arg_names true `None in + template_parameter_and_arg_names true FixedArgs in let cpp_arg_gen = lower_args extra_template_names extra_arg_names in - let cpp_args = cpp_arg_gen templated_args `None in - (* We want to print the [* = nullptr] at most once, and preferrably on a forward decl *) - let init_template_requires = - Option.is_none fdbody || not (Hash_set.mem forward_decls (fdname, fdargs)) - in + let cpp_args = cpp_arg_gen templated_args FixedArgs in let almost_fn = make_fun_defn - ~templates_init:([template_params], init_template_requires) + ~templates_init:([template_params], true) ~name:fdname ~return_type:(lower_returntype fdargs fdrt) ~args:cpp_args in - match fdbody with - | None -> - (* Side Effect: *) - Hash_set.add forward_decls (fdname, fdargs) ; - [almost_fn ()] - | Some fdbody -> - let register_functor variadic_fun_type = - let suffix = - match variadic_fun_type with - | `None -> functor_suffix - | `ReduceSum -> reduce_sum_functor_suffix - | `VariadicHOF x -> variadic_functor_suffix x in - let functor_name = fdname ^ suffix in - let struct_template = - match (fdsuffix, variadic_fun_type) with - | FnLpdf _, `ReduceSum -> Some (Bool "propto__") - | _ -> None in - let arg_templates, templated_args = - template_parameter_and_arg_names false variadic_fun_type in - let cpp_args = cpp_arg_gen templated_args variadic_fun_type in - let functor_decl = - make_fun_defn - ~templates_init:([arg_templates], true) - ~name:"operator()" - ~return_type:(lower_returntype fdargs fdrt) - ~args:cpp_args ~cv_qualifiers:[Const] () in - (* Side Effect: *) - add_functor_decl functors functor_name struct_template functor_decl ; - let defn_template = - match fdsuffix with - | FnLpdf _ | FnTarget -> [TemplateType "propto__"] - | _ -> [] in - let defn_args = - List.map ~f:Exprs.to_var - (List.map ~f:snd templated_args @ extra_arg_names @ ["pstream__"]) - in - let defn_args = - match (variadic_fun_type, defn_args) with - | `ReduceSum, slice :: start :: end_ :: rest -> - slice :: plus_one start :: plus_one end_ :: rest - | _ -> defn_args in - let defn_body = - [ Return - (Some (Exprs.templated_fun_call fdname defn_template defn_args)) - ] in - make_fun_defn - ~templates_init: - ([struct_template |> Option.to_list; arg_templates], false) - ~name: - ( functor_name - ^ (if struct_template <> None then "" else "") - ^ "::operator()" ) - ~return_type:(lower_returntype fdargs fdrt) - ~args:cpp_args ~cv_qualifiers:[Const] ~body:defn_body () in - let out_body = lower_fun_body fdargs fdsuffix fdbody in - [almost_fn ~body:out_body (); register_functor `None] - @ ( if String.Set.mem funs_used_in_reduce_sum fdname then - [register_functor `ReduceSum] - else [] ) - @ (* Produces the variadic functors that has the pstream argument - as not the last argument. For DAEs this is the 4th, for ODEs the 3rd *) - List.map - (List.stable_dedup @@ Map.find_multi variadic_fns fdname) - ~f:(fun i -> register_functor (`VariadicHOF i)) + let fd = + match Option.map ~f:(lower_fun_body fdargs fdsuffix) fdbody with + | Some body -> almost_fn ~body () + | None -> almost_fn () in + let register_functor variadic_fun_type = + let suffix = Lower_expr.functor_suffix_select variadic_fun_type in + let functor_name = fdname ^ suffix in + let struct_template = + match (fdsuffix, variadic_fun_type) with + | FnLpdf _, ReduceSum -> Some (Bool "propto__") + | _ -> None in + let arg_templates, templated_args = + template_parameter_and_arg_names false variadic_fun_type in + let cpp_args = cpp_arg_gen templated_args variadic_fun_type in + let defn_template = + match fdsuffix with + | FnLpdf _ | FnTarget -> [TemplateType "propto__"] + | _ -> [] in + let defn_args = + List.map ~f:Exprs.to_var + (List.map ~f:snd templated_args @ extra_arg_names @ ["pstream__"]) in + let defn_args = + match (variadic_fun_type, defn_args) with + | ReduceSum, slice :: start :: end_ :: rest -> + slice :: plus_one start :: plus_one end_ :: rest + | _ -> defn_args in + let defn_body = + [Return (Some (Exprs.templated_fun_call fdname defn_template defn_args))] + in + let functor_decl = + make_fun_defn + ~templates_init:([arg_templates], true) + ~name:"operator()" + ~return_type:(lower_returntype fdargs fdrt) + ~args:cpp_args ~cv_qualifiers:[Const] ~body:defn_body () in + make_struct_defn ~param:struct_template ~name:functor_name + ~body:[FunDef functor_decl] () in + (fd, functors |> List.map ~f:register_functor) -let is_fun_used_with_reduce_sum (p : Program.Numbered.t) = - let rec find_functors_expr accum Expr.Fixed.{pattern; _} = - String.Set.union accum - ( match pattern with - | FunApp (StanLib (x, FnPlain, _), {pattern= Var f; _} :: _) - when Stan_math_signatures.is_reduce_sum_fn x -> - String.Set.of_list [Utils.stdlib_distribution_name f] - | x -> Expr.Fixed.Pattern.fold find_functors_expr accum x ) in - let rec find_functors_stmt accum stmt = - Stmt.Fixed.( - Pattern.fold find_functors_expr find_functors_stmt accum stmt.pattern) - in - Program.fold find_functors_expr find_functors_stmt String.Set.empty p - -let get_variadic_requirements (p : Program.Numbered.t) = - let rec find_functors_expr accum Expr.Fixed.{pattern; _} = - match pattern with - | FunApp (StanLib (x, FnPlain, _), {pattern= Var f; _} :: _) -> ( - match - Hashtbl.find Stan_math_signatures.stan_math_variadic_signatures x - with - | Some {required_fn_args; _} -> - Map.add_multi accum - ~key:(Utils.stdlib_distribution_name f) - ~data:(List.length required_fn_args) - | _ -> Expr.Fixed.Pattern.fold find_functors_expr accum pattern ) - | _ -> Expr.Fixed.Pattern.fold find_functors_expr accum pattern in +let get_functor_requirements (p : Program.Numbered.t) = + let open Expr.Fixed in + let rec find_functors_expr init = function + | {pattern= FunApp (StanLib (hof, FnPlain, _), args); _} -> + let f accum = function + | {pattern= Var name; _} as e + when UnsizedType.is_fun_type (Expr.Typed.type_of e) -> + Map.add_multi accum + ~key:(Utils.stdlib_distribution_name name) + ~data:(Lower_expr.functor_type hof) + | e -> find_functors_expr accum e in + List.fold ~init ~f args + | {pattern; _} -> Pattern.fold find_functors_expr init pattern in let rec find_functors_stmt accum stmt = Stmt.Fixed.( Pattern.fold find_functors_expr find_functors_stmt accum stmt.pattern) in Program.fold find_functors_expr find_functors_stmt String.Map.empty p -(** We need to do a fair bit of bookkeeping to handle the functors necessary for the various - higher order functions. - - Each functor needs a forward decl struct before the function, - then the function definition, - then the actual functor definitions - *) let collect_functors_functions (p : Program.Numbered.t) : defn list = - let (functors : (string, Cpp.struct_defn) Hashtbl.t) = - String.Table.create () in - let forward_decls = Hash_set.Poly.create () in - let reduce_sum_fns = is_fun_used_with_reduce_sum p in - let variadic_fns = get_variadic_requirements p in - let fun_and_functor_defs = + let functor_required = get_functor_requirements p in + let fun_has_def = + List.filter_map p.functions_block ~f:(function + | {fdname; fdbody= Some _; _} -> Some fdname + | _ -> None ) + |> String.Set.of_list in + let fun_decls, fun_defns = p.functions_block - |> List.concat_map - ~f:(lower_fun_def functors forward_decls reduce_sum_fns variadic_fns) - |> List.map ~f:(fun f -> FunDef f) in - let functor_struct_decls = - functors |> Hashtbl.data |> List.map ~f:(fun s -> Struct s) in - functor_struct_decls @ fun_and_functor_defs + |> List.filter_map ~f:(fun d -> + if Set.mem fun_has_def d.fdname && Option.is_none d.fdbody then None + else + let functors = + Map.find_multi functor_required d.fdname |> List.stable_dedup + in + let fn, st = lower_fun_def functors d in + let decl, defn = Cpp.split_fun_decl_defn fn in + Some + (FunDef decl :: List.map ~f:(fun s -> Struct s) st, FunDef defn) ) + |> List.unzip in + List.concat fun_decls @ fun_defns let lower_standalone_fun_def namespace_fun Program.{fdname; fdsuffix; fdargs; fdbody; fdrt; _} = @@ -385,10 +327,10 @@ module Testing = struct open Fmt let pp_fun_def_test ppf a = - (list ~sep:cut Cpp.Printing.pp_fun_defn) - ppf - (lower_fun_def (String.Table.create ()) (Hash_set.Poly.create ()) - String.Set.empty String.Map.empty a ) + let defn, st = lower_fun_def [FixedArgs] a in + Cpp.Printing.pp_fun_defn ppf defn ; + cut ppf () ; + (list ~sep:cut Cpp.Printing.pp_struct_defn) ppf st let%expect_test "udf" = let with_no_loc stmt = @@ -435,16 +377,17 @@ module Testing = struct stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } - template , - stan::is_vt_not_complex, - stan::is_row_vector, - stan::is_vt_not_complex>*> - void - sars_functor__::operator()(const T0__& x, const T1__& y, std::ostream* - pstream__) const { - return sars(x, y, pstream__); - } |}] + struct sars_functor__ { + template , + stan::is_vt_not_complex, + stan::is_row_vector, + stan::is_vt_not_complex>* = nullptr> + void + operator()(const T0__& x, const T1__& y, std::ostream* pstream__) const { + return sars(x, y, pstream__); + } + }; |}] let%expect_test "udf-expressions" = let with_no_loc stmt = @@ -502,19 +445,21 @@ module Testing = struct stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } - template , - stan::is_vt_not_complex, - stan::is_row_vector, - stan::is_vt_not_complex, - stan::is_row_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar>*> - Eigen::Matrix, - stan::base_type_t, stan::base_type_t, T3__>,-1,-1> - sars_functor__::operator()(const T0__& x, const T1__& y, const T2__& z, - const std::vector>& w, - std::ostream* pstream__) const { - return sars(x, y, z, w, pstream__); - } |}] + struct sars_functor__ { + template , + stan::is_vt_not_complex, + stan::is_row_vector, + stan::is_vt_not_complex, + stan::is_row_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar>* = nullptr> + Eigen::Matrix, + stan::base_type_t, stan::base_type_t, T3__>,-1,-1> + operator()(const T0__& x, const T1__& y, const T2__& z, + const std::vector>& w, std::ostream* + pstream__) const { + return sars(x, y, z, w, pstream__); + } + }; |}] end diff --git a/test/integration/good/code-gen/complex_numbers/cpp.expected b/test/integration/good/code-gen/complex_numbers/cpp.expected index 0d739e6567..98ce98399c 100644 --- a/test/integration/good/code-gen/complex_numbers/cpp.expected +++ b/test/integration/good/code-gen/complex_numbers/cpp.expected @@ -5761,70 +5761,46 @@ static constexpr std::array locations_array__ = " (in 'complex_scalar.stan', line 29, column 32 to line 32, column 3)", " (in 'complex_scalar.stan', line 34, column 4 to column 13)", " (in 'complex_scalar.stan', line 33, column 45 to line 35, column 3)"}; -struct foo_functor__ { - std::complex operator()(std::ostream* pstream__) const; -}; -struct foo5_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>& z, std::ostream* - pstream__) const; -}; -struct foo7_functor__ { - template >* = nullptr> - std::vector>> - operator()(const std::vector>& z, std::ostream* - pstream__) const; -}; -struct foo3_functor__ { - template >* = nullptr> - std::complex> - operator()(const std::complex& z, std::ostream* pstream__) const; -}; -struct foo9_functor__ { - template >* = nullptr> - std::vector>>> - operator()(const T0__& r, std::ostream* pstream__) const; -}; -struct foo2_functor__ { - template >* = nullptr> - std::complex> - operator()(const T0__& r, std::ostream* pstream__) const; -}; -struct foo10_functor__ { - template >* = nullptr> - std::vector>>> - operator()(const std::vector>>& z, - std::ostream* pstream__) const; -}; -struct foo6_functor__ { - template >* = nullptr> - std::vector>> - operator()(const T0__& r, std::ostream* pstream__) const; -}; -struct foo4_functor__ { - std::vector> operator()(std::ostream* pstream__) const; -}; -struct foo1_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::complex& z, std::ostream* pstream__) const; -}; -struct foo8_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>>& z, - std::ostream* pstream__) const; -}; +std::complex foo(std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t +foo1(const std::complex& z, std::ostream* pstream__); +template >* = nullptr> +std::complex> +foo2(const T0__& r, std::ostream* pstream__); +template >* = nullptr> +std::complex> +foo3(const std::complex& z, std::ostream* pstream__); +std::vector> foo4(std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t +foo5(const std::vector>& z, std::ostream* pstream__); +template >* = nullptr> +std::vector>> +foo6(const T0__& r, std::ostream* pstream__); +template >* = nullptr> +std::vector>> +foo7(const std::vector>& z, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t +foo8(const std::vector>>& z, std::ostream* + pstream__); +template >* = nullptr> +std::vector>>> +foo9(const T0__& r, std::ostream* pstream__); +template >* = nullptr> +std::vector>>> +foo10(const std::vector>>& z, std::ostream* + pstream__); std::complex foo(std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -5841,11 +5817,7 @@ std::complex foo(std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -std::complex foo_functor__::operator()(std::ostream* pstream__) const { - return foo(pstream__); -} -template >* = nullptr> +template >*> stan::promote_args_t foo1(const std::complex& z, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -5864,13 +5836,6 @@ foo1(const std::complex& z, std::ostream* pstream__) { } } template >*> -stan::promote_args_t -foo1_functor__::operator()(const std::complex& z, std::ostream* - pstream__) const { - return foo1(z, pstream__); -} -template >* = nullptr> std::complex> foo2(const T0__& r, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -5890,12 +5855,6 @@ foo2(const T0__& r, std::ostream* pstream__) { } template >*> std::complex> -foo2_functor__::operator()(const T0__& r, std::ostream* pstream__) const { - return foo2(r, pstream__); -} -template >* = nullptr> -std::complex> foo3(const std::complex& z, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -5912,12 +5871,6 @@ foo3(const std::complex& z, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -std::complex> -foo3_functor__::operator()(const std::complex& z, std::ostream* - pstream__) const { - return foo3(z, pstream__); -} std::vector> foo4(std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -5935,12 +5888,7 @@ std::vector> foo4(std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -std::vector> -foo4_functor__::operator()(std::ostream* pstream__) const { - return foo4(pstream__); -} -template >* = nullptr> +template >*> stan::promote_args_t foo5(const std::vector>& z, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -5959,13 +5907,6 @@ foo5(const std::vector>& z, std::ostream* pstream__) { } } template >*> -stan::promote_args_t -foo5_functor__::operator()(const std::vector>& z, - std::ostream* pstream__) const { - return foo5(z, pstream__); -} -template >* = nullptr> std::vector>> foo6(const T0__& r, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -5987,12 +5928,6 @@ foo6(const T0__& r, std::ostream* pstream__) { } template >*> std::vector>> -foo6_functor__::operator()(const T0__& r, std::ostream* pstream__) const { - return foo6(r, pstream__); -} -template >* = nullptr> -std::vector>> foo7(const std::vector>& z, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -6010,13 +5945,6 @@ foo7(const std::vector>& z, std::ostream* pstream__) { } } template >*> -std::vector>> -foo7_functor__::operator()(const std::vector>& z, - std::ostream* pstream__) const { - return foo7(z, pstream__); -} -template >* = nullptr> stan::promote_args_t foo8(const std::vector>>& z, std::ostream* pstream__) { @@ -6036,13 +5964,6 @@ foo8(const std::vector>>& z, std::ostream* } } template >*> -stan::promote_args_t -foo8_functor__::operator()(const std::vector>>& - z, std::ostream* pstream__) const { - return foo8(z, pstream__); -} -template >* = nullptr> std::vector>>> foo9(const T0__& r, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -6072,12 +5993,6 @@ foo9(const T0__& r, std::ostream* pstream__) { } template >*> std::vector>>> -foo9_functor__::operator()(const T0__& r, std::ostream* pstream__) const { - return foo9(r, pstream__); -} -template >* = nullptr> -std::vector>>> foo10(const std::vector>>& z, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -6095,13 +6010,6 @@ foo10(const std::vector>>& z, std::ostream* stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -std::vector>>> -foo10_functor__::operator()(const std::vector< - std::vector>>& z, - std::ostream* pstream__) const { - return foo10(z, pstream__); -} class complex_scalar_model final : public model_base_crtp { private: int d_i; @@ -8413,52 +8321,49 @@ static constexpr std::array locations_array__ = " (in 'user_function_templating.stan', line 20, column 54 to line 22, column 3)", " (in 'user_function_templating.stan', line 24, column 4 to column 35)", " (in 'user_function_templating.stan', line 23, column 38 to line 25, column 3)"}; -struct foo_functor__ { - template , - stan::is_vt_complex>* = nullptr> - Eigen::Matrix>>,-1,-1> - operator()(const T0__& Z, std::ostream* pstream__) const; - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,-1> - operator()(const T0__& A, std::ostream* pstream__) const; - template , - stan::is_vt_complex>* = nullptr> - Eigen::Matrix>>,-1,1> - operator()(const T0__& Z, std::ostream* pstream__) const; - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& A, std::ostream* pstream__) const; - template , - stan::is_vt_complex>* = nullptr> - Eigen::Matrix>>,1,-1> - operator()(const T0__& Z, std::ostream* pstream__) const; - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,1,-1> - operator()(const T0__& A, std::ostream* pstream__) const; - template >* = nullptr> - std::vector>,-1,-1>> - operator()(const std::vector,-1,-1>>& Z, - std::ostream* pstream__) const; - template >* = nullptr> - std::vector,-1,-1>> - operator()(const std::vector>& A, std::ostream* - pstream__) const; -}; template , stan::is_vt_complex>* = nullptr> Eigen::Matrix>>,-1,-1> +foo(const T0__& Z_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix>,-1,-1> +foo(const T0__& A_arg__, std::ostream* pstream__); +template , + stan::is_vt_complex>* = nullptr> +Eigen::Matrix>>,-1,1> +foo(const T0__& Z_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix>,-1,1> +foo(const T0__& A_arg__, std::ostream* pstream__); +template , + stan::is_vt_complex>* = nullptr> +Eigen::Matrix>>,1,-1> +foo(const T0__& Z_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix>,1,-1> +foo(const T0__& A_arg__, std::ostream* pstream__); +template >* = nullptr> +std::vector>,-1,-1>> +foo(const std::vector,-1,-1>>& Z, + std::ostream* pstream__); +template >* = nullptr> +std::vector,-1,-1>> +foo(const std::vector>& A, std::ostream* pstream__); +template , + stan::is_vt_complex>*> +Eigen::Matrix>>,-1,-1> foo(const T0__& Z_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; int current_statement__ = 0; @@ -8478,14 +8383,7 @@ foo(const T0__& Z_arg__, std::ostream* pstream__) { } template , - stan::is_vt_complex>*> -Eigen::Matrix>>,-1,-1> -foo_functor__::operator()(const T0__& Z, std::ostream* pstream__) const { - return foo(Z, pstream__); -} -template , - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix>,-1,-1> foo(const T0__& A_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; @@ -8506,16 +8404,9 @@ foo(const T0__& A_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,-1> -foo_functor__::operator()(const T0__& A, std::ostream* pstream__) const { - return foo(A, pstream__); -} template , - stan::is_vt_complex>* = nullptr> + stan::is_vt_complex>*> Eigen::Matrix>>,-1,1> foo(const T0__& Z_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; @@ -8536,14 +8427,7 @@ foo(const T0__& Z_arg__, std::ostream* pstream__) { } template , - stan::is_vt_complex>*> -Eigen::Matrix>>,-1,1> -foo_functor__::operator()(const T0__& Z, std::ostream* pstream__) const { - return foo(Z, pstream__); -} -template , - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix>,-1,1> foo(const T0__& A_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; @@ -8564,16 +8448,9 @@ foo(const T0__& A_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,1> -foo_functor__::operator()(const T0__& A, std::ostream* pstream__) const { - return foo(A, pstream__); -} template , - stan::is_vt_complex>* = nullptr> + stan::is_vt_complex>*> Eigen::Matrix>>,1,-1> foo(const T0__& Z_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; @@ -8594,14 +8471,7 @@ foo(const T0__& Z_arg__, std::ostream* pstream__) { } template , - stan::is_vt_complex>*> -Eigen::Matrix>>,1,-1> -foo_functor__::operator()(const T0__& Z, std::ostream* pstream__) const { - return foo(Z, pstream__); -} -template , - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix>,1,-1> foo(const T0__& A_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; @@ -8622,15 +8492,7 @@ foo(const T0__& A_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,1,-1> -foo_functor__::operator()(const T0__& A, std::ostream* pstream__) const { - return foo(A, pstream__); -} -template >* = nullptr> +template >*> std::vector>,-1,-1>> foo(const std::vector,-1,-1>>& Z, std::ostream* pstream__) { @@ -8650,14 +8512,6 @@ foo(const std::vector,-1,-1>>& Z, } } template >*> -std::vector>,-1,-1>> -foo_functor__::operator()(const std::vector< - Eigen::Matrix,-1,-1>>& - Z, std::ostream* pstream__) const { - return foo(Z, pstream__); -} -template >* = nullptr> std::vector,-1,-1>> foo(const std::vector>& A, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -8677,12 +8531,6 @@ foo(const std::vector>& A, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -std::vector,-1,-1>> -foo_functor__::operator()(const std::vector>& A, - std::ostream* pstream__) const { - return foo(A, pstream__); -} class user_function_templating_model final : public model_base_crtp { private: int N; diff --git a/test/integration/good/code-gen/cpp.expected b/test/integration/good/code-gen/cpp.expected index fab8f1307d..05f9ed8fb3 100644 --- a/test/integration/good/code-gen/cpp.expected +++ b/test/integration/good/code-gen/cpp.expected @@ -749,51 +749,24 @@ static constexpr std::array locations_array__ = " (in 'cpp-reserved-words.stan', line 14, column 13 to column 15)", " (in 'cpp-reserved-words.stan', line 15, column 17 to column 19)", " (in 'cpp-reserved-words.stan', line 16, column 17 to column 19)"}; -struct _stan_case_functor__ { - void operator()(std::ostream* pstream__) const; -}; -struct _stan_bool_functor__ { - void operator()(std::ostream* pstream__) const; -}; -struct _stan_char32_t_functor__ { - void operator()(std::ostream* pstream__) const; -}; -struct _stan_char_functor__ { - void operator()(std::ostream* pstream__) const; -}; -struct _stan_and_functor__ { - int operator()(const int& _stan_STAN_MAJOR, std::ostream* pstream__) const; -}; -struct _stan_and_eq_functor__ { - template >* = nullptr> - void - operator()(const T0__& _stan_STAN_MINOR, std::ostream* pstream__) const; -}; -struct _stan_alignof_functor__ { - void operator()(const int& _stan_char, std::ostream* pstream__) const; -}; -struct _stan_alignas_functor__ { - void operator()(const int& _stan_asm, std::ostream* pstream__) const; -}; -struct _stan_catch_functor__ { - void operator()(std::ostream* pstream__) const; -}; -struct _stan_bitand_functor__ { - void operator()(const int& _stan_constexpr, std::ostream* pstream__) const; -}; -struct _stan_bitor_functor__ { - void operator()(std::ostream* pstream__) const; -}; -struct _stan_char16_t_functor__ { - void operator()(std::ostream* pstream__) const; -}; -struct _stan_asm_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - void operator()(const T0__& _stan_class, std::ostream* pstream__) const; -}; +void _stan_alignas(const int& _stan_asm, std::ostream* pstream__); +void _stan_alignof(const int& _stan_char, std::ostream* pstream__); +int _stan_and(const int& _stan_STAN_MAJOR, std::ostream* pstream__); +template >* = nullptr> +void _stan_and_eq(const T0__& _stan_STAN_MINOR, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +void _stan_asm(const T0__& _stan_class_arg__, std::ostream* pstream__); +void _stan_bitand(const int& _stan_constexpr, std::ostream* pstream__); +void _stan_bitor(std::ostream* pstream__); +void _stan_bool(std::ostream* pstream__); +void _stan_case(std::ostream* pstream__); +void _stan_catch(std::ostream* pstream__); +void _stan_char(std::ostream* pstream__); +void _stan_char16_t(std::ostream* pstream__); +void _stan_char32_t(std::ostream* pstream__); void _stan_alignas(const int& _stan_asm, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -809,11 +782,6 @@ void _stan_alignas(const int& _stan_asm, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -void -_stan_alignas_functor__::operator()(const int& _stan_asm, std::ostream* - pstream__) const { - return _stan_alignas(_stan_asm, pstream__); -} void _stan_alignof(const int& _stan_char, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -829,11 +797,6 @@ void _stan_alignof(const int& _stan_char, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -void -_stan_alignof_functor__::operator()(const int& _stan_char, std::ostream* - pstream__) const { - return _stan_alignof(_stan_char, pstream__); -} int _stan_and(const int& _stan_STAN_MAJOR, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -850,13 +813,7 @@ int _stan_and(const int& _stan_STAN_MAJOR, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -_stan_and_functor__::operator()(const int& _stan_STAN_MAJOR, std::ostream* - pstream__) const { - return _stan_and(_stan_STAN_MAJOR, pstream__); -} -template >* = nullptr> +template >*> void _stan_and_eq(const T0__& _stan_STAN_MINOR, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -872,15 +829,9 @@ void _stan_and_eq(const T0__& _stan_STAN_MINOR, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -void -_stan_and_eq_functor__::operator()(const T0__& _stan_STAN_MINOR, - std::ostream* pstream__) const { - return _stan_and_eq(_stan_STAN_MINOR, pstream__); -} template , - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> void _stan_asm(const T0__& _stan_class_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; int current_statement__ = 0; @@ -897,14 +848,6 @@ void _stan_asm(const T0__& _stan_class_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -void -_stan_asm_functor__::operator()(const T0__& _stan_class, std::ostream* - pstream__) const { - return _stan_asm(_stan_class, pstream__); -} void _stan_bitand(const int& _stan_constexpr, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -920,11 +863,6 @@ void _stan_bitand(const int& _stan_constexpr, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -void -_stan_bitand_functor__::operator()(const int& _stan_constexpr, std::ostream* - pstream__) const { - return _stan_bitand(_stan_constexpr, pstream__); -} void _stan_bitor(std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -940,9 +878,6 @@ void _stan_bitor(std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -void _stan_bitor_functor__::operator()(std::ostream* pstream__) const { - return _stan_bitor(pstream__); -} void _stan_bool(std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -958,9 +893,6 @@ void _stan_bool(std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -void _stan_bool_functor__::operator()(std::ostream* pstream__) const { - return _stan_bool(pstream__); -} void _stan_case(std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -976,9 +908,6 @@ void _stan_case(std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -void _stan_case_functor__::operator()(std::ostream* pstream__) const { - return _stan_case(pstream__); -} void _stan_catch(std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -994,9 +923,6 @@ void _stan_catch(std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -void _stan_catch_functor__::operator()(std::ostream* pstream__) const { - return _stan_catch(pstream__); -} void _stan_char(std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -1012,9 +938,6 @@ void _stan_char(std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -void _stan_char_functor__::operator()(std::ostream* pstream__) const { - return _stan_char(pstream__); -} void _stan_char16_t(std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -1030,9 +953,6 @@ void _stan_char16_t(std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -void _stan_char16_t_functor__::operator()(std::ostream* pstream__) const { - return _stan_char16_t(pstream__); -} void _stan_char32_t(std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -1048,9 +968,6 @@ void _stan_char32_t(std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -void _stan_char32_t_functor__::operator()(std::ostream* pstream__) const { - return _stan_char32_t(pstream__); -} class cpp_reserved_words_model final : public model_base_crtp { private: double _stan_class; @@ -3269,588 +3186,7 @@ static constexpr std::array locations_array__ = " (in 'mother.stan', line 347, column 4 to column 18)", " (in 'mother.stan', line 348, column 4 to column 16)", " (in 'mother.stan', line 345, column 41 to line 349, column 3)"}; -struct foo_functor__ { - int operator()(const int& n, std::ostream* pstream__) const; -}; -struct f1_functor__ { - template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - int - operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, const T3__& a4, - const std::vector& a5, - const std::vector>& a6, const T6__& a7, - const std::vector>& a8, - const std::vector>>& a9, - const T9__& a10, const std::vector>& - a11, const std::vector>>& - a12, std::ostream* pstream__) const; -}; -struct foo_bar1_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const T0__& x, std::ostream* pstream__) const; -}; -struct binomialf_functor__ { - template , - stan::is_vt_not_complex, - stan::is_col_vector, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix, - stan::base_type_t>,-1,1> - operator()(const T0__& phi, const T1__& theta, const std::vector& - x_r, const std::vector& x_i, std::ostream* pstream__) const; -}; -struct foo_6_functor__ { - void operator()(std::ostream* pstream__) const; -}; -struct foo_3_functor__ { - template >* = nullptr> - std::vector> - operator()(const T0__& t, const int& n, std::ostream* pstream__) const; -}; -struct foo_lp_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const T0__& x, T_lp__& lp__, T_lp_accum__& lp_accum__, - std::ostream* pstream__) const; -}; -struct vecmufoo_functor__ { - template >* = nullptr> - Eigen::Matrix,-1,1> - operator()(const T0__& mu, std::ostream* pstream__) const; -}; -struct foo_lccdf_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const int& y, const T1__& lambda, std::ostream* pstream__) const; -}; -struct f8_functor__ { - template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - std::vector< - Eigen::Matrix, T7__, - stan::promote_args_t, - T10__, T11__>>,-1,1>> - operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, const T3__& a4, - const std::vector& a5, - const std::vector>& a6, const T6__& a7, - const std::vector>& a8, - const std::vector>>& a9, - const T9__& a10, const std::vector>& - a11, const std::vector>>& - a12, std::ostream* pstream__) const; -}; -struct f9_functor__ { - template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - std::vector< - std::vector< - Eigen::Matrix, T7__, - stan::promote_args_t, - T10__, T11__>>,-1,1>>> - operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, const T3__& a4, - const std::vector& a5, - const std::vector>& a6, const T6__& a7, - const std::vector>& a8, - const std::vector>>& a9, - const T9__& a10, const std::vector>& - a11, const std::vector>>& - a12, std::ostream* pstream__) const; -}; -struct f2_functor__ { - template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - std::vector - operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, const T3__& a4, - const std::vector& a5, - const std::vector>& a6, const T6__& a7, - const std::vector>& a8, - const std::vector>>& a9, - const T9__& a10, const std::vector>& - a11, const std::vector>>& - a12, std::ostream* pstream__) const; -}; -struct f10_functor__ { - template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - Eigen::Matrix, T7__, - stan::promote_args_t, T10__, - T11__>>,-1,-1> - operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, const T3__& a4, - const std::vector& a5, - const std::vector>& a6, const T6__& a7, - const std::vector>& a8, - const std::vector>>& a9, - const T9__& a10, const std::vector>& - a11, const std::vector>>& - a12, std::ostream* pstream__) const; -}; -struct f4_functor__ { - template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t, T7__, - stan::promote_args_t, T10__, T11__>> - operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, const T3__& a4, - const std::vector& a5, - const std::vector>& a6, const T6__& a7, - const std::vector>& a8, - const std::vector>>& a9, - const T9__& a10, const std::vector>& - a11, const std::vector>>& - a12, std::ostream* pstream__) const; -}; -struct foo_5_functor__ { - template , - stan::is_vt_not_complex, - stan::is_col_vector, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix, - stan::base_type_t>,-1,1> - operator()(const T0__& shared_params, const T1__& job_params, - const std::vector& data_r, const std::vector& - data_i, std::ostream* pstream__) const; -}; -struct foo_lpmf_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const int& y, const T1__& lambda, std::ostream* pstream__) const; -}; -struct f0_functor__ { - template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - void - operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, const T3__& a4, - const std::vector& a5, - const std::vector>& a6, const T6__& a7, - const std::vector>& a8, - const std::vector>>& a9, - const T9__& a10, const std::vector>& - a11, const std::vector>>& - a12, std::ostream* pstream__) const; -}; -struct vecmubar_functor__ { - template >* = nullptr> - Eigen::Matrix,-1,1> - operator()(const T0__& mu, std::ostream* pstream__) const; -}; -struct relative_diff_functor__ { - template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const T0__& x, const T1__& y, const T2__& max_, const T3__& - min_, std::ostream* pstream__) const; -}; -struct foo_rng_functor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const T0__& mu, const T1__& sigma, RNG& base_rng__, - std::ostream* pstream__) const; -}; -struct algebra_system_functor__ { - template , - stan::is_vt_not_complex, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar>* = nullptr> - Eigen::Matrix, - stan::base_type_t, T2__>,-1,1> - operator()(const T0__& x, const T1__& y, const std::vector& dat, - const std::vector& dat_int, std::ostream* pstream__) const; -}; -struct matfoo_functor__ { - Eigen::Matrix operator()(std::ostream* pstream__) const; -}; -struct foo_bar2_functor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const T0__& x, const T1__& y, std::ostream* pstream__) const; -}; -struct sho_functor__ { - template , - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - std::vector> - operator()(const T0__& t, const std::vector& y, - const std::vector& theta, const std::vector& x, - const std::vector& x_int, std::ostream* pstream__) const; -}; -struct f12_functor__ { - template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - std::vector< - std::vector< - Eigen::Matrix, T7__, - stan::promote_args_t, - T10__, T11__>>,-1,-1>>> - operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, const T3__& a4, - const std::vector& a5, - const std::vector>& a6, const T6__& a7, - const std::vector>& a8, - const std::vector>>& a9, - const T9__& a10, const std::vector>& - a11, const std::vector>>& - a12, std::ostream* pstream__) const; -}; -struct f11_functor__ { - template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - std::vector< - Eigen::Matrix, T7__, - stan::promote_args_t, - T10__, T11__>>,-1,-1>> - operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, const T3__& a4, - const std::vector& a5, - const std::vector>& a6, const T6__& a7, - const std::vector>& a8, - const std::vector>>& a9, - const T9__& a10, const std::vector>& - a11, const std::vector>>& - a12, std::ostream* pstream__) const; -}; -struct f7_functor__ { - template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - Eigen::Matrix, T7__, - stan::promote_args_t, T10__, - T11__>>,-1,1> - operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, const T3__& a4, - const std::vector& a5, - const std::vector>& a6, const T6__& a7, - const std::vector>& a8, - const std::vector>>& a9, - const T9__& a10, const std::vector>& - a11, const std::vector>>& - a12, std::ostream* pstream__) const; -}; -struct foo_4_functor__ { - template >* = nullptr> - void operator()(const std::vector& x, std::ostream* pstream__) const; -}; -struct f3_functor__ { - template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - std::vector> - operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, const T3__& a4, - const std::vector& a5, - const std::vector>& a6, const T6__& a7, - const std::vector>& a8, - const std::vector>>& a9, - const T9__& a10, const std::vector>& - a11, const std::vector>>& - a12, std::ostream* pstream__) const; -}; -struct foo_2_functor__ { - int operator()(const int& a, std::ostream* pstream__) const; -}; -struct foo_five_args_functor__ { - template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const T0__& x1, const T1__& x2, const T2__& x3, const T3__& x4, - const T4__& x5, std::ostream* pstream__) const; -}; -struct f6_functor__ { - template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - std::vector< - std::vector< - stan::promote_args_t, T7__, - stan::promote_args_t, T10__, T11__>>>> - operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, const T3__& a4, - const std::vector& a5, - const std::vector>& a6, const T6__& a7, - const std::vector>& a8, - const std::vector>>& a9, - const T9__& a10, const std::vector>& - a11, const std::vector>>& - a12, std::ostream* pstream__) const; -}; -struct vecfoo_functor__ { - Eigen::Matrix operator()(std::ostream* pstream__) const; -}; -struct foo_bar0_functor__ { - double operator()(std::ostream* pstream__) const; -}; -struct unit_normal_lp_functor__ { - template >* = nullptr> - void - operator()(const T0__& u, T_lp__& lp__, T_lp_accum__& lp_accum__, - std::ostream* pstream__) const; -}; -struct foo_1_functor__ { - int operator()(const int& a, std::ostream* pstream__) const; -}; -struct covsqrt2corsqrt_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,-1> - operator()(const T0__& mat, const int& invert, std::ostream* pstream__) const; -}; -struct foo_lcdf_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const int& y, const T1__& lambda, std::ostream* pstream__) const; -}; -struct f5_functor__ { - template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - std::vector< - stan::promote_args_t, T7__, - stan::promote_args_t, T10__, T11__>>> - operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, const T3__& a4, - const std::vector& a5, - const std::vector>& a6, const T6__& a7, - const std::vector>& a8, - const std::vector>>& a9, - const T9__& a10, const std::vector>& - a11, const std::vector>>& - a12, std::ostream* pstream__) const; -}; -struct foo_five_args_lp_functor__ { - template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t> - operator()(const T0__& x1, const T1__& x2, const T2__& x3, const T3__& x4, - const T4__& x5, const T5__& x6, T_lp__& lp__, T_lp_accum__& - lp_accum__, std::ostream* pstream__) const; -}; int foo(const int& n, std::ostream* pstream__); -int foo(const int& n, std::ostream* pstream__) { - using local_scalar_t__ = double; - int current_statement__ = 0; - static constexpr bool propto__ = true; - // suppress unused var warning - (void) propto__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - current_statement__ = 594; - if (stan::math::logical_eq(n, 0)) { - current_statement__ = 593; - return 1; - } - current_statement__ = 595; - return (n * foo((n - 1), pstream__)); - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } -} -int foo_functor__::operator()(const int& n, std::ostream* pstream__) const { - return foo(n, pstream__); -} template , stan::is_stan_scalar, @@ -3859,23 +3195,528 @@ std::vector> sho(const T0__& t, const std::vector& y, const std::vector& theta, const std::vector& x, const std::vector& x_int, std::ostream* pstream__); -template >* = nullptr> +stan::promote_args_t foo_bar1(const T0__& x, std::ostream* pstream__); +template , - stan::is_stan_scalar, - stan::is_stan_scalar>*> -std::vector> -sho(const T0__& t, const std::vector& y, const std::vector& - theta, const std::vector& x, const std::vector& x_int, - std::ostream* pstream__) { - using local_scalar_t__ = stan::promote_args_t; - int current_statement__ = 0; - static constexpr bool propto__ = true; - // suppress unused var warning - (void) propto__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +foo_bar2(const T0__& x, const T1__& y, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t +foo_lpmf(const int& y, const T1__& lambda, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t +foo_lcdf(const int& y, const T1__& lambda, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t +foo_lccdf(const int& y, const T1__& lambda, std::ostream* pstream__); +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +foo_rng(const T0__& mu, const T1__& sigma, RNG& base_rng__, std::ostream* + pstream__); +template >* = nullptr> +void +unit_normal_lp(const T0__& u, T_lp__& lp__, T_lp_accum__& lp_accum__, + std::ostream* pstream__); +int foo_1(const int& a, std::ostream* pstream__); +int foo_2(const int& a, std::ostream* pstream__); +template >* = nullptr> +std::vector> +foo_3(const T0__& t, const int& n, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t +foo_lp(const T0__& x, T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* + pstream__); +template >* = nullptr> +void foo_4(const std::vector& x, std::ostream* pstream__); +template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +relative_diff(const T0__& x, const T1__& y, const T2__& max_, const T3__& + min_, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,1> +foo_5(const T0__& shared_params_arg__, const T1__& job_params_arg__, + const std::vector& data_r, const std::vector& data_i, + std::ostream* pstream__); +template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +foo_five_args(const T0__& x1, const T1__& x2, const T2__& x3, const T3__& x4, + const T4__& x5, std::ostream* pstream__); +template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t> +foo_five_args_lp(const T0__& x1, const T1__& x2, const T2__& x3, const T3__& + x4, const T4__& x5, const T5__& x6, T_lp__& lp__, + T_lp_accum__& lp_accum__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix>,-1,-1> +covsqrt2corsqrt(const T0__& mat_arg__, const int& invert, std::ostream* + pstream__); +template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +void +f0(const int& a1, const std::vector& a2, + const std::vector>& a3, const T3__& a4, + const std::vector& a5, const std::vector>& a6, + const T6__& a7_arg__, const std::vector>& a8, + const std::vector>>& a9, const T9__& + a10_arg__, const std::vector>& a11, + const std::vector>>& a12, + std::ostream* pstream__); +template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +int +f1(const int& a1, const std::vector& a2, + const std::vector>& a3, const T3__& a4, + const std::vector& a5, const std::vector>& a6, + const T6__& a7_arg__, const std::vector>& a8, + const std::vector>>& a9, const T9__& + a10_arg__, const std::vector>& a11, + const std::vector>>& a12, + std::ostream* pstream__); +template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +std::vector +f2(const int& a1, const std::vector& a2, + const std::vector>& a3, const T3__& a4, + const std::vector& a5, const std::vector>& a6, + const T6__& a7_arg__, const std::vector>& a8, + const std::vector>>& a9, const T9__& + a10_arg__, const std::vector>& a11, + const std::vector>>& a12, + std::ostream* pstream__); +template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +std::vector> +f3(const int& a1, const std::vector& a2, + const std::vector>& a3, const T3__& a4, + const std::vector& a5, const std::vector>& a6, + const T6__& a7_arg__, const std::vector>& a8, + const std::vector>>& a9, const T9__& + a10_arg__, const std::vector>& a11, + const std::vector>>& a12, + std::ostream* pstream__); +template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t, T7__, + stan::promote_args_t, T10__, T11__>> +f4(const int& a1, const std::vector& a2, + const std::vector>& a3, const T3__& a4, + const std::vector& a5, const std::vector>& a6, + const T6__& a7_arg__, const std::vector>& a8, + const std::vector>>& a9, const T9__& + a10_arg__, const std::vector>& a11, + const std::vector>>& a12, + std::ostream* pstream__); +template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +std::vector< + stan::promote_args_t, T7__, + stan::promote_args_t, T10__, T11__>>> +f5(const int& a1, const std::vector& a2, + const std::vector>& a3, const T3__& a4, + const std::vector& a5, const std::vector>& a6, + const T6__& a7_arg__, const std::vector>& a8, + const std::vector>>& a9, const T9__& + a10_arg__, const std::vector>& a11, + const std::vector>>& a12, + std::ostream* pstream__); +template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +std::vector< + std::vector< + stan::promote_args_t, T7__, + stan::promote_args_t, T10__, T11__>>>> +f6(const int& a1, const std::vector& a2, + const std::vector>& a3, const T3__& a4, + const std::vector& a5, const std::vector>& a6, + const T6__& a7_arg__, const std::vector>& a8, + const std::vector>>& a9, const T9__& + a10_arg__, const std::vector>& a11, + const std::vector>>& a12, + std::ostream* pstream__); +template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +Eigen::Matrix, + T7__, + stan::promote_args_t, T10__, + T11__>>,-1,1> +f7(const int& a1, const std::vector& a2, + const std::vector>& a3, const T3__& a4, + const std::vector& a5, const std::vector>& a6, + const T6__& a7_arg__, const std::vector>& a8, + const std::vector>>& a9, const T9__& + a10_arg__, const std::vector>& a11, + const std::vector>>& a12, + std::ostream* pstream__); +template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +std::vector< + Eigen::Matrix, T7__, + stan::promote_args_t, T10__, + T11__>>,-1,1>> +f8(const int& a1, const std::vector& a2, + const std::vector>& a3, const T3__& a4, + const std::vector& a5, const std::vector>& a6, + const T6__& a7_arg__, const std::vector>& a8, + const std::vector>>& a9, const T9__& + a10_arg__, const std::vector>& a11, + const std::vector>>& a12, + std::ostream* pstream__); +template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +std::vector< + std::vector< + Eigen::Matrix, T7__, + stan::promote_args_t, + T10__, T11__>>,-1,1>>> +f9(const int& a1, const std::vector& a2, + const std::vector>& a3, const T3__& a4, + const std::vector& a5, const std::vector>& a6, + const T6__& a7_arg__, const std::vector>& a8, + const std::vector>>& a9, const T9__& + a10_arg__, const std::vector>& a11, + const std::vector>>& a12, + std::ostream* pstream__); +template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +Eigen::Matrix, + T7__, + stan::promote_args_t, T10__, + T11__>>,-1,-1> +f10(const int& a1, const std::vector& a2, + const std::vector>& a3, const T3__& a4, + const std::vector& a5, const std::vector>& a6, + const T6__& a7_arg__, const std::vector>& a8, + const std::vector>>& a9, const T9__& + a10_arg__, const std::vector>& a11, + const std::vector>>& a12, + std::ostream* pstream__); +template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +std::vector< + Eigen::Matrix, T7__, + stan::promote_args_t, T10__, + T11__>>,-1,-1>> +f11(const int& a1, const std::vector& a2, + const std::vector>& a3, const T3__& a4, + const std::vector& a5, const std::vector>& a6, + const T6__& a7_arg__, const std::vector>& a8, + const std::vector>>& a9, const T9__& + a10_arg__, const std::vector>& a11, + const std::vector>>& a12, + std::ostream* pstream__); +template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +std::vector< + std::vector< + Eigen::Matrix, T7__, + stan::promote_args_t, + T10__, T11__>>,-1,-1>>> +f12(const int& a1, const std::vector& a2, + const std::vector>& a3, const T3__& a4, + const std::vector& a5, const std::vector>& a6, + const T6__& a7_arg__, const std::vector>& a8, + const std::vector>>& a9, const T9__& + a10_arg__, const std::vector>& a11, + const std::vector>>& a12, + std::ostream* pstream__); +void foo_6(std::ostream* pstream__); +Eigen::Matrix matfoo(std::ostream* pstream__); +Eigen::Matrix vecfoo(std::ostream* pstream__); +template >* = nullptr> +Eigen::Matrix,-1,1> +vecmufoo(const T0__& mu, std::ostream* pstream__); +template >* = nullptr> +Eigen::Matrix,-1,1> +vecmubar(const T0__& mu, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar>* = nullptr> +Eigen::Matrix, + stan::base_type_t, T2__>,-1,1> +algebra_system(const T0__& x_arg__, const T1__& y_arg__, + const std::vector& dat, const std::vector& dat_int, + std::ostream* pstream__); +struct algebra_system_functor__ { + template , + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar>* = nullptr> + Eigen::Matrix, + stan::base_type_t, T2__>,-1,1> + operator()(const T0__& x, const T1__& y, const std::vector& dat, + const std::vector& dat_int, std::ostream* pstream__) const { + return algebra_system(x, y, dat, dat_int, pstream__); + } +}; +template , + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,1> +binomialf(const T0__& phi_arg__, const T1__& theta_arg__, + const std::vector& x_r, const std::vector& x_i, + std::ostream* pstream__); +struct binomialf_functor__ { + template , + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex>* = nullptr> + Eigen::Matrix, + stan::base_type_t>,-1,1> + operator()(const T0__& phi, const T1__& theta, const std::vector& + x_r, const std::vector& x_i, std::ostream* pstream__) const { + return binomialf(phi, theta, x_r, x_i, pstream__); + } +}; +int foo(const int& n, std::ostream* pstream__) { + using local_scalar_t__ = double; + int current_statement__ = 0; + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 594; + if (stan::math::logical_eq(n, 0)) { + current_statement__ = 593; + return 1; + } + current_statement__ = 595; + return (n * foo((n - 1), pstream__)); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +template , + stan::is_stan_scalar, + stan::is_stan_scalar>*> +std::vector> +sho(const T0__& t, const std::vector& y, const std::vector& + theta, const std::vector& x, const std::vector& x_int, + std::ostream* pstream__) { + using local_scalar_t__ = stan::promote_args_t; + int current_statement__ = 0; + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { std::vector dydt = std::vector(2, DUMMY_VAR__); current_statement__ = 598; @@ -3894,18 +3735,6 @@ sho(const T0__& t, const std::vector& y, const std::vector& stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar, - stan::is_stan_scalar>*> -std::vector> -sho_functor__::operator()(const T0__& t, const std::vector& y, - const std::vector& theta, - const std::vector& x, - const std::vector& x_int, std::ostream* - pstream__) const { - return sho(t, y, theta, x, x_int, pstream__); -} double foo_bar0(std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -3922,11 +3751,7 @@ double foo_bar0(std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -double foo_bar0_functor__::operator()(std::ostream* pstream__) const { - return foo_bar0(pstream__); -} -template >* = nullptr> +template >*> stan::promote_args_t foo_bar1(const T0__& x, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -3943,14 +3768,9 @@ stan::promote_args_t foo_bar1(const T0__& x, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -foo_bar1_functor__::operator()(const T0__& x, std::ostream* pstream__) const { - return foo_bar1(x, pstream__); -} template , - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> stan::promote_args_t foo_bar2(const T0__& x, const T1__& y, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -3968,16 +3788,8 @@ foo_bar2(const T0__& x, const T1__& y, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar>*> -stan::promote_args_t -foo_bar2_functor__::operator()(const T0__& x, const T1__& y, std::ostream* - pstream__) const { - return foo_bar2(x, y, pstream__); -} template >* = nullptr> + stan::require_all_t>*> stan::promote_args_t foo_lpmf(const int& y, const T1__& lambda, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -3992,15 +3804,7 @@ foo_lpmf(const int& y, const T1__& lambda, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -foo_lpmf_functor__::operator()(const int& y, const T1__& lambda, - std::ostream* pstream__) const { - return foo_lpmf(y, lambda, pstream__); -} -template >* = nullptr> +template >*> stan::promote_args_t foo_lcdf(const int& y, const T1__& lambda, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -4020,13 +3824,6 @@ foo_lcdf(const int& y, const T1__& lambda, std::ostream* pstream__) { } template >*> stan::promote_args_t -foo_lcdf_functor__::operator()(const int& y, const T1__& lambda, - std::ostream* pstream__) const { - return foo_lcdf(y, lambda, pstream__); -} -template >* = nullptr> -stan::promote_args_t foo_lccdf(const int& y, const T1__& lambda, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -4043,15 +3840,9 @@ foo_lccdf(const int& y, const T1__& lambda, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -foo_lccdf_functor__::operator()(const int& y, const T1__& lambda, - std::ostream* pstream__) const { - return foo_lccdf(y, lambda, pstream__); -} template , - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> stan::promote_args_t foo_rng(const T0__& mu, const T1__& sigma, RNG& base_rng__, std::ostream* pstream__) { @@ -4070,17 +3861,9 @@ foo_rng(const T0__& mu, const T1__& sigma, RNG& base_rng__, std::ostream* stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar>*> -stan::promote_args_t -foo_rng_functor__::operator()(const T0__& mu, const T1__& sigma, RNG& - base_rng__, std::ostream* pstream__) const { - return foo_rng(mu, sigma, base_rng__, pstream__); -} template >* = nullptr> + stan::require_all_t>*> void unit_normal_lp(const T0__& u, T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) { @@ -4098,15 +3881,6 @@ unit_normal_lp(const T0__& u, T_lp__& lp__, T_lp_accum__& lp_accum__, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -void -unit_normal_lp_functor__::operator()(const T0__& u, T_lp__& lp__, - T_lp_accum__& lp_accum__, std::ostream* - pstream__) const { - return unit_normal_lp(u, lp__, lp_accum__, pstream__); -} int foo_1(const int& a, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -4312,9 +4086,6 @@ int foo_1(const int& a, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int foo_1_functor__::operator()(const int& a, std::ostream* pstream__) const { - return foo_1(a, pstream__); -} int foo_2(const int& a, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -4342,11 +4113,7 @@ int foo_2(const int& a, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int foo_2_functor__::operator()(const int& a, std::ostream* pstream__) const { - return foo_2(a, pstream__); -} -template >* = nullptr> +template >*> std::vector> foo_3(const T0__& t, const int& n, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -4364,15 +4131,9 @@ foo_3(const T0__& t, const int& n, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -std::vector> -foo_3_functor__::operator()(const T0__& t, const int& n, std::ostream* - pstream__) const { - return foo_3(t, n, pstream__); -} template >* = nullptr> + stan::require_all_t>*> stan::promote_args_t foo_lp(const T0__& x, T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) { @@ -4388,16 +4149,7 @@ foo_lp(const T0__& x, T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -foo_lp_functor__::operator()(const T0__& x, T_lp__& lp__, T_lp_accum__& - lp_accum__, std::ostream* pstream__) const { - return foo_lp(x, lp__, lp_accum__, pstream__); -} -template >* = nullptr> +template >*> void foo_4(const std::vector& x, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -4420,17 +4172,11 @@ void foo_4(const std::vector& x, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -void -foo_4_functor__::operator()(const std::vector& x, std::ostream* - pstream__) const { - return foo_4(x, pstream__); -} template , stan::is_stan_scalar, stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> stan::promote_args_t relative_diff(const T0__& x, const T1__& y, const T2__& max_, const T3__& min_, std::ostream* pstream__) { @@ -4481,22 +4227,11 @@ relative_diff(const T0__& x, const T1__& y, const T2__& max_, const T3__& stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>*> -stan::promote_args_t -relative_diff_functor__::operator()(const T0__& x, const T1__& y, const T2__& - max_, const T3__& min_, std::ostream* - pstream__) const { - return relative_diff(x, y, max_, min_, pstream__); -} template , stan::is_vt_not_complex, stan::is_col_vector, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix, stan::base_type_t>,-1,1> foo_5(const T0__& shared_params_arg__, const T1__& job_params_arg__, @@ -4520,26 +4255,13 @@ foo_5(const T0__& shared_params_arg__, const T1__& job_params_arg__, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_col_vector, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,1> -foo_5_functor__::operator()(const T0__& shared_params, const T1__& - job_params, const std::vector& data_r, - const std::vector& data_i, std::ostream* - pstream__) const { - return foo_5(shared_params, job_params, data_r, data_i, pstream__); -} template , stan::is_stan_scalar, stan::is_stan_scalar, stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> stan::promote_args_t foo_five_args(const T0__& x1, const T1__& x2, const T2__& x3, const T3__& x4, const T4__& x5, std::ostream* pstream__) { @@ -4558,19 +4280,6 @@ foo_five_args(const T0__& x1, const T1__& x2, const T2__& x3, const T3__& x4, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>*> -stan::promote_args_t -foo_five_args_functor__::operator()(const T0__& x1, const T1__& x2, - const T2__& x3, const T3__& x4, - const T4__& x5, std::ostream* pstream__) const { - return foo_five_args(x1, x2, x3, x4, x5, pstream__); -} template , stan::is_stan_scalar, stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> stan::promote_args_t> foo_five_args_lp(const T0__& x1, const T1__& x2, const T2__& x3, const T3__& @@ -4598,28 +4307,9 @@ foo_five_args_lp(const T0__& x1, const T1__& x2, const T2__& x3, const T3__& stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>*> -stan::promote_args_t> -foo_five_args_lp_functor__::operator()(const T0__& x1, const T1__& x2, - const T2__& x3, const T3__& x4, - const T4__& x5, const T5__& x6, - T_lp__& lp__, T_lp_accum__& - lp_accum__, std::ostream* pstream__) const { - return foo_five_args_lp(x1, x2, x3, x4, x5, x6, lp__, lp_accum__, - pstream__); -} template , - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix>,-1,-1> covsqrt2corsqrt(const T0__& mat_arg__, const int& invert, std::ostream* pstream__) { @@ -4660,14 +4350,6 @@ covsqrt2corsqrt(const T0__& mat_arg__, const int& invert, std::ostream* stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,-1> -covsqrt2corsqrt_functor__::operator()(const T0__& mat, const int& invert, - std::ostream* pstream__) const { - return covsqrt2corsqrt(mat, invert, pstream__); -} template , stan::is_vt_not_complex, stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> void f0(const int& a1, const std::vector& a2, const std::vector>& a3, const T3__& a4, @@ -4701,48 +4383,18 @@ f0(const int& a1, const std::vector& a2, static constexpr bool propto__ = true; // suppress unused var warning (void) propto__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - current_statement__ = 737; - if (pstream__) { - stan::math::stan_print(pstream__, "hi"); - stan::math::stan_print(pstream__, "\n"); - } - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } -} -template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>*> -void -f0_functor__::operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, const T3__& - a4, const std::vector& a5, - const std::vector>& a6, - const T6__& a7, - const std::vector>& a8, - const std::vector< - std::vector>>& a9, - const T9__& a10, - const std::vector>& a11, - const std::vector< - std::vector>>& - a12, std::ostream* pstream__) const { - return f0(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, pstream__); + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 737; + if (pstream__) { + stan::math::stan_print(pstream__, "hi"); + stan::math::stan_print(pstream__, "\n"); + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } } template , stan::is_vt_not_complex, stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> int f1(const int& a1, const std::vector& a2, const std::vector>& a3, const T3__& a4, @@ -4801,36 +4453,6 @@ template , stan::is_stan_scalar, stan::is_stan_scalar>*> -int -f1_functor__::operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, const T3__& - a4, const std::vector& a5, - const std::vector>& a6, - const T6__& a7, - const std::vector>& a8, - const std::vector< - std::vector>>& a9, - const T9__& a10, - const std::vector>& a11, - const std::vector< - std::vector>>& - a12, std::ostream* pstream__) const { - return f1(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, pstream__); -} -template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> std::vector f2(const int& a1, const std::vector& a2, const std::vector>& a3, const T3__& a4, @@ -4874,36 +4496,6 @@ template , stan::is_stan_scalar, stan::is_stan_scalar>*> -std::vector -f2_functor__::operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, const T3__& - a4, const std::vector& a5, - const std::vector>& a6, - const T6__& a7, - const std::vector>& a8, - const std::vector< - std::vector>>& a9, - const T9__& a10, - const std::vector>& a11, - const std::vector< - std::vector>>& - a12, std::ostream* pstream__) const { - return f2(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, pstream__); -} -template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> std::vector> f3(const int& a1, const std::vector& a2, const std::vector>& a3, const T3__& a4, @@ -4947,36 +4539,6 @@ template , stan::is_stan_scalar, stan::is_stan_scalar>*> -std::vector> -f3_functor__::operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, const T3__& - a4, const std::vector& a5, - const std::vector>& a6, - const T6__& a7, - const std::vector>& a8, - const std::vector< - std::vector>>& a9, - const T9__& a10, - const std::vector>& a11, - const std::vector< - std::vector>>& - a12, std::ostream* pstream__) const { - return f3(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, pstream__); -} -template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> stan::promote_args_t, T7__, stan::promote_args_t, T10__, T11__>> f4(const int& a1, const std::vector& a2, @@ -5021,37 +4583,6 @@ template , stan::is_stan_scalar, stan::is_stan_scalar>*> -stan::promote_args_t, T7__, - stan::promote_args_t, T10__, T11__>> -f4_functor__::operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, const T3__& - a4, const std::vector& a5, - const std::vector>& a6, - const T6__& a7, - const std::vector>& a8, - const std::vector< - std::vector>>& a9, - const T9__& a10, - const std::vector>& a11, - const std::vector< - std::vector>>& - a12, std::ostream* pstream__) const { - return f4(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, pstream__); -} -template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> std::vector< stan::promote_args_t, T7__, stan::promote_args_t, T10__, T11__>>> @@ -5097,38 +4628,6 @@ template , stan::is_stan_scalar, stan::is_stan_scalar>*> -std::vector< - stan::promote_args_t, T7__, - stan::promote_args_t, T10__, T11__>>> -f5_functor__::operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, const T3__& - a4, const std::vector& a5, - const std::vector>& a6, - const T6__& a7, - const std::vector>& a8, - const std::vector< - std::vector>>& a9, - const T9__& a10, - const std::vector>& a11, - const std::vector< - std::vector>>& - a12, std::ostream* pstream__) const { - return f5(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, pstream__); -} -template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> std::vector< std::vector< stan::promote_args_t, T7__, @@ -5175,39 +4674,6 @@ template , stan::is_stan_scalar, stan::is_stan_scalar>*> -std::vector< - std::vector< - stan::promote_args_t, T7__, - stan::promote_args_t, T10__, T11__>>>> -f6_functor__::operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, const T3__& - a4, const std::vector& a5, - const std::vector>& a6, - const T6__& a7, - const std::vector>& a8, - const std::vector< - std::vector>>& a9, - const T9__& a10, - const std::vector>& a11, - const std::vector< - std::vector>>& - a12, std::ostream* pstream__) const { - return f6(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, pstream__); -} -template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> Eigen::Matrix, T7__, stan::promote_args_t, T10__, @@ -5254,39 +4720,6 @@ template , stan::is_stan_scalar, stan::is_stan_scalar>*> -Eigen::Matrix, - T7__, - stan::promote_args_t, T10__, - T11__>>,-1,1> -f7_functor__::operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, const T3__& - a4, const std::vector& a5, - const std::vector>& a6, - const T6__& a7, - const std::vector>& a8, - const std::vector< - std::vector>>& a9, - const T9__& a10, - const std::vector>& a11, - const std::vector< - std::vector>>& - a12, std::ostream* pstream__) const { - return f7(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, pstream__); -} -template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> std::vector< Eigen::Matrix, T7__, @@ -5334,40 +4767,6 @@ template , stan::is_stan_scalar, stan::is_stan_scalar>*> -std::vector< - Eigen::Matrix, T7__, - stan::promote_args_t, T10__, - T11__>>,-1,1>> -f8_functor__::operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, const T3__& - a4, const std::vector& a5, - const std::vector>& a6, - const T6__& a7, - const std::vector>& a8, - const std::vector< - std::vector>>& a9, - const T9__& a10, - const std::vector>& a11, - const std::vector< - std::vector>>& - a12, std::ostream* pstream__) const { - return f8(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, pstream__); -} -template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> std::vector< std::vector< Eigen::Matrix, stan::is_stan_scalar, stan::is_stan_scalar>*> -std::vector< - std::vector< - Eigen::Matrix, T7__, - stan::promote_args_t, - T10__, T11__>>,-1,1>>> -f9_functor__::operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, const T3__& - a4, const std::vector& a5, - const std::vector>& a6, - const T6__& a7, - const std::vector>& a8, - const std::vector< - std::vector>>& a9, - const T9__& a10, - const std::vector>& a11, - const std::vector< - std::vector>>& - a12, std::ostream* pstream__) const { - return f9(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, pstream__); -} -template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> Eigen::Matrix, T7__, stan::promote_args_t, T10__, @@ -5497,39 +4861,6 @@ template , stan::is_stan_scalar, stan::is_stan_scalar>*> -Eigen::Matrix, - T7__, - stan::promote_args_t, T10__, - T11__>>,-1,-1> -f10_functor__::operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, - const T3__& a4, const std::vector& a5, - const std::vector>& a6, - const T6__& a7, - const std::vector>& a8, - const std::vector< - std::vector>>& a9, - const T9__& a10, - const std::vector>& a11, - const std::vector< - std::vector>>& - a12, std::ostream* pstream__) const { - return f10(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, pstream__); -} -template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> std::vector< Eigen::Matrix, T7__, @@ -5577,40 +4908,6 @@ template , stan::is_stan_scalar, stan::is_stan_scalar>*> -std::vector< - Eigen::Matrix, T7__, - stan::promote_args_t, T10__, - T11__>>,-1,-1>> -f11_functor__::operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, - const T3__& a4, const std::vector& a5, - const std::vector>& a6, - const T6__& a7, - const std::vector>& a8, - const std::vector< - std::vector>>& a9, - const T9__& a10, - const std::vector>& a11, - const std::vector< - std::vector>>& - a12, std::ostream* pstream__) const { - return f11(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, pstream__); -} -template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> std::vector< std::vector< Eigen::Matrix& a2, const std::vector>>& a9, const T9__& a10_arg__, const std::vector>& a11, const std::vector>>& a12, - std::ostream* pstream__) { - using local_scalar_t__ = stan::promote_args_t, T7__, - stan::promote_args_t, T10__, T11__>>; - int current_statement__ = 0; - const auto& a7 = stan::math::to_ref(a7_arg__); - const auto& a10 = stan::math::to_ref(a10_arg__); - static constexpr bool propto__ = true; - // suppress unused var warning - (void) propto__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - current_statement__ = 761; - return a12; - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } -} -template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>*> -std::vector< - std::vector< - Eigen::Matrix, T7__, - stan::promote_args_t, - T10__, T11__>>,-1,-1>>> -f12_functor__::operator()(const int& a1, const std::vector& a2, - const std::vector>& a3, - const T3__& a4, const std::vector& a5, - const std::vector>& a6, - const T6__& a7, - const std::vector>& a8, - const std::vector< - std::vector>>& a9, - const T9__& a10, - const std::vector>& a11, - const std::vector< - std::vector>>& - a12, std::ostream* pstream__) const { - return f12(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, pstream__); + std::ostream* pstream__) { + using local_scalar_t__ = stan::promote_args_t, T7__, + stan::promote_args_t, T10__, T11__>>; + int current_statement__ = 0; + const auto& a7 = stan::math::to_ref(a7_arg__); + const auto& a10 = stan::math::to_ref(a10_arg__); + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 761; + return a12; + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } } void foo_6(std::ostream* pstream__) { using local_scalar_t__ = double; @@ -5708,9 +4970,6 @@ void foo_6(std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -void foo_6_functor__::operator()(std::ostream* pstream__) const { - return foo_6(pstream__); -} Eigen::Matrix matfoo(std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -5734,10 +4993,6 @@ Eigen::Matrix matfoo(std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -Eigen::Matrix -matfoo_functor__::operator()(std::ostream* pstream__) const { - return matfoo(pstream__); -} Eigen::Matrix vecfoo(std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -5754,12 +5009,7 @@ Eigen::Matrix vecfoo(std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -Eigen::Matrix -vecfoo_functor__::operator()(std::ostream* pstream__) const { - return vecfoo(pstream__); -} -template >* = nullptr> +template >*> Eigen::Matrix,-1,1> vecmufoo(const T0__& mu, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -5784,12 +5034,6 @@ vecmufoo(const T0__& mu, std::ostream* pstream__) { } template >*> Eigen::Matrix,-1,1> -vecmufoo_functor__::operator()(const T0__& mu, std::ostream* pstream__) const { - return vecmufoo(mu, pstream__); -} -template >* = nullptr> -Eigen::Matrix,-1,1> vecmubar(const T0__& mu, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -5814,17 +5058,12 @@ vecmubar(const T0__& mu, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -Eigen::Matrix,-1,1> -vecmubar_functor__::operator()(const T0__& mu, std::ostream* pstream__) const { - return vecmubar(mu, pstream__); -} template , stan::is_vt_not_complex, stan::is_col_vector, stan::is_vt_not_complex, - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> Eigen::Matrix, stan::base_type_t, T2__>,-1,1> algebra_system(const T0__& x_arg__, const T1__& y_arg__, @@ -5860,25 +5099,11 @@ algebra_system(const T0__& x_arg__, const T1__& y_arg__, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar>*> -Eigen::Matrix, - stan::base_type_t, T2__>,-1,1> -algebra_system_functor__::operator()(const T0__& x, const T1__& y, - const std::vector& dat, - const std::vector& dat_int, - std::ostream* pstream__) const { - return algebra_system(x, y, dat, dat_int, pstream__); -} template , stan::is_vt_not_complex, stan::is_col_vector, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix, stan::base_type_t>,-1,1> binomialf(const T0__& phi_arg__, const T1__& theta_arg__, @@ -5907,19 +5132,6 @@ binomialf(const T0__& phi_arg__, const T1__& theta_arg__, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_col_vector, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,1> -binomialf_functor__::operator()(const T0__& phi, const T1__& theta, - const std::vector& x_r, - const std::vector& x_i, std::ostream* - pstream__) const { - return binomialf(phi, theta, x_r, x_i, pstream__); -} class mother_model final : public model_base_crtp { private: int N; @@ -11539,13 +10751,62 @@ static constexpr std::array locations_array__ = " (in 'motherHOF.stan', line 28, column 4 to column 25)", " (in 'motherHOF.stan', line 29, column 4 to column 15)", " (in 'motherHOF.stan', line 25, column 45 to line 30, column 3)"}; -struct map_rectfake_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const T0__& x, std::ostream* pstream__) const; +template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +std::vector> +sho(const T0__& t, const std::vector& y, const std::vector& + theta, const std::vector& x, const std::vector& x_int, + std::ostream* pstream__); +struct sho_functor__ { + template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> + std::vector> + operator()(const T0__& t, const std::vector& y, + const std::vector& theta, const std::vector& x, + const std::vector& x_int, std::ostream* pstream__) const { + return sho(t, y, theta, x, x_int, pstream__); + } }; -struct goo_functor__ { +template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +integrand(const T0__& x, const T1__& xc, const std::vector& theta, + const std::vector& x_r, const std::vector& x_i, + std::ostream* pstream__); +struct integrand_functor__ { + template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> + stan::promote_args_t + operator()(const T0__& x, const T1__& xc, const std::vector& theta, + const std::vector& x_r, const std::vector& x_i, + std::ostream* pstream__) const { + return integrand(x, xc, theta, x_r, x_i, pstream__); + } +}; +template , + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar>* = nullptr> +Eigen::Matrix, + stan::base_type_t, T2__>,-1,1> +foo(const T0__& shared_params_arg__, const T1__& job_params_arg__, + const std::vector& data_r, const std::vector& data_i, + std::ostream* pstream__); +struct foo_functor__ { template , stan::is_vt_not_complex, @@ -11556,9 +10817,22 @@ struct goo_functor__ { stan::base_type_t, T2__>,-1,1> operator()(const T0__& shared_params, const T1__& job_params, const std::vector& data_r, const std::vector& data_i, - std::ostream* pstream__) const; + std::ostream* pstream__) const { + return foo(shared_params, job_params, data_r, data_i, pstream__); + } }; -struct foo_functor__ { +template , + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar>* = nullptr> +Eigen::Matrix, + stan::base_type_t, T2__>,-1,1> +goo(const T0__& shared_params_arg__, const T1__& job_params_arg__, + const std::vector& data_r, const std::vector& data_i, + std::ostream* pstream__); +struct goo_functor__ { template , stan::is_vt_not_complex, @@ -11569,19 +10843,25 @@ struct foo_functor__ { stan::base_type_t, T2__>,-1,1> operator()(const T0__& shared_params, const T1__& job_params, const std::vector& data_r, const std::vector& data_i, - std::ostream* pstream__) const; -}; -struct integrand_functor__ { - template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const T0__& x, const T1__& xc, const std::vector& theta, - const std::vector& x_r, const std::vector& x_i, - std::ostream* pstream__) const; + std::ostream* pstream__) const { + return goo(shared_params, job_params, data_r, data_i, pstream__); + } }; +template >* = nullptr> +stan::promote_args_t +map_rectfake(const T0__& x, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar>* = nullptr> +Eigen::Matrix, + stan::base_type_t, T2__>,-1,1> +algebra_system(const T0__& x_arg__, const T1__& y_arg__, + const std::vector& dat, const std::vector& dat_int, + std::ostream* pstream__); struct algebra_system_functor__ { template , @@ -11592,24 +10872,15 @@ struct algebra_system_functor__ { Eigen::Matrix, stan::base_type_t, T2__>,-1,1> operator()(const T0__& x, const T1__& y, const std::vector& dat, - const std::vector& dat_int, std::ostream* pstream__) const; -}; -struct sho_functor__ { - template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - std::vector> - operator()(const T0__& t, const std::vector& y, - const std::vector& theta, const std::vector& x, - const std::vector& x_int, std::ostream* pstream__) const; + const std::vector& dat_int, std::ostream* pstream__) const { + return algebra_system(x, y, dat, dat_int, pstream__); + } }; template , stan::is_stan_scalar, stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> std::vector> sho(const T0__& t, const std::vector& y, const std::vector& theta, const std::vector& x, const std::vector& x_int, @@ -11646,18 +10917,6 @@ template , stan::is_stan_scalar, stan::is_stan_scalar>*> -std::vector> -sho_functor__::operator()(const T0__& t, const std::vector& y, - const std::vector& theta, - const std::vector& x, const std::vector& - x_int, std::ostream* pstream__) const { - return sho(t, y, theta, x, x_int, pstream__); -} -template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> stan::promote_args_t integrand(const T0__& x, const T1__& xc, const std::vector& theta, const std::vector& x_r, const std::vector& x_i, @@ -11677,25 +10936,12 @@ integrand(const T0__& x, const T1__& xc, const std::vector& theta, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>*> -stan::promote_args_t -integrand_functor__::operator()(const T0__& x, const T1__& xc, - const std::vector& theta, - const std::vector& x_r, - const std::vector& x_i, std::ostream* - pstream__) const { - return integrand(x, xc, theta, x_r, x_i, pstream__); -} template , stan::is_vt_not_complex, stan::is_col_vector, stan::is_vt_not_complex, - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> Eigen::Matrix, stan::base_type_t, T2__>,-1,1> foo(const T0__& shared_params_arg__, const T1__& job_params_arg__, @@ -11727,20 +10973,6 @@ template >*> Eigen::Matrix, stan::base_type_t, T2__>,-1,1> -foo_functor__::operator()(const T0__& shared_params, const T1__& job_params, - const std::vector& data_r, - const std::vector& data_i, std::ostream* - pstream__) const { - return foo(shared_params, job_params, data_r, data_i, pstream__); -} -template , - stan::is_vt_not_complex, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar>* = nullptr> -Eigen::Matrix, - stan::base_type_t, T2__>,-1,1> goo(const T0__& shared_params_arg__, const T1__& job_params_arg__, const std::vector& data_r, const std::vector& data_i, std::ostream* pstream__) { @@ -11762,22 +10994,7 @@ goo(const T0__& shared_params_arg__, const T1__& job_params_arg__, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar>*> -Eigen::Matrix, - stan::base_type_t, T2__>,-1,1> -goo_functor__::operator()(const T0__& shared_params, const T1__& job_params, - const std::vector& data_r, - const std::vector& data_i, std::ostream* - pstream__) const { - return goo(shared_params, job_params, data_r, data_i, pstream__); -} -template >* = nullptr> +template >*> stan::promote_args_t map_rectfake(const T0__& x, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -11795,17 +11012,12 @@ map_rectfake(const T0__& x, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -map_rectfake_functor__::operator()(const T0__& x, std::ostream* pstream__) const { - return map_rectfake(x, pstream__); -} template , stan::is_vt_not_complex, stan::is_col_vector, stan::is_vt_not_complex, - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> Eigen::Matrix, stan::base_type_t, T2__>,-1,1> algebra_system(const T0__& x_arg__, const T1__& y_arg__, @@ -11841,20 +11053,6 @@ algebra_system(const T0__& x_arg__, const T1__& y_arg__, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar>*> -Eigen::Matrix, - stan::base_type_t, T2__>,-1,1> -algebra_system_functor__::operator()(const T0__& x, const T1__& y, - const std::vector& dat, - const std::vector& dat_int, - std::ostream* pstream__) const { - return algebra_system(x, y, dat, dat_int, pstream__); -} class motherHOF_model final : public model_base_crtp { private: int T; @@ -13986,6 +13184,17 @@ static constexpr std::array locations_array__ = " (in 'new_integrate_interface.stan', line 438, column 18 to column 19)", " (in 'new_integrate_interface.stan', line 3, column 4 to column 13)", " (in 'new_integrate_interface.stan', line 2, column 47 to line 4, column 3)"}; +template , + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_col_vector, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, T2__, + stan::base_type_t>,-1,1> +f(const T0__& t, const T1__& z_arg__, const T2__& a, const T3__& b_arg__, + std::ostream* pstream__); struct f_variadic2_functor__ { template , @@ -13997,20 +13206,9 @@ struct f_variadic2_functor__ { Eigen::Matrix, T2__, stan::base_type_t>,-1,1> operator()(const T0__& t, const T1__& z, std::ostream* pstream__, - const T2__& a, const T3__& b) const; -}; -struct f_functor__ { - template , - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix, T2__, - stan::base_type_t>,-1,1> - operator()(const T0__& t, const T1__& z, const T2__& a, const T3__& b, - std::ostream* pstream__) const; + const T2__& a, const T3__& b) const { + return f(t, z, a, b, pstream__); + } }; template , @@ -14018,7 +13216,7 @@ template , stan::is_stan_scalar, stan::is_col_vector, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix, T2__, stan::base_type_t>,-1,1> f(const T0__& t, const T1__& z_arg__, const T2__& a, const T3__& b_arg__, @@ -14042,32 +13240,6 @@ f(const T0__& t, const T1__& z_arg__, const T2__& a, const T3__& b_arg__, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex>*> -Eigen::Matrix, T2__, - stan::base_type_t>,-1,1> -f_functor__::operator()(const T0__& t, const T1__& z, const T2__& a, - const T3__& b, std::ostream* pstream__) const { - return f(t, z, a, b, pstream__); -} -template , - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex>*> -Eigen::Matrix, T2__, - stan::base_type_t>,-1,1> -f_variadic2_functor__::operator()(const T0__& t, const T1__& z, std::ostream* - pstream__, const T2__& a, const T3__& b) const { - return f(t, z, a, b, pstream__); -} class new_integrate_interface_model final : public model_base_crtp { private: int N; @@ -17773,6 +16945,15 @@ static constexpr std::array locations_array__ = " (in 'old_integrate_interface.stan', line 17, column 4 to column 42)", " (in 'old_integrate_interface.stan', line 18, column 4 to column 26)", " (in 'old_integrate_interface.stan', line 7, column 38 to line 19, column 3)"}; +template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +std::vector> +dz_dt(const T0__& t, const std::vector& z, const std::vector& + theta, const std::vector& x_r, const std::vector& x_i, + std::ostream* pstream__); struct dz_dt_functor__ { template , @@ -17782,13 +16963,15 @@ struct dz_dt_functor__ { std::vector> operator()(const T0__& t, const std::vector& z, const std::vector& theta, const std::vector& x_r, - const std::vector& x_i, std::ostream* pstream__) const; + const std::vector& x_i, std::ostream* pstream__) const { + return dz_dt(t, z, theta, x_r, x_i, pstream__); + } }; template , stan::is_stan_scalar, stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> std::vector> dz_dt(const T0__& t, const std::vector& z, const std::vector& theta, const std::vector& x_r, const std::vector& x_i, @@ -17832,19 +17015,6 @@ dz_dt(const T0__& t, const std::vector& z, const std::vector& stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>*> -std::vector> -dz_dt_functor__::operator()(const T0__& t, const std::vector& z, - const std::vector& theta, - const std::vector& x_r, - const std::vector& x_i, std::ostream* - pstream__) const { - return dz_dt(t, z, theta, x_r, x_i, pstream__); -} class old_integrate_interface_model final : public model_base_crtp { private: int N; @@ -19816,58 +18986,46 @@ static constexpr std::array locations_array__ = " (in 'overloading_templating.stan', line 36, column 29 to line 38, column 4)", " (in 'overloading_templating.stan', line 40, column 4 to column 23)", " (in 'overloading_templating.stan', line 39, column 25 to line 41, column 3)"}; -struct foo_functor__ { - double operator()(const int& p, std::ostream* pstream__) const; - template >* = nullptr> - stan::promote_args_t - operator()(const T0__& p, std::ostream* pstream__) const; - template , - stan::is_vt_not_complex>* = nullptr> - stan::promote_args_t> - operator()(const T0__& p, std::ostream* pstream__) const; - template , - stan::is_vt_not_complex>* = nullptr> - stan::promote_args_t> - operator()(const T0__& p, std::ostream* pstream__) const; - template , - stan::is_vt_not_complex>* = nullptr> - stan::promote_args_t> - operator()(const T0__& p, std::ostream* pstream__) const; - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector& p, std::ostream* pstream__) const; - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>& p, std::ostream* - pstream__) const; - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>& p, std::ostream* - pstream__) const; - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>& p, std::ostream* - pstream__) const; - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>& p, std::ostream* pstream__) const; - double operator()(const std::vector& p, std::ostream* pstream__) const; -}; +double foo(const int& p, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t foo(const T0__& p, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +stan::promote_args_t> +foo(const T0__& p_arg__, std::ostream* pstream__); template , stan::is_vt_not_complex>* = nullptr> stan::promote_args_t> foo(const T0__& p_arg__, std::ostream* pstream__); -double foo(const int& p, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +stan::promote_args_t> +foo(const T0__& p_arg__, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t +foo(const std::vector& p, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t +foo(const std::vector>& p, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t +foo(const std::vector>& p, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t +foo(const std::vector>& p, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t +foo(const std::vector>& p, std::ostream* pstream__); +double foo(const std::vector& p, std::ostream* pstream__); double foo(const int& p, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -19884,11 +19042,7 @@ double foo(const int& p, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -double foo_functor__::operator()(const int& p, std::ostream* pstream__) const { - return foo(p, pstream__); -} -template >* = nullptr> +template >*> stan::promote_args_t foo(const T0__& p, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -19905,14 +19059,9 @@ stan::promote_args_t foo(const T0__& p, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -foo_functor__::operator()(const T0__& p, std::ostream* pstream__) const { - return foo(p, pstream__); -} template , - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> stan::promote_args_t> foo(const T0__& p_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; @@ -19931,13 +19080,6 @@ foo(const T0__& p_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -stan::promote_args_t> -foo_functor__::operator()(const T0__& p, std::ostream* pstream__) const { - return foo(p, pstream__); -} template , stan::is_vt_not_complex>*> @@ -19959,16 +19101,9 @@ foo(const T0__& p_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -stan::promote_args_t> -foo_functor__::operator()(const T0__& p, std::ostream* pstream__) const { - return foo(p, pstream__); -} template , - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> stan::promote_args_t> foo(const T0__& p_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; @@ -19987,15 +19122,7 @@ foo(const T0__& p_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -stan::promote_args_t> -foo_functor__::operator()(const T0__& p, std::ostream* pstream__) const { - return foo(p, pstream__); -} -template >* = nullptr> +template >*> stan::promote_args_t foo(const std::vector& p, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -20015,12 +19142,6 @@ foo(const std::vector& p, std::ostream* pstream__) { } template >*> stan::promote_args_t -foo_functor__::operator()(const std::vector& p, std::ostream* pstream__) const { - return foo(p, pstream__); -} -template >* = nullptr> -stan::promote_args_t foo(const std::vector>& p, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -20041,13 +19162,6 @@ foo(const std::vector>& p, std::ostream* pstream__) { } template >*> stan::promote_args_t -foo_functor__::operator()(const std::vector>& p, - std::ostream* pstream__) const { - return foo(p, pstream__); -} -template >* = nullptr> -stan::promote_args_t foo(const std::vector>& p, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -20068,13 +19182,6 @@ foo(const std::vector>& p, std::ostream* pstream__) { } template >*> stan::promote_args_t -foo_functor__::operator()(const std::vector>& p, - std::ostream* pstream__) const { - return foo(p, pstream__); -} -template >* = nullptr> -stan::promote_args_t foo(const std::vector>& p, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -20095,13 +19202,6 @@ foo(const std::vector>& p, std::ostream* pstream__) { } template >*> stan::promote_args_t -foo_functor__::operator()(const std::vector>& p, - std::ostream* pstream__) const { - return foo(p, pstream__); -} -template >* = nullptr> -stan::promote_args_t foo(const std::vector>& p, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -20120,12 +19220,6 @@ foo(const std::vector>& p, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -foo_functor__::operator()(const std::vector>& p, - std::ostream* pstream__) const { - return foo(p, pstream__); -} double foo(const std::vector& p, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -20142,10 +19236,6 @@ double foo(const std::vector& p, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -double -foo_functor__::operator()(const std::vector& p, std::ostream* pstream__) const { - return foo(p, pstream__); -} class overloading_templating_model final : public model_base_crtp { private: Eigen::Matrix a_data__; @@ -21138,21 +20228,16 @@ static constexpr std::array locations_array__ = " (in 'promotion.stan', line 2, column 28 to line 4, column 4)", " (in 'promotion.stan', line 7, column 5 to column 18)", " (in 'promotion.stan', line 6, column 28 to line 8, column 4)"}; -struct ident_functor__ { - template >* = nullptr> - std::complex> - operator()(const std::complex& x, std::ostream* pstream__) const; -}; -struct foo_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector& zs, std::ostream* pstream__) const; -}; template >* = nullptr> std::complex> +ident(const std::complex& x, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t +foo(const std::vector& zs, std::ostream* pstream__); +template >*> +std::complex> ident(const std::complex& x, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -21170,13 +20255,6 @@ ident(const std::complex& x, std::ostream* pstream__) { } } template >*> -std::complex> -ident_functor__::operator()(const std::complex& x, std::ostream* - pstream__) const { - return ident(x, pstream__); -} -template >* = nullptr> stan::promote_args_t foo(const std::vector& zs, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -21194,12 +20272,6 @@ foo(const std::vector& zs, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -foo_functor__::operator()(const std::vector& zs, std::ostream* - pstream__) const { - return foo(zs, pstream__); -} class promotion_model final : public model_base_crtp { private: @@ -21535,62 +20607,47 @@ static constexpr std::array locations_array__ = " (in 'recursive-slicing.stan', line 61, column 6 to column 30)", " (in 'recursive-slicing.stan', line 60, column 3 to line 63, column 38)", " (in 'recursive-slicing.stan', line 57, column 28 to line 64, column 3)"}; -struct test3_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& gamma, std::ostream* pstream__) const; -}; -struct test7_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& gamma, std::ostream* pstream__) const; -}; -struct foo_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - stan::promote_args_t> - operator()(const T0__& a, std::ostream* pstream__) const; - template >* = nullptr> - stan::promote_args_t - operator()(const T0__& b, std::ostream* pstream__) const; -}; -struct test2_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& gamma, std::ostream* pstream__) const; -}; -struct test6_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - void operator()(const T0__& alpha, std::ostream* pstream__) const; -}; -struct test4_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& gamma, std::ostream* pstream__) const; -}; -struct matrix_pow_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,-1> - operator()(const T0__& a, const int& n, std::ostream* pstream__) const; -}; template , stan::is_vt_not_complex>* = nullptr> Eigen::Matrix>,-1,1> +test2(const T0__& gamma_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix>,-1,-1> +matrix_pow(const T0__& a_arg__, const int& n, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +stan::promote_args_t> +foo(const T0__& a_arg__, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t foo(const T0__& b, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix>,-1,1> +test4(const T0__& gamma_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix>,-1,1> +test3(const T0__& gamma_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +void test6(const T0__& alpha_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix>,-1,1> +test7(const T0__& gamma_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>*> +Eigen::Matrix>,-1,1> test2(const T0__& gamma_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; int current_statement__ = 0; @@ -21620,16 +20677,9 @@ test2(const T0__& gamma_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,1> -test2_functor__::operator()(const T0__& gamma, std::ostream* pstream__) const { - return test2(gamma, pstream__); -} template , - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix>,-1,-1> matrix_pow(const T0__& a_arg__, const int& n, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; @@ -21664,14 +20714,6 @@ matrix_pow(const T0__& a_arg__, const int& n, std::ostream* pstream__) { template , stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,-1> -matrix_pow_functor__::operator()(const T0__& a, const int& n, std::ostream* - pstream__) const { - return matrix_pow(a, n, pstream__); -} -template , - stan::is_vt_not_complex>* = nullptr> stan::promote_args_t> foo(const T0__& a_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; @@ -21690,15 +20732,7 @@ foo(const T0__& a_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -stan::promote_args_t> -foo_functor__::operator()(const T0__& a, std::ostream* pstream__) const { - return foo(a, pstream__); -} -template >* = nullptr> +template >*> stan::promote_args_t foo(const T0__& b, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -21722,21 +20756,6 @@ stan::promote_args_t foo(const T0__& b, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -foo_functor__::operator()(const T0__& b, std::ostream* pstream__) const { - return foo(b, pstream__); -} -template , - stan::is_vt_not_complex>* = nullptr> -Eigen::Matrix>,-1,1> -test3(const T0__& gamma_arg__, std::ostream* pstream__); -template , - stan::is_vt_not_complex>* = nullptr> -Eigen::Matrix>,-1,1> -test4(const T0__& gamma_arg__, std::ostream* pstream__); template , stan::is_vt_not_complex>*> @@ -21773,13 +20792,6 @@ template , stan::is_vt_not_complex>*> Eigen::Matrix>,-1,1> -test4_functor__::operator()(const T0__& gamma, std::ostream* pstream__) const { - return test4(gamma, pstream__); -} -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,1> test3(const T0__& gamma_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; int current_statement__ = 0; @@ -21800,13 +20812,6 @@ test3(const T0__& gamma_arg__, std::ostream* pstream__) { template , stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,1> -test3_functor__::operator()(const T0__& gamma, std::ostream* pstream__) const { - return test3(gamma, pstream__); -} -template , - stan::is_vt_not_complex>* = nullptr> void test6(const T0__& alpha_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; int current_statement__ = 0; @@ -21843,13 +20848,6 @@ void test6(const T0__& alpha_arg__, std::ostream* pstream__) { template , stan::is_vt_not_complex>*> -void -test6_functor__::operator()(const T0__& alpha, std::ostream* pstream__) const { - return test6(alpha, pstream__); -} -template , - stan::is_vt_not_complex>* = nullptr> Eigen::Matrix>,-1,1> test7(const T0__& gamma_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; @@ -21878,13 +20876,6 @@ test7(const T0__& gamma_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,1> -test7_functor__::operator()(const T0__& gamma, std::ostream* pstream__) const { - return test7(gamma, pstream__); -} class recursive_slicing_model final : public model_base_crtp { private: int N; @@ -22226,58 +21217,57 @@ static constexpr std::array locations_array__ = " (in 'reduce_sum_m1.stan', line 13, column 6 to column 35)", " (in 'reduce_sum_m1.stan', line 12, column 11 to line 14, column 5)", " (in 'reduce_sum_m1.stan', line 11, column 6 to column 55)", - " (in 'reduce_sum_m1.stan', line 10, column 21 to line 12, column 5)", - " (in 'reduce_sum_m1.stan', line 10, column 4 to line 14, column 5)", - " (in 'reduce_sum_m1.stan', line 9, column 67 to line 15, column 3)", - " (in 'reduce_sum_m1.stan', line 17, column 4 to column 39)", - " (in 'reduce_sum_m1.stan', line 16, column 58 to line 18, column 3)"}; -struct h_functor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, const std::vector& a, std::ostream* pstream__) const; -}; + " (in 'reduce_sum_m1.stan', line 10, column 21 to line 12, column 5)", + " (in 'reduce_sum_m1.stan', line 10, column 4 to line 14, column 5)", + " (in 'reduce_sum_m1.stan', line 9, column 67 to line 15, column 3)", + " (in 'reduce_sum_m1.stan', line 17, column 4 to column 39)", + " (in 'reduce_sum_m1.stan', line 16, column 58 to line 18, column 3)"}; +template >* = nullptr> +stan::promote_args_t +g(const std::vector& y_slice, const int& start, const int& end, + std::ostream* pstream__); struct g_rsfunctor__ { template >* = nullptr> stan::promote_args_t operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__) const; + end, std::ostream* pstream__) const { + return g(y_slice, (start + 1), (end + 1), pstream__); + } }; +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +h(const std::vector& y_slice, const int& start, const int& end, + const std::vector& a, std::ostream* pstream__); struct h_rsfunctor__ { template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__, const std::vector& a) const; -}; -struct g_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__) const; -}; -struct foo_lpdf_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__) const; + end, std::ostream* pstream__, const std::vector& a) const { + return h(y_slice, (start + 1), (end + 1), a, pstream__); + } }; +template >* = nullptr> +stan::promote_args_t +foo_lpdf(const std::vector& y_slice, const int& start, const int& end, + std::ostream* pstream__); template struct foo_lpdf_rsfunctor__ { template >* = nullptr> stan::promote_args_t operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__) const; + end, std::ostream* pstream__) const { + return foo_lpdf(y_slice, (start + 1), (end + 1), pstream__); + } }; -template >* = nullptr> +template >*> stan::promote_args_t g(const std::vector& y_slice, const int& start, const int& end, std::ostream* pstream__) { @@ -22302,21 +21292,9 @@ g(const std::vector& y_slice, const int& start, const int& end, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -g_functor__::operator()(const std::vector& y_slice, const int& start, - const int& end, std::ostream* pstream__) const { - return g(y_slice, start, end, pstream__); -} -template >*> -stan::promote_args_t -g_rsfunctor__::operator()(const std::vector& y_slice, const int& start, - const int& end, std::ostream* pstream__) const { - return g(y_slice, (start + 1), (end + 1), pstream__); -} template , - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> stan::promote_args_t h(const std::vector& y_slice, const int& start, const int& end, const std::vector& a, std::ostream* pstream__) { @@ -22343,26 +21321,8 @@ h(const std::vector& y_slice, const int& start, const int& end, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar>*> -stan::promote_args_t -h_functor__::operator()(const std::vector& y_slice, const int& start, - const int& end, const std::vector& a, - std::ostream* pstream__) const { - return h(y_slice, start, end, a, pstream__); -} -template , - stan::is_stan_scalar>*> -stan::promote_args_t -h_rsfunctor__::operator()(const std::vector& y_slice, const int& start, - const int& end, std::ostream* pstream__, - const std::vector& a) const { - return h(y_slice, (start + 1), (end + 1), a, pstream__); -} template >* = nullptr> + stan::require_all_t>*> stan::promote_args_t foo_lpdf(const std::vector& y_slice, const int& start, const int& end, std::ostream* pstream__) { @@ -22378,21 +21338,6 @@ foo_lpdf(const std::vector& y_slice, const int& start, const int& end, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -foo_lpdf_functor__::operator()(const std::vector& y_slice, const int& - start, const int& end, std::ostream* pstream__) const { - return foo_lpdf(y_slice, start, end, pstream__); -} -template -template >*> -stan::promote_args_t -foo_lpdf_rsfunctor__::operator()(const std::vector& y_slice, - const int& start, const int& end, - std::ostream* pstream__) const { - return foo_lpdf(y_slice, (start + 1), (end + 1), pstream__); -} class reduce_sum_m1_model final : public model_base_crtp { private: int N; @@ -22919,185 +21864,143 @@ static constexpr std::array locations_array__ = " (in 'reduce_sum_m2.stan', line 115, column 4 to line 119, column 5)", " (in 'reduce_sum_m2.stan', line 120, column 4 to column 20)", " (in 'reduce_sum_m2.stan', line 113, column 65 to line 121, column 3)"}; -struct h4_functor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y, const int& start, const int& end, - const std::vector>& a, std::ostream* - pstream__) const; -}; -struct h3_functor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y, const int& start, const int& end, - const std::vector>& a, std::ostream* - pstream__) const; -}; -struct h1_rsfunctor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y, const int& start, const int& end, - std::ostream* pstream__, const std::vector& a) const; -}; -struct h7_rsfunctor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y, const int& start, const int& end, - std::ostream* pstream__, - const std::vector>>& a) const; -}; -struct h3_rsfunctor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y, const int& start, const int& end, - std::ostream* pstream__, - const std::vector>& a) const; -}; -struct g3_functor__ { +template >* = nullptr> +stan::promote_args_t +g1(const std::vector& y_slice, const int& start, const int& end, + std::ostream* pstream__); +struct g1_rsfunctor__ { template >* = nullptr> stan::promote_args_t - operator()(const std::vector>& y_slice, const int& - start, const int& end, std::ostream* pstream__) const; + operator()(const std::vector& y_slice, const int& start, const int& + end, std::ostream* pstream__) const { + return g1(y_slice, (start + 1), (end + 1), pstream__); + } }; -struct g8_rsfunctor__ { +template >* = nullptr> +stan::promote_args_t +g2(const std::vector>& y_slice, const int& start, + const int& end, std::ostream* pstream__); +struct g2_rsfunctor__ { template >* = nullptr> stan::promote_args_t - operator()(const std::vector>>& - y_slice, const int& start, const int& end, std::ostream* - pstream__) const; -}; -struct h5_functor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y, const int& start, const int& end, - const std::vector>& a, std::ostream* pstream__) const; + operator()(const std::vector>& y_slice, const int& + start, const int& end, std::ostream* pstream__) const { + return g2(y_slice, (start + 1), (end + 1), pstream__); + } }; -struct g7_rsfunctor__ { +template >* = nullptr> +stan::promote_args_t +g3(const std::vector>& y_slice, const int& start, + const int& end, std::ostream* pstream__); +struct g3_rsfunctor__ { template >* = nullptr> stan::promote_args_t - operator()(const std::vector>>& - y_slice, const int& start, const int& end, std::ostream* - pstream__) const; + operator()(const std::vector>& y_slice, const int& + start, const int& end, std::ostream* pstream__) const { + return g3(y_slice, (start + 1), (end + 1), pstream__); + } }; +template >* = nullptr> +stan::promote_args_t +g4(const std::vector>& y_slice, const int& start, + const int& end, std::ostream* pstream__); struct g4_rsfunctor__ { template >* = nullptr> stan::promote_args_t operator()(const std::vector>& y_slice, - const int& start, const int& end, std::ostream* pstream__) const; -}; -struct h4_rsfunctor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y, const int& start, const int& end, - std::ostream* pstream__, - const std::vector>& a) const; + const int& start, const int& end, std::ostream* pstream__) const { + return g4(y_slice, (start + 1), (end + 1), pstream__); + } }; -struct g4_functor__ { +template >* = nullptr> +stan::promote_args_t +g5(const std::vector>& y_slice, const int& start, + const int& end, std::ostream* pstream__); +struct g5_rsfunctor__ { template >* = nullptr> stan::promote_args_t - operator()(const std::vector>& y_slice, - const int& start, const int& end, std::ostream* pstream__) const; + operator()(const std::vector>& y_slice, const int& start, + const int& end, std::ostream* pstream__) const { + return g5(y_slice, (start + 1), (end + 1), pstream__); + } }; +template >* = nullptr> +stan::promote_args_t +g6(const std::vector>>& y_slice, + const int& start, const int& end, std::ostream* pstream__); struct g6_rsfunctor__ { template >* = nullptr> stan::promote_args_t operator()(const std::vector>>& y_slice, const int& start, const int& end, std::ostream* - pstream__) const; -}; -struct g5_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>& y_slice, const int& start, - const int& end, std::ostream* pstream__) const; -}; -struct g5_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>& y_slice, const int& start, - const int& end, std::ostream* pstream__) const; + pstream__) const { + return g6(y_slice, (start + 1), (end + 1), pstream__); + } }; -struct g7_functor__ { +template >* = nullptr> +stan::promote_args_t +g7(const std::vector>>& y_slice, + const int& start, const int& end, std::ostream* pstream__); +struct g7_rsfunctor__ { template >* = nullptr> stan::promote_args_t operator()(const std::vector>>& y_slice, const int& start, const int& end, std::ostream* - pstream__) const; -}; -struct h1_functor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y, const int& start, const int& end, - const std::vector& a, std::ostream* pstream__) const; + pstream__) const { + return g7(y_slice, (start + 1), (end + 1), pstream__); + } }; -struct g1_rsfunctor__ { +template >* = nullptr> +stan::promote_args_t +g8(const std::vector>>& y_slice, + const int& start, const int& end, std::ostream* pstream__); +struct g8_rsfunctor__ { template >* = nullptr> stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__) const; + operator()(const std::vector>>& + y_slice, const int& start, const int& end, std::ostream* + pstream__) const { + return g8(y_slice, (start + 1), (end + 1), pstream__); + } }; -struct h5_rsfunctor__ { +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +h1(const std::vector& y, const int& start, const int& end, + const std::vector& a, std::ostream* pstream__); +struct h1_rsfunctor__ { template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t operator()(const std::vector& y, const int& start, const int& end, - std::ostream* pstream__, const std::vector>& a) const; -}; -struct g3_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>& y_slice, const int& - start, const int& end, std::ostream* pstream__) const; -}; -struct g2_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>& y_slice, const int& - start, const int& end, std::ostream* pstream__) const; -}; -struct g2_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>& y_slice, const int& - start, const int& end, std::ostream* pstream__) const; -}; -struct g1_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__) const; + std::ostream* pstream__, const std::vector& a) const { + return h1(y, (start + 1), (end + 1), a, pstream__); + } }; +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +h2(const std::vector& y, const int& start, const int& end, + const std::vector>& a, std::ostream* pstream__); struct h2_rsfunctor__ { template , @@ -23105,80 +22008,115 @@ struct h2_rsfunctor__ { stan::promote_args_t operator()(const std::vector& y, const int& start, const int& end, std::ostream* pstream__, - const std::vector>& a) const; -}; -struct g8_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>>& - y_slice, const int& start, const int& end, std::ostream* - pstream__) const; + const std::vector>& a) const { + return h2(y, (start + 1), (end + 1), a, pstream__); + } }; -struct h2_functor__ { +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +h3(const std::vector& y, const int& start, const int& end, + const std::vector>& a, std::ostream* pstream__); +struct h3_rsfunctor__ { template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t operator()(const std::vector& y, const int& start, const int& end, - const std::vector>& a, std::ostream* - pstream__) const; + std::ostream* pstream__, + const std::vector>& a) const { + return h3(y, (start + 1), (end + 1), a, pstream__); + } }; -struct h8_rsfunctor__ { +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +h4(const std::vector& y, const int& start, const int& end, + const std::vector>& a, std::ostream* pstream__); +struct h4_rsfunctor__ { template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t operator()(const std::vector& y, const int& start, const int& end, std::ostream* pstream__, - const std::vector>>& a) const; + const std::vector>& a) const { + return h4(y, (start + 1), (end + 1), a, pstream__); + } }; -struct h7_functor__ { +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +h5(const std::vector& y, const int& start, const int& end, + const std::vector>& a, std::ostream* pstream__); +struct h5_rsfunctor__ { template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t operator()(const std::vector& y, const int& start, const int& end, - const std::vector>>& a, - std::ostream* pstream__) const; + std::ostream* pstream__, const std::vector>& a) const { + return h5(y, (start + 1), (end + 1), a, pstream__); + } }; -struct h8_functor__ { +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +h6(const std::vector& y, const int& start, const int& end, + const std::vector>>& a, std::ostream* + pstream__); +struct h6_rsfunctor__ { template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t operator()(const std::vector& y, const int& start, const int& end, - const std::vector>>& a, - std::ostream* pstream__) const; + std::ostream* pstream__, + const std::vector>>& a) const { + return h6(y, (start + 1), (end + 1), a, pstream__); + } }; -struct h6_rsfunctor__ { +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +h7(const std::vector& y, const int& start, const int& end, + const std::vector>>& a, std::ostream* + pstream__); +struct h7_rsfunctor__ { template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t operator()(const std::vector& y, const int& start, const int& end, std::ostream* pstream__, - const std::vector>>& a) const; + const std::vector>>& a) const { + return h7(y, (start + 1), (end + 1), a, pstream__); + } }; -struct h6_functor__ { +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +h8(const std::vector& y, const int& start, const int& end, + const std::vector>>& a, + std::ostream* pstream__); +struct h8_rsfunctor__ { template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t operator()(const std::vector& y, const int& start, const int& end, - const std::vector>>& a, - std::ostream* pstream__) const; -}; -struct g6_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>>& - y_slice, const int& start, const int& end, std::ostream* - pstream__) const; + std::ostream* pstream__, + const std::vector>>& a) const { + return h8(y, (start + 1), (end + 1), a, pstream__); + } }; -template >* = nullptr> +template >*> stan::promote_args_t g1(const std::vector& y_slice, const int& start, const int& end, std::ostream* pstream__) { @@ -23199,19 +22137,6 @@ g1(const std::vector& y_slice, const int& start, const int& end, } template >*> stan::promote_args_t -g1_functor__::operator()(const std::vector& y_slice, const int& start, - const int& end, std::ostream* pstream__) const { - return g1(y_slice, start, end, pstream__); -} -template >*> -stan::promote_args_t -g1_rsfunctor__::operator()(const std::vector& y_slice, const int& - start, const int& end, std::ostream* pstream__) const { - return g1(y_slice, (start + 1), (end + 1), pstream__); -} -template >* = nullptr> -stan::promote_args_t g2(const std::vector>& y_slice, const int& start, const int& end, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -23242,21 +22167,6 @@ g2(const std::vector>& y_slice, const int& start, } template >*> stan::promote_args_t -g2_functor__::operator()(const std::vector>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return g2(y_slice, start, end, pstream__); -} -template >*> -stan::promote_args_t -g2_rsfunctor__::operator()(const std::vector>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return g2(y_slice, (start + 1), (end + 1), pstream__); -} -template >* = nullptr> -stan::promote_args_t g3(const std::vector>& y_slice, const int& start, const int& end, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -23287,21 +22197,6 @@ g3(const std::vector>& y_slice, const int& start, } template >*> stan::promote_args_t -g3_functor__::operator()(const std::vector>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return g3(y_slice, start, end, pstream__); -} -template >*> -stan::promote_args_t -g3_rsfunctor__::operator()(const std::vector>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return g3(y_slice, (start + 1), (end + 1), pstream__); -} -template >* = nullptr> -stan::promote_args_t g4(const std::vector>& y_slice, const int& start, const int& end, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -23333,21 +22228,6 @@ g4(const std::vector>& y_slice, const int& start, } template >*> stan::promote_args_t -g4_functor__::operator()(const std::vector>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return g4(y_slice, start, end, pstream__); -} -template >*> -stan::promote_args_t -g4_rsfunctor__::operator()(const std::vector>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return g4(y_slice, (start + 1), (end + 1), pstream__); -} -template >* = nullptr> -stan::promote_args_t g5(const std::vector>& y_slice, const int& start, const int& end, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -23384,21 +22264,6 @@ g5(const std::vector>& y_slice, const int& start, } template >*> stan::promote_args_t -g5_functor__::operator()(const std::vector>& y_slice, - const int& start, const int& end, std::ostream* - pstream__) const { - return g5(y_slice, start, end, pstream__); -} -template >*> -stan::promote_args_t -g5_rsfunctor__::operator()(const std::vector>& y_slice, - const int& start, const int& end, std::ostream* - pstream__) const { - return g5(y_slice, (start + 1), (end + 1), pstream__); -} -template >* = nullptr> -stan::promote_args_t g6(const std::vector>>& y_slice, const int& start, const int& end, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -23436,23 +22301,6 @@ g6(const std::vector>>& y_slice, } template >*> stan::promote_args_t -g6_functor__::operator()(const std::vector< - std::vector>>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return g6(y_slice, start, end, pstream__); -} -template >*> -stan::promote_args_t -g6_rsfunctor__::operator()(const std::vector< - std::vector>>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return g6(y_slice, (start + 1), (end + 1), pstream__); -} -template >* = nullptr> -stan::promote_args_t g7(const std::vector>>& y_slice, const int& start, const int& end, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -23490,23 +22338,6 @@ g7(const std::vector>>& y_slice, } template >*> stan::promote_args_t -g7_functor__::operator()(const std::vector< - std::vector>>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return g7(y_slice, start, end, pstream__); -} -template >*> -stan::promote_args_t -g7_rsfunctor__::operator()(const std::vector< - std::vector>>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return g7(y_slice, (start + 1), (end + 1), pstream__); -} -template >* = nullptr> -stan::promote_args_t g8(const std::vector>>& y_slice, const int& start, const int& end, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -23542,25 +22373,9 @@ g8(const std::vector>>& y_slice, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -g8_functor__::operator()(const std::vector< - std::vector>>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return g8(y_slice, start, end, pstream__); -} -template >*> -stan::promote_args_t -g8_rsfunctor__::operator()(const std::vector< - std::vector>>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return g8(y_slice, (start + 1), (end + 1), pstream__); -} template , - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> stan::promote_args_t h1(const std::vector& y, const int& start, const int& end, const std::vector& a, std::ostream* pstream__) { @@ -23585,24 +22400,6 @@ template , stan::is_stan_scalar>*> stan::promote_args_t -h1_functor__::operator()(const std::vector& y, const int& start, - const int& end, const std::vector& a, - std::ostream* pstream__) const { - return h1(y, start, end, a, pstream__); -} -template , - stan::is_stan_scalar>*> -stan::promote_args_t -h1_rsfunctor__::operator()(const std::vector& y, const int& start, - const int& end, std::ostream* pstream__, - const std::vector& a) const { - return h1(y, (start + 1), (end + 1), a, pstream__); -} -template , - stan::is_stan_scalar>* = nullptr> -stan::promote_args_t h2(const std::vector& y, const int& start, const int& end, const std::vector>& a, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -23634,25 +22431,6 @@ template , stan::is_stan_scalar>*> stan::promote_args_t -h2_functor__::operator()(const std::vector& y, const int& start, - const int& end, - const std::vector>& a, - std::ostream* pstream__) const { - return h2(y, start, end, a, pstream__); -} -template , - stan::is_stan_scalar>*> -stan::promote_args_t -h2_rsfunctor__::operator()(const std::vector& y, const int& start, - const int& end, std::ostream* pstream__, - const std::vector>& a) const { - return h2(y, (start + 1), (end + 1), a, pstream__); -} -template , - stan::is_stan_scalar>* = nullptr> -stan::promote_args_t h3(const std::vector& y, const int& start, const int& end, const std::vector>& a, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -23684,25 +22462,6 @@ template , stan::is_stan_scalar>*> stan::promote_args_t -h3_functor__::operator()(const std::vector& y, const int& start, - const int& end, - const std::vector>& a, - std::ostream* pstream__) const { - return h3(y, start, end, a, pstream__); -} -template , - stan::is_stan_scalar>*> -stan::promote_args_t -h3_rsfunctor__::operator()(const std::vector& y, const int& start, - const int& end, std::ostream* pstream__, - const std::vector>& a) const { - return h3(y, (start + 1), (end + 1), a, pstream__); -} -template , - stan::is_stan_scalar>* = nullptr> -stan::promote_args_t h4(const std::vector& y, const int& start, const int& end, const std::vector>& a, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -23735,25 +22494,6 @@ template , stan::is_stan_scalar>*> stan::promote_args_t -h4_functor__::operator()(const std::vector& y, const int& start, - const int& end, - const std::vector>& a, - std::ostream* pstream__) const { - return h4(y, start, end, a, pstream__); -} -template , - stan::is_stan_scalar>*> -stan::promote_args_t -h4_rsfunctor__::operator()(const std::vector& y, const int& start, - const int& end, std::ostream* pstream__, - const std::vector>& a) const { - return h4(y, (start + 1), (end + 1), a, pstream__); -} -template , - stan::is_stan_scalar>* = nullptr> -stan::promote_args_t h5(const std::vector& y, const int& start, const int& end, const std::vector>& a, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -23791,25 +22531,6 @@ template , stan::is_stan_scalar>*> stan::promote_args_t -h5_functor__::operator()(const std::vector& y, const int& start, - const int& end, - const std::vector>& a, - std::ostream* pstream__) const { - return h5(y, start, end, a, pstream__); -} -template , - stan::is_stan_scalar>*> -stan::promote_args_t -h5_rsfunctor__::operator()(const std::vector& y, const int& start, - const int& end, std::ostream* pstream__, - const std::vector>& a) const { - return h5(y, (start + 1), (end + 1), a, pstream__); -} -template , - stan::is_stan_scalar>* = nullptr> -stan::promote_args_t h6(const std::vector& y, const int& start, const int& end, const std::vector>>& a, std::ostream* pstream__) { @@ -23849,27 +22570,6 @@ template , stan::is_stan_scalar>*> stan::promote_args_t -h6_functor__::operator()(const std::vector& y, const int& start, - const int& end, - const std::vector< - std::vector>>& a, - std::ostream* pstream__) const { - return h6(y, start, end, a, pstream__); -} -template , - stan::is_stan_scalar>*> -stan::promote_args_t -h6_rsfunctor__::operator()(const std::vector& y, const int& start, - const int& end, std::ostream* pstream__, - const std::vector< - std::vector>>& a) const { - return h6(y, (start + 1), (end + 1), a, pstream__); -} -template , - stan::is_stan_scalar>* = nullptr> -stan::promote_args_t h7(const std::vector& y, const int& start, const int& end, const std::vector>>& a, std::ostream* pstream__) { @@ -23909,27 +22609,6 @@ template , stan::is_stan_scalar>*> stan::promote_args_t -h7_functor__::operator()(const std::vector& y, const int& start, - const int& end, - const std::vector< - std::vector>>& a, - std::ostream* pstream__) const { - return h7(y, start, end, a, pstream__); -} -template , - stan::is_stan_scalar>*> -stan::promote_args_t -h7_rsfunctor__::operator()(const std::vector& y, const int& start, - const int& end, std::ostream* pstream__, - const std::vector< - std::vector>>& a) const { - return h7(y, (start + 1), (end + 1), a, pstream__); -} -template , - stan::is_stan_scalar>* = nullptr> -stan::promote_args_t h8(const std::vector& y, const int& start, const int& end, const std::vector>>& a, std::ostream* pstream__) { @@ -23965,27 +22644,6 @@ h8(const std::vector& y, const int& start, const int& end, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar>*> -stan::promote_args_t -h8_functor__::operator()(const std::vector& y, const int& start, - const int& end, - const std::vector< - std::vector>>& a, - std::ostream* pstream__) const { - return h8(y, start, end, a, pstream__); -} -template , - stan::is_stan_scalar>*> -stan::promote_args_t -h8_rsfunctor__::operator()(const std::vector& y, const int& start, - const int& end, std::ostream* pstream__, - const std::vector< - std::vector>>& a) const { - return h8(y, (start + 1), (end + 1), a, pstream__); -} class reduce_sum_m2_model final : public model_base_crtp { private: int N; @@ -25528,376 +24186,340 @@ static constexpr std::array locations_array__ = " (in 'reduce_sum_m3.stan', line 145, column 4 to line 146, column 66)", " (in 'reduce_sum_m3.stan', line 148, column 4 to column 15)", " (in 'reduce_sum_m3.stan', line 86, column 11 to line 149, column 3)"}; -struct g10_functor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, const std::vector>>& - a, std::ostream* pstream__) const; -}; -struct f1_functor__ { +template >* = nullptr> +stan::promote_args_t +f1(const std::vector& y_slice, const int& start, const int& end, + std::ostream* pstream__); +struct f1_rsfunctor__ { template >* = nullptr> stan::promote_args_t operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__) const; -}; -struct f10_rsfunctor__ { - double - operator()(const std::vector>& y_slice, const int& start, - const int& end, std::ostream* pstream__) const; -}; -struct g8_rsfunctor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__, - const std::vector>& a) const; -}; -struct g7_rsfunctor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__, - const std::vector>& a) const; -}; -struct g6_rsfunctor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__, - const std::vector>& a) const; + end, std::ostream* pstream__) const { + return f1(y_slice, (start + 1), (end + 1), pstream__); + } }; -struct f5_rsfunctor__ { +template >* = nullptr> +stan::promote_args_t +f1a(const std::vector& y_slice, const int& start, const int& end, + std::ostream* pstream__); +struct f1a_rsfunctor__ { template >* = nullptr> stan::promote_args_t - operator()(const std::vector>& y_slice, const int& start, - const int& end, std::ostream* pstream__) const; -}; -struct g5_rsfunctor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__, const std::vector& a) const; -}; -struct g5_functor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, const std::vector& a, std::ostream* pstream__) const; -}; -struct g7_functor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, const std::vector>& a, - std::ostream* pstream__) const; + end, std::ostream* pstream__) const { + return f1a(y_slice, (start + 1), (end + 1), pstream__); + } }; -struct g1_rsfunctor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__, const T3__& a) const; +template >* = nullptr> +stan::promote_args_t +f2(const std::vector>& y_slice, const int& start, + const int& end, std::ostream* pstream__); +struct f2_rsfunctor__ { + template >* = nullptr> + stan::promote_args_t + operator()(const std::vector>& y_slice, const int& + start, const int& end, std::ostream* pstream__) const { + return f2(y_slice, (start + 1), (end + 1), pstream__); + } }; -struct f8_functor__ { +template >* = nullptr> +stan::promote_args_t +f3(const std::vector>& y_slice, const int& start, + const int& end, std::ostream* pstream__); +struct f3_rsfunctor__ { template >* = nullptr> stan::promote_args_t - operator()(const std::vector>>& - y_slice, const int& start, const int& end, std::ostream* - pstream__) const; -}; -struct f9_functor__ { - double - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__) const; -}; -struct g3_rsfunctor__ { - template , - stan::is_row_vector, - stan::is_vt_not_complex>* = nullptr> - stan::promote_args_t> - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__, const T3__& a) const; + operator()(const std::vector>& y_slice, const int& + start, const int& end, std::ostream* pstream__) const { + return f3(y_slice, (start + 1), (end + 1), pstream__); + } }; -struct f2_functor__ { +template >* = nullptr> +stan::promote_args_t +f4(const std::vector>& y_slice, const int& start, + const int& end, std::ostream* pstream__); +struct f4_rsfunctor__ { template >* = nullptr> stan::promote_args_t - operator()(const std::vector>& y_slice, const int& - start, const int& end, std::ostream* pstream__) const; + operator()(const std::vector>& y_slice, + const int& start, const int& end, std::ostream* pstream__) const { + return f4(y_slice, (start + 1), (end + 1), pstream__); + } }; -struct s_functor__ { - template , - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_row_vector, - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t, - stan::base_type_t, stan::base_type_t, - stan::promote_args_t>> - operator()(const std::vector& y_slice, const int& start, const int& - end, const int& a, const T4__& b, const T5__& c, const T6__& d, - const T7__& e, const std::vector& f, - const std::vector& g, - const std::vector>& h, - const std::vector>& i, - const std::vector>& j, - const std::vector>& k, - const std::vector>& l, - const std::vector>>& m, - const std::vector>>& n, - const std::vector>>& o, - const std::vector>>& p, - const std::vector>>& q, - std::ostream* pstream__) const; +template >* = nullptr> +stan::promote_args_t +f5(const std::vector>& y_slice, const int& start, + const int& end, std::ostream* pstream__); +struct f5_rsfunctor__ { + template >* = nullptr> + stan::promote_args_t + operator()(const std::vector>& y_slice, const int& start, + const int& end, std::ostream* pstream__) const { + return f5(y_slice, (start + 1), (end + 1), pstream__); + } }; -struct f10_functor__ { - double - operator()(const std::vector>& y_slice, const int& start, - const int& end, std::ostream* pstream__) const; +template >* = nullptr> +stan::promote_args_t +f6(const std::vector>>& y_slice, + const int& start, const int& end, std::ostream* pstream__); +struct f6_rsfunctor__ { + template >* = nullptr> + stan::promote_args_t + operator()(const std::vector>>& + y_slice, const int& start, const int& end, std::ostream* + pstream__) const { + return f6(y_slice, (start + 1), (end + 1), pstream__); + } }; -struct g2_functor__ { - template , - stan::is_col_vector, - stan::is_vt_not_complex>* = nullptr> - stan::promote_args_t> - operator()(const std::vector& y_slice, const int& start, const int& - end, const T3__& a, std::ostream* pstream__) const; +template >* = nullptr> +stan::promote_args_t +f7(const std::vector>>& y_slice, + const int& start, const int& end, std::ostream* pstream__); +struct f7_rsfunctor__ { + template >* = nullptr> + stan::promote_args_t + operator()(const std::vector>>& + y_slice, const int& start, const int& end, std::ostream* + pstream__) const { + return f7(y_slice, (start + 1), (end + 1), pstream__); + } }; -struct f4_functor__ { +template >* = nullptr> +stan::promote_args_t +f8(const std::vector>>& y_slice, + const int& start, const int& end, std::ostream* pstream__); +struct f8_rsfunctor__ { template >* = nullptr> stan::promote_args_t - operator()(const std::vector>& y_slice, - const int& start, const int& end, std::ostream* pstream__) const; + operator()(const std::vector>>& + y_slice, const int& start, const int& end, std::ostream* + pstream__) const { + return f8(y_slice, (start + 1), (end + 1), pstream__); + } }; +double +f9(const std::vector& y_slice, const int& start, const int& end, + std::ostream* pstream__); struct f9_rsfunctor__ { double operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__) const; + end, std::ostream* pstream__) const { + return f9(y_slice, (start + 1), (end + 1), pstream__); + } }; -struct f7_rsfunctor__ { +double +f10(const std::vector>& y_slice, const int& start, + const int& end, std::ostream* pstream__); +struct f10_rsfunctor__ { + double + operator()(const std::vector>& y_slice, const int& start, + const int& end, std::ostream* pstream__) const { + return f10(y_slice, (start + 1), (end + 1), pstream__); + } +}; +double +f11(const std::vector>>& y_slice, const int& + start, const int& end, std::ostream* pstream__); +struct f11_rsfunctor__ { + double + operator()(const std::vector>>& y_slice, + const int& start, const int& end, std::ostream* pstream__) const { + return f11(y_slice, (start + 1), (end + 1), pstream__); + } +}; +template >* = nullptr> +stan::promote_args_t +f12(const std::vector>>& y_slice, const int& + start, const int& end, std::ostream* pstream__); +struct f12_rsfunctor__ { template >* = nullptr> stan::promote_args_t - operator()(const std::vector>>& - y_slice, const int& start, const int& end, std::ostream* - pstream__) const; + operator()(const std::vector>>& y_slice, + const int& start, const int& end, std::ostream* pstream__) const { + return f12(y_slice, (start + 1), (end + 1), pstream__); + } }; -struct g6_functor__ { +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +g1(const std::vector& y_slice, const int& start, const int& end, + const T3__& a, std::ostream* pstream__); +struct g1_rsfunctor__ { template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t operator()(const std::vector& y_slice, const int& start, const int& - end, const std::vector>& a, - std::ostream* pstream__) const; -}; -struct f11_rsfunctor__ { - double - operator()(const std::vector>>& y_slice, - const int& start, const int& end, std::ostream* pstream__) const; + end, std::ostream* pstream__, const T3__& a) const { + return g1(y_slice, (start + 1), (end + 1), a, pstream__); + } }; -struct g3_functor__ { +template , + stan::is_col_vector, + stan::is_vt_not_complex>* = nullptr> +stan::promote_args_t> +g2(const std::vector& y_slice, const int& start, const int& end, + const T3__& a_arg__, std::ostream* pstream__); +struct g2_rsfunctor__ { template , - stan::is_row_vector, + stan::is_col_vector, stan::is_vt_not_complex>* = nullptr> stan::promote_args_t> operator()(const std::vector& y_slice, const int& start, const int& - end, const T3__& a, std::ostream* pstream__) const; -}; -struct f12_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>>& y_slice, - const int& start, const int& end, std::ostream* pstream__) const; -}; -struct f11_functor__ { - double - operator()(const std::vector>>& y_slice, - const int& start, const int& end, std::ostream* pstream__) const; + end, std::ostream* pstream__, const T3__& a) const { + return g2(y_slice, (start + 1), (end + 1), a, pstream__); + } }; -struct g4_rsfunctor__ { +template , + stan::is_row_vector, + stan::is_vt_not_complex>* = nullptr> +stan::promote_args_t> +g3(const std::vector& y_slice, const int& start, const int& end, + const T3__& a_arg__, std::ostream* pstream__); +struct g3_rsfunctor__ { template , - stan::is_eigen_matrix_dynamic, + stan::is_row_vector, stan::is_vt_not_complex>* = nullptr> stan::promote_args_t> operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__, const T3__& a) const; + end, std::ostream* pstream__, const T3__& a) const { + return g3(y_slice, (start + 1), (end + 1), a, pstream__); + } }; -struct g4_functor__ { +template , + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +stan::promote_args_t> +g4(const std::vector& y_slice, const int& start, const int& end, + const T3__& a_arg__, std::ostream* pstream__); +struct g4_rsfunctor__ { template , stan::is_eigen_matrix_dynamic, stan::is_vt_not_complex>* = nullptr> stan::promote_args_t> operator()(const std::vector& y_slice, const int& start, const int& - end, const T3__& a, std::ostream* pstream__) const; + end, std::ostream* pstream__, const T3__& a) const { + return g4(y_slice, (start + 1), (end + 1), a, pstream__); + } }; -struct g9_functor__ { +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +g5(const std::vector& y_slice, const int& start, const int& end, + const std::vector& a, std::ostream* pstream__); +struct g5_rsfunctor__ { template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t operator()(const std::vector& y_slice, const int& start, const int& - end, const std::vector>& a, std::ostream* - pstream__) const; + end, std::ostream* pstream__, const std::vector& a) const { + return g5(y_slice, (start + 1), (end + 1), a, pstream__); + } }; -struct g11_rsfunctor__ { +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +g6(const std::vector& y_slice, const int& start, const int& end, + const std::vector>& a, std::ostream* pstream__); +struct g6_rsfunctor__ { template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t operator()(const std::vector& y_slice, const int& start, const int& end, std::ostream* pstream__, - const std::vector>>& a) const; -}; -struct f7_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>>& - y_slice, const int& start, const int& end, std::ostream* - pstream__) const; -}; -struct f1_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__) const; -}; -struct f3_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>& y_slice, const int& - start, const int& end, std::ostream* pstream__) const; -}; -struct g11_functor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, const std::vector>>& - a, std::ostream* pstream__) const; + const std::vector>& a) const { + return g6(y_slice, (start + 1), (end + 1), a, pstream__); + } }; -struct g9_rsfunctor__ { +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +g7(const std::vector& y_slice, const int& start, const int& end, + const std::vector>& a, std::ostream* pstream__); +struct g7_rsfunctor__ { template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t operator()(const std::vector& y_slice, const int& start, const int& end, std::ostream* pstream__, - const std::vector>& a) const; -}; -struct f12_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>>& y_slice, - const int& start, const int& end, std::ostream* pstream__) const; -}; -struct f6_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>>& - y_slice, const int& start, const int& end, std::ostream* - pstream__) const; -}; -struct f3_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>& y_slice, const int& - start, const int& end, std::ostream* pstream__) const; -}; -struct f2_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>& y_slice, const int& - start, const int& end, std::ostream* pstream__) const; + const std::vector>& a) const { + return g7(y_slice, (start + 1), (end + 1), a, pstream__); + } }; -struct g12_functor__ { +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +g8(const std::vector& y_slice, const int& start, const int& end, + const std::vector>& a, std::ostream* pstream__); +struct g8_rsfunctor__ { template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t operator()(const std::vector& y_slice, const int& start, const int& - end, const std::vector>>& - a, std::ostream* pstream__) const; -}; -struct f6_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>>& - y_slice, const int& start, const int& end, std::ostream* - pstream__) const; -}; -struct g2_rsfunctor__ { - template , - stan::is_col_vector, - stan::is_vt_not_complex>* = nullptr> - stan::promote_args_t> - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__, const T3__& a) const; + end, std::ostream* pstream__, + const std::vector>& a) const { + return g8(y_slice, (start + 1), (end + 1), a, pstream__); + } }; -struct g1_functor__ { +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +g9(const std::vector& y_slice, const int& start, const int& end, + const std::vector>& a, std::ostream* pstream__); +struct g9_rsfunctor__ { template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t operator()(const std::vector& y_slice, const int& start, const int& - end, const T3__& a, std::ostream* pstream__) const; -}; -struct r_functor__ { - double operator()(std::ostream* pstream__) const; + end, std::ostream* pstream__, + const std::vector>& a) const { + return g9(y_slice, (start + 1), (end + 1), a, pstream__); + } }; +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +g10(const std::vector& y_slice, const int& start, const int& end, + const std::vector>>& a, + std::ostream* pstream__); struct g10_rsfunctor__ { template , @@ -25905,39 +24527,35 @@ struct g10_rsfunctor__ { stan::promote_args_t operator()(const std::vector& y_slice, const int& start, const int& end, std::ostream* pstream__, - const std::vector>>& a) const; -}; -struct f1a_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__) const; + const std::vector>>& a) const { + return g10(y_slice, (start + 1), (end + 1), a, pstream__); + } }; -struct g8_functor__ { +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +g11(const std::vector& y_slice, const int& start, const int& end, + const std::vector>>& a, + std::ostream* pstream__); +struct g11_rsfunctor__ { template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t operator()(const std::vector& y_slice, const int& start, const int& - end, const std::vector>& a, - std::ostream* pstream__) const; -}; -struct f8_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>>& - y_slice, const int& start, const int& end, std::ostream* - pstream__) const; -}; -struct f5_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>& y_slice, const int& start, - const int& end, std::ostream* pstream__) const; + end, std::ostream* pstream__, + const std::vector>>& a) const { + return g11(y_slice, (start + 1), (end + 1), a, pstream__); + } }; +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +g12(const std::vector& y_slice, const int& start, const int& end, + const std::vector>>& a, + std::ostream* pstream__); struct g12_rsfunctor__ { template , @@ -25945,15 +24563,49 @@ struct g12_rsfunctor__ { stan::promote_args_t operator()(const std::vector& y_slice, const int& start, const int& end, std::ostream* pstream__, - const std::vector>>& a) const; -}; -struct f4_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>& y_slice, - const int& start, const int& end, std::ostream* pstream__) const; + const std::vector>>& a) const { + return g12(y_slice, (start + 1), (end + 1), a, pstream__); + } }; +template , + stan::is_stan_scalar, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_row_vector, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t, + stan::base_type_t, stan::base_type_t, + stan::promote_args_t>> +s(const std::vector& y_slice, const int& start, const int& end, + const int& a, const T4__& b, const T5__& c_arg__, const T6__& d_arg__, + const T7__& e_arg__, const std::vector& f, const std::vector& g, + const std::vector>& h, + const std::vector>& i, + const std::vector>& j, + const std::vector>& k, + const std::vector>& l, + const std::vector>>& m, + const std::vector>>& n, + const std::vector>>& o, + const std::vector>>& p, + const std::vector>>& q, std::ostream* + pstream__); struct s_rsfunctor__ { template >>& n, const std::vector>>& o, const std::vector>>& p, - const std::vector>>& q) const; -}; -struct f1a_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__) const; + const std::vector>>& q) const { + return s(y_slice, (start + 1), (end + 1), a, b, c, d, e, f, g, h, i, j, + k, l, m, n, o, p, q, pstream__); + } }; -template >* = nullptr> +double r(std::ostream* pstream__); +template >*> stan::promote_args_t f1(const std::vector& y_slice, const int& start, const int& end, std::ostream* pstream__) { @@ -26024,19 +24672,6 @@ f1(const std::vector& y_slice, const int& start, const int& end, } template >*> stan::promote_args_t -f1_functor__::operator()(const std::vector& y_slice, const int& start, - const int& end, std::ostream* pstream__) const { - return f1(y_slice, start, end, pstream__); -} -template >*> -stan::promote_args_t -f1_rsfunctor__::operator()(const std::vector& y_slice, const int& - start, const int& end, std::ostream* pstream__) const { - return f1(y_slice, (start + 1), (end + 1), pstream__); -} -template >* = nullptr> -stan::promote_args_t f1a(const std::vector& y_slice, const int& start, const int& end, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -26056,19 +24691,6 @@ f1a(const std::vector& y_slice, const int& start, const int& end, } template >*> stan::promote_args_t -f1a_functor__::operator()(const std::vector& y_slice, const int& start, - const int& end, std::ostream* pstream__) const { - return f1a(y_slice, start, end, pstream__); -} -template >*> -stan::promote_args_t -f1a_rsfunctor__::operator()(const std::vector& y_slice, const int& - start, const int& end, std::ostream* pstream__) const { - return f1a(y_slice, (start + 1), (end + 1), pstream__); -} -template >* = nullptr> -stan::promote_args_t f2(const std::vector>& y_slice, const int& start, const int& end, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -26088,21 +24710,6 @@ f2(const std::vector>& y_slice, const int& start, } template >*> stan::promote_args_t -f2_functor__::operator()(const std::vector>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return f2(y_slice, start, end, pstream__); -} -template >*> -stan::promote_args_t -f2_rsfunctor__::operator()(const std::vector>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return f2(y_slice, (start + 1), (end + 1), pstream__); -} -template >* = nullptr> -stan::promote_args_t f3(const std::vector>& y_slice, const int& start, const int& end, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -26122,21 +24729,6 @@ f3(const std::vector>& y_slice, const int& start, } template >*> stan::promote_args_t -f3_functor__::operator()(const std::vector>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return f3(y_slice, start, end, pstream__); -} -template >*> -stan::promote_args_t -f3_rsfunctor__::operator()(const std::vector>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return f3(y_slice, (start + 1), (end + 1), pstream__); -} -template >* = nullptr> -stan::promote_args_t f4(const std::vector>& y_slice, const int& start, const int& end, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -26156,21 +24748,6 @@ f4(const std::vector>& y_slice, const int& start, } template >*> stan::promote_args_t -f4_functor__::operator()(const std::vector>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return f4(y_slice, start, end, pstream__); -} -template >*> -stan::promote_args_t -f4_rsfunctor__::operator()(const std::vector>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return f4(y_slice, (start + 1), (end + 1), pstream__); -} -template >* = nullptr> -stan::promote_args_t f5(const std::vector>& y_slice, const int& start, const int& end, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -26190,21 +24767,6 @@ f5(const std::vector>& y_slice, const int& start, } template >*> stan::promote_args_t -f5_functor__::operator()(const std::vector>& y_slice, - const int& start, const int& end, std::ostream* - pstream__) const { - return f5(y_slice, start, end, pstream__); -} -template >*> -stan::promote_args_t -f5_rsfunctor__::operator()(const std::vector>& y_slice, - const int& start, const int& end, std::ostream* - pstream__) const { - return f5(y_slice, (start + 1), (end + 1), pstream__); -} -template >* = nullptr> -stan::promote_args_t f6(const std::vector>>& y_slice, const int& start, const int& end, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -26224,23 +24786,6 @@ f6(const std::vector>>& y_slice, } template >*> stan::promote_args_t -f6_functor__::operator()(const std::vector< - std::vector>>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return f6(y_slice, start, end, pstream__); -} -template >*> -stan::promote_args_t -f6_rsfunctor__::operator()(const std::vector< - std::vector>>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return f6(y_slice, (start + 1), (end + 1), pstream__); -} -template >* = nullptr> -stan::promote_args_t f7(const std::vector>>& y_slice, const int& start, const int& end, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -26260,23 +24805,6 @@ f7(const std::vector>>& y_slice, } template >*> stan::promote_args_t -f7_functor__::operator()(const std::vector< - std::vector>>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return f7(y_slice, start, end, pstream__); -} -template >*> -stan::promote_args_t -f7_rsfunctor__::operator()(const std::vector< - std::vector>>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return f7(y_slice, (start + 1), (end + 1), pstream__); -} -template >* = nullptr> -stan::promote_args_t f8(const std::vector>>& y_slice, const int& start, const int& end, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -26294,22 +24822,6 @@ f8(const std::vector>>& y_slice, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -f8_functor__::operator()(const std::vector< - std::vector>>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return f8(y_slice, start, end, pstream__); -} -template >*> -stan::promote_args_t -f8_rsfunctor__::operator()(const std::vector< - std::vector>>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return f8(y_slice, (start + 1), (end + 1), pstream__); -} double f9(const std::vector& y_slice, const int& start, const int& end, std::ostream* pstream__) { @@ -26329,16 +24841,6 @@ f9(const std::vector& y_slice, const int& start, const int& end, } } double -f9_functor__::operator()(const std::vector& y_slice, const int& start, - const int& end, std::ostream* pstream__) const { - return f9(y_slice, start, end, pstream__); -} -double -f9_rsfunctor__::operator()(const std::vector& y_slice, const int& start, - const int& end, std::ostream* pstream__) const { - return f9(y_slice, (start + 1), (end + 1), pstream__); -} -double f10(const std::vector>& y_slice, const int& start, const int& end, std::ostream* pstream__) { using local_scalar_t__ = double; @@ -26357,18 +24859,6 @@ f10(const std::vector>& y_slice, const int& start, } } double -f10_functor__::operator()(const std::vector>& y_slice, - const int& start, const int& end, std::ostream* - pstream__) const { - return f10(y_slice, start, end, pstream__); -} -double -f10_rsfunctor__::operator()(const std::vector>& y_slice, - const int& start, const int& end, std::ostream* - pstream__) const { - return f10(y_slice, (start + 1), (end + 1), pstream__); -} -double f11(const std::vector>>& y_slice, const int& start, const int& end, std::ostream* pstream__) { using local_scalar_t__ = double; @@ -26386,20 +24876,7 @@ f11(const std::vector>>& y_slice, const int& stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -double -f11_functor__::operator()(const std::vector>>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return f11(y_slice, start, end, pstream__); -} -double -f11_rsfunctor__::operator()(const std::vector>>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return f11(y_slice, (start + 1), (end + 1), pstream__); -} -template >* = nullptr> +template >*> stan::promote_args_t f12(const std::vector>>& y_slice, const int& start, const int& end, std::ostream* pstream__) { @@ -26418,23 +24895,9 @@ f12(const std::vector>>& y_slice, const int& stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -f12_functor__::operator()(const std::vector>>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return f12(y_slice, start, end, pstream__); -} -template >*> -stan::promote_args_t -f12_rsfunctor__::operator()(const std::vector>>& - y_slice, const int& start, const int& end, - std::ostream* pstream__) const { - return f12(y_slice, (start + 1), (end + 1), pstream__); -} template , - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> stan::promote_args_t g1(const std::vector& y_slice, const int& start, const int& end, const T3__& a, std::ostream* pstream__) { @@ -26453,28 +24916,10 @@ g1(const std::vector& y_slice, const int& start, const int& end, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar>*> -stan::promote_args_t -g1_functor__::operator()(const std::vector& y_slice, const int& start, - const int& end, const T3__& a, std::ostream* - pstream__) const { - return g1(y_slice, start, end, a, pstream__); -} -template , - stan::is_stan_scalar>*> -stan::promote_args_t -g1_rsfunctor__::operator()(const std::vector& y_slice, const int& - start, const int& end, std::ostream* pstream__, - const T3__& a) const { - return g1(y_slice, (start + 1), (end + 1), a, pstream__); -} template , stan::is_col_vector, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> stan::promote_args_t> g2(const std::vector& y_slice, const int& start, const int& end, const T3__& a_arg__, std::ostream* pstream__) { @@ -26495,30 +24940,10 @@ g2(const std::vector& y_slice, const int& start, const int& end, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_col_vector, - stan::is_vt_not_complex>*> -stan::promote_args_t> -g2_functor__::operator()(const std::vector& y_slice, const int& start, - const int& end, const T3__& a, std::ostream* - pstream__) const { - return g2(y_slice, start, end, a, pstream__); -} -template , - stan::is_col_vector, - stan::is_vt_not_complex>*> -stan::promote_args_t> -g2_rsfunctor__::operator()(const std::vector& y_slice, const int& - start, const int& end, std::ostream* pstream__, - const T3__& a) const { - return g2(y_slice, (start + 1), (end + 1), a, pstream__); -} template , stan::is_row_vector, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> stan::promote_args_t> g3(const std::vector& y_slice, const int& start, const int& end, const T3__& a_arg__, std::ostream* pstream__) { @@ -26532,37 +24957,17 @@ g3(const std::vector& y_slice, const int& start, const int& end, local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); // suppress unused var warning (void) DUMMY_VAR__; - try { - current_statement__ = 201; - return 0.0; - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } -} -template , - stan::is_row_vector, - stan::is_vt_not_complex>*> -stan::promote_args_t> -g3_functor__::operator()(const std::vector& y_slice, const int& start, - const int& end, const T3__& a, std::ostream* - pstream__) const { - return g3(y_slice, start, end, a, pstream__); -} -template , - stan::is_row_vector, - stan::is_vt_not_complex>*> -stan::promote_args_t> -g3_rsfunctor__::operator()(const std::vector& y_slice, const int& - start, const int& end, std::ostream* pstream__, - const T3__& a) const { - return g3(y_slice, (start + 1), (end + 1), a, pstream__); + try { + current_statement__ = 201; + return 0.0; + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } } template , stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> stan::promote_args_t> g4(const std::vector& y_slice, const int& start, const int& end, const T3__& a_arg__, std::ostream* pstream__) { @@ -26585,27 +24990,7 @@ g4(const std::vector& y_slice, const int& start, const int& end, } template , - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -stan::promote_args_t> -g4_functor__::operator()(const std::vector& y_slice, const int& start, - const int& end, const T3__& a, std::ostream* - pstream__) const { - return g4(y_slice, start, end, a, pstream__); -} -template , - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -stan::promote_args_t> -g4_rsfunctor__::operator()(const std::vector& y_slice, const int& - start, const int& end, std::ostream* pstream__, - const T3__& a) const { - return g4(y_slice, (start + 1), (end + 1), a, pstream__); -} -template , - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> stan::promote_args_t g5(const std::vector& y_slice, const int& start, const int& end, const std::vector& a, std::ostream* pstream__) { @@ -26628,24 +25013,6 @@ template , stan::is_stan_scalar>*> stan::promote_args_t -g5_functor__::operator()(const std::vector& y_slice, const int& start, - const int& end, const std::vector& a, - std::ostream* pstream__) const { - return g5(y_slice, start, end, a, pstream__); -} -template , - stan::is_stan_scalar>*> -stan::promote_args_t -g5_rsfunctor__::operator()(const std::vector& y_slice, const int& - start, const int& end, std::ostream* pstream__, - const std::vector& a) const { - return g5(y_slice, (start + 1), (end + 1), a, pstream__); -} -template , - stan::is_stan_scalar>* = nullptr> -stan::promote_args_t g6(const std::vector& y_slice, const int& start, const int& end, const std::vector>& a, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -26667,25 +25034,6 @@ template , stan::is_stan_scalar>*> stan::promote_args_t -g6_functor__::operator()(const std::vector& y_slice, const int& start, - const int& end, - const std::vector>& a, - std::ostream* pstream__) const { - return g6(y_slice, start, end, a, pstream__); -} -template , - stan::is_stan_scalar>*> -stan::promote_args_t -g6_rsfunctor__::operator()(const std::vector& y_slice, const int& - start, const int& end, std::ostream* pstream__, - const std::vector>& a) const { - return g6(y_slice, (start + 1), (end + 1), a, pstream__); -} -template , - stan::is_stan_scalar>* = nullptr> -stan::promote_args_t g7(const std::vector& y_slice, const int& start, const int& end, const std::vector>& a, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -26707,25 +25055,6 @@ template , stan::is_stan_scalar>*> stan::promote_args_t -g7_functor__::operator()(const std::vector& y_slice, const int& start, - const int& end, - const std::vector>& a, - std::ostream* pstream__) const { - return g7(y_slice, start, end, a, pstream__); -} -template , - stan::is_stan_scalar>*> -stan::promote_args_t -g7_rsfunctor__::operator()(const std::vector& y_slice, const int& - start, const int& end, std::ostream* pstream__, - const std::vector>& a) const { - return g7(y_slice, (start + 1), (end + 1), a, pstream__); -} -template , - stan::is_stan_scalar>* = nullptr> -stan::promote_args_t g8(const std::vector& y_slice, const int& start, const int& end, const std::vector>& a, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -26747,25 +25076,6 @@ template , stan::is_stan_scalar>*> stan::promote_args_t -g8_functor__::operator()(const std::vector& y_slice, const int& start, - const int& end, - const std::vector>& a, - std::ostream* pstream__) const { - return g8(y_slice, start, end, a, pstream__); -} -template , - stan::is_stan_scalar>*> -stan::promote_args_t -g8_rsfunctor__::operator()(const std::vector& y_slice, const int& - start, const int& end, std::ostream* pstream__, - const std::vector>& a) const { - return g8(y_slice, (start + 1), (end + 1), a, pstream__); -} -template , - stan::is_stan_scalar>* = nullptr> -stan::promote_args_t g9(const std::vector& y_slice, const int& start, const int& end, const std::vector>& a, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -26787,25 +25097,6 @@ template , stan::is_stan_scalar>*> stan::promote_args_t -g9_functor__::operator()(const std::vector& y_slice, const int& start, - const int& end, - const std::vector>& a, - std::ostream* pstream__) const { - return g9(y_slice, start, end, a, pstream__); -} -template , - stan::is_stan_scalar>*> -stan::promote_args_t -g9_rsfunctor__::operator()(const std::vector& y_slice, const int& - start, const int& end, std::ostream* pstream__, - const std::vector>& a) const { - return g9(y_slice, (start + 1), (end + 1), a, pstream__); -} -template , - stan::is_stan_scalar>* = nullptr> -stan::promote_args_t g10(const std::vector& y_slice, const int& start, const int& end, const std::vector>>& a, std::ostream* pstream__) { @@ -26828,27 +25119,6 @@ template , stan::is_stan_scalar>*> stan::promote_args_t -g10_functor__::operator()(const std::vector& y_slice, const int& start, - const int& end, - const std::vector< - std::vector>>& a, - std::ostream* pstream__) const { - return g10(y_slice, start, end, a, pstream__); -} -template , - stan::is_stan_scalar>*> -stan::promote_args_t -g10_rsfunctor__::operator()(const std::vector& y_slice, const int& - start, const int& end, std::ostream* pstream__, - const std::vector< - std::vector>>& a) const { - return g10(y_slice, (start + 1), (end + 1), a, pstream__); -} -template , - stan::is_stan_scalar>* = nullptr> -stan::promote_args_t g11(const std::vector& y_slice, const int& start, const int& end, const std::vector>>& a, std::ostream* pstream__) { @@ -26871,27 +25141,6 @@ template , stan::is_stan_scalar>*> stan::promote_args_t -g11_functor__::operator()(const std::vector& y_slice, const int& start, - const int& end, - const std::vector< - std::vector>>& a, - std::ostream* pstream__) const { - return g11(y_slice, start, end, a, pstream__); -} -template , - stan::is_stan_scalar>*> -stan::promote_args_t -g11_rsfunctor__::operator()(const std::vector& y_slice, const int& - start, const int& end, std::ostream* pstream__, - const std::vector< - std::vector>>& a) const { - return g11(y_slice, (start + 1), (end + 1), a, pstream__); -} -template , - stan::is_stan_scalar>* = nullptr> -stan::promote_args_t g12(const std::vector& y_slice, const int& start, const int& end, const std::vector>>& a, std::ostream* pstream__) { @@ -26910,28 +25159,6 @@ g12(const std::vector& y_slice, const int& start, const int& end, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar>*> -stan::promote_args_t -g12_functor__::operator()(const std::vector& y_slice, const int& start, - const int& end, - const std::vector< - std::vector>>& a, - std::ostream* pstream__) const { - return g12(y_slice, start, end, a, pstream__); -} -template , - stan::is_stan_scalar>*> -stan::promote_args_t -g12_rsfunctor__::operator()(const std::vector& y_slice, const int& - start, const int& end, std::ostream* pstream__, - const std::vector< - std::vector>>& - a) const { - return g12(y_slice, (start + 1), (end + 1), a, pstream__); -} template , stan::is_stan_scalar, stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> stan::promote_args_t, stan::base_type_t, stan::base_type_t, stan::promote_args_t& y_slice, const int& start, const int& end, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_row_vector, - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>*> -stan::promote_args_t, - stan::base_type_t, stan::base_type_t, - stan::promote_args_t>> -s_functor__::operator()(const std::vector& y_slice, const int& start, - const int& end, const int& a, const T4__& b, - const T5__& c, const T6__& d, const T7__& e, - const std::vector& f, const std::vector& - g, const std::vector>& h, - const std::vector>& i, - const std::vector>& j, - const std::vector>& k, - const std::vector>& l, - const std::vector< - std::vector>>& m, - const std::vector< - std::vector>>& n, - const std::vector< - std::vector>>& o, - const std::vector>>& p, - const std::vector>>& - q, std::ostream* pstream__) const { - return s(y_slice, start, end, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, - p, q, pstream__); -} -template , - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_row_vector, - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>*> -stan::promote_args_t, - stan::base_type_t, stan::base_type_t, - stan::promote_args_t>> -s_rsfunctor__::operator()(const std::vector& y_slice, const int& start, - const int& end, std::ostream* pstream__, const int& - a, const T4__& b, const T5__& c, const T6__& d, - const T7__& e, const std::vector& f, - const std::vector& g, - const std::vector>& h, - const std::vector>& i, - const std::vector>& j, - const std::vector>& k, - const std::vector>& l, - const std::vector< - std::vector>>& m, - const std::vector< - std::vector>>& n, - const std::vector< - std::vector>>& - o, - const std::vector>>& - p, - const std::vector>>& - q) const { - return s(y_slice, (start + 1), (end + 1), a, b, c, d, e, f, g, h, i, j, k, - l, m, n, o, p, q, pstream__); -} double r(std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -27394,9 +25526,6 @@ double r(std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -double r_functor__::operator()(std::ostream* pstream__) const { - return r(pstream__); -} class reduce_sum_m3_model final : public model_base_crtp { private: int N; @@ -29191,16 +27320,14 @@ static constexpr std::array locations_array__ = " (in 'shadowing.stan', line 3, column 4 to column 30)", " (in 'shadowing.stan', line 5, column 4 to column 14)", " (in 'shadowing.stan', line 2, column 43 to line 6, column 3)"}; -struct rhs_functor__ { - template , - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar>* = nullptr> - Eigen::Matrix, T2__>,-1,1> - operator()(const T0__& t, const T1__& y, const T2__& alpha, std::ostream* - pstream__) const; -}; +template , + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar>* = nullptr> +Eigen::Matrix, T2__>,-1,1> +rhs(const T0__& t, const T1__& y_arg__, const T2__& alpha, std::ostream* + pstream__); struct rhs_variadic2_functor__ { template , @@ -29209,13 +27336,15 @@ struct rhs_variadic2_functor__ { stan::is_stan_scalar>* = nullptr> Eigen::Matrix, T2__>,-1,1> operator()(const T0__& t, const T1__& y, std::ostream* pstream__, - const T2__& alpha) const; + const T2__& alpha) const { + return rhs(t, y, alpha, pstream__); + } }; template , stan::is_col_vector, stan::is_vt_not_complex, - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> Eigen::Matrix, T2__>,-1,1> rhs(const T0__& t, const T1__& y_arg__, const T2__& alpha, std::ostream* pstream__) { @@ -29241,27 +27370,6 @@ rhs(const T0__& t, const T1__& y_arg__, const T2__& alpha, std::ostream* stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar>*> -Eigen::Matrix, T2__>,-1,1> -rhs_functor__::operator()(const T0__& t, const T1__& y, const T2__& alpha, - std::ostream* pstream__) const { - return rhs(t, y, alpha, pstream__); -} -template , - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar>*> -Eigen::Matrix, T2__>,-1,1> -rhs_variadic2_functor__::operator()(const T0__& t, const T1__& y, - std::ostream* pstream__, const T2__& - alpha) const { - return rhs(t, y, alpha, pstream__); -} class shadowing_model final : public model_base_crtp { private: Eigen::Matrix x_data__; @@ -30166,39 +28274,25 @@ static constexpr std::array locations_array__ = " (in 'single-argument-lpmf.stan', line 14, column 25 to line 16, column 3)", " (in 'single-argument-lpmf.stan', line 18, column 4 to column 14)", " (in 'single-argument-lpmf.stan', line 17, column 23 to line 19, column 3)"}; -struct foo5_lp_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const T0__& y, T_lp__& lp__, T_lp_accum__& lp_accum__, - std::ostream* pstream__) const; -}; -struct foo3_lpdf_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const T0__& y, std::ostream* pstream__) const; -}; -struct foo2_lpdf_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const T0__& y, std::ostream* pstream__) const; -}; -struct foo1_lpmf_functor__ { - template double - operator()(const int& y, std::ostream* pstream__) const; -}; -struct foo0_lpmf_functor__ { - template double - operator()(const int& y, std::ostream* pstream__) const; -}; -struct foo4_lp_functor__ { - template double - operator()(const int& y, T_lp__& lp__, T_lp_accum__& lp_accum__, - std::ostream* pstream__) const; -}; +template double +foo0_lpmf(const int& y, std::ostream* pstream__); +template double +foo1_lpmf(const int& y, std::ostream* pstream__); +template double +foo4_lp(const int& y, T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* + pstream__); +template >* = nullptr> +stan::promote_args_t foo2_lpdf(const T0__& y, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t foo3_lpdf(const T0__& y, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t +foo5_lp(const T0__& y, T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* + pstream__); template double foo0_lpmf(const int& y, std::ostream* pstream__) { using local_scalar_t__ = double; @@ -30214,10 +28308,6 @@ foo0_lpmf(const int& y, std::ostream* pstream__) { } } template double -foo0_lpmf_functor__::operator()(const int& y, std::ostream* pstream__) const { - return foo0_lpmf(y, pstream__); -} -template double foo1_lpmf(const int& y, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -30231,10 +28321,6 @@ foo1_lpmf(const int& y, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template double -foo1_lpmf_functor__::operator()(const int& y, std::ostream* pstream__) const { - return foo1_lpmf(y, pstream__); -} template double foo4_lp(const int& y, T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) { @@ -30250,13 +28336,8 @@ foo4_lp(const int& y, T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template double -foo4_lp_functor__::operator()(const int& y, T_lp__& lp__, T_lp_accum__& - lp_accum__, std::ostream* pstream__) const { - return foo4_lp(y, lp__, lp_accum__, pstream__); -} template >* = nullptr> + stan::require_all_t>*> stan::promote_args_t foo2_lpdf(const T0__& y, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -30272,12 +28353,6 @@ stan::promote_args_t foo2_lpdf(const T0__& y, std::ostream* pstream__) { } template >*> -stan::promote_args_t -foo2_lpdf_functor__::operator()(const T0__& y, std::ostream* pstream__) const { - return foo2_lpdf(y, pstream__); -} -template >* = nullptr> stan::promote_args_t foo3_lpdf(const T0__& y, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -30291,15 +28366,9 @@ stan::promote_args_t foo3_lpdf(const T0__& y, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -foo3_lpdf_functor__::operator()(const T0__& y, std::ostream* pstream__) const { - return foo3_lpdf(y, pstream__); -} template >* = nullptr> + stan::require_all_t>*> stan::promote_args_t foo5_lp(const T0__& y, T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) { @@ -30315,14 +28384,6 @@ foo5_lp(const T0__& y, T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -foo5_lp_functor__::operator()(const T0__& y, T_lp__& lp__, T_lp_accum__& - lp_accum__, std::ostream* pstream__) const { - return foo5_lp(y, lp__, lp_accum__, pstream__); -} class single_argument_lpmf_model final : public model_base_crtp { private: @@ -33646,14 +31707,10 @@ static constexpr std::array locations_array__ = " (in 'udf_tilde_stmt_conflict.stan', line 10, column 4 to column 20)", " (in 'udf_tilde_stmt_conflict.stan', line 3, column 4 to column 21)", " (in 'udf_tilde_stmt_conflict.stan', line 2, column 22 to line 4, column 3)"}; -struct normal_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const T0__& a, std::ostream* pstream__) const; -}; template >* = nullptr> +stan::promote_args_t normal(const T0__& a, std::ostream* pstream__); +template >*> stan::promote_args_t normal(const T0__& a, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -33670,11 +31727,6 @@ stan::promote_args_t normal(const T0__& a, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -normal_functor__::operator()(const T0__& a, std::ostream* pstream__) const { - return normal(a, pstream__); -} class udf_tilde_stmt_conflict_model final : public model_base_crtp { private: @@ -33947,17 +31999,15 @@ static constexpr std::array locations_array__ = " (in 'user_constrain.stan', line 10, column 2 to column 19)", " (in 'user_constrain.stan', line 3, column 4 to column 13)", " (in 'user_constrain.stan', line 2, column 36 to line 4, column 3)"}; -struct lb_constrain_functor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const T0__& x, const T1__& y, std::ostream* pstream__) const; -}; template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t +lb_constrain(const T0__& x, const T1__& y, std::ostream* pstream__); +template , + stan::is_stan_scalar>*> +stan::promote_args_t lb_constrain(const T0__& x, const T1__& y, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -33974,14 +32024,6 @@ lb_constrain(const T0__& x, const T1__& y, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar>*> -stan::promote_args_t -lb_constrain_functor__::operator()(const T0__& x, const T1__& y, - std::ostream* pstream__) const { - return lb_constrain(x, y, pstream__); -} class user_constrain_model final : public model_base_crtp { private: diff --git a/test/integration/good/code-gen/expressions/cpp.expected b/test/integration/good/code-gen/expressions/cpp.expected index a303afd171..a1684fe024 100644 --- a/test/integration/good/code-gen/expressions/cpp.expected +++ b/test/integration/good/code-gen/expressions/cpp.expected @@ -466,54 +466,6 @@ static constexpr std::array locations_array__ = " (in 'simple_function.stan', line 8, column 34 to line 10, column 3)", " (in 'simple_function.stan', line 12, column 4 to column 21)", " (in 'simple_function.stan', line 11, column 37 to line 13, column 3)"}; -struct add_udf_functor__ { - template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix, - stan::base_type_t>,-1,-1> - operator()(const T0__& a, const T1__& b, std::ostream* pstream__) const; -}; -struct foo3_functor__ { - template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix, - stan::base_type_t>,-1,-1> - operator()(const T0__& a, const T1__& b, std::ostream* pstream__) const; -}; -struct foo2_functor__ { - template , - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - Eigen::Matrix, T1__, T2__>,-1,1> - operator()(const T0__& a, const std::vector>& b, - const std::vector>& c, std::ostream* - pstream__) const; -}; -struct foo1_functor__ { - template , - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_row_vector, - stan::is_vt_not_complex>* = nullptr> - stan::promote_args_t, - stan::base_type_t, stan::base_type_t> - operator()(const T0__& a, const int& b, const std::vector& c, - const T3__& d, const T4__& e, const T5__& f, std::ostream* - pstream__) const; -}; template , @@ -526,6 +478,45 @@ template >* = nullptr> stan::promote_args_t, stan::base_type_t, stan::base_type_t> +foo1(const T0__& a, const int& b, const std::vector& c, const T3__& + d_arg__, const T4__& e_arg__, const T5__& f_arg__, std::ostream* + pstream__); +template , + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +Eigen::Matrix, T1__, T2__>,-1,1> +foo2(const T0__& a_arg__, const std::vector>& b, + const std::vector>& c, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +foo3(const T0__& a_arg__, const T1__& b_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +add_udf(const T0__& a_arg__, const T1__& b_arg__, std::ostream* pstream__); +template , + stan::is_stan_scalar, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_row_vector, + stan::is_vt_not_complex>*> +stan::promote_args_t, + stan::base_type_t, stan::base_type_t> foo1(const T0__& a, const int& b, const std::vector& c, const T3__& d_arg__, const T4__& e_arg__, const T5__& f_arg__, std::ostream* pstream__) { @@ -550,29 +541,11 @@ foo1(const T0__& a, const int& b, const std::vector& c, const T3__& stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_row_vector, - stan::is_vt_not_complex>*> -stan::promote_args_t, - stan::base_type_t, stan::base_type_t> -foo1_functor__::operator()(const T0__& a, const int& b, - const std::vector& c, const T3__& d, - const T4__& e, const T5__& f, std::ostream* - pstream__) const { - return foo1(a, b, c, d, e, f, pstream__); -} template , stan::is_vt_not_complex, stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> Eigen::Matrix, T1__, T2__>,-1,1> foo2(const T0__& a_arg__, const std::vector>& b, const std::vector>& c, std::ostream* pstream__) { @@ -593,23 +566,11 @@ foo2(const T0__& a_arg__, const std::vector>& b, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar>*> -Eigen::Matrix, T1__, T2__>,-1,1> -foo2_functor__::operator()(const T0__& a, - const std::vector>& b, - const std::vector>& c, - std::ostream* pstream__) const { - return foo2(a, b, c, pstream__); -} template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix, stan::base_type_t>,-1,-1> foo3(const T0__& a_arg__, const T1__& b_arg__, std::ostream* pstream__) { @@ -631,22 +592,11 @@ foo3(const T0__& a_arg__, const T1__& b_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -foo3_functor__::operator()(const T0__& a, const T1__& b, std::ostream* - pstream__) const { - return foo3(a, b, pstream__); -} template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix, stan::base_type_t>,-1,-1> add_udf(const T0__& a_arg__, const T1__& b_arg__, std::ostream* pstream__) { @@ -668,17 +618,6 @@ add_udf(const T0__& a_arg__, const T1__& b_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -add_udf_functor__::operator()(const T0__& a, const T1__& b, std::ostream* - pstream__) const { - return add_udf(a, b, pstream__); -} class simple_function_model final : public model_base_crtp { private: int N; diff --git a/test/integration/good/code-gen/lir.expected b/test/integration/good/code-gen/lir.expected index d8254453d2..42e62026e6 100644 --- a/test/integration/good/code-gen/lir.expected +++ b/test/integration/good/code-gen/lir.expected @@ -1069,1073 +1069,975 @@ (Literal "\" (in 'mother.stan', line 348, column 4 to column 16)\"") (Literal "\" (in 'mother.stan', line 345, column 41 to line 349, column 3)\""))))))) - (Struct - ((param ()) (struct_name foo_functor__) - (body - ((FunDef - ((templates_init ((()) true)) (inline false) (return_type Int) - (name "operator()") - (args - (((Const (Ref Int)) n) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name f1_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - true)) - (inline false) (return_type Int) (name "operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) - a11) - ((Const - (Ref - (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name foo_bar1_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) true)) - (inline false) - (return_type (TypeTrait stan::promote_args_t ((TemplateType T0__)))) - (name "operator()") - (args - (((Const (Ref (TemplateType T0__))) x) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name binomialf_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T0__) (Typename T1__) - (RequireIs stan::is_col_vector T0__) - (RequireIs stan::is_vt_not_complex T0__) - (RequireIs stan::is_col_vector T1__) - (RequireIs stan::is_vt_not_complex T1__))) - true)) - (inline false) - (return_type - (Matrix - (TypeTrait stan::promote_args_t - ((TemplateType stan::base_type_t) - (TemplateType stan::base_type_t))) - -1 1)) - (name "operator()") - (args - (((Const (Ref (TemplateType T0__))) phi) - ((Const (Ref (TemplateType T1__))) theta) - ((Const (Ref (StdVector Double))) x_r) - ((Const (Ref (StdVector Int))) x_i) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name foo_6_functor__) - (body - ((FunDef - ((templates_init ((()) true)) (inline false) (return_type Void) - (name "operator()") - (args (((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name foo_3_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) true)) - (inline false) - (return_type - (StdVector (TypeTrait stan::promote_args_t ((TemplateType T0__))))) - (name "operator()") - (args - (((Const (Ref (TemplateType T0__))) t) ((Const (Ref Int)) n) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name foo_lp_functor__) - (body - ((FunDef - ((templates_init - ((((Bool propto__) (Typename T0__) (Typename T_lp__) - (Typename T_lp_accum__) (RequireIs stan::is_stan_scalar T0__))) - true)) - (inline false) - (return_type (TypeTrait stan::promote_args_t ((TemplateType T0__)))) - (name "operator()") - (args - (((Const (Ref (TemplateType T0__))) x) - ((Ref (TemplateType T_lp__)) lp__) - ((Ref (TemplateType T_lp_accum__)) lp_accum__) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name vecmufoo_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) true)) - (inline false) - (return_type - (Matrix (TypeTrait stan::promote_args_t ((TemplateType T0__))) -1 - 1)) - (name "operator()") - (args - (((Const (Ref (TemplateType T0__))) mu) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name foo_lccdf_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T1__) (RequireIs stan::is_stan_scalar T1__))) true)) - (inline false) - (return_type (TypeTrait stan::promote_args_t ((TemplateType T1__)))) - (name "operator()") - (args - (((Const (Ref Int)) y) ((Const (Ref (TemplateType T1__))) lambda) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name f8_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - true)) - (inline false) - (return_type - (StdVector - (Matrix - (TypeTrait stan::promote_args_t - ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) - (TemplateType stan::base_type_t) (TemplateType T7__) - (TypeTrait stan::promote_args_t - ((TemplateType T8__) (TemplateType stan::base_type_t) - (TemplateType T10__) (TemplateType T11__))))) - -1 1))) - (name "operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) - a11) - ((Const - (Ref - (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name f9_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - true)) - (inline false) - (return_type - (StdVector - (StdVector - (Matrix - (TypeTrait stan::promote_args_t - ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) - (TemplateType stan::base_type_t) (TemplateType T7__) - (TypeTrait stan::promote_args_t - ((TemplateType T8__) (TemplateType stan::base_type_t) - (TemplateType T10__) (TemplateType T11__))))) - -1 1)))) - (name "operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) - a11) - ((Const - (Ref - (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name f2_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - true)) - (inline false) (return_type (StdVector Int)) (name "operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) - a11) - ((Const - (Ref - (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name f10_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - true)) - (inline false) - (return_type - (Matrix - (TypeTrait stan::promote_args_t - ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) - (TemplateType stan::base_type_t) (TemplateType T7__) - (TypeTrait stan::promote_args_t - ((TemplateType T8__) (TemplateType stan::base_type_t) - (TemplateType T10__) (TemplateType T11__))))) - -1 -1)) - (name "operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) - a11) - ((Const - (Ref - (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name f4_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - true)) - (inline false) - (return_type - (TypeTrait stan::promote_args_t - ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) - (TemplateType stan::base_type_t) (TemplateType T7__) - (TypeTrait stan::promote_args_t - ((TemplateType T8__) (TemplateType stan::base_type_t) - (TemplateType T10__) (TemplateType T11__)))))) - (name "operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) - a11) - ((Const - (Ref - (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name foo_5_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T0__) (Typename T1__) - (RequireIs stan::is_col_vector T0__) - (RequireIs stan::is_vt_not_complex T0__) - (RequireIs stan::is_col_vector T1__) - (RequireIs stan::is_vt_not_complex T1__))) - true)) - (inline false) - (return_type - (Matrix - (TypeTrait stan::promote_args_t - ((TemplateType stan::base_type_t) - (TemplateType stan::base_type_t))) - -1 1)) - (name "operator()") - (args - (((Const (Ref (TemplateType T0__))) shared_params) - ((Const (Ref (TemplateType T1__))) job_params) - ((Const (Ref (StdVector Double))) data_r) - ((Const (Ref (StdVector Int))) data_i) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name foo_lpmf_functor__) - (body - ((FunDef - ((templates_init - ((((Bool propto__) (Typename T1__) - (RequireIs stan::is_stan_scalar T1__))) - true)) - (inline false) - (return_type (TypeTrait stan::promote_args_t ((TemplateType T1__)))) - (name "operator()") - (args - (((Const (Ref Int)) y) ((Const (Ref (TemplateType T1__))) lambda) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name f0_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - true)) - (inline false) (return_type Void) (name "operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) - a11) - ((Const - (Ref - (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name vecmubar_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) true)) - (inline false) - (return_type - (Matrix (TypeTrait stan::promote_args_t ((TemplateType T0__))) -1 - 1)) - (name "operator()") - (args - (((Const (Ref (TemplateType T0__))) mu) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name relative_diff_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T0__) (Typename T1__) (Typename T2__) (Typename T3__) - (RequireIs stan::is_stan_scalar T0__) - (RequireIs stan::is_stan_scalar T1__) - (RequireIs stan::is_stan_scalar T2__) - (RequireIs stan::is_stan_scalar T3__))) - true)) - (inline false) - (return_type + (FunDef + ((templates_init ((()) true)) (inline false) (return_type Int) (name foo) + (args + (((Const (Ref Int)) n) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T0__) (Typename T1__) (Typename T2__) + (RequireIs stan::is_stan_scalar T0__) + (RequireIs stan::is_stan_scalar T1__) + (RequireIs stan::is_stan_scalar T2__))) + true)) + (inline false) + (return_type + (StdVector + (TypeTrait stan::promote_args_t + ((TemplateType T0__) (TemplateType T1__) (TemplateType T2__))))) + (name sho) + (args + (((Const (Ref (TemplateType T0__))) t) + ((Const (Ref (StdVector (TemplateType T1__)))) y) + ((Const (Ref (StdVector (TemplateType T2__)))) theta) + ((Const (Ref (StdVector Double))) x) + ((Const (Ref (StdVector Int))) x_int) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init ((()) true)) (inline false) (return_type Double) + (name foo_bar0) + (args (((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) true)) + (inline false) + (return_type (TypeTrait stan::promote_args_t ((TemplateType T0__)))) + (name foo_bar1) + (args + (((Const (Ref (TemplateType T0__))) x) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T0__) (Typename T1__) + (RequireIs stan::is_stan_scalar T0__) + (RequireIs stan::is_stan_scalar T1__))) + true)) + (inline false) + (return_type + (TypeTrait stan::promote_args_t + ((TemplateType T0__) (TemplateType T1__)))) + (name foo_bar2) + (args + (((Const (Ref (TemplateType T0__))) x) + ((Const (Ref (TemplateType T1__))) y) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Bool propto__) (Typename T1__) + (RequireIs stan::is_stan_scalar T1__))) + true)) + (inline false) + (return_type (TypeTrait stan::promote_args_t ((TemplateType T1__)))) + (name foo_lpmf) + (args + (((Const (Ref Int)) y) ((Const (Ref (TemplateType T1__))) lambda) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T1__) (RequireIs stan::is_stan_scalar T1__))) true)) + (inline false) + (return_type (TypeTrait stan::promote_args_t ((TemplateType T1__)))) + (name foo_lcdf) + (args + (((Const (Ref Int)) y) ((Const (Ref (TemplateType T1__))) lambda) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T1__) (RequireIs stan::is_stan_scalar T1__))) true)) + (inline false) + (return_type (TypeTrait stan::promote_args_t ((TemplateType T1__)))) + (name foo_lccdf) + (args + (((Const (Ref Int)) y) ((Const (Ref (TemplateType T1__))) lambda) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T0__) (Typename T1__) (Typename RNG) + (RequireIs stan::is_stan_scalar T0__) + (RequireIs stan::is_stan_scalar T1__))) + true)) + (inline false) + (return_type + (TypeTrait stan::promote_args_t + ((TemplateType T0__) (TemplateType T1__)))) + (name foo_rng) + (args + (((Const (Ref (TemplateType T0__))) mu) + ((Const (Ref (TemplateType T1__))) sigma) + ((Ref (TemplateType RNG)) base_rng__) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Bool propto__) (Typename T0__) (Typename T_lp__) + (Typename T_lp_accum__) (RequireIs stan::is_stan_scalar T0__))) + true)) + (inline false) (return_type Void) (name unit_normal_lp) + (args + (((Const (Ref (TemplateType T0__))) u) + ((Ref (TemplateType T_lp__)) lp__) + ((Ref (TemplateType T_lp_accum__)) lp_accum__) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init ((()) true)) (inline false) (return_type Int) + (name foo_1) + (args + (((Const (Ref Int)) a) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init ((()) true)) (inline false) (return_type Int) + (name foo_2) + (args + (((Const (Ref Int)) a) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) true)) + (inline false) + (return_type + (StdVector (TypeTrait stan::promote_args_t ((TemplateType T0__))))) + (name foo_3) + (args + (((Const (Ref (TemplateType T0__))) t) ((Const (Ref Int)) n) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Bool propto__) (Typename T0__) (Typename T_lp__) + (Typename T_lp_accum__) (RequireIs stan::is_stan_scalar T0__))) + true)) + (inline false) + (return_type (TypeTrait stan::promote_args_t ((TemplateType T0__)))) + (name foo_lp) + (args + (((Const (Ref (TemplateType T0__))) x) + ((Ref (TemplateType T_lp__)) lp__) + ((Ref (TemplateType T_lp_accum__)) lp_accum__) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) true)) + (inline false) (return_type Void) (name foo_4) + (args + (((Const (Ref (StdVector (TemplateType T0__)))) x) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T0__) (Typename T1__) (Typename T2__) (Typename T3__) + (RequireIs stan::is_stan_scalar T0__) + (RequireIs stan::is_stan_scalar T1__) + (RequireIs stan::is_stan_scalar T2__) + (RequireIs stan::is_stan_scalar T3__))) + true)) + (inline false) + (return_type + (TypeTrait stan::promote_args_t + ((TemplateType T0__) (TemplateType T1__) (TemplateType T2__) + (TemplateType T3__)))) + (name relative_diff) + (args + (((Const (Ref (TemplateType T0__))) x) + ((Const (Ref (TemplateType T1__))) y) + ((Const (Ref (TemplateType T2__))) max_) + ((Const (Ref (TemplateType T3__))) min_) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T0__) (Typename T1__) (RequireIs stan::is_col_vector T0__) + (RequireIs stan::is_vt_not_complex T0__) + (RequireIs stan::is_col_vector T1__) + (RequireIs stan::is_vt_not_complex T1__))) + true)) + (inline false) + (return_type + (Matrix + (TypeTrait stan::promote_args_t + ((TemplateType stan::base_type_t) + (TemplateType stan::base_type_t))) + -1 1)) + (name foo_5) + (args + (((Const (Ref (TemplateType T0__))) shared_params_arg__) + ((Const (Ref (TemplateType T1__))) job_params_arg__) + ((Const (Ref (StdVector Double))) data_r) + ((Const (Ref (StdVector Int))) data_i) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T0__) (Typename T1__) (Typename T2__) (Typename T3__) + (Typename T4__) (RequireIs stan::is_stan_scalar T0__) + (RequireIs stan::is_stan_scalar T1__) + (RequireIs stan::is_stan_scalar T2__) + (RequireIs stan::is_stan_scalar T3__) + (RequireIs stan::is_stan_scalar T4__))) + true)) + (inline false) + (return_type + (TypeTrait stan::promote_args_t + ((TemplateType T0__) (TemplateType T1__) (TemplateType T2__) + (TemplateType T3__) (TemplateType T4__)))) + (name foo_five_args) + (args + (((Const (Ref (TemplateType T0__))) x1) + ((Const (Ref (TemplateType T1__))) x2) + ((Const (Ref (TemplateType T2__))) x3) + ((Const (Ref (TemplateType T3__))) x4) + ((Const (Ref (TemplateType T4__))) x5) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Bool propto__) (Typename T0__) (Typename T1__) (Typename T2__) + (Typename T3__) (Typename T4__) (Typename T5__) (Typename T_lp__) + (Typename T_lp_accum__) (RequireIs stan::is_stan_scalar T0__) + (RequireIs stan::is_stan_scalar T1__) + (RequireIs stan::is_stan_scalar T2__) + (RequireIs stan::is_stan_scalar T3__) + (RequireIs stan::is_stan_scalar T4__) + (RequireIs stan::is_stan_scalar T5__))) + true)) + (inline false) + (return_type + (TypeTrait stan::promote_args_t + ((TemplateType T0__) (TemplateType T1__) (TemplateType T2__) + (TemplateType T3__) (TemplateType T4__) + (TypeTrait stan::promote_args_t ((TemplateType T5__)))))) + (name foo_five_args_lp) + (args + (((Const (Ref (TemplateType T0__))) x1) + ((Const (Ref (TemplateType T1__))) x2) + ((Const (Ref (TemplateType T2__))) x3) + ((Const (Ref (TemplateType T3__))) x4) + ((Const (Ref (TemplateType T4__))) x5) + ((Const (Ref (TemplateType T5__))) x6) + ((Ref (TemplateType T_lp__)) lp__) + ((Ref (TemplateType T_lp_accum__)) lp_accum__) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T0__) (RequireIs stan::is_eigen_matrix_dynamic T0__) + (RequireIs stan::is_vt_not_complex T0__))) + true)) + (inline false) + (return_type + (Matrix + (TypeTrait stan::promote_args_t + ((TemplateType stan::base_type_t))) + -1 -1)) + (name covsqrt2corsqrt) + (args + (((Const (Ref (TemplateType T0__))) mat_arg__) + ((Const (Ref Int)) invert) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) + (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) + (Typename T11__) (RequireIs stan::is_stan_scalar T3__) + (RequireIs stan::is_stan_scalar T4__) + (RequireIs stan::is_stan_scalar T5__) + (RequireIs stan::is_col_vector T6__) + (RequireIs stan::is_vt_not_complex T6__) + (RequireIs stan::is_stan_scalar T7__) + (RequireIs stan::is_stan_scalar T8__) + (RequireIs stan::is_eigen_matrix_dynamic T9__) + (RequireIs stan::is_vt_not_complex T9__) + (RequireIs stan::is_stan_scalar T10__) + (RequireIs stan::is_stan_scalar T11__))) + true)) + (inline false) (return_type Void) (name f0) + (args + (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) + ((Const (Ref (StdVector (StdVector Int)))) a3) + ((Const (Ref (TemplateType T3__))) a4) + ((Const (Ref (StdVector (TemplateType T4__)))) a5) + ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) + ((Const (Ref (TemplateType T6__))) a7_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) + a9) + ((Const (Ref (TemplateType T9__))) a10_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) + a12) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) + (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) + (Typename T11__) (RequireIs stan::is_stan_scalar T3__) + (RequireIs stan::is_stan_scalar T4__) + (RequireIs stan::is_stan_scalar T5__) + (RequireIs stan::is_col_vector T6__) + (RequireIs stan::is_vt_not_complex T6__) + (RequireIs stan::is_stan_scalar T7__) + (RequireIs stan::is_stan_scalar T8__) + (RequireIs stan::is_eigen_matrix_dynamic T9__) + (RequireIs stan::is_vt_not_complex T9__) + (RequireIs stan::is_stan_scalar T10__) + (RequireIs stan::is_stan_scalar T11__))) + true)) + (inline false) (return_type Int) (name f1) + (args + (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) + ((Const (Ref (StdVector (StdVector Int)))) a3) + ((Const (Ref (TemplateType T3__))) a4) + ((Const (Ref (StdVector (TemplateType T4__)))) a5) + ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) + ((Const (Ref (TemplateType T6__))) a7_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) + a9) + ((Const (Ref (TemplateType T9__))) a10_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) + a12) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) + (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) + (Typename T11__) (RequireIs stan::is_stan_scalar T3__) + (RequireIs stan::is_stan_scalar T4__) + (RequireIs stan::is_stan_scalar T5__) + (RequireIs stan::is_col_vector T6__) + (RequireIs stan::is_vt_not_complex T6__) + (RequireIs stan::is_stan_scalar T7__) + (RequireIs stan::is_stan_scalar T8__) + (RequireIs stan::is_eigen_matrix_dynamic T9__) + (RequireIs stan::is_vt_not_complex T9__) + (RequireIs stan::is_stan_scalar T10__) + (RequireIs stan::is_stan_scalar T11__))) + true)) + (inline false) (return_type (StdVector Int)) (name f2) + (args + (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) + ((Const (Ref (StdVector (StdVector Int)))) a3) + ((Const (Ref (TemplateType T3__))) a4) + ((Const (Ref (StdVector (TemplateType T4__)))) a5) + ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) + ((Const (Ref (TemplateType T6__))) a7_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) + a9) + ((Const (Ref (TemplateType T9__))) a10_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) + a12) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) + (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) + (Typename T11__) (RequireIs stan::is_stan_scalar T3__) + (RequireIs stan::is_stan_scalar T4__) + (RequireIs stan::is_stan_scalar T5__) + (RequireIs stan::is_col_vector T6__) + (RequireIs stan::is_vt_not_complex T6__) + (RequireIs stan::is_stan_scalar T7__) + (RequireIs stan::is_stan_scalar T8__) + (RequireIs stan::is_eigen_matrix_dynamic T9__) + (RequireIs stan::is_vt_not_complex T9__) + (RequireIs stan::is_stan_scalar T10__) + (RequireIs stan::is_stan_scalar T11__))) + true)) + (inline false) (return_type (StdVector (StdVector Int))) (name f3) + (args + (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) + ((Const (Ref (StdVector (StdVector Int)))) a3) + ((Const (Ref (TemplateType T3__))) a4) + ((Const (Ref (StdVector (TemplateType T4__)))) a5) + ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) + ((Const (Ref (TemplateType T6__))) a7_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) + a9) + ((Const (Ref (TemplateType T9__))) a10_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) + a12) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) + (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) + (Typename T11__) (RequireIs stan::is_stan_scalar T3__) + (RequireIs stan::is_stan_scalar T4__) + (RequireIs stan::is_stan_scalar T5__) + (RequireIs stan::is_col_vector T6__) + (RequireIs stan::is_vt_not_complex T6__) + (RequireIs stan::is_stan_scalar T7__) + (RequireIs stan::is_stan_scalar T8__) + (RequireIs stan::is_eigen_matrix_dynamic T9__) + (RequireIs stan::is_vt_not_complex T9__) + (RequireIs stan::is_stan_scalar T10__) + (RequireIs stan::is_stan_scalar T11__))) + true)) + (inline false) + (return_type + (TypeTrait stan::promote_args_t + ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) + (TemplateType stan::base_type_t) (TemplateType T7__) + (TypeTrait stan::promote_args_t + ((TemplateType T8__) (TemplateType stan::base_type_t) + (TemplateType T10__) (TemplateType T11__)))))) + (name f4) + (args + (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) + ((Const (Ref (StdVector (StdVector Int)))) a3) + ((Const (Ref (TemplateType T3__))) a4) + ((Const (Ref (StdVector (TemplateType T4__)))) a5) + ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) + ((Const (Ref (TemplateType T6__))) a7_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) + a9) + ((Const (Ref (TemplateType T9__))) a10_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) + a12) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) + (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) + (Typename T11__) (RequireIs stan::is_stan_scalar T3__) + (RequireIs stan::is_stan_scalar T4__) + (RequireIs stan::is_stan_scalar T5__) + (RequireIs stan::is_col_vector T6__) + (RequireIs stan::is_vt_not_complex T6__) + (RequireIs stan::is_stan_scalar T7__) + (RequireIs stan::is_stan_scalar T8__) + (RequireIs stan::is_eigen_matrix_dynamic T9__) + (RequireIs stan::is_vt_not_complex T9__) + (RequireIs stan::is_stan_scalar T10__) + (RequireIs stan::is_stan_scalar T11__))) + true)) + (inline false) + (return_type + (StdVector + (TypeTrait stan::promote_args_t + ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) + (TemplateType stan::base_type_t) (TemplateType T7__) + (TypeTrait stan::promote_args_t + ((TemplateType T8__) (TemplateType stan::base_type_t) + (TemplateType T10__) (TemplateType T11__))))))) + (name f5) + (args + (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) + ((Const (Ref (StdVector (StdVector Int)))) a3) + ((Const (Ref (TemplateType T3__))) a4) + ((Const (Ref (StdVector (TemplateType T4__)))) a5) + ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) + ((Const (Ref (TemplateType T6__))) a7_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) + a9) + ((Const (Ref (TemplateType T9__))) a10_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) + a12) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) + (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) + (Typename T11__) (RequireIs stan::is_stan_scalar T3__) + (RequireIs stan::is_stan_scalar T4__) + (RequireIs stan::is_stan_scalar T5__) + (RequireIs stan::is_col_vector T6__) + (RequireIs stan::is_vt_not_complex T6__) + (RequireIs stan::is_stan_scalar T7__) + (RequireIs stan::is_stan_scalar T8__) + (RequireIs stan::is_eigen_matrix_dynamic T9__) + (RequireIs stan::is_vt_not_complex T9__) + (RequireIs stan::is_stan_scalar T10__) + (RequireIs stan::is_stan_scalar T11__))) + true)) + (inline false) + (return_type + (StdVector + (StdVector + (TypeTrait stan::promote_args_t + ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) + (TemplateType stan::base_type_t) (TemplateType T7__) (TypeTrait stan::promote_args_t - ((TemplateType T0__) (TemplateType T1__) (TemplateType T2__) - (TemplateType T3__)))) - (name "operator()") - (args - (((Const (Ref (TemplateType T0__))) x) - ((Const (Ref (TemplateType T1__))) y) - ((Const (Ref (TemplateType T2__))) max_) - ((Const (Ref (TemplateType T3__))) min_) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name foo_rng_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T0__) (Typename T1__) (Typename RNG) - (RequireIs stan::is_stan_scalar T0__) - (RequireIs stan::is_stan_scalar T1__))) - true)) - (inline false) - (return_type + ((TemplateType T8__) (TemplateType stan::base_type_t) + (TemplateType T10__) (TemplateType T11__)))))))) + (name f6) + (args + (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) + ((Const (Ref (StdVector (StdVector Int)))) a3) + ((Const (Ref (TemplateType T3__))) a4) + ((Const (Ref (StdVector (TemplateType T4__)))) a5) + ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) + ((Const (Ref (TemplateType T6__))) a7_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) + a9) + ((Const (Ref (TemplateType T9__))) a10_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) + a12) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) + (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) + (Typename T11__) (RequireIs stan::is_stan_scalar T3__) + (RequireIs stan::is_stan_scalar T4__) + (RequireIs stan::is_stan_scalar T5__) + (RequireIs stan::is_col_vector T6__) + (RequireIs stan::is_vt_not_complex T6__) + (RequireIs stan::is_stan_scalar T7__) + (RequireIs stan::is_stan_scalar T8__) + (RequireIs stan::is_eigen_matrix_dynamic T9__) + (RequireIs stan::is_vt_not_complex T9__) + (RequireIs stan::is_stan_scalar T10__) + (RequireIs stan::is_stan_scalar T11__))) + true)) + (inline false) + (return_type + (Matrix + (TypeTrait stan::promote_args_t + ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) + (TemplateType stan::base_type_t) (TemplateType T7__) + (TypeTrait stan::promote_args_t + ((TemplateType T8__) (TemplateType stan::base_type_t) + (TemplateType T10__) (TemplateType T11__))))) + -1 1)) + (name f7) + (args + (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) + ((Const (Ref (StdVector (StdVector Int)))) a3) + ((Const (Ref (TemplateType T3__))) a4) + ((Const (Ref (StdVector (TemplateType T4__)))) a5) + ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) + ((Const (Ref (TemplateType T6__))) a7_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) + a9) + ((Const (Ref (TemplateType T9__))) a10_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) + a12) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) + (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) + (Typename T11__) (RequireIs stan::is_stan_scalar T3__) + (RequireIs stan::is_stan_scalar T4__) + (RequireIs stan::is_stan_scalar T5__) + (RequireIs stan::is_col_vector T6__) + (RequireIs stan::is_vt_not_complex T6__) + (RequireIs stan::is_stan_scalar T7__) + (RequireIs stan::is_stan_scalar T8__) + (RequireIs stan::is_eigen_matrix_dynamic T9__) + (RequireIs stan::is_vt_not_complex T9__) + (RequireIs stan::is_stan_scalar T10__) + (RequireIs stan::is_stan_scalar T11__))) + true)) + (inline false) + (return_type + (StdVector + (Matrix + (TypeTrait stan::promote_args_t + ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) + (TemplateType stan::base_type_t) (TemplateType T7__) (TypeTrait stan::promote_args_t - ((TemplateType T0__) (TemplateType T1__)))) - (name "operator()") - (args - (((Const (Ref (TemplateType T0__))) mu) - ((Const (Ref (TemplateType T1__))) sigma) - ((Ref (TemplateType RNG)) base_rng__) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name algebra_system_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T0__) (Typename T1__) (Typename T2__) - (RequireIs stan::is_col_vector T0__) - (RequireIs stan::is_vt_not_complex T0__) - (RequireIs stan::is_col_vector T1__) - (RequireIs stan::is_vt_not_complex T1__) - (RequireIs stan::is_stan_scalar T2__))) - true)) - (inline false) - (return_type - (Matrix + ((TemplateType T8__) (TemplateType stan::base_type_t) + (TemplateType T10__) (TemplateType T11__))))) + -1 1))) + (name f8) + (args + (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) + ((Const (Ref (StdVector (StdVector Int)))) a3) + ((Const (Ref (TemplateType T3__))) a4) + ((Const (Ref (StdVector (TemplateType T4__)))) a5) + ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) + ((Const (Ref (TemplateType T6__))) a7_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) + a9) + ((Const (Ref (TemplateType T9__))) a10_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) + a12) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) + (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) + (Typename T11__) (RequireIs stan::is_stan_scalar T3__) + (RequireIs stan::is_stan_scalar T4__) + (RequireIs stan::is_stan_scalar T5__) + (RequireIs stan::is_col_vector T6__) + (RequireIs stan::is_vt_not_complex T6__) + (RequireIs stan::is_stan_scalar T7__) + (RequireIs stan::is_stan_scalar T8__) + (RequireIs stan::is_eigen_matrix_dynamic T9__) + (RequireIs stan::is_vt_not_complex T9__) + (RequireIs stan::is_stan_scalar T10__) + (RequireIs stan::is_stan_scalar T11__))) + true)) + (inline false) + (return_type + (StdVector + (StdVector + (Matrix + (TypeTrait stan::promote_args_t + ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) + (TemplateType stan::base_type_t) (TemplateType T7__) (TypeTrait stan::promote_args_t - ((TemplateType stan::base_type_t) - (TemplateType stan::base_type_t) (TemplateType T2__))) - -1 1)) - (name "operator()") - (args - (((Const (Ref (TemplateType T0__))) x) - ((Const (Ref (TemplateType T1__))) y) - ((Const (Ref (StdVector (TemplateType T2__)))) dat) - ((Const (Ref (StdVector Int))) dat_int) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name matfoo_functor__) - (body - ((FunDef - ((templates_init ((()) true)) (inline false) - (return_type (Matrix Double -1 -1)) (name "operator()") - (args (((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name foo_bar2_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T0__) (Typename T1__) - (RequireIs stan::is_stan_scalar T0__) - (RequireIs stan::is_stan_scalar T1__))) - true)) - (inline false) - (return_type + ((TemplateType T8__) (TemplateType stan::base_type_t) + (TemplateType T10__) (TemplateType T11__))))) + -1 1)))) + (name f9) + (args + (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) + ((Const (Ref (StdVector (StdVector Int)))) a3) + ((Const (Ref (TemplateType T3__))) a4) + ((Const (Ref (StdVector (TemplateType T4__)))) a5) + ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) + ((Const (Ref (TemplateType T6__))) a7_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) + a9) + ((Const (Ref (TemplateType T9__))) a10_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) + a12) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) + (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) + (Typename T11__) (RequireIs stan::is_stan_scalar T3__) + (RequireIs stan::is_stan_scalar T4__) + (RequireIs stan::is_stan_scalar T5__) + (RequireIs stan::is_col_vector T6__) + (RequireIs stan::is_vt_not_complex T6__) + (RequireIs stan::is_stan_scalar T7__) + (RequireIs stan::is_stan_scalar T8__) + (RequireIs stan::is_eigen_matrix_dynamic T9__) + (RequireIs stan::is_vt_not_complex T9__) + (RequireIs stan::is_stan_scalar T10__) + (RequireIs stan::is_stan_scalar T11__))) + true)) + (inline false) + (return_type + (Matrix + (TypeTrait stan::promote_args_t + ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) + (TemplateType stan::base_type_t) (TemplateType T7__) + (TypeTrait stan::promote_args_t + ((TemplateType T8__) (TemplateType stan::base_type_t) + (TemplateType T10__) (TemplateType T11__))))) + -1 -1)) + (name f10) + (args + (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) + ((Const (Ref (StdVector (StdVector Int)))) a3) + ((Const (Ref (TemplateType T3__))) a4) + ((Const (Ref (StdVector (TemplateType T4__)))) a5) + ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) + ((Const (Ref (TemplateType T6__))) a7_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) + a9) + ((Const (Ref (TemplateType T9__))) a10_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) + a12) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) + (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) + (Typename T11__) (RequireIs stan::is_stan_scalar T3__) + (RequireIs stan::is_stan_scalar T4__) + (RequireIs stan::is_stan_scalar T5__) + (RequireIs stan::is_col_vector T6__) + (RequireIs stan::is_vt_not_complex T6__) + (RequireIs stan::is_stan_scalar T7__) + (RequireIs stan::is_stan_scalar T8__) + (RequireIs stan::is_eigen_matrix_dynamic T9__) + (RequireIs stan::is_vt_not_complex T9__) + (RequireIs stan::is_stan_scalar T10__) + (RequireIs stan::is_stan_scalar T11__))) + true)) + (inline false) + (return_type + (StdVector + (Matrix + (TypeTrait stan::promote_args_t + ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) + (TemplateType stan::base_type_t) (TemplateType T7__) (TypeTrait stan::promote_args_t - ((TemplateType T0__) (TemplateType T1__)))) - (name "operator()") - (args - (((Const (Ref (TemplateType T0__))) x) - ((Const (Ref (TemplateType T1__))) y) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) + ((TemplateType T8__) (TemplateType stan::base_type_t) + (TemplateType T10__) (TemplateType T11__))))) + -1 -1))) + (name f11) + (args + (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) + ((Const (Ref (StdVector (StdVector Int)))) a3) + ((Const (Ref (TemplateType T3__))) a4) + ((Const (Ref (StdVector (TemplateType T4__)))) a5) + ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) + ((Const (Ref (TemplateType T6__))) a7_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) + a9) + ((Const (Ref (TemplateType T9__))) a10_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) + a12) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) + (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) + (Typename T11__) (RequireIs stan::is_stan_scalar T3__) + (RequireIs stan::is_stan_scalar T4__) + (RequireIs stan::is_stan_scalar T5__) + (RequireIs stan::is_col_vector T6__) + (RequireIs stan::is_vt_not_complex T6__) + (RequireIs stan::is_stan_scalar T7__) + (RequireIs stan::is_stan_scalar T8__) + (RequireIs stan::is_eigen_matrix_dynamic T9__) + (RequireIs stan::is_vt_not_complex T9__) + (RequireIs stan::is_stan_scalar T10__) + (RequireIs stan::is_stan_scalar T11__))) + true)) + (inline false) + (return_type + (StdVector + (StdVector + (Matrix + (TypeTrait stan::promote_args_t + ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) + (TemplateType stan::base_type_t) (TemplateType T7__) + (TypeTrait stan::promote_args_t + ((TemplateType T8__) (TemplateType stan::base_type_t) + (TemplateType T10__) (TemplateType T11__))))) + -1 -1)))) + (name f12) + (args + (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) + ((Const (Ref (StdVector (StdVector Int)))) a3) + ((Const (Ref (TemplateType T3__))) a4) + ((Const (Ref (StdVector (TemplateType T4__)))) a5) + ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) + ((Const (Ref (TemplateType T6__))) a7_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) + a9) + ((Const (Ref (TemplateType T9__))) a10_arg__) + ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) + ((Const + (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) + a12) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init ((()) true)) (inline false) (return_type Void) + (name foo_6) (args (((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init ((()) true)) (inline false) + (return_type (Matrix Double -1 -1)) (name matfoo) + (args (((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init ((()) true)) (inline false) + (return_type (Matrix Double -1 1)) (name vecfoo) + (args (((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) true)) + (inline false) + (return_type + (Matrix (TypeTrait stan::promote_args_t ((TemplateType T0__))) -1 1)) + (name vecmufoo) + (args + (((Const (Ref (TemplateType T0__))) mu) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) true)) + (inline false) + (return_type + (Matrix (TypeTrait stan::promote_args_t ((TemplateType T0__))) -1 1)) + (name vecmubar) + (args + (((Const (Ref (TemplateType T0__))) mu) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T0__) (Typename T1__) (Typename T2__) + (RequireIs stan::is_col_vector T0__) + (RequireIs stan::is_vt_not_complex T0__) + (RequireIs stan::is_col_vector T1__) + (RequireIs stan::is_vt_not_complex T1__) + (RequireIs stan::is_stan_scalar T2__))) + true)) + (inline false) + (return_type + (Matrix + (TypeTrait stan::promote_args_t + ((TemplateType stan::base_type_t) + (TemplateType stan::base_type_t) (TemplateType T2__))) + -1 1)) + (name algebra_system) + (args + (((Const (Ref (TemplateType T0__))) x_arg__) + ((Const (Ref (TemplateType T1__))) y_arg__) + ((Const (Ref (StdVector (TemplateType T2__)))) dat) + ((Const (Ref (StdVector Int))) dat_int) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) (Struct - ((param ()) (struct_name sho_functor__) + ((param ()) (struct_name algebra_system_functor__) (body ((FunDef ((templates_init ((((Typename T0__) (Typename T1__) (Typename T2__) - (RequireIs stan::is_stan_scalar T0__) - (RequireIs stan::is_stan_scalar T1__) + (RequireIs stan::is_col_vector T0__) + (RequireIs stan::is_vt_not_complex T0__) + (RequireIs stan::is_col_vector T1__) + (RequireIs stan::is_vt_not_complex T1__) (RequireIs stan::is_stan_scalar T2__))) true)) (inline false) - (return_type - (StdVector - (TypeTrait stan::promote_args_t - ((TemplateType T0__) (TemplateType T1__) (TemplateType T2__))))) - (name "operator()") - (args - (((Const (Ref (TemplateType T0__))) t) - ((Const (Ref (StdVector (TemplateType T1__)))) y) - ((Const (Ref (StdVector (TemplateType T2__)))) theta) - ((Const (Ref (StdVector Double))) x) - ((Const (Ref (StdVector Int))) x_int) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name f12_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - true)) - (inline false) - (return_type - (StdVector - (StdVector - (Matrix - (TypeTrait stan::promote_args_t - ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) - (TemplateType stan::base_type_t) (TemplateType T7__) - (TypeTrait stan::promote_args_t - ((TemplateType T8__) (TemplateType stan::base_type_t) - (TemplateType T10__) (TemplateType T11__))))) - -1 -1)))) - (name "operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) - a11) - ((Const - (Ref - (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name f11_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - true)) - (inline false) - (return_type - (StdVector - (Matrix - (TypeTrait stan::promote_args_t - ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) - (TemplateType stan::base_type_t) (TemplateType T7__) - (TypeTrait stan::promote_args_t - ((TemplateType T8__) (TemplateType stan::base_type_t) - (TemplateType T10__) (TemplateType T11__))))) - -1 -1))) - (name "operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) - a11) - ((Const - (Ref - (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name f7_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - true)) - (inline false) (return_type (Matrix (TypeTrait stan::promote_args_t - ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) - (TemplateType stan::base_type_t) (TemplateType T7__) - (TypeTrait stan::promote_args_t - ((TemplateType T8__) (TemplateType stan::base_type_t) - (TemplateType T10__) (TemplateType T11__))))) + ((TemplateType stan::base_type_t) + (TemplateType stan::base_type_t) (TemplateType T2__))) -1 1)) (name "operator()") (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) - a11) - ((Const - (Ref - (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name foo_4_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) true)) - (inline false) (return_type Void) (name "operator()") - (args - (((Const (Ref (StdVector (TemplateType T0__)))) x) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name f3_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - true)) - (inline false) (return_type (StdVector (StdVector Int))) - (name "operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) - a11) - ((Const - (Ref - (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name foo_2_functor__) - (body - ((FunDef - ((templates_init ((()) true)) (inline false) (return_type Int) - (name "operator()") - (args - (((Const (Ref Int)) a) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name foo_five_args_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T0__) (Typename T1__) (Typename T2__) (Typename T3__) - (Typename T4__) (RequireIs stan::is_stan_scalar T0__) - (RequireIs stan::is_stan_scalar T1__) - (RequireIs stan::is_stan_scalar T2__) - (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__))) - true)) - (inline false) - (return_type - (TypeTrait stan::promote_args_t - ((TemplateType T0__) (TemplateType T1__) (TemplateType T2__) - (TemplateType T3__) (TemplateType T4__)))) - (name "operator()") - (args - (((Const (Ref (TemplateType T0__))) x1) - ((Const (Ref (TemplateType T1__))) x2) - ((Const (Ref (TemplateType T2__))) x3) - ((Const (Ref (TemplateType T3__))) x4) - ((Const (Ref (TemplateType T4__))) x5) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name f6_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - true)) - (inline false) - (return_type - (StdVector - (StdVector - (TypeTrait stan::promote_args_t - ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) - (TemplateType stan::base_type_t) (TemplateType T7__) - (TypeTrait stan::promote_args_t - ((TemplateType T8__) (TemplateType stan::base_type_t) - (TemplateType T10__) (TemplateType T11__)))))))) - (name "operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) - a11) - ((Const - (Ref - (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name vecfoo_functor__) - (body - ((FunDef - ((templates_init ((()) true)) (inline false) - (return_type (Matrix Double -1 1)) (name "operator()") - (args (((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name foo_bar0_functor__) - (body - ((FunDef - ((templates_init ((()) true)) (inline false) (return_type Double) - (name "operator()") - (args (((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name unit_normal_lp_functor__) - (body - ((FunDef - ((templates_init - ((((Bool propto__) (Typename T0__) (Typename T_lp__) - (Typename T_lp_accum__) (RequireIs stan::is_stan_scalar T0__))) - true)) - (inline false) (return_type Void) (name "operator()") - (args - (((Const (Ref (TemplateType T0__))) u) - ((Ref (TemplateType T_lp__)) lp__) - ((Ref (TemplateType T_lp_accum__)) lp_accum__) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name foo_1_functor__) - (body - ((FunDef - ((templates_init ((()) true)) (inline false) (return_type Int) - (name "operator()") - (args - (((Const (Ref Int)) a) + (((Const (Ref (TemplateType T0__))) x) + ((Const (Ref (TemplateType T1__))) y) + ((Const (Ref (StdVector (TemplateType T2__)))) dat) + ((Const (Ref (StdVector Int))) dat_int) ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) + (cv_qualifiers (Const)) + (body + (((Return + ((FunCall algebra_system () + ((Var x) (Var y) (Var dat) (Var dat_int) (Var pstream__)))))))))))))) + (FunDef + ((templates_init + ((((Typename T0__) (Typename T1__) (RequireIs stan::is_col_vector T0__) + (RequireIs stan::is_vt_not_complex T0__) + (RequireIs stan::is_col_vector T1__) + (RequireIs stan::is_vt_not_complex T1__))) + true)) + (inline false) + (return_type + (Matrix + (TypeTrait stan::promote_args_t + ((TemplateType stan::base_type_t) + (TemplateType stan::base_type_t))) + -1 1)) + (name binomialf) + (args + (((Const (Ref (TemplateType T0__))) phi_arg__) + ((Const (Ref (TemplateType T1__))) theta_arg__) + ((Const (Ref (StdVector Double))) x_r) + ((Const (Ref (StdVector Int))) x_i) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) (Struct - ((param ()) (struct_name covsqrt2corsqrt_functor__) + ((param ()) (struct_name binomialf_functor__) (body ((FunDef ((templates_init - ((((Typename T0__) (RequireIs stan::is_eigen_matrix_dynamic T0__) - (RequireIs stan::is_vt_not_complex T0__))) + ((((Typename T0__) (Typename T1__) + (RequireIs stan::is_col_vector T0__) + (RequireIs stan::is_vt_not_complex T0__) + (RequireIs stan::is_col_vector T1__) + (RequireIs stan::is_vt_not_complex T1__))) true)) (inline false) (return_type (Matrix (TypeTrait stan::promote_args_t - ((TemplateType stan::base_type_t))) - -1 -1)) - (name "operator()") - (args - (((Const (Ref (TemplateType T0__))) mat) ((Const (Ref Int)) invert) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name foo_lcdf_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T1__) (RequireIs stan::is_stan_scalar T1__))) true)) - (inline false) - (return_type (TypeTrait stan::promote_args_t ((TemplateType T1__)))) - (name "operator()") - (args - (((Const (Ref Int)) y) ((Const (Ref (TemplateType T1__))) lambda) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name f5_functor__) - (body - ((FunDef - ((templates_init - ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - true)) - (inline false) - (return_type - (StdVector - (TypeTrait stan::promote_args_t - ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) - (TemplateType stan::base_type_t) (TemplateType T7__) - (TypeTrait stan::promote_args_t - ((TemplateType T8__) (TemplateType stan::base_type_t) - (TemplateType T10__) (TemplateType T11__))))))) - (name "operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) - a11) - ((Const - (Ref - (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (Struct - ((param ()) (struct_name foo_five_args_lp_functor__) - (body - ((FunDef - ((templates_init - ((((Bool propto__) (Typename T0__) (Typename T1__) (Typename T2__) - (Typename T3__) (Typename T4__) (Typename T5__) - (Typename T_lp__) (Typename T_lp_accum__) - (RequireIs stan::is_stan_scalar T0__) - (RequireIs stan::is_stan_scalar T1__) - (RequireIs stan::is_stan_scalar T2__) - (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__))) - true)) - (inline false) - (return_type - (TypeTrait stan::promote_args_t - ((TemplateType T0__) (TemplateType T1__) (TemplateType T2__) - (TemplateType T3__) (TemplateType T4__) - (TypeTrait stan::promote_args_t ((TemplateType T5__)))))) + ((TemplateType stan::base_type_t) + (TemplateType stan::base_type_t))) + -1 1)) (name "operator()") (args - (((Const (Ref (TemplateType T0__))) x1) - ((Const (Ref (TemplateType T1__))) x2) - ((Const (Ref (TemplateType T2__))) x3) - ((Const (Ref (TemplateType T3__))) x4) - ((Const (Ref (TemplateType T4__))) x5) - ((Const (Ref (TemplateType T5__))) x6) - ((Ref (TemplateType T_lp__)) lp__) - ((Ref (TemplateType T_lp_accum__)) lp_accum__) + (((Const (Ref (TemplateType T0__))) phi) + ((Const (Ref (TemplateType T1__))) theta) + ((Const (Ref (StdVector Double))) x_r) + ((Const (Ref (StdVector Int))) x_i) ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) (body ()))))))) - (FunDef - ((templates_init ((()) true)) (inline false) (return_type Int) (name foo) - (args - (((Const (Ref Int)) n) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers ()) (body ()))) + (cv_qualifiers (Const)) + (body + (((Return + ((FunCall binomialf () + ((Var phi) (Var theta) (Var x_r) (Var x_i) (Var pstream__)))))))))))))) (FunDef ((templates_init ((()) false)) (inline false) (return_type Int) (name foo) @@ -2180,35 +2082,6 @@ (FunCall stan::lang::rethrow_located () ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init ((() ()) false)) (inline false) (return_type Int) - (name "foo_functor__::operator()") - (args - (((Const (Ref Int)) n) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body (((Return ((FunCall foo () ((Var n) (Var pstream__)))))))))) - (FunDef - ((templates_init - ((((Typename T0__) (Typename T1__) (Typename T2__) - (RequireIs stan::is_stan_scalar T0__) - (RequireIs stan::is_stan_scalar T1__) - (RequireIs stan::is_stan_scalar T2__))) - true)) - (inline false) - (return_type - (StdVector - (TypeTrait stan::promote_args_t - ((TemplateType T0__) (TemplateType T1__) (TemplateType T2__))))) - (name sho) - (args - (((Const (Ref (TemplateType T0__))) t) - ((Const (Ref (StdVector (TemplateType T1__)))) y) - ((Const (Ref (StdVector (TemplateType T2__)))) theta) - ((Const (Ref (StdVector Double))) x) - ((Const (Ref (StdVector Int))) x_int) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers ()) (body ()))) (FunDef ((templates_init ((((Typename T0__) (Typename T1__) (Typename T2__) @@ -2279,51 +2152,25 @@ (FunCall stan::model::index_uni () ((Literal 1)))))) Subtract (Parens - (BinOp - (FunCall stan::model::rvalue () - ((Var theta) (Literal "\"theta\"") - (FunCall stan::model::index_uni () ((Literal 1))))) - Multiply - (FunCall stan::model::rvalue () - ((Var y) (Literal "\"y\"") - (FunCall stan::model::index_uni () ((Literal 2))))))))) - (Literal "\"assigning variable dydt\"") - (FunCall stan::model::index_uni () ((Literal 2)))))) - (Expression (Assign (Var current_statement__) (Literal 600))) - (Return ((Var dydt)))) - ((Const (Ref (TypeLiteral std::exception))) e) - ((Expression - (FunCall stan::lang::rethrow_located () - ((Var e) - (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init - ((() - ((Typename T0__) (Typename T1__) (Typename T2__) - (RequireIs stan::is_stan_scalar T0__) - (RequireIs stan::is_stan_scalar T1__) - (RequireIs stan::is_stan_scalar T2__))) - false)) - (inline false) - (return_type - (StdVector - (TypeTrait stan::promote_args_t - ((TemplateType T0__) (TemplateType T1__) (TemplateType T2__))))) - (name "sho_functor__::operator()") - (args - (((Const (Ref (TemplateType T0__))) t) - ((Const (Ref (StdVector (TemplateType T1__)))) y) - ((Const (Ref (StdVector (TemplateType T2__)))) theta) - ((Const (Ref (StdVector Double))) x) - ((Const (Ref (StdVector Int))) x_int) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall sho () - ((Var t) (Var y) (Var theta) (Var x) (Var x_int) (Var pstream__)))))))))) + (BinOp + (FunCall stan::model::rvalue () + ((Var theta) (Literal "\"theta\"") + (FunCall stan::model::index_uni () ((Literal 1))))) + Multiply + (FunCall stan::model::rvalue () + ((Var y) (Literal "\"y\"") + (FunCall stan::model::index_uni () ((Literal 2))))))))) + (Literal "\"assigning variable dydt\"") + (FunCall stan::model::index_uni () ((Literal 2)))))) + (Expression (Assign (Var current_statement__) (Literal 600))) + (Return ((Var dydt)))) + ((Const (Ref (TypeLiteral std::exception))) e) + ((Expression + (FunCall stan::lang::rethrow_located () + ((Var e) + (Index (Var locations_array__) (Var current_statement__)))))))))))) (FunDef - ((templates_init ((()) true)) (inline false) (return_type Double) + ((templates_init ((()) false)) (inline false) (return_type Double) (name foo_bar0) (args (((Pointer (TypeLiteral std::ostream)) pstream__))) (cv_qualifiers ()) @@ -2353,15 +2200,9 @@ (FunCall stan::lang::rethrow_located () ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init ((() ()) false)) (inline false) (return_type Double) - (name "foo_bar0_functor__::operator()") - (args (((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body (((Return ((FunCall foo_bar0 () ((Var pstream__)))))))))) (FunDef ((templates_init - ((((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) true)) + ((((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) false)) (inline false) (return_type (TypeTrait stan::promote_args_t ((TemplateType T0__)))) (name foo_bar1) @@ -2396,23 +2237,12 @@ (FunCall stan::lang::rethrow_located () ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init - ((() ((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) false)) - (inline false) - (return_type (TypeTrait stan::promote_args_t ((TemplateType T0__)))) - (name "foo_bar1_functor__::operator()") - (args - (((Const (Ref (TemplateType T0__))) x) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body (((Return ((FunCall foo_bar1 () ((Var x) (Var pstream__)))))))))) (FunDef ((templates_init ((((Typename T0__) (Typename T1__) (RequireIs stan::is_stan_scalar T0__) (RequireIs stan::is_stan_scalar T1__))) - true)) + false)) (inline false) (return_type (TypeTrait stan::promote_args_t @@ -2451,30 +2281,11 @@ (FunCall stan::lang::rethrow_located () ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init - ((() - ((Typename T0__) (Typename T1__) - (RequireIs stan::is_stan_scalar T0__) - (RequireIs stan::is_stan_scalar T1__))) - false)) - (inline false) - (return_type - (TypeTrait stan::promote_args_t - ((TemplateType T0__) (TemplateType T1__)))) - (name "foo_bar2_functor__::operator()") - (args - (((Const (Ref (TemplateType T0__))) x) - ((Const (Ref (TemplateType T1__))) y) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return ((FunCall foo_bar2 () ((Var x) (Var y) (Var pstream__)))))))))) (FunDef ((templates_init ((((Bool propto__) (Typename T1__) (RequireIs stan::is_stan_scalar T1__))) - true)) + false)) (inline false) (return_type (TypeTrait stan::promote_args_t ((TemplateType T1__)))) (name foo_lpmf) @@ -2506,24 +2317,7 @@ (Index (Var locations_array__) (Var current_statement__)))))))))))) (FunDef ((templates_init - ((() - ((Bool propto__) (Typename T1__) - (RequireIs stan::is_stan_scalar T1__))) - false)) - (inline false) - (return_type (TypeTrait stan::promote_args_t ((TemplateType T1__)))) - (name "foo_lpmf_functor__::operator()") - (args - (((Const (Ref Int)) y) ((Const (Ref (TemplateType T1__))) lambda) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall foo_lpmf ((TemplateType propto__)) - ((Var y) (Var lambda) (Var pstream__)))))))))) - (FunDef - ((templates_init - ((((Typename T1__) (RequireIs stan::is_stan_scalar T1__))) true)) + ((((Typename T1__) (RequireIs stan::is_stan_scalar T1__))) false)) (inline false) (return_type (TypeTrait stan::promote_args_t ((TemplateType T1__)))) (name foo_lcdf) @@ -2560,20 +2354,7 @@ (Index (Var locations_array__) (Var current_statement__)))))))))))) (FunDef ((templates_init - ((() ((Typename T1__) (RequireIs stan::is_stan_scalar T1__))) false)) - (inline false) - (return_type (TypeTrait stan::promote_args_t ((TemplateType T1__)))) - (name "foo_lcdf_functor__::operator()") - (args - (((Const (Ref Int)) y) ((Const (Ref (TemplateType T1__))) lambda) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall foo_lcdf () ((Var y) (Var lambda) (Var pstream__)))))))))) - (FunDef - ((templates_init - ((((Typename T1__) (RequireIs stan::is_stan_scalar T1__))) true)) + ((((Typename T1__) (RequireIs stan::is_stan_scalar T1__))) false)) (inline false) (return_type (TypeTrait stan::promote_args_t ((TemplateType T1__)))) (name foo_lccdf) @@ -2608,25 +2389,12 @@ (FunCall stan::lang::rethrow_located () ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init - ((() ((Typename T1__) (RequireIs stan::is_stan_scalar T1__))) false)) - (inline false) - (return_type (TypeTrait stan::promote_args_t ((TemplateType T1__)))) - (name "foo_lccdf_functor__::operator()") - (args - (((Const (Ref Int)) y) ((Const (Ref (TemplateType T1__))) lambda) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall foo_lccdf () ((Var y) (Var lambda) (Var pstream__)))))))))) (FunDef ((templates_init ((((Typename T0__) (Typename T1__) (Typename RNG) (RequireIs stan::is_stan_scalar T0__) (RequireIs stan::is_stan_scalar T1__))) - true)) + false)) (inline false) (return_type (TypeTrait stan::promote_args_t @@ -2668,33 +2436,11 @@ (FunCall stan::lang::rethrow_located () ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init - ((() - ((Typename T0__) (Typename T1__) (Typename RNG) - (RequireIs stan::is_stan_scalar T0__) - (RequireIs stan::is_stan_scalar T1__))) - false)) - (inline false) - (return_type - (TypeTrait stan::promote_args_t - ((TemplateType T0__) (TemplateType T1__)))) - (name "foo_rng_functor__::operator()") - (args - (((Const (Ref (TemplateType T0__))) mu) - ((Const (Ref (TemplateType T1__))) sigma) - ((Ref (TemplateType RNG)) base_rng__) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall foo_rng () - ((Var mu) (Var sigma) (Var base_rng__) (Var pstream__)))))))))) (FunDef ((templates_init ((((Bool propto__) (Typename T0__) (Typename T_lp__) (Typename T_lp_accum__) (RequireIs stan::is_stan_scalar T0__))) - true)) + false)) (inline false) (return_type Void) (name unit_normal_lp) (args (((Const (Ref (TemplateType T0__))) u) @@ -2733,25 +2479,7 @@ ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) (FunDef - ((templates_init - ((() - ((Bool propto__) (Typename T0__) (Typename T_lp__) - (Typename T_lp_accum__) (RequireIs stan::is_stan_scalar T0__))) - false)) - (inline false) (return_type Void) - (name "unit_normal_lp_functor__::operator()") - (args - (((Const (Ref (TemplateType T0__))) u) - ((Ref (TemplateType T_lp__)) lp__) - ((Ref (TemplateType T_lp_accum__)) lp_accum__) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall unit_normal_lp ((TemplateType propto__)) - ((Var u) (Var lp__) (Var lp_accum__) (Var pstream__)))))))))) - (FunDef - ((templates_init ((()) true)) (inline false) (return_type Int) + ((templates_init ((()) false)) (inline false) (return_type Int) (name foo_1) (args (((Const (Ref Int)) a) @@ -3135,15 +2863,7 @@ ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) (FunDef - ((templates_init ((() ()) false)) (inline false) (return_type Int) - (name "foo_1_functor__::operator()") - (args - (((Const (Ref Int)) a) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body (((Return ((FunCall foo_1 () ((Var a) (Var pstream__)))))))))) - (FunDef - ((templates_init ((()) true)) (inline false) (return_type Int) + ((templates_init ((()) false)) (inline false) (return_type Int) (name foo_2) (args (((Const (Ref Int)) a) @@ -3202,17 +2922,9 @@ (FunCall stan::lang::rethrow_located () ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init ((() ()) false)) (inline false) (return_type Int) - (name "foo_2_functor__::operator()") - (args - (((Const (Ref Int)) a) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body (((Return ((FunCall foo_2 () ((Var a) (Var pstream__)))))))))) (FunDef ((templates_init - ((((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) true)) + ((((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) false)) (inline false) (return_type (StdVector (TypeTrait stan::promote_args_t ((TemplateType T0__))))) @@ -3248,24 +2960,11 @@ (FunCall stan::lang::rethrow_located () ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init - ((() ((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) false)) - (inline false) - (return_type - (StdVector (TypeTrait stan::promote_args_t ((TemplateType T0__))))) - (name "foo_3_functor__::operator()") - (args - (((Const (Ref (TemplateType T0__))) t) ((Const (Ref Int)) n) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return ((FunCall foo_3 () ((Var t) (Var n) (Var pstream__)))))))))) (FunDef ((templates_init ((((Bool propto__) (Typename T0__) (Typename T_lp__) (Typename T_lp_accum__) (RequireIs stan::is_stan_scalar T0__))) - true)) + false)) (inline false) (return_type (TypeTrait stan::promote_args_t ((TemplateType T0__)))) (name foo_lp) @@ -3302,26 +3001,7 @@ (Index (Var locations_array__) (Var current_statement__)))))))))))) (FunDef ((templates_init - ((() - ((Bool propto__) (Typename T0__) (Typename T_lp__) - (Typename T_lp_accum__) (RequireIs stan::is_stan_scalar T0__))) - false)) - (inline false) - (return_type (TypeTrait stan::promote_args_t ((TemplateType T0__)))) - (name "foo_lp_functor__::operator()") - (args - (((Const (Ref (TemplateType T0__))) x) - ((Ref (TemplateType T_lp__)) lp__) - ((Ref (TemplateType T_lp_accum__)) lp_accum__) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall foo_lp ((TemplateType propto__)) - ((Var x) (Var lp__) (Var lp_accum__) (Var pstream__)))))))))) - (FunDef - ((templates_init - ((((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) true)) + ((((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) false)) (inline false) (return_type Void) (name foo_4) (args (((Const (Ref (StdVector (TemplateType T0__)))) x) @@ -3376,15 +3056,6 @@ (FunCall stan::lang::rethrow_located () ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init - ((() ((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) false)) - (inline false) (return_type Void) (name "foo_4_functor__::operator()") - (args - (((Const (Ref (StdVector (TemplateType T0__)))) x) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body (((Return ((FunCall foo_4 () ((Var x) (Var pstream__)))))))))) (FunDef ((templates_init ((((Typename T0__) (Typename T1__) (Typename T2__) (Typename T3__) @@ -3392,7 +3063,7 @@ (RequireIs stan::is_stan_scalar T1__) (RequireIs stan::is_stan_scalar T2__) (RequireIs stan::is_stan_scalar T3__))) - true)) + false)) (inline false) (return_type (TypeTrait stan::promote_args_t @@ -3525,39 +3196,13 @@ (FunCall stan::lang::rethrow_located () ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init - ((() - ((Typename T0__) (Typename T1__) (Typename T2__) (Typename T3__) - (RequireIs stan::is_stan_scalar T0__) - (RequireIs stan::is_stan_scalar T1__) - (RequireIs stan::is_stan_scalar T2__) - (RequireIs stan::is_stan_scalar T3__))) - false)) - (inline false) - (return_type - (TypeTrait stan::promote_args_t - ((TemplateType T0__) (TemplateType T1__) (TemplateType T2__) - (TemplateType T3__)))) - (name "relative_diff_functor__::operator()") - (args - (((Const (Ref (TemplateType T0__))) x) - ((Const (Ref (TemplateType T1__))) y) - ((Const (Ref (TemplateType T2__))) max_) - ((Const (Ref (TemplateType T3__))) min_) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall relative_diff () - ((Var x) (Var y) (Var max_) (Var min_) (Var pstream__)))))))))) (FunDef ((templates_init ((((Typename T0__) (Typename T1__) (RequireIs stan::is_col_vector T0__) (RequireIs stan::is_vt_not_complex T0__) (RequireIs stan::is_col_vector T1__) (RequireIs stan::is_vt_not_complex T1__))) - true)) + false)) (inline false) (return_type (Matrix @@ -3620,34 +3265,6 @@ (FunCall stan::lang::rethrow_located () ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init - ((() - ((Typename T0__) (Typename T1__) (RequireIs stan::is_col_vector T0__) - (RequireIs stan::is_vt_not_complex T0__) - (RequireIs stan::is_col_vector T1__) - (RequireIs stan::is_vt_not_complex T1__))) - false)) - (inline false) - (return_type - (Matrix - (TypeTrait stan::promote_args_t - ((TemplateType stan::base_type_t) - (TemplateType stan::base_type_t))) - -1 1)) - (name "foo_5_functor__::operator()") - (args - (((Const (Ref (TemplateType T0__))) shared_params) - ((Const (Ref (TemplateType T1__))) job_params) - ((Const (Ref (StdVector Double))) data_r) - ((Const (Ref (StdVector Int))) data_i) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall foo_5 () - ((Var shared_params) (Var job_params) (Var data_r) (Var data_i) - (Var pstream__)))))))))) (FunDef ((templates_init ((((Typename T0__) (Typename T1__) (Typename T2__) (Typename T3__) @@ -3656,7 +3273,7 @@ (RequireIs stan::is_stan_scalar T2__) (RequireIs stan::is_stan_scalar T3__) (RequireIs stan::is_stan_scalar T4__))) - true)) + false)) (inline false) (return_type (TypeTrait stan::promote_args_t @@ -3700,34 +3317,6 @@ (FunCall stan::lang::rethrow_located () ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init - ((() - ((Typename T0__) (Typename T1__) (Typename T2__) (Typename T3__) - (Typename T4__) (RequireIs stan::is_stan_scalar T0__) - (RequireIs stan::is_stan_scalar T1__) - (RequireIs stan::is_stan_scalar T2__) - (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__))) - false)) - (inline false) - (return_type - (TypeTrait stan::promote_args_t - ((TemplateType T0__) (TemplateType T1__) (TemplateType T2__) - (TemplateType T3__) (TemplateType T4__)))) - (name "foo_five_args_functor__::operator()") - (args - (((Const (Ref (TemplateType T0__))) x1) - ((Const (Ref (TemplateType T1__))) x2) - ((Const (Ref (TemplateType T2__))) x3) - ((Const (Ref (TemplateType T3__))) x4) - ((Const (Ref (TemplateType T4__))) x5) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall foo_five_args () - ((Var x1) (Var x2) (Var x3) (Var x4) (Var x5) (Var pstream__)))))))))) (FunDef ((templates_init ((((Bool propto__) (Typename T0__) (Typename T1__) (Typename T2__) @@ -3738,7 +3327,7 @@ (RequireIs stan::is_stan_scalar T3__) (RequireIs stan::is_stan_scalar T4__) (RequireIs stan::is_stan_scalar T5__))) - true)) + false)) (inline false) (return_type (TypeTrait stan::promote_args_t @@ -3764,64 +3353,29 @@ (TemplateType T3__) (TemplateType T4__) (TypeTrait stan::promote_args_t ((TemplateType T5__))))))) (VariableDefn - ((static false) (constexpr false) (type_ Int) - (name current_statement__) (init (Assignment (Literal 0))))) - (VariableDefn - ((static false) (constexpr false) - (type_ (TypeLiteral local_scalar_t__)) (name DUMMY_VAR__) - (init - (Construction - ((FunCall std::numeric_limits::quiet_NaN () ())))))) - (Comment "suppress unused var warning") - (Expression (Cast Void (Var DUMMY_VAR__))) - (TryCatch - ((Expression (Assign (Var current_statement__) (Literal 727))) - (Return ((Var x1)))) - ((Const (Ref (TypeLiteral std::exception))) e) - ((Expression - (FunCall stan::lang::rethrow_located () - ((Var e) - (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init - ((() - ((Bool propto__) (Typename T0__) (Typename T1__) (Typename T2__) - (Typename T3__) (Typename T4__) (Typename T5__) (Typename T_lp__) - (Typename T_lp_accum__) (RequireIs stan::is_stan_scalar T0__) - (RequireIs stan::is_stan_scalar T1__) - (RequireIs stan::is_stan_scalar T2__) - (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__))) - false)) - (inline false) - (return_type - (TypeTrait stan::promote_args_t - ((TemplateType T0__) (TemplateType T1__) (TemplateType T2__) - (TemplateType T3__) (TemplateType T4__) - (TypeTrait stan::promote_args_t ((TemplateType T5__)))))) - (name "foo_five_args_lp_functor__::operator()") - (args - (((Const (Ref (TemplateType T0__))) x1) - ((Const (Ref (TemplateType T1__))) x2) - ((Const (Ref (TemplateType T2__))) x3) - ((Const (Ref (TemplateType T3__))) x4) - ((Const (Ref (TemplateType T4__))) x5) - ((Const (Ref (TemplateType T5__))) x6) - ((Ref (TemplateType T_lp__)) lp__) - ((Ref (TemplateType T_lp_accum__)) lp_accum__) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall foo_five_args_lp ((TemplateType propto__)) - ((Var x1) (Var x2) (Var x3) (Var x4) (Var x5) (Var x6) (Var lp__) - (Var lp_accum__) (Var pstream__)))))))))) + ((static false) (constexpr false) (type_ Int) + (name current_statement__) (init (Assignment (Literal 0))))) + (VariableDefn + ((static false) (constexpr false) + (type_ (TypeLiteral local_scalar_t__)) (name DUMMY_VAR__) + (init + (Construction + ((FunCall std::numeric_limits::quiet_NaN () ())))))) + (Comment "suppress unused var warning") + (Expression (Cast Void (Var DUMMY_VAR__))) + (TryCatch + ((Expression (Assign (Var current_statement__) (Literal 727))) + (Return ((Var x1)))) + ((Const (Ref (TypeLiteral std::exception))) e) + ((Expression + (FunCall stan::lang::rethrow_located () + ((Var e) + (Index (Var locations_array__) (Var current_statement__)))))))))))) (FunDef ((templates_init ((((Typename T0__) (RequireIs stan::is_eigen_matrix_dynamic T0__) (RequireIs stan::is_vt_not_complex T0__))) - true)) + false)) (inline false) (return_type (Matrix @@ -3912,27 +3466,6 @@ (FunCall stan::lang::rethrow_located () ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init - ((() - ((Typename T0__) (RequireIs stan::is_eigen_matrix_dynamic T0__) - (RequireIs stan::is_vt_not_complex T0__))) - false)) - (inline false) - (return_type - (Matrix - (TypeTrait stan::promote_args_t - ((TemplateType stan::base_type_t))) - -1 -1)) - (name "covsqrt2corsqrt_functor__::operator()") - (args - (((Const (Ref (TemplateType T0__))) mat) ((Const (Ref Int)) invert) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall covsqrt2corsqrt () - ((Var mat) (Var invert) (Var pstream__)))))))))) (FunDef ((templates_init ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) @@ -3948,7 +3481,7 @@ (RequireIs stan::is_vt_not_complex T9__) (RequireIs stan::is_stan_scalar T10__) (RequireIs stan::is_stan_scalar T11__))) - true)) + false)) (inline false) (return_type Void) (name f0) (args (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) @@ -4018,47 +3551,6 @@ (FunCall stan::lang::rethrow_located () ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init - ((() - ((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - false)) - (inline false) (return_type Void) (name "f0_functor__::operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall f0 () - ((Var a1) (Var a2) (Var a3) (Var a4) (Var a5) (Var a6) (Var a7) - (Var a8) (Var a9) (Var a10) (Var a11) (Var a12) (Var pstream__)))))))))) (FunDef ((templates_init ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) @@ -4074,7 +3566,7 @@ (RequireIs stan::is_vt_not_complex T9__) (RequireIs stan::is_stan_scalar T10__) (RequireIs stan::is_stan_scalar T11__))) - true)) + false)) (inline false) (return_type Int) (name f1) (args (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) @@ -4136,47 +3628,6 @@ (FunCall stan::lang::rethrow_located () ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init - ((() - ((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - false)) - (inline false) (return_type Int) (name "f1_functor__::operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall f1 () - ((Var a1) (Var a2) (Var a3) (Var a4) (Var a5) (Var a6) (Var a7) - (Var a8) (Var a9) (Var a10) (Var a11) (Var a12) (Var pstream__)))))))))) (FunDef ((templates_init ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) @@ -4192,7 +3643,7 @@ (RequireIs stan::is_vt_not_complex T9__) (RequireIs stan::is_stan_scalar T10__) (RequireIs stan::is_stan_scalar T11__))) - true)) + false)) (inline false) (return_type (StdVector Int)) (name f2) (args (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) @@ -4254,167 +3705,6 @@ (FunCall stan::lang::rethrow_located () ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init - ((() - ((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - false)) - (inline false) (return_type (StdVector Int)) - (name "f2_functor__::operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall f2 () - ((Var a1) (Var a2) (Var a3) (Var a4) (Var a5) (Var a6) (Var a7) - (Var a8) (Var a9) (Var a10) (Var a11) (Var a12) (Var pstream__)))))))))) - (FunDef - ((templates_init - ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - true)) - (inline false) (return_type (StdVector (StdVector Int))) (name f3) - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7_arg__) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10_arg__) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers ()) - (body - (((Using local_scalar_t__ - ((TypeTrait stan::promote_args_t - ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) - (TemplateType stan::base_type_t) (TemplateType T7__) - (TypeTrait stan::promote_args_t - ((TemplateType T8__) (TemplateType stan::base_type_t) - (TemplateType T10__) (TemplateType T11__))))))) - (VariableDefn - ((static false) (constexpr false) (type_ Int) - (name current_statement__) (init (Assignment (Literal 0))))) - (VariableDefn - ((static false) (constexpr false) (type_ (Const (Ref Auto))) - (name a7) - (init - (Assignment (FunCall stan::math::to_ref () ((Var a7_arg__))))))) - (VariableDefn - ((static false) (constexpr false) (type_ (Const (Ref Auto))) - (name a10) - (init - (Assignment (FunCall stan::math::to_ref () ((Var a10_arg__))))))) - (VariableDefn - ((static true) (constexpr true) (type_ (TypeLiteral bool)) - (name propto__) (init (Assignment (Literal true))))) - (Comment "suppress unused var warning") - (Expression (Cast Void (Var propto__))) - (VariableDefn - ((static false) (constexpr false) - (type_ (TypeLiteral local_scalar_t__)) (name DUMMY_VAR__) - (init - (Construction - ((FunCall std::numeric_limits::quiet_NaN () ())))))) - (Comment "suppress unused var warning") - (Expression (Cast Void (Var DUMMY_VAR__))) - (TryCatch - ((Expression (Assign (Var current_statement__) (Literal 743))) - (Return ((Var a3)))) - ((Const (Ref (TypeLiteral std::exception))) e) - ((Expression - (FunCall stan::lang::rethrow_located () - ((Var e) - (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init - ((() - ((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - false)) - (inline false) (return_type (StdVector (StdVector Int))) - (name "f3_functor__::operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall f3 () - ((Var a1) (Var a2) (Var a3) (Var a4) (Var a5) (Var a6) (Var a7) - (Var a8) (Var a9) (Var a10) (Var a11) (Var a12) (Var pstream__)))))))))) (FunDef ((templates_init ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) @@ -4424,22 +3714,14 @@ (RequireIs stan::is_stan_scalar T5__) (RequireIs stan::is_col_vector T6__) (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - true)) - (inline false) - (return_type - (TypeTrait stan::promote_args_t - ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) - (TemplateType stan::base_type_t) (TemplateType T7__) - (TypeTrait stan::promote_args_t - ((TemplateType T8__) (TemplateType stan::base_type_t) - (TemplateType T10__) (TemplateType T11__)))))) - (name f4) + (RequireIs stan::is_stan_scalar T7__) + (RequireIs stan::is_stan_scalar T8__) + (RequireIs stan::is_eigen_matrix_dynamic T9__) + (RequireIs stan::is_vt_not_complex T9__) + (RequireIs stan::is_stan_scalar T10__) + (RequireIs stan::is_stan_scalar T11__))) + false)) + (inline false) (return_type (StdVector (StdVector Int))) (name f3) (args (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) ((Const (Ref (StdVector (StdVector Int)))) a3) @@ -4493,8 +3775,8 @@ (Comment "suppress unused var warning") (Expression (Cast Void (Var DUMMY_VAR__))) (TryCatch - ((Expression (Assign (Var current_statement__) (Literal 745))) - (Return ((Var a4)))) + ((Expression (Assign (Var current_statement__) (Literal 743))) + (Return ((Var a3)))) ((Const (Ref (TypeLiteral std::exception))) e) ((Expression (FunCall stan::lang::rethrow_located () @@ -4502,8 +3784,7 @@ (Index (Var locations_array__) (Var current_statement__)))))))))))) (FunDef ((templates_init - ((() - ((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) + ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) (Typename T11__) (RequireIs stan::is_stan_scalar T3__) (RequireIs stan::is_stan_scalar T4__) @@ -4525,56 +3806,7 @@ (TypeTrait stan::promote_args_t ((TemplateType T8__) (TemplateType stan::base_type_t) (TemplateType T10__) (TemplateType T11__)))))) - (name "f4_functor__::operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall f4 () - ((Var a1) (Var a2) (Var a3) (Var a4) (Var a5) (Var a6) (Var a7) - (Var a8) (Var a9) (Var a10) (Var a11) (Var a12) (Var pstream__)))))))))) - (FunDef - ((templates_init - ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - true)) - (inline false) - (return_type - (StdVector - (TypeTrait stan::promote_args_t - ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) - (TemplateType stan::base_type_t) (TemplateType T7__) - (TypeTrait stan::promote_args_t - ((TemplateType T8__) (TemplateType stan::base_type_t) - (TemplateType T10__) (TemplateType T11__))))))) - (name f5) + (name f4) (args (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) ((Const (Ref (StdVector (StdVector Int)))) a3) @@ -4628,8 +3860,8 @@ (Comment "suppress unused var warning") (Expression (Cast Void (Var DUMMY_VAR__))) (TryCatch - ((Expression (Assign (Var current_statement__) (Literal 747))) - (Return ((Var a5)))) + ((Expression (Assign (Var current_statement__) (Literal 745))) + (Return ((Var a4)))) ((Const (Ref (TypeLiteral std::exception))) e) ((Expression (FunCall stan::lang::rethrow_located () @@ -4637,8 +3869,7 @@ (Index (Var locations_array__) (Var current_statement__)))))))))))) (FunDef ((templates_init - ((() - ((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) + ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) (Typename T11__) (RequireIs stan::is_stan_scalar T3__) (RequireIs stan::is_stan_scalar T4__) @@ -4661,57 +3892,7 @@ (TypeTrait stan::promote_args_t ((TemplateType T8__) (TemplateType stan::base_type_t) (TemplateType T10__) (TemplateType T11__))))))) - (name "f5_functor__::operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall f5 () - ((Var a1) (Var a2) (Var a3) (Var a4) (Var a5) (Var a6) (Var a7) - (Var a8) (Var a9) (Var a10) (Var a11) (Var a12) (Var pstream__)))))))))) - (FunDef - ((templates_init - ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - true)) - (inline false) - (return_type - (StdVector - (StdVector - (TypeTrait stan::promote_args_t - ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) - (TemplateType stan::base_type_t) (TemplateType T7__) - (TypeTrait stan::promote_args_t - ((TemplateType T8__) (TemplateType stan::base_type_t) - (TemplateType T10__) (TemplateType T11__)))))))) - (name f6) + (name f5) (args (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) ((Const (Ref (StdVector (StdVector Int)))) a3) @@ -4765,8 +3946,8 @@ (Comment "suppress unused var warning") (Expression (Cast Void (Var DUMMY_VAR__))) (TryCatch - ((Expression (Assign (Var current_statement__) (Literal 749))) - (Return ((Var a6)))) + ((Expression (Assign (Var current_statement__) (Literal 747))) + (Return ((Var a5)))) ((Const (Ref (TypeLiteral std::exception))) e) ((Expression (FunCall stan::lang::rethrow_located () @@ -4774,8 +3955,7 @@ (Index (Var locations_array__) (Var current_statement__)))))))))))) (FunDef ((templates_init - ((() - ((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) + ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) (Typename T11__) (RequireIs stan::is_stan_scalar T3__) (RequireIs stan::is_stan_scalar T4__) @@ -4799,57 +3979,7 @@ (TypeTrait stan::promote_args_t ((TemplateType T8__) (TemplateType stan::base_type_t) (TemplateType T10__) (TemplateType T11__)))))))) - (name "f6_functor__::operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall f6 () - ((Var a1) (Var a2) (Var a3) (Var a4) (Var a5) (Var a6) (Var a7) - (Var a8) (Var a9) (Var a10) (Var a11) (Var a12) (Var pstream__)))))))))) - (FunDef - ((templates_init - ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - true)) - (inline false) - (return_type - (Matrix - (TypeTrait stan::promote_args_t - ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) - (TemplateType stan::base_type_t) (TemplateType T7__) - (TypeTrait stan::promote_args_t - ((TemplateType T8__) (TemplateType stan::base_type_t) - (TemplateType T10__) (TemplateType T11__))))) - -1 1)) - (name f7) + (name f6) (args (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) ((Const (Ref (StdVector (StdVector Int)))) a3) @@ -4903,8 +4033,8 @@ (Comment "suppress unused var warning") (Expression (Cast Void (Var DUMMY_VAR__))) (TryCatch - ((Expression (Assign (Var current_statement__) (Literal 751))) - (Return ((Var a7)))) + ((Expression (Assign (Var current_statement__) (Literal 749))) + (Return ((Var a6)))) ((Const (Ref (TypeLiteral std::exception))) e) ((Expression (FunCall stan::lang::rethrow_located () @@ -4912,8 +4042,7 @@ (Index (Var locations_array__) (Var current_statement__)))))))))))) (FunDef ((templates_init - ((() - ((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) + ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) (Typename T11__) (RequireIs stan::is_stan_scalar T3__) (RequireIs stan::is_stan_scalar T4__) @@ -4937,58 +4066,7 @@ ((TemplateType T8__) (TemplateType stan::base_type_t) (TemplateType T10__) (TemplateType T11__))))) -1 1)) - (name "f7_functor__::operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall f7 () - ((Var a1) (Var a2) (Var a3) (Var a4) (Var a5) (Var a6) (Var a7) - (Var a8) (Var a9) (Var a10) (Var a11) (Var a12) (Var pstream__)))))))))) - (FunDef - ((templates_init - ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - true)) - (inline false) - (return_type - (StdVector - (Matrix - (TypeTrait stan::promote_args_t - ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) - (TemplateType stan::base_type_t) (TemplateType T7__) - (TypeTrait stan::promote_args_t - ((TemplateType T8__) (TemplateType stan::base_type_t) - (TemplateType T10__) (TemplateType T11__))))) - -1 1))) - (name f8) + (name f7) (args (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) ((Const (Ref (StdVector (StdVector Int)))) a3) @@ -5042,8 +4120,8 @@ (Comment "suppress unused var warning") (Expression (Cast Void (Var DUMMY_VAR__))) (TryCatch - ((Expression (Assign (Var current_statement__) (Literal 753))) - (Return ((Var a8)))) + ((Expression (Assign (Var current_statement__) (Literal 751))) + (Return ((Var a7)))) ((Const (Ref (TypeLiteral std::exception))) e) ((Expression (FunCall stan::lang::rethrow_located () @@ -5051,8 +4129,7 @@ (Index (Var locations_array__) (Var current_statement__)))))))))))) (FunDef ((templates_init - ((() - ((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) + ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) (Typename T11__) (RequireIs stan::is_stan_scalar T3__) (RequireIs stan::is_stan_scalar T4__) @@ -5075,61 +4152,9 @@ (TemplateType stan::base_type_t) (TemplateType T7__) (TypeTrait stan::promote_args_t ((TemplateType T8__) (TemplateType stan::base_type_t) - (TemplateType T10__) (TemplateType T11__))))) - -1 1))) - (name "f8_functor__::operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall f8 () - ((Var a1) (Var a2) (Var a3) (Var a4) (Var a5) (Var a6) (Var a7) - (Var a8) (Var a9) (Var a10) (Var a11) (Var a12) (Var pstream__)))))))))) - (FunDef - ((templates_init - ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - true)) - (inline false) - (return_type - (StdVector - (StdVector - (Matrix - (TypeTrait stan::promote_args_t - ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) - (TemplateType stan::base_type_t) (TemplateType T7__) - (TypeTrait stan::promote_args_t - ((TemplateType T8__) (TemplateType stan::base_type_t) - (TemplateType T10__) (TemplateType T11__))))) - -1 1)))) - (name f9) + (TemplateType T10__) (TemplateType T11__))))) + -1 1))) + (name f8) (args (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) ((Const (Ref (StdVector (StdVector Int)))) a3) @@ -5183,8 +4208,8 @@ (Comment "suppress unused var warning") (Expression (Cast Void (Var DUMMY_VAR__))) (TryCatch - ((Expression (Assign (Var current_statement__) (Literal 755))) - (Return ((Var a9)))) + ((Expression (Assign (Var current_statement__) (Literal 753))) + (Return ((Var a8)))) ((Const (Ref (TypeLiteral std::exception))) e) ((Expression (FunCall stan::lang::rethrow_located () @@ -5192,8 +4217,7 @@ (Index (Var locations_array__) (Var current_statement__)))))))))))) (FunDef ((templates_init - ((() - ((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) + ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) (Typename T11__) (RequireIs stan::is_stan_scalar T3__) (RequireIs stan::is_stan_scalar T4__) @@ -5219,30 +4243,67 @@ ((TemplateType T8__) (TemplateType stan::base_type_t) (TemplateType T10__) (TemplateType T11__))))) -1 1)))) - (name "f9_functor__::operator()") + (name f9) (args (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) ((Const (Ref (StdVector (StdVector Int)))) a3) ((Const (Ref (TemplateType T3__))) a4) ((Const (Ref (StdVector (TemplateType T4__)))) a5) ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) + ((Const (Ref (TemplateType T6__))) a7_arg__) ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) ((Const (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) a9) - ((Const (Ref (TemplateType T9__))) a10) + ((Const (Ref (TemplateType T9__))) a10_arg__) ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) ((Const (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) a12) ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) + (cv_qualifiers ()) (body - (((Return - ((FunCall f9 () - ((Var a1) (Var a2) (Var a3) (Var a4) (Var a5) (Var a6) (Var a7) - (Var a8) (Var a9) (Var a10) (Var a11) (Var a12) (Var pstream__)))))))))) + (((Using local_scalar_t__ + ((TypeTrait stan::promote_args_t + ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) + (TemplateType stan::base_type_t) (TemplateType T7__) + (TypeTrait stan::promote_args_t + ((TemplateType T8__) (TemplateType stan::base_type_t) + (TemplateType T10__) (TemplateType T11__))))))) + (VariableDefn + ((static false) (constexpr false) (type_ Int) + (name current_statement__) (init (Assignment (Literal 0))))) + (VariableDefn + ((static false) (constexpr false) (type_ (Const (Ref Auto))) + (name a7) + (init + (Assignment (FunCall stan::math::to_ref () ((Var a7_arg__))))))) + (VariableDefn + ((static false) (constexpr false) (type_ (Const (Ref Auto))) + (name a10) + (init + (Assignment (FunCall stan::math::to_ref () ((Var a10_arg__))))))) + (VariableDefn + ((static true) (constexpr true) (type_ (TypeLiteral bool)) + (name propto__) (init (Assignment (Literal true))))) + (Comment "suppress unused var warning") + (Expression (Cast Void (Var propto__))) + (VariableDefn + ((static false) (constexpr false) + (type_ (TypeLiteral local_scalar_t__)) (name DUMMY_VAR__) + (init + (Construction + ((FunCall std::numeric_limits::quiet_NaN () ())))))) + (Comment "suppress unused var warning") + (Expression (Cast Void (Var DUMMY_VAR__))) + (TryCatch + ((Expression (Assign (Var current_statement__) (Literal 755))) + (Return ((Var a9)))) + ((Const (Ref (TypeLiteral std::exception))) e) + ((Expression + (FunCall stan::lang::rethrow_located () + ((Var e) + (Index (Var locations_array__) (Var current_statement__)))))))))))) (FunDef ((templates_init ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) @@ -5258,7 +4319,7 @@ (RequireIs stan::is_vt_not_complex T9__) (RequireIs stan::is_stan_scalar T10__) (RequireIs stan::is_stan_scalar T11__))) - true)) + false)) (inline false) (return_type (Matrix @@ -5330,57 +4391,6 @@ (FunCall stan::lang::rethrow_located () ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init - ((() - ((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - false)) - (inline false) - (return_type - (Matrix - (TypeTrait stan::promote_args_t - ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) - (TemplateType stan::base_type_t) (TemplateType T7__) - (TypeTrait stan::promote_args_t - ((TemplateType T8__) (TemplateType stan::base_type_t) - (TemplateType T10__) (TemplateType T11__))))) - -1 -1)) - (name "f10_functor__::operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall f10 () - ((Var a1) (Var a2) (Var a3) (Var a4) (Var a5) (Var a6) (Var a7) - (Var a8) (Var a9) (Var a10) (Var a11) (Var a12) (Var pstream__)))))))))) (FunDef ((templates_init ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) @@ -5396,7 +4406,7 @@ (RequireIs stan::is_vt_not_complex T9__) (RequireIs stan::is_stan_scalar T10__) (RequireIs stan::is_stan_scalar T11__))) - true)) + false)) (inline false) (return_type (StdVector @@ -5469,58 +4479,6 @@ (FunCall stan::lang::rethrow_located () ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init - ((() - ((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - false)) - (inline false) - (return_type - (StdVector - (Matrix - (TypeTrait stan::promote_args_t - ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) - (TemplateType stan::base_type_t) (TemplateType T7__) - (TypeTrait stan::promote_args_t - ((TemplateType T8__) (TemplateType stan::base_type_t) - (TemplateType T10__) (TemplateType T11__))))) - -1 -1))) - (name "f11_functor__::operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall f11 () - ((Var a1) (Var a2) (Var a3) (Var a4) (Var a5) (Var a6) (Var a7) - (Var a8) (Var a9) (Var a10) (Var a11) (Var a12) (Var pstream__)))))))))) (FunDef ((templates_init ((((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) @@ -5536,7 +4494,7 @@ (RequireIs stan::is_vt_not_complex T9__) (RequireIs stan::is_stan_scalar T10__) (RequireIs stan::is_stan_scalar T11__))) - true)) + false)) (inline false) (return_type (StdVector @@ -5611,60 +4569,7 @@ ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) (FunDef - ((templates_init - ((() - ((Typename T3__) (Typename T4__) (Typename T5__) (Typename T6__) - (Typename T7__) (Typename T8__) (Typename T9__) (Typename T10__) - (Typename T11__) (RequireIs stan::is_stan_scalar T3__) - (RequireIs stan::is_stan_scalar T4__) - (RequireIs stan::is_stan_scalar T5__) - (RequireIs stan::is_col_vector T6__) - (RequireIs stan::is_vt_not_complex T6__) - (RequireIs stan::is_stan_scalar T7__) - (RequireIs stan::is_stan_scalar T8__) - (RequireIs stan::is_eigen_matrix_dynamic T9__) - (RequireIs stan::is_vt_not_complex T9__) - (RequireIs stan::is_stan_scalar T10__) - (RequireIs stan::is_stan_scalar T11__))) - false)) - (inline false) - (return_type - (StdVector - (StdVector - (Matrix - (TypeTrait stan::promote_args_t - ((TemplateType T3__) (TemplateType T4__) (TemplateType T5__) - (TemplateType stan::base_type_t) (TemplateType T7__) - (TypeTrait stan::promote_args_t - ((TemplateType T8__) (TemplateType stan::base_type_t) - (TemplateType T10__) (TemplateType T11__))))) - -1 -1)))) - (name "f12_functor__::operator()") - (args - (((Const (Ref Int)) a1) ((Const (Ref (StdVector Int))) a2) - ((Const (Ref (StdVector (StdVector Int)))) a3) - ((Const (Ref (TemplateType T3__))) a4) - ((Const (Ref (StdVector (TemplateType T4__)))) a5) - ((Const (Ref (StdVector (StdVector (TemplateType T5__))))) a6) - ((Const (Ref (TemplateType T6__))) a7) - ((Const (Ref (StdVector (Matrix (TemplateType T7__) -1 1)))) a8) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T8__) -1 1))))) - a9) - ((Const (Ref (TemplateType T9__))) a10) - ((Const (Ref (StdVector (Matrix (TemplateType T10__) -1 -1)))) a11) - ((Const - (Ref (StdVector (StdVector (Matrix (TemplateType T11__) -1 -1))))) - a12) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall f12 () - ((Var a1) (Var a2) (Var a3) (Var a4) (Var a5) (Var a6) (Var a7) - (Var a8) (Var a9) (Var a10) (Var a11) (Var a12) (Var pstream__)))))))))) - (FunDef - ((templates_init ((()) true)) (inline false) (return_type Void) + ((templates_init ((()) false)) (inline false) (return_type Void) (name foo_6) (args (((Pointer (TypeLiteral std::ostream)) pstream__))) (cv_qualifiers ()) (body @@ -5736,13 +4641,7 @@ ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) (FunDef - ((templates_init ((() ()) false)) (inline false) (return_type Void) - (name "foo_6_functor__::operator()") - (args (((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body (((Return ((FunCall foo_6 () ((Var pstream__)))))))))) - (FunDef - ((templates_init ((()) true)) (inline false) + ((templates_init ((()) false)) (inline false) (return_type (Matrix Double -1 -1)) (name matfoo) (args (((Pointer (TypeLiteral std::ostream)) pstream__))) (cv_qualifiers ()) @@ -5799,14 +4698,7 @@ ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) (FunDef - ((templates_init ((() ()) false)) (inline false) - (return_type (Matrix Double -1 -1)) - (name "matfoo_functor__::operator()") - (args (((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body (((Return ((FunCall matfoo () ((Var pstream__)))))))))) - (FunDef - ((templates_init ((()) true)) (inline false) + ((templates_init ((()) false)) (inline false) (return_type (Matrix Double -1 1)) (name vecfoo) (args (((Pointer (TypeLiteral std::ostream)) pstream__))) (cv_qualifiers ()) @@ -5843,15 +4735,9 @@ (FunCall stan::lang::rethrow_located () ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init ((() ()) false)) (inline false) - (return_type (Matrix Double -1 1)) (name "vecfoo_functor__::operator()") - (args (((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body (((Return ((FunCall vecfoo () ((Var pstream__)))))))))) (FunDef ((templates_init - ((((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) true)) + ((((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) false)) (inline false) (return_type (Matrix (TypeTrait stan::promote_args_t ((TemplateType T0__))) -1 1)) @@ -5903,19 +4789,7 @@ (Index (Var locations_array__) (Var current_statement__)))))))))))) (FunDef ((templates_init - ((() ((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) false)) - (inline false) - (return_type - (Matrix (TypeTrait stan::promote_args_t ((TemplateType T0__))) -1 1)) - (name "vecmufoo_functor__::operator()") - (args - (((Const (Ref (TemplateType T0__))) mu) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body (((Return ((FunCall vecmufoo () ((Var mu) (Var pstream__)))))))))) - (FunDef - ((templates_init - ((((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) true)) + ((((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) false)) (inline false) (return_type (Matrix (TypeTrait stan::promote_args_t ((TemplateType T0__))) -1 1)) @@ -5979,18 +4853,6 @@ (FunCall stan::lang::rethrow_located () ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init - ((() ((Typename T0__) (RequireIs stan::is_stan_scalar T0__))) false)) - (inline false) - (return_type - (Matrix (TypeTrait stan::promote_args_t ((TemplateType T0__))) -1 1)) - (name "vecmubar_functor__::operator()") - (args - (((Const (Ref (TemplateType T0__))) mu) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body (((Return ((FunCall vecmubar () ((Var mu) (Var pstream__)))))))))) (FunDef ((templates_init ((((Typename T0__) (Typename T1__) (Typename T2__) @@ -5999,7 +4861,7 @@ (RequireIs stan::is_col_vector T1__) (RequireIs stan::is_vt_not_complex T1__) (RequireIs stan::is_stan_scalar T2__))) - true)) + false)) (inline false) (return_type (Matrix @@ -6089,42 +4951,13 @@ (FunCall stan::lang::rethrow_located () ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init - ((() - ((Typename T0__) (Typename T1__) (Typename T2__) - (RequireIs stan::is_col_vector T0__) - (RequireIs stan::is_vt_not_complex T0__) - (RequireIs stan::is_col_vector T1__) - (RequireIs stan::is_vt_not_complex T1__) - (RequireIs stan::is_stan_scalar T2__))) - false)) - (inline false) - (return_type - (Matrix - (TypeTrait stan::promote_args_t - ((TemplateType stan::base_type_t) - (TemplateType stan::base_type_t) (TemplateType T2__))) - -1 1)) - (name "algebra_system_functor__::operator()") - (args - (((Const (Ref (TemplateType T0__))) x) - ((Const (Ref (TemplateType T1__))) y) - ((Const (Ref (StdVector (TemplateType T2__)))) dat) - ((Const (Ref (StdVector Int))) dat_int) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall algebra_system () - ((Var x) (Var y) (Var dat) (Var dat_int) (Var pstream__)))))))))) (FunDef ((templates_init ((((Typename T0__) (Typename T1__) (RequireIs stan::is_col_vector T0__) (RequireIs stan::is_vt_not_complex T0__) (RequireIs stan::is_col_vector T1__) (RequireIs stan::is_vt_not_complex T1__))) - true)) + false)) (inline false) (return_type (Matrix @@ -6191,33 +5024,6 @@ (FunCall stan::lang::rethrow_located () ((Var e) (Index (Var locations_array__) (Var current_statement__)))))))))))) - (FunDef - ((templates_init - ((() - ((Typename T0__) (Typename T1__) (RequireIs stan::is_col_vector T0__) - (RequireIs stan::is_vt_not_complex T0__) - (RequireIs stan::is_col_vector T1__) - (RequireIs stan::is_vt_not_complex T1__))) - false)) - (inline false) - (return_type - (Matrix - (TypeTrait stan::promote_args_t - ((TemplateType stan::base_type_t) - (TemplateType stan::base_type_t))) - -1 1)) - (name "binomialf_functor__::operator()") - (args - (((Const (Ref (TemplateType T0__))) phi) - ((Const (Ref (TemplateType T1__))) theta) - ((Const (Ref (StdVector Double))) x_r) - ((Const (Ref (StdVector Int))) x_i) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers (Const)) - (body - (((Return - ((FunCall binomialf () - ((Var phi) (Var theta) (Var x_r) (Var x_i) (Var pstream__)))))))))) (Class ((class_name mother_model) (final true) (public_base (TypeTrait model_base_crtp ((TypeLiteral mother_model)))) diff --git a/test/integration/good/code-gen/ode/cpp.expected b/test/integration/good/code-gen/ode/cpp.expected index 14253fe84e..b51074200a 100644 --- a/test/integration/good/code-gen/ode/cpp.expected +++ b/test/integration/good/code-gen/ode/cpp.expected @@ -42,16 +42,30 @@ static constexpr std::array locations_array__ = " (in 'ode_adjoint_test_model.stan', line 5, column 43 to line 7, column 3)", " (in 'ode_adjoint_test_model.stan', line 9, column 4 to column 13)", " (in 'ode_adjoint_test_model.stan', line 8, column 50 to line 10, column 3)"}; -struct f_1_arg_functor__ { - template , + stan::is_col_vector, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix>,-1,1> +f_0_arg(const T0__& t, const T1__& z_arg__, std::ostream* pstream__); +struct f_0_arg_variadic2_functor__ { + template , stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar>* = nullptr> - Eigen::Matrix, T2__>,-1,1> - operator()(const T0__& t, const T1__& z, const T2__& a, std::ostream* - pstream__) const; + stan::is_vt_not_complex>* = nullptr> + Eigen::Matrix>,-1,1> + operator()(const T0__& t, const T1__& z, std::ostream* pstream__) const { + return f_0_arg(t, z, pstream__); + } }; +template , + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar>* = nullptr> +Eigen::Matrix, T2__>,-1,1> +f_1_arg(const T0__& t, const T1__& z_arg__, const T2__& a, std::ostream* + pstream__); struct f_1_arg_variadic2_functor__ { template , @@ -60,8 +74,18 @@ struct f_1_arg_variadic2_functor__ { stan::is_stan_scalar>* = nullptr> Eigen::Matrix, T2__>,-1,1> operator()(const T0__& t, const T1__& z, std::ostream* pstream__, - const T2__& a) const; + const T2__& a) const { + return f_1_arg(t, z, a, pstream__); + } }; +template , + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar>* = nullptr> +Eigen::Matrix, T3__>,-1,1> +f_2_arg(const T0__& t, const T1__& z_arg__, const int& b, const T3__& a, + std::ostream* pstream__); struct f_2_arg_variadic2_functor__ { template , @@ -70,38 +94,14 @@ struct f_2_arg_variadic2_functor__ { stan::is_stan_scalar>* = nullptr> Eigen::Matrix, T3__>,-1,1> operator()(const T0__& t, const T1__& z, std::ostream* pstream__, - const int& b, const T3__& a) const; -}; -struct f_0_arg_functor__ { - template , - stan::is_col_vector, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& t, const T1__& z, std::ostream* pstream__) const; -}; -struct f_2_arg_functor__ { - template , - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar>* = nullptr> - Eigen::Matrix, T3__>,-1,1> - operator()(const T0__& t, const T1__& z, const int& b, const T3__& a, - std::ostream* pstream__) const; -}; -struct f_0_arg_variadic2_functor__ { - template , - stan::is_col_vector, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& t, const T1__& z, std::ostream* pstream__) const; + const int& b, const T3__& a) const { + return f_2_arg(t, z, b, a, pstream__); + } }; template , stan::is_col_vector, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix>,-1,1> f_0_arg(const T0__& t, const T1__& z_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t, - stan::is_col_vector, - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,1> -f_0_arg_functor__::operator()(const T0__& t, const T1__& z, std::ostream* - pstream__) const { - return f_0_arg(t, z, pstream__); -} -template , - stan::is_col_vector, - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,1> -f_0_arg_variadic2_functor__::operator()(const T0__& t, const T1__& z, - std::ostream* pstream__) const { - return f_0_arg(t, z, pstream__); -} template , stan::is_col_vector, stan::is_vt_not_complex, - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> Eigen::Matrix, T2__>,-1,1> f_1_arg(const T0__& t, const T1__& z_arg__, const T2__& a, std::ostream* pstream__) { @@ -164,32 +146,11 @@ f_1_arg(const T0__& t, const T1__& z_arg__, const T2__& a, std::ostream* stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar>*> -Eigen::Matrix, T2__>,-1,1> -f_1_arg_functor__::operator()(const T0__& t, const T1__& z, const T2__& a, - std::ostream* pstream__) const { - return f_1_arg(t, z, a, pstream__); -} -template , - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar>*> -Eigen::Matrix, T2__>,-1,1> -f_1_arg_variadic2_functor__::operator()(const T0__& t, const T1__& z, - std::ostream* pstream__, const T2__& - a) const { - return f_1_arg(t, z, a, pstream__); -} template , stan::is_col_vector, stan::is_vt_not_complex, - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> Eigen::Matrix, T3__>,-1,1> f_2_arg(const T0__& t, const T1__& z_arg__, const int& b, const T3__& a, std::ostream* pstream__) { @@ -210,27 +171,6 @@ f_2_arg(const T0__& t, const T1__& z_arg__, const int& b, const T3__& a, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar>*> -Eigen::Matrix, T3__>,-1,1> -f_2_arg_functor__::operator()(const T0__& t, const T1__& z, const int& b, - const T3__& a, std::ostream* pstream__) const { - return f_2_arg(t, z, b, a, pstream__); -} -template , - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar>*> -Eigen::Matrix, T3__>,-1,1> -f_2_arg_variadic2_functor__::operator()(const T0__& t, const T1__& z, - std::ostream* pstream__, const int& - b, const T3__& a) const { - return f_2_arg(t, z, b, a, pstream__); -} class ode_adjoint_test_model_model final : public model_base_crtp { private: int N; @@ -761,6 +701,21 @@ static constexpr std::array locations_array__ = " (in 'overloaded-ode.stan', line 36, column 4 to column 39)", " (in 'overloaded-ode.stan', line 38, column 4 to column 16)", " (in 'overloaded-ode.stan', line 29, column 22 to line 39, column 3)"}; +template , + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +Eigen::Matrix, T2__, T3__, + T4__, stan::promote_args_t>,-1,1> +simple_SIR(const T0__& t, const T1__& y_arg__, const T2__& beta, const T3__& + kappa, const T4__& gamma, const T5__& xi, const T6__& delta, + std::ostream* pstream__); struct simple_SIR_variadic2_functor__ { template >,-1,1> operator()(const T0__& t, const T1__& y, std::ostream* pstream__, const T2__& beta, const T3__& kappa, const T4__& gamma, - const T5__& xi, const T6__& delta) const; + const T5__& xi, const T6__& delta) const { + return simple_SIR(t, y, beta, kappa, gamma, xi, delta, pstream__); + } +}; +template , + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +Eigen::Matrix, T2__, T3__, + T4__, stan::promote_args_t>,-1,1> +simple_SIR(const T0__& t, const T1__& y_arg__, const T2__& beta, const T3__& + kappa, const T4__& gamma, const T5__& xi, const T6__& delta, + const int& unused, std::ostream* pstream__); +struct simple_SIR_variadic2_functor__ { template , @@ -791,39 +765,9 @@ struct simple_SIR_variadic2_functor__ { T3__, T4__, stan::promote_args_t>,-1,1> operator()(const T0__& t, const T1__& y, std::ostream* pstream__, const T2__& beta, const T3__& kappa, const T4__& gamma, - const T5__& xi, const T6__& delta, const int& unused) const; -}; -struct simple_SIR_functor__ { - template , - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - Eigen::Matrix, T2__, - T3__, T4__, stan::promote_args_t>,-1,1> - operator()(const T0__& t, const T1__& y, const T2__& beta, const T3__& - kappa, const T4__& gamma, const T5__& xi, const T6__& delta, - std::ostream* pstream__) const; - template , - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - Eigen::Matrix, T2__, - T3__, T4__, stan::promote_args_t>,-1,1> - operator()(const T0__& t, const T1__& y, const T2__& beta, const T3__& - kappa, const T4__& gamma, const T5__& xi, const T6__& delta, - const int& unused, std::ostream* pstream__) const; + const T5__& xi, const T6__& delta, const int& unused) const { + return simple_SIR(t, y, beta, kappa, gamma, xi, delta, unused, pstream__); + } }; template , stan::is_stan_scalar, stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> Eigen::Matrix, T2__, T3__, T4__, stan::promote_args_t>,-1,1> simple_SIR(const T0__& t, const T1__& y_arg__, const T2__& beta, const T3__& @@ -894,43 +838,6 @@ template >*> Eigen::Matrix, T2__, T3__, T4__, stan::promote_args_t>,-1,1> -simple_SIR_functor__::operator()(const T0__& t, const T1__& y, const T2__& - beta, const T3__& kappa, const T4__& gamma, - const T5__& xi, const T6__& delta, - std::ostream* pstream__) const { - return simple_SIR(t, y, beta, kappa, gamma, xi, delta, pstream__); -} -template , - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>*> -Eigen::Matrix, T2__, T3__, - T4__, stan::promote_args_t>,-1,1> -simple_SIR_variadic2_functor__::operator()(const T0__& t, const T1__& y, - std::ostream* pstream__, - const T2__& beta, const T3__& - kappa, const T4__& gamma, - const T5__& xi, const T6__& delta) const { - return simple_SIR(t, y, beta, kappa, gamma, xi, delta, pstream__); -} -template , - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> -Eigen::Matrix, T2__, T3__, - T4__, stan::promote_args_t>,-1,1> simple_SIR(const T0__& t, const T1__& y_arg__, const T2__& beta, const T3__& kappa, const T4__& gamma, const T5__& xi, const T6__& delta, const int& unused, std::ostream* pstream__) { @@ -981,44 +888,6 @@ simple_SIR(const T0__& t, const T1__& y_arg__, const T2__& beta, const T3__& stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>*> -Eigen::Matrix, T2__, T3__, - T4__, stan::promote_args_t>,-1,1> -simple_SIR_functor__::operator()(const T0__& t, const T1__& y, const T2__& - beta, const T3__& kappa, const T4__& gamma, - const T5__& xi, const T6__& delta, - const int& unused, std::ostream* pstream__) const { - return simple_SIR(t, y, beta, kappa, gamma, xi, delta, unused, pstream__); -} -template , - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>*> -Eigen::Matrix, T2__, T3__, - T4__, stan::promote_args_t>,-1,1> -simple_SIR_variadic2_functor__::operator()(const T0__& t, const T1__& y, - std::ostream* pstream__, - const T2__& beta, const T3__& - kappa, const T4__& gamma, - const T5__& xi, const T6__& delta, - const int& unused) const { - return simple_SIR(t, y, beta, kappa, gamma, xi, delta, unused, pstream__); -} class overloaded_ode_model final : public model_base_crtp { private: int N_t; diff --git a/test/integration/good/code-gen/standalone_functions/cpp.expected b/test/integration/good/code-gen/standalone_functions/cpp.expected index 32b8e49bc5..63b77049ed 100644 --- a/test/integration/good/code-gen/standalone_functions/cpp.expected +++ b/test/integration/good/code-gen/standalone_functions/cpp.expected @@ -27,65 +27,43 @@ static constexpr std::array locations_array__ = " (in 'basic.stan', line 34, column 24 to line 36, column 3)", " (in 'basic.stan', line 39, column 4 to column 33)", " (in 'basic.stan', line 38, column 33 to line 40, column 3)"}; -struct test_rng_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const T0__& a, RNG& base_rng__, std::ostream* pstream__) const; -}; -struct test_lpdf_functor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const T0__& a, const T1__& b, std::ostream* pstream__) const; -}; -struct my_vector_mul_by_5_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& x, std::ostream* pstream__) const; -}; -struct my_log1p_exp_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const T0__& x, std::ostream* pstream__) const; -}; -struct array_fun_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector& a, std::ostream* pstream__) const; -}; -struct int_array_fun_functor__ { - double operator()(const std::vector& a, std::ostream* pstream__) const; -}; -struct test_lp_functor__ { - template >* = nullptr> - void - operator()(const T0__& a, T_lp__& lp__, T_lp_accum__& lp_accum__, - std::ostream* pstream__) const; -}; -struct test_lgamma_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const T0__& x, std::ostream* pstream__) const; -}; -struct int_only_multiplication_functor__ { - int operator()(const int& a, const int& b, std::ostream* pstream__) const; -}; +template >* = nullptr> +stan::promote_args_t +my_log1p_exp(const T0__& x, std::ostream* pstream__); template >* = nullptr> stan::promote_args_t array_fun(const std::vector& a, std::ostream* pstream__); +double int_array_fun(const std::vector& a, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix>,-1,1> +my_vector_mul_by_5(const T0__& x_arg__, std::ostream* pstream__); +int +int_only_multiplication(const int& a, const int& b, std::ostream* pstream__); template >* = nullptr> stan::promote_args_t +test_lgamma(const T0__& x, std::ostream* pstream__); +template >* = nullptr> +void +test_lp(const T0__& a, T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* + pstream__); +template >* = nullptr> +stan::promote_args_t +test_rng(const T0__& a, RNG& base_rng__, std::ostream* pstream__); +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +test_lpdf(const T0__& a, const T1__& b, std::ostream* pstream__); +template >*> +stan::promote_args_t my_log1p_exp(const T0__& x, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -104,11 +82,6 @@ my_log1p_exp(const T0__& x, std::ostream* pstream__) { } template >*> stan::promote_args_t -my_log1p_exp_functor__::operator()(const T0__& x, std::ostream* pstream__) const { - return my_log1p_exp(x, pstream__); -} -template >*> -stan::promote_args_t array_fun(const std::vector& a, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -125,12 +98,6 @@ array_fun(const std::vector& a, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -array_fun_functor__::operator()(const std::vector& a, std::ostream* - pstream__) const { - return array_fun(a, pstream__); -} double int_array_fun(const std::vector& a, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -147,14 +114,9 @@ double int_array_fun(const std::vector& a, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -double -int_array_fun_functor__::operator()(const std::vector& a, std::ostream* - pstream__) const { - return int_array_fun(a, pstream__); -} template , - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix>,-1,1> my_vector_mul_by_5(const T0__& x_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; @@ -182,14 +144,6 @@ my_vector_mul_by_5(const T0__& x_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,1> -my_vector_mul_by_5_functor__::operator()(const T0__& x, std::ostream* - pstream__) const { - return my_vector_mul_by_5(x, pstream__); -} int int_only_multiplication(const int& a, const int& b, std::ostream* pstream__) { using local_scalar_t__ = double; @@ -207,13 +161,7 @@ int_only_multiplication(const int& a, const int& b, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -int_only_multiplication_functor__::operator()(const int& a, const int& b, - std::ostream* pstream__) const { - return int_only_multiplication(a, b, pstream__); -} -template >* = nullptr> +template >*> stan::promote_args_t test_lgamma(const T0__& x, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -231,14 +179,9 @@ test_lgamma(const T0__& x, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -test_lgamma_functor__::operator()(const T0__& x, std::ostream* pstream__) const { - return test_lgamma(x, pstream__); -} template >* = nullptr> + stan::require_all_t>*> void test_lp(const T0__& a, T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) { @@ -254,16 +197,8 @@ test_lp(const T0__& a, T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -void -test_lp_functor__::operator()(const T0__& a, T_lp__& lp__, T_lp_accum__& - lp_accum__, std::ostream* pstream__) const { - return test_lp(a, lp__, lp_accum__, pstream__); -} template >* = nullptr> + stan::require_all_t>*> stan::promote_args_t test_rng(const T0__& a, RNG& base_rng__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -281,16 +216,9 @@ test_rng(const T0__& a, RNG& base_rng__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -test_rng_functor__::operator()(const T0__& a, RNG& base_rng__, std::ostream* - pstream__) const { - return test_rng(a, base_rng__, pstream__); -} template , - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> stan::promote_args_t test_lpdf(const T0__& a, const T1__& b, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -305,14 +233,6 @@ test_lpdf(const T0__& a, const T1__& b, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar>*> -stan::promote_args_t -test_lpdf_functor__::operator()(const T0__& a, const T1__& b, std::ostream* - pstream__) const { - return test_lpdf(a, b, pstream__); -} } // [[stan::function]] auto my_log1p_exp(const double& x, std::ostream* pstream__ = nullptr) { @@ -390,61 +310,43 @@ static constexpr std::array locations_array__ = " (in 'basic.stanfunctions', line 31, column 22 to line 33, column 1)", " (in 'basic.stanfunctions', line 36, column 2 to column 31)", " (in 'basic.stanfunctions', line 35, column 31 to line 37, column 1)"}; -struct test_rng_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const T0__& a, RNG& base_rng__, std::ostream* pstream__) const; -}; -struct test_lpdf_functor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const T0__& a, const T1__& b, std::ostream* pstream__) const; -}; -struct my_vector_mul_by_5_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& x, std::ostream* pstream__) const; -}; -struct my_log1p_exp_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const T0__& x, std::ostream* pstream__) const; -}; -struct array_fun_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector& a, std::ostream* pstream__) const; -}; -struct int_array_fun_functor__ { - double operator()(const std::vector& a, std::ostream* pstream__) const; -}; -struct test_lp_functor__ { - template >* = nullptr> - void - operator()(const T0__& a, T_lp__& lp__, T_lp_accum__& lp_accum__, - std::ostream* pstream__) const; -}; -struct test_lgamma_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const T0__& x, std::ostream* pstream__) const; -}; -struct int_only_multiplication_functor__ { - int operator()(const int& a, const int& b, std::ostream* pstream__) const; -}; template >* = nullptr> stan::promote_args_t +my_log1p_exp(const T0__& x, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t +array_fun(const std::vector& a, std::ostream* pstream__); +double int_array_fun(const std::vector& a, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix>,-1,1> +my_vector_mul_by_5(const T0__& x_arg__, std::ostream* pstream__); +int +int_only_multiplication(const int& a, const int& b, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t +test_lgamma(const T0__& x, std::ostream* pstream__); +template >* = nullptr> +void +test_lp(const T0__& a, T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* + pstream__); +template >* = nullptr> +stan::promote_args_t +test_rng(const T0__& a, RNG& base_rng__, std::ostream* pstream__); +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +test_lpdf(const T0__& a, const T1__& b, std::ostream* pstream__); +template >*> +stan::promote_args_t my_log1p_exp(const T0__& x, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -463,12 +365,6 @@ my_log1p_exp(const T0__& x, std::ostream* pstream__) { } template >*> stan::promote_args_t -my_log1p_exp_functor__::operator()(const T0__& x, std::ostream* pstream__) const { - return my_log1p_exp(x, pstream__); -} -template >* = nullptr> -stan::promote_args_t array_fun(const std::vector& a, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -485,12 +381,6 @@ array_fun(const std::vector& a, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -array_fun_functor__::operator()(const std::vector& a, std::ostream* - pstream__) const { - return array_fun(a, pstream__); -} double int_array_fun(const std::vector& a, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -507,14 +397,9 @@ double int_array_fun(const std::vector& a, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -double -int_array_fun_functor__::operator()(const std::vector& a, std::ostream* - pstream__) const { - return int_array_fun(a, pstream__); -} template , - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix>,-1,1> my_vector_mul_by_5(const T0__& x_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; @@ -542,14 +427,6 @@ my_vector_mul_by_5(const T0__& x_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,1> -my_vector_mul_by_5_functor__::operator()(const T0__& x, std::ostream* - pstream__) const { - return my_vector_mul_by_5(x, pstream__); -} int int_only_multiplication(const int& a, const int& b, std::ostream* pstream__) { using local_scalar_t__ = double; @@ -567,13 +444,7 @@ int_only_multiplication(const int& a, const int& b, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -int_only_multiplication_functor__::operator()(const int& a, const int& b, - std::ostream* pstream__) const { - return int_only_multiplication(a, b, pstream__); -} -template >* = nullptr> +template >*> stan::promote_args_t test_lgamma(const T0__& x, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -591,14 +462,9 @@ test_lgamma(const T0__& x, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -test_lgamma_functor__::operator()(const T0__& x, std::ostream* pstream__) const { - return test_lgamma(x, pstream__); -} template >* = nullptr> + stan::require_all_t>*> void test_lp(const T0__& a, T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) { @@ -614,16 +480,8 @@ test_lp(const T0__& a, T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -void -test_lp_functor__::operator()(const T0__& a, T_lp__& lp__, T_lp_accum__& - lp_accum__, std::ostream* pstream__) const { - return test_lp(a, lp__, lp_accum__, pstream__); -} template >* = nullptr> + stan::require_all_t>*> stan::promote_args_t test_rng(const T0__& a, RNG& base_rng__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -641,16 +499,9 @@ test_rng(const T0__& a, RNG& base_rng__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -test_rng_functor__::operator()(const T0__& a, RNG& base_rng__, std::ostream* - pstream__) const { - return test_rng(a, base_rng__, pstream__); -} template , - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> stan::promote_args_t test_lpdf(const T0__& a, const T1__& b, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -665,14 +516,6 @@ test_lpdf(const T0__& a, const T1__& b, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar>*> -stan::promote_args_t -test_lpdf_functor__::operator()(const T0__& a, const T1__& b, std::ostream* - pstream__) const { - return test_lpdf(a, b, pstream__); -} } // [[stan::function]] auto my_log1p_exp(const double& x, std::ostream* pstream__ = nullptr) { @@ -740,16 +583,20 @@ static constexpr std::array locations_array__ = " (in 'integrate.stan', line 15, column 4 to column 21)", " (in 'integrate.stan', line 21, column 4 to line 23, column 61)", " (in 'integrate.stan', line 14, column 23 to line 24, column 3)"}; -struct integrand_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& x, std::ostream* pstream__) const; -}; -struct ode_integrate_functor__ { - double operator()(std::ostream* pstream__) const; -}; +template , + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix>,-1,1> +integrand(const T0__& x_arg__, std::ostream* pstream__); +template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +std::vector> +integrand_ode(const T0__& r, const std::vector& f, + const std::vector& theta, const std::vector& x_r, + const std::vector& x_i, std::ostream* pstream__); struct integrand_ode_functor__ { template , @@ -759,11 +606,14 @@ struct integrand_ode_functor__ { std::vector> operator()(const T0__& r, const std::vector& f, const std::vector& theta, const std::vector& x_r, - const std::vector& x_i, std::ostream* pstream__) const; + const std::vector& x_i, std::ostream* pstream__) const { + return integrand_ode(r, f, theta, x_r, x_i, pstream__); + } }; +double ode_integrate(std::ostream* pstream__); template , - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix>,-1,1> integrand(const T0__& x_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; @@ -782,18 +632,11 @@ integrand(const T0__& x_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,1> -integrand_functor__::operator()(const T0__& x, std::ostream* pstream__) const { - return integrand(x, pstream__); -} template , stan::is_stan_scalar, stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> std::vector> integrand_ode(const T0__& r, const std::vector& f, const std::vector& theta, const std::vector& x_r, @@ -821,19 +664,6 @@ integrand_ode(const T0__& r, const std::vector& f, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>*> -std::vector> -integrand_ode_functor__::operator()(const T0__& r, const std::vector& - f, const std::vector& theta, - const std::vector& x_r, - const std::vector& x_i, - std::ostream* pstream__) const { - return integrand_ode(r, f, theta, x_r, x_i, pstream__); -} double ode_integrate(std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -859,9 +689,6 @@ double ode_integrate(std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -double ode_integrate_functor__::operator()(std::ostream* pstream__) const { - return ode_integrate(pstream__); -} } // [[stan::function]] auto diff --git a/test/integration/good/compiler-optimizations/cpp.expected b/test/integration/good/compiler-optimizations/cpp.expected index 5203be916c..dc9fc5c6e8 100644 --- a/test/integration/good/compiler-optimizations/cpp.expected +++ b/test/integration/good/compiler-optimizations/cpp.expected @@ -1866,6 +1866,15 @@ static constexpr std::array locations_array__ = " (in 'ad-level-failing.stan', line 17, column 4 to column 48)", " (in 'ad-level-failing.stan', line 19, column 4 to column 16)", " (in 'ad-level-failing.stan', line 11, column 61 to line 20, column 3)"}; +template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +std::vector> +simple_SIR(const T0__& t, const std::vector& y, + const std::vector& theta, const std::vector& x_r, + const std::vector& x_i, std::ostream* pstream__); struct simple_SIR_functor__ { template , @@ -1875,13 +1884,15 @@ struct simple_SIR_functor__ { std::vector> operator()(const T0__& t, const std::vector& y, const std::vector& theta, const std::vector& x_r, - const std::vector& x_i, std::ostream* pstream__) const; + const std::vector& x_i, std::ostream* pstream__) const { + return simple_SIR(t, y, theta, x_r, x_i, pstream__); + } }; template , stan::is_stan_scalar, stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> std::vector> simple_SIR(const T0__& t, const std::vector& y, const std::vector& theta, const std::vector& x_r, @@ -1937,19 +1948,6 @@ simple_SIR(const T0__& t, const std::vector& y, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>*> -std::vector> -simple_SIR_functor__::operator()(const T0__& t, const std::vector& y, - const std::vector& theta, - const std::vector& x_r, - const std::vector& x_i, std::ostream* - pstream__) const { - return simple_SIR(t, y, theta, x_r, x_i, pstream__); -} class ad_level_failing_model final : public model_base_crtp { private: double lcm_sym26__; @@ -2563,23 +2561,17 @@ static constexpr std::array locations_array__ = " (in 'copy_fail.stan', line 21, column 4 to column 13)", " (in 'copy_fail.stan', line 12, column 36 to line 22, column 3)", " (in 'copy_fail.stan', line 24, column 74 to line 46, column 3)"}; -struct last_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; -struct prob_uncaptured_functor__ { - template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix, - stan::base_type_t>,-1,-1> - operator()(const int& nind, const int& n_occasions, const T2__& p, - const T3__& phi, std::ostream* pstream__) const; -}; -struct first_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; +int first_capture(const std::vector& y_i, std::ostream* pstream__); +int last_capture(const std::vector& y_i, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, + const T3__& phi_arg__, std::ostream* pstream__); int first_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -2617,11 +2609,6 @@ int first_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -first_capture_functor__::operator()(const std::vector& y_i, - std::ostream* pstream__) const { - return first_capture(y_i, pstream__); -} int last_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -2665,16 +2652,11 @@ int last_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -last_capture_functor__::operator()(const std::vector& y_i, std::ostream* - pstream__) const { - return last_capture(y_i, pstream__); -} template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix, stan::base_type_t>,-1,-1> prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, @@ -2805,18 +2787,6 @@ prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured_functor__::operator()(const int& nind, const int& - n_occasions, const T2__& p, const T3__& - phi, std::ostream* pstream__) const { - return prob_uncaptured(nind, n_occasions, p, phi, pstream__); -} class copy_fail_model final : public model_base_crtp { private: int lcm_sym118__; @@ -8330,23 +8300,17 @@ static constexpr std::array locations_array__ = " (in 'expr-prop-fail5.stan', line 21, column 4 to column 13)", " (in 'expr-prop-fail5.stan', line 12, column 36 to line 22, column 3)", " (in 'expr-prop-fail5.stan', line 24, column 74 to line 48, column 3)"}; -struct last_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; -struct prob_uncaptured_functor__ { - template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix, - stan::base_type_t>,-1,-1> - operator()(const int& nind, const int& n_occasions, const T2__& p, - const T3__& phi, std::ostream* pstream__) const; -}; -struct first_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; +int first_capture(const std::vector& y_i, std::ostream* pstream__); +int last_capture(const std::vector& y_i, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, + const T3__& phi_arg__, std::ostream* pstream__); int first_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -8384,11 +8348,6 @@ int first_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -first_capture_functor__::operator()(const std::vector& y_i, - std::ostream* pstream__) const { - return first_capture(y_i, pstream__); -} int last_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -8432,16 +8391,11 @@ int last_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -last_capture_functor__::operator()(const std::vector& y_i, std::ostream* - pstream__) const { - return last_capture(y_i, pstream__); -} template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix, stan::base_type_t>,-1,-1> prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, @@ -8572,18 +8526,6 @@ prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured_functor__::operator()(const int& nind, const int& - n_occasions, const T2__& p, const T3__& - phi, std::ostream* pstream__) const { - return prob_uncaptured(nind, n_occasions, p, phi, pstream__); -} class expr_prop_fail5_model final : public model_base_crtp { private: int lcm_sym115__; @@ -9942,41 +9884,35 @@ static constexpr std::array locations_array__ = " (in 'expr-prop-fail6.stan', line 28, column 36 to line 36, column 3)", " (in 'expr-prop-fail6.stan', line 48, column 47 to line 65, column 3)", " (in 'expr-prop-fail6.stan', line 81, column 74 to line 143, column 3)"}; -struct js_super_lp_functor__ { - template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - void - operator()(const std::vector>& y, const std::vector& - first, const std::vector& last, const T3__& p, const T4__& - phi, const T5__& psi, const T6__& nu, const T7__& chi, T_lp__& - lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) const; -}; -struct last_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; -struct prob_uncaptured_functor__ { - template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix, - stan::base_type_t>,-1,-1> - operator()(const T0__& p, const T1__& phi, std::ostream* pstream__) const; -}; -struct first_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; +int first_capture(const std::vector& y_i, std::ostream* pstream__); +int last_capture(const std::vector& y_i, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const T0__& p_arg__, const T1__& phi_arg__, std::ostream* + pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +void +js_super_lp(const std::vector>& y, const std::vector& + first, const std::vector& last, const T3__& p_arg__, + const T4__& phi_arg__, const T5__& psi, const T6__& nu_arg__, + const T7__& chi_arg__, T_lp__& lp__, T_lp_accum__& lp_accum__, + std::ostream* pstream__); int first_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -10014,11 +9950,6 @@ int first_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -first_capture_functor__::operator()(const std::vector& y_i, - std::ostream* pstream__) const { - return first_capture(y_i, pstream__); -} int last_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -10062,16 +9993,11 @@ int last_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -last_capture_functor__::operator()(const std::vector& y_i, std::ostream* - pstream__) const { - return last_capture(y_i, pstream__); -} template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix, stan::base_type_t>,-1,-1> prob_uncaptured(const T0__& p_arg__, const T1__& phi_arg__, std::ostream* @@ -10209,17 +10135,6 @@ prob_uncaptured(const T0__& p_arg__, const T1__& phi_arg__, std::ostream* stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured_functor__::operator()(const T0__& p, const T1__& phi, - std::ostream* pstream__) const { - return prob_uncaptured(p, phi, pstream__); -} template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> void js_super_lp(const std::vector>& y, const std::vector& first, const std::vector& last, const T3__& p_arg__, @@ -10757,29 +10672,6 @@ js_super_lp(const std::vector>& y, const std::vector& stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -void -js_super_lp_functor__::operator()(const std::vector>& y, - const std::vector& first, - const std::vector& last, const T3__& - p, const T4__& phi, const T5__& psi, - const T6__& nu, const T7__& chi, T_lp__& - lp__, T_lp_accum__& lp_accum__, - std::ostream* pstream__) const { - return js_super_lp(y, first, last, p, phi, psi, nu, chi, lp__, - lp_accum__, pstream__); -} class expr_prop_fail6_model final : public model_base_crtp { private: int lcm_sym248__; @@ -14537,23 +14429,17 @@ static constexpr std::array locations_array__ = " (in 'fails-test.stan', line 21, column 4 to column 13)", " (in 'fails-test.stan', line 12, column 36 to line 22, column 3)", " (in 'fails-test.stan', line 24, column 74 to line 46, column 3)"}; -struct last_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; -struct prob_uncaptured_functor__ { - template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix, - stan::base_type_t>,-1,-1> - operator()(const int& nind, const int& n_occasions, const T2__& p, - const T3__& phi, std::ostream* pstream__) const; -}; -struct first_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; +int first_capture(const std::vector& y_i, std::ostream* pstream__); +int last_capture(const std::vector& y_i, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, + const T3__& phi_arg__, std::ostream* pstream__); int first_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -14591,11 +14477,6 @@ int first_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -first_capture_functor__::operator()(const std::vector& y_i, - std::ostream* pstream__) const { - return first_capture(y_i, pstream__); -} int last_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -14639,16 +14520,11 @@ int last_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -last_capture_functor__::operator()(const std::vector& y_i, std::ostream* - pstream__) const { - return last_capture(y_i, pstream__); -} template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix, stan::base_type_t>,-1,-1> prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, @@ -14779,18 +14655,6 @@ prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured_functor__::operator()(const int& nind, const int& - n_occasions, const T2__& p, const T3__& - phi, std::ostream* pstream__) const { - return prob_uncaptured(nind, n_occasions, p, phi, pstream__); -} class fails_test_model final : public model_base_crtp { private: int lcm_sym118__; @@ -16069,22 +15933,17 @@ static constexpr std::array locations_array__ = " (in 'function-in-function-loops.stan', line 6, column 6 to column 15)", " (in 'function-in-function-loops.stan', line 13, column 8 to column 43)", " (in 'function-in-function-loops.stan', line 9, column 24 to line 16, column 3)"}; -struct summer_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - stan::promote_args_t> - operator()(const T0__& et, std::ostream* pstream__) const; -}; -struct do_something_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const T0__& x, std::ostream* pstream__) const; -}; template >* = nullptr> stan::promote_args_t +do_something(const T0__& x, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +stan::promote_args_t> +summer(const T0__& et_arg__, std::ostream* pstream__); +template >*> +stan::promote_args_t do_something(const T0__& x, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -16101,14 +15960,9 @@ do_something(const T0__& x, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -do_something_functor__::operator()(const T0__& x, std::ostream* pstream__) const { - return do_something(x, pstream__); -} template , - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> stan::promote_args_t> summer(const T0__& et_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; @@ -16154,13 +16008,6 @@ summer(const T0__& et_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -stan::promote_args_t> -summer_functor__::operator()(const T0__& et, std::ostream* pstream__) const { - return summer(et, pstream__); -} class function_in_function_loops_model final : public model_base_crtp { private: int N; @@ -16503,24 +16350,20 @@ static constexpr std::array locations_array__ = " (in 'inline-functions-varmat.stan', line 2, column 34 to line 4, column 3)", " (in 'inline-functions-varmat.stan', line 10, column 6 to column 15)", " (in 'inline-functions-varmat.stan', line 8, column 6 to column 15)"}; -struct single_ret_fun_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& A, std::ostream* pstream__) const; -}; -struct multi_ret_fun_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& A, std::ostream* pstream__) const; -}; template , stan::is_vt_not_complex>* = nullptr> Eigen::Matrix>,-1,1> +single_ret_fun(const T0__& A_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix>,-1,1> +multi_ret_fun(const T0__& A_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>*> +Eigen::Matrix>,-1,1> single_ret_fun(const T0__& A_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; int current_statement__ = 0; @@ -16542,13 +16385,6 @@ template , stan::is_vt_not_complex>*> Eigen::Matrix>,-1,1> -single_ret_fun_functor__::operator()(const T0__& A, std::ostream* pstream__) const { - return single_ret_fun(A, pstream__); -} -template , - stan::is_vt_not_complex>* = nullptr> -Eigen::Matrix>,-1,1> multi_ret_fun(const T0__& A_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; int current_statement__ = 0; @@ -16579,13 +16415,6 @@ multi_ret_fun(const T0__& A_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,1> -multi_ret_fun_functor__::operator()(const T0__& A, std::ostream* pstream__) const { - return multi_ret_fun(A, pstream__); -} class inline_functions_varmat_model final : public model_base_crtp { private: @@ -17045,10 +16874,8 @@ static constexpr std::array locations_array__ = " (in 'inline-tdata.stan', line 10, column 3 to column 31)", " (in 'inline-tdata.stan', line 3, column 4 to column 31)", " (in 'inline-tdata.stan', line 2, column 26 to line 4, column 3)"}; -struct foo_functor__ { - Eigen::Matrix - operator()(const int& N, const int& M, std::ostream* pstream__) const; -}; +Eigen::Matrix +foo(const int& N, const int& M, std::ostream* pstream__); Eigen::Matrix foo(const int& N, const int& M, std::ostream* pstream__) { using local_scalar_t__ = double; @@ -17069,10 +16896,6 @@ foo(const int& N, const int& M, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -Eigen::Matrix -foo_functor__::operator()(const int& N, const int& M, std::ostream* pstream__) const { - return foo(N, M, pstream__); -} class inline_tdata_model final : public model_base_crtp { private: Eigen::Matrix lcm_sym5___data__; @@ -17380,17 +17203,15 @@ static constexpr std::array locations_array__ = " (in 'inliner-same-names.stan', line 17, column 9 to column 10)", " (in 'inliner-same-names.stan', line 9, column 4 to column 15)", " (in 'inliner-same-names.stan', line 2, column 24 to line 10, column 3)"}; -struct foo_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& oR, std::ostream* pstream__) const; -}; template , stan::is_vt_not_complex>* = nullptr> Eigen::Matrix>,-1,1> +foo(const T0__& oR_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>*> +Eigen::Matrix>,-1,1> foo(const T0__& oR_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; int current_statement__ = 0; @@ -17418,13 +17239,6 @@ foo(const T0__& oR_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,1> -foo_functor__::operator()(const T0__& oR, std::ostream* pstream__) const { - return foo(oR, pstream__); -} class inliner_same_names_model final : public model_base_crtp { private: int N; @@ -17894,46 +17708,38 @@ static constexpr std::array locations_array__ = " (in 'inlining-fail2.stan', line 48, column 47 to line 65, column 3)", " (in 'inlining-fail2.stan', line 79, column 70 to line 137, column 3)", " (in 'inlining-fail2.stan', line 148, column 33 to line 158, column 3)"}; -struct prob_uncaptured_functor__ { - template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix, - stan::base_type_t>,-1,-1> - operator()(const T0__& p, const T1__& phi, std::ostream* pstream__) const; -}; -struct first_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; -struct seq_cprob_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& gamma, std::ostream* pstream__) const; -}; -struct last_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; -struct jolly_seber_lp_functor__ { - template , - 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>* = nullptr> - void - operator()(const std::vector>& y, const std::vector& - first, const std::vector& last, const T3__& p, const T4__& - phi, const T5__& gamma, const T6__& chi, T_lp__& lp__, - T_lp_accum__& lp_accum__, std::ostream* pstream__) const; -}; +int first_capture(const std::vector& y_i, std::ostream* pstream__); +int last_capture(const std::vector& y_i, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const T0__& p_arg__, const T1__& phi_arg__, std::ostream* + pstream__); +template , + 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>* = nullptr> +void +jolly_seber_lp(const std::vector>& y, + const std::vector& first, const std::vector& last, + const T3__& p_arg__, const T4__& phi_arg__, const T5__& + gamma_arg__, const T6__& chi_arg__, T_lp__& lp__, + T_lp_accum__& lp_accum__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix>,-1,1> +seq_cprob(const T0__& gamma_arg__, std::ostream* pstream__); int first_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -17971,11 +17777,6 @@ int first_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -first_capture_functor__::operator()(const std::vector& y_i, - std::ostream* pstream__) const { - return first_capture(y_i, pstream__); -} int last_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -18019,16 +17820,11 @@ int last_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -last_capture_functor__::operator()(const std::vector& y_i, std::ostream* - pstream__) const { - return last_capture(y_i, pstream__); -} template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix, stan::base_type_t>,-1,-1> prob_uncaptured(const T0__& p_arg__, const T1__& phi_arg__, std::ostream* @@ -18166,17 +17962,6 @@ prob_uncaptured(const T0__& p_arg__, const T1__& phi_arg__, std::ostream* stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured_functor__::operator()(const T0__& p, const T1__& phi, - std::ostream* pstream__) const { - return prob_uncaptured(p, phi, pstream__); -} template , @@ -18186,7 +17971,7 @@ template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> void jolly_seber_lp(const std::vector>& y, const std::vector& first, const std::vector& last, @@ -18709,30 +18494,9 @@ jolly_seber_lp(const std::vector>& y, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - 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>*> -void -jolly_seber_lp_functor__::operator()(const std::vector>& y, - const std::vector& first, - const std::vector& last, - const T3__& p, const T4__& phi, - const T5__& gamma, const T6__& chi, - T_lp__& lp__, T_lp_accum__& lp_accum__, - std::ostream* pstream__) const { - return jolly_seber_lp(y, first, last, p, phi, gamma, chi, lp__, - lp_accum__, pstream__); -} template , - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix>,-1,1> seq_cprob(const T0__& gamma_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; @@ -18794,13 +18558,6 @@ seq_cprob(const T0__& gamma_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,1> -seq_cprob_functor__::operator()(const T0__& gamma, std::ostream* pstream__) const { - return seq_cprob(gamma, pstream__); -} class inlining_fail2_model final : public model_base_crtp { private: int lcm_sym266__; @@ -21874,23 +21631,17 @@ static constexpr std::array locations_array__ = " (in 'lcm-fails2.stan', line 21, column 4 to column 13)", " (in 'lcm-fails2.stan', line 12, column 36 to line 22, column 3)", " (in 'lcm-fails2.stan', line 24, column 74 to line 46, column 3)"}; -struct last_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; -struct prob_uncaptured_functor__ { - template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix, - stan::base_type_t>,-1,-1> - operator()(const int& nind, const int& n_occasions, const T2__& p, - const T3__& phi, std::ostream* pstream__) const; -}; -struct first_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; +int first_capture(const std::vector& y_i, std::ostream* pstream__); +int last_capture(const std::vector& y_i, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, + const T3__& phi_arg__, std::ostream* pstream__); int first_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -21928,11 +21679,6 @@ int first_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -first_capture_functor__::operator()(const std::vector& y_i, - std::ostream* pstream__) const { - return first_capture(y_i, pstream__); -} int last_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -21976,16 +21722,11 @@ int last_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -last_capture_functor__::operator()(const std::vector& y_i, std::ostream* - pstream__) const { - return last_capture(y_i, pstream__); -} template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix, stan::base_type_t>,-1,-1> prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, @@ -22116,18 +21857,6 @@ prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured_functor__::operator()(const int& nind, const int& - n_occasions, const T2__& p, const T3__& - phi, std::ostream* pstream__) const { - return prob_uncaptured(nind, n_occasions, p, phi, pstream__); -} class lcm_fails2_model final : public model_base_crtp { private: int lcm_sym106__; @@ -23266,29 +22995,22 @@ static constexpr std::array locations_array__ = " (in 'lupdf-inlining.stan', line 5, column 34 to line 7, column 5)", " (in 'lupdf-inlining.stan', line 9, column 8 to column 32)", " (in 'lupdf-inlining.stan', line 8, column 26 to line 10, column 5)"}; -struct foo_lpdf_functor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const T0__& x, const T1__& mu, std::ostream* pstream__) const; -}; -struct bar_lpmf_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const int& n, const T1__& mu, std::ostream* pstream__) const; -}; -struct baz_lpdf_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const T0__& x, std::ostream* pstream__) const; -}; template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t +foo_lpdf(const T0__& x, const T1__& mu, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t +bar_lpmf(const int& n, const T1__& mu, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t baz_lpdf(const T0__& x, std::ostream* pstream__); +template , + stan::is_stan_scalar>*> +stan::promote_args_t foo_lpdf(const T0__& x, const T1__& mu, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -23305,16 +23027,8 @@ foo_lpdf(const T0__& x, const T1__& mu, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar>*> -stan::promote_args_t -foo_lpdf_functor__::operator()(const T0__& x, const T1__& mu, std::ostream* - pstream__) const { - return foo_lpdf(x, mu, pstream__); -} template >* = nullptr> + stan::require_all_t>*> stan::promote_args_t bar_lpmf(const int& n, const T1__& mu, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -23332,15 +23046,8 @@ bar_lpmf(const int& n, const T1__& mu, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -bar_lpmf_functor__::operator()(const int& n, const T1__& mu, std::ostream* - pstream__) const { - return bar_lpmf(n, mu, pstream__); -} template >* = nullptr> + stan::require_all_t>*> stan::promote_args_t baz_lpdf(const T0__& x, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -23357,12 +23064,6 @@ stan::promote_args_t baz_lpdf(const T0__& x, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -baz_lpdf_functor__::operator()(const T0__& x, std::ostream* pstream__) const { - return baz_lpdf(x, pstream__); -} class lupdf_inlining_model final : public model_base_crtp { private: int n; @@ -25348,25 +25049,19 @@ static constexpr std::array locations_array__ = " (in 'optimizations.stan', line 11, column 8 to column 21)", " (in 'optimizations.stan', line 16, column 8 to column 18)", " (in 'optimizations.stan', line 14, column 18 to line 17, column 5)"}; -struct nrfun_lp_functor__ { - template >* = nullptr> - void - operator()(const T0__& x, const int& y, T_lp__& lp__, T_lp_accum__& - lp_accum__, std::ostream* pstream__) const; -}; -struct rfun_lp_functor__ { - template int - operator()(T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) const; -}; -struct rfun_functor__ { - int operator()(const int& y, std::ostream* pstream__) const; -}; template >* = nullptr> void +nrfun_lp(const T0__& x, const int& y, T_lp__& lp__, T_lp_accum__& lp_accum__, + std::ostream* pstream__); +int rfun(const int& y, std::ostream* pstream__); +template int +rfun_lp(T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__); +template >*> +void nrfun_lp(const T0__& x, const int& y, T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -25389,15 +25084,6 @@ nrfun_lp(const T0__& x, const int& y, T_lp__& lp__, T_lp_accum__& lp_accum__, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -void -nrfun_lp_functor__::operator()(const T0__& x, const int& y, T_lp__& lp__, - T_lp_accum__& lp_accum__, std::ostream* - pstream__) const { - return nrfun_lp(x, y, lp__, lp_accum__, pstream__); -} int rfun(const int& y, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -25424,9 +25110,6 @@ int rfun(const int& y, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int rfun_functor__::operator()(const int& y, std::ostream* pstream__) const { - return rfun(y, pstream__); -} template int rfun_lp(T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) { using local_scalar_t__ = double; @@ -25443,11 +25126,6 @@ rfun_lp(T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template int -rfun_lp_functor__::operator()(T_lp__& lp__, T_lp_accum__& lp_accum__, - std::ostream* pstream__) const { - return rfun_lp(lp__, lp_accum__, pstream__); -} class optimizations_model final : public model_base_crtp { private: @@ -26364,15 +26042,11 @@ static constexpr std::array locations_array__ = " (in 'overloaded-fn.stan', line 2, column 20 to line 4, column 4)", " (in 'overloaded-fn.stan', line 7, column 5 to column 20)", " (in 'overloaded-fn.stan', line 6, column 19 to line 8, column 4)"}; -struct dumb_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const T0__& x, std::ostream* pstream__) const; - double operator()(const int& x, std::ostream* pstream__) const; -}; template >* = nullptr> +stan::promote_args_t dumb(const T0__& x, std::ostream* pstream__); +double dumb(const int& x, std::ostream* pstream__); +template >*> stan::promote_args_t dumb(const T0__& x, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -26392,11 +26066,6 @@ stan::promote_args_t dumb(const T0__& x, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -dumb_functor__::operator()(const T0__& x, std::ostream* pstream__) const { - return dumb(x, pstream__); -} double dumb(const int& x, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -26416,10 +26085,6 @@ double dumb(const int& x, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -double -dumb_functor__::operator()(const int& x, std::ostream* pstream__) const { - return dumb(x, pstream__); -} class overloaded_fn_model final : public model_base_crtp { private: diff --git a/test/integration/good/compiler-optimizations/cppO0.expected b/test/integration/good/compiler-optimizations/cppO0.expected index 7d3a8d743c..10359afcd6 100644 --- a/test/integration/good/compiler-optimizations/cppO0.expected +++ b/test/integration/good/compiler-optimizations/cppO0.expected @@ -561,6 +561,15 @@ static constexpr std::array locations_array__ = " (in 'ad-level-failing.stan', line 17, column 4 to column 48)", " (in 'ad-level-failing.stan', line 19, column 4 to column 16)", " (in 'ad-level-failing.stan', line 11, column 61 to line 20, column 3)"}; +template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +std::vector> +simple_SIR(const T0__& t, const std::vector& y, + const std::vector& theta, const std::vector& x_r, + const std::vector& x_i, std::ostream* pstream__); struct simple_SIR_functor__ { template , @@ -570,13 +579,15 @@ struct simple_SIR_functor__ { std::vector> operator()(const T0__& t, const std::vector& y, const std::vector& theta, const std::vector& x_r, - const std::vector& x_i, std::ostream* pstream__) const; + const std::vector& x_i, std::ostream* pstream__) const { + return simple_SIR(t, y, theta, x_r, x_i, pstream__); + } }; template , stan::is_stan_scalar, stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> std::vector> simple_SIR(const T0__& t, const std::vector& y, const std::vector& theta, const std::vector& x_r, @@ -628,19 +639,6 @@ simple_SIR(const T0__& t, const std::vector& y, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>*> -std::vector> -simple_SIR_functor__::operator()(const T0__& t, const std::vector& y, - const std::vector& theta, - const std::vector& x_r, - const std::vector& x_i, std::ostream* - pstream__) const { - return simple_SIR(t, y, theta, x_r, x_i, pstream__); -} class ad_level_failing_model final : public model_base_crtp { private: int N_t; @@ -1569,23 +1567,17 @@ static constexpr std::array locations_array__ = " (in 'copy_fail.stan', line 27, column 4 to line 44, column 5)", " (in 'copy_fail.stan', line 45, column 4 to column 15)", " (in 'copy_fail.stan', line 24, column 74 to line 46, column 3)"}; -struct last_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; -struct prob_uncaptured_functor__ { - template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix, - stan::base_type_t>,-1,-1> - operator()(const int& nind, const int& n_occasions, const T2__& p, - const T3__& phi, std::ostream* pstream__) const; -}; -struct first_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; +int first_capture(const std::vector& y_i, std::ostream* pstream__); +int last_capture(const std::vector& y_i, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, + const T3__& phi_arg__, std::ostream* pstream__); int first_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -1610,11 +1602,6 @@ int first_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -first_capture_functor__::operator()(const std::vector& y_i, - std::ostream* pstream__) const { - return first_capture(y_i, pstream__); -} int last_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -1642,16 +1629,11 @@ int last_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -last_capture_functor__::operator()(const std::vector& y_i, std::ostream* - pstream__) const { - return last_capture(y_i, pstream__); -} template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix, stan::base_type_t>,-1,-1> prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, @@ -1707,18 +1689,6 @@ prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured_functor__::operator()(const int& nind, const int& - n_occasions, const T2__& p, const T3__& - phi, std::ostream* pstream__) const { - return prob_uncaptured(nind, n_occasions, p, phi, pstream__); -} class copy_fail_model final : public model_base_crtp { private: int nind; @@ -6167,23 +6137,17 @@ static constexpr std::array locations_array__ = " (in 'expr-prop-fail5.stan', line 27, column 4 to line 46, column 5)", " (in 'expr-prop-fail5.stan', line 47, column 4 to column 15)", " (in 'expr-prop-fail5.stan', line 24, column 74 to line 48, column 3)"}; -struct last_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; -struct prob_uncaptured_functor__ { - template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix, - stan::base_type_t>,-1,-1> - operator()(const int& nind, const int& n_occasions, const T2__& p, - const T3__& phi, std::ostream* pstream__) const; -}; -struct first_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; +int first_capture(const std::vector& y_i, std::ostream* pstream__); +int last_capture(const std::vector& y_i, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, + const T3__& phi_arg__, std::ostream* pstream__); int first_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -6208,11 +6172,6 @@ int first_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -first_capture_functor__::operator()(const std::vector& y_i, - std::ostream* pstream__) const { - return first_capture(y_i, pstream__); -} int last_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -6240,16 +6199,11 @@ int last_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -last_capture_functor__::operator()(const std::vector& y_i, std::ostream* - pstream__) const { - return last_capture(y_i, pstream__); -} template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix, stan::base_type_t>,-1,-1> prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, @@ -6309,18 +6263,6 @@ prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured_functor__::operator()(const int& nind, const int& - n_occasions, const T2__& p, const T3__& - phi, std::ostream* pstream__) const { - return prob_uncaptured(nind, n_occasions, p, phi, pstream__); -} class expr_prop_fail5_model final : public model_base_crtp { private: int nind; @@ -7127,41 +7069,35 @@ static constexpr std::array locations_array__ = " (in 'expr-prop-fail6.stan', line 86, column 25 to line 142, column 5)", " (in 'expr-prop-fail6.stan', line 86, column 4 to line 142, column 5)", " (in 'expr-prop-fail6.stan', line 81, column 74 to line 143, column 3)"}; -struct js_super_lp_functor__ { - template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - void - operator()(const std::vector>& y, const std::vector& - first, const std::vector& last, const T3__& p, const T4__& - phi, const T5__& psi, const T6__& nu, const T7__& chi, T_lp__& - lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) const; -}; -struct last_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; -struct prob_uncaptured_functor__ { - template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix, - stan::base_type_t>,-1,-1> - operator()(const T0__& p, const T1__& phi, std::ostream* pstream__) const; -}; -struct first_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; +int first_capture(const std::vector& y_i, std::ostream* pstream__); +int last_capture(const std::vector& y_i, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const T0__& p_arg__, const T1__& phi_arg__, std::ostream* + pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +void +js_super_lp(const std::vector>& y, const std::vector& + first, const std::vector& last, const T3__& p_arg__, + const T4__& phi_arg__, const T5__& psi, const T6__& nu_arg__, + const T7__& chi_arg__, T_lp__& lp__, T_lp_accum__& lp_accum__, + std::ostream* pstream__); int first_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -7186,11 +7122,6 @@ int first_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -first_capture_functor__::operator()(const std::vector& y_i, - std::ostream* pstream__) const { - return first_capture(y_i, pstream__); -} int last_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -7218,16 +7149,11 @@ int last_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -last_capture_functor__::operator()(const std::vector& y_i, std::ostream* - pstream__) const { - return last_capture(y_i, pstream__); -} template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix, stan::base_type_t>,-1,-1> prob_uncaptured(const T0__& p_arg__, const T1__& phi_arg__, std::ostream* @@ -7289,17 +7215,6 @@ prob_uncaptured(const T0__& p_arg__, const T1__& phi_arg__, std::ostream* stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured_functor__::operator()(const T0__& p, const T1__& phi, - std::ostream* pstream__) const { - return prob_uncaptured(p, phi, pstream__); -} template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> void js_super_lp(const std::vector>& y, const std::vector& first, const std::vector& last, const T3__& p_arg__, @@ -7537,29 +7452,6 @@ js_super_lp(const std::vector>& y, const std::vector& stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -void -js_super_lp_functor__::operator()(const std::vector>& y, - const std::vector& first, - const std::vector& last, const T3__& - p, const T4__& phi, const T5__& psi, - const T6__& nu, const T7__& chi, T_lp__& - lp__, T_lp_accum__& lp_accum__, - std::ostream* pstream__) const { - return js_super_lp(y, first, last, p, phi, psi, nu, chi, lp__, - lp_accum__, pstream__); -} class expr_prop_fail6_model final : public model_base_crtp { private: int M; @@ -9671,23 +9563,17 @@ static constexpr std::array locations_array__ = " (in 'fails-test.stan', line 27, column 4 to line 44, column 5)", " (in 'fails-test.stan', line 45, column 4 to column 15)", " (in 'fails-test.stan', line 24, column 74 to line 46, column 3)"}; -struct last_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; -struct prob_uncaptured_functor__ { - template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix, - stan::base_type_t>,-1,-1> - operator()(const int& nind, const int& n_occasions, const T2__& p, - const T3__& phi, std::ostream* pstream__) const; -}; -struct first_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; +int first_capture(const std::vector& y_i, std::ostream* pstream__); +int last_capture(const std::vector& y_i, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, + const T3__& phi_arg__, std::ostream* pstream__); int first_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -9712,11 +9598,6 @@ int first_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -first_capture_functor__::operator()(const std::vector& y_i, - std::ostream* pstream__) const { - return first_capture(y_i, pstream__); -} int last_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -9744,16 +9625,11 @@ int last_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -last_capture_functor__::operator()(const std::vector& y_i, std::ostream* - pstream__) const { - return last_capture(y_i, pstream__); -} template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix, stan::base_type_t>,-1,-1> prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, @@ -9809,18 +9685,6 @@ prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured_functor__::operator()(const int& nind, const int& - n_occasions, const T2__& p, const T3__& - phi, std::ostream* pstream__) const { - return prob_uncaptured(nind, n_occasions, p, phi, pstream__); -} class fails_test_model final : public model_base_crtp { private: int nind; @@ -10472,24 +10336,20 @@ static constexpr std::array locations_array__ = " (in 'function-in-function-inline.stan', line 2, column 30 to line 4, column 3)", " (in 'function-in-function-inline.stan', line 7, column 4 to column 27)", " (in 'function-in-function-inline.stan', line 6, column 30 to line 8, column 3)"}; -struct inner_lpdf_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - stan::promote_args_t> - operator()(const T0__& phi, std::ostream* pstream__) const; -}; -struct outer_lpdf_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - stan::promote_args_t> - operator()(const T0__& phi, std::ostream* pstream__) const; -}; template , stan::is_vt_not_complex>* = nullptr> stan::promote_args_t> +inner_lpdf(const T0__& phi_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +stan::promote_args_t> +outer_lpdf(const T0__& phi_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>*> +stan::promote_args_t> inner_lpdf(const T0__& phi_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; int current_statement__ = 0; @@ -10508,13 +10368,6 @@ template , stan::is_vt_not_complex>*> stan::promote_args_t> -inner_lpdf_functor__::operator()(const T0__& phi, std::ostream* pstream__) const { - return inner_lpdf(phi, pstream__); -} -template , - stan::is_vt_not_complex>* = nullptr> -stan::promote_args_t> outer_lpdf(const T0__& phi_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; int current_statement__ = 0; @@ -10529,13 +10382,6 @@ outer_lpdf(const T0__& phi_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -stan::promote_args_t> -outer_lpdf_functor__::operator()(const T0__& phi, std::ostream* pstream__) const { - return outer_lpdf(phi, pstream__); -} class function_in_function_inline_model final : public model_base_crtp { private: Eigen::Matrix phi_data__; @@ -10833,22 +10679,17 @@ static constexpr std::array locations_array__ = " (in 'function-in-function-loops.stan', line 12, column 4 to line 14, column 5)", " (in 'function-in-function-loops.stan', line 15, column 4 to column 23)", " (in 'function-in-function-loops.stan', line 9, column 24 to line 16, column 3)"}; -struct summer_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - stan::promote_args_t> - operator()(const T0__& et, std::ostream* pstream__) const; -}; -struct do_something_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const T0__& x, std::ostream* pstream__) const; -}; template >* = nullptr> stan::promote_args_t +do_something(const T0__& x, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +stan::promote_args_t> +summer(const T0__& et_arg__, std::ostream* pstream__); +template >*> +stan::promote_args_t do_something(const T0__& x, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -10871,14 +10712,9 @@ do_something(const T0__& x, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -do_something_functor__::operator()(const T0__& x, std::ostream* pstream__) const { - return do_something(x, pstream__); -} template , - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> stan::promote_args_t> summer(const T0__& et_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; @@ -10910,13 +10746,6 @@ summer(const T0__& et_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -stan::promote_args_t> -summer_functor__::operator()(const T0__& et, std::ostream* pstream__) const { - return summer(et, pstream__); -} class function_in_function_loops_model final : public model_base_crtp { private: int N; @@ -11201,24 +11030,20 @@ static constexpr std::array locations_array__ = " (in 'inline-functions-varmat.stan', line 7, column 20 to line 9, column 5)", " (in 'inline-functions-varmat.stan', line 7, column 4 to line 11, column 5)", " (in 'inline-functions-varmat.stan', line 5, column 33 to line 12, column 3)"}; -struct single_ret_fun_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& A, std::ostream* pstream__) const; -}; -struct multi_ret_fun_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& A, std::ostream* pstream__) const; -}; template , stan::is_vt_not_complex>* = nullptr> Eigen::Matrix>,-1,1> +single_ret_fun(const T0__& A_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix>,-1,1> +multi_ret_fun(const T0__& A_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>*> +Eigen::Matrix>,-1,1> single_ret_fun(const T0__& A_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; int current_statement__ = 0; @@ -11240,13 +11065,6 @@ template , stan::is_vt_not_complex>*> Eigen::Matrix>,-1,1> -single_ret_fun_functor__::operator()(const T0__& A, std::ostream* pstream__) const { - return single_ret_fun(A, pstream__); -} -template , - stan::is_vt_not_complex>* = nullptr> -Eigen::Matrix>,-1,1> multi_ret_fun(const T0__& A_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; int current_statement__ = 0; @@ -11273,13 +11091,6 @@ multi_ret_fun(const T0__& A_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,1> -multi_ret_fun_functor__::operator()(const T0__& A, std::ostream* pstream__) const { - return multi_ret_fun(A, pstream__); -} class inline_functions_varmat_model final : public model_base_crtp { private: @@ -11651,10 +11462,8 @@ static constexpr std::array locations_array__ = " (in 'inline-tdata.stan', line 10, column 3 to column 31)", " (in 'inline-tdata.stan', line 3, column 4 to column 31)", " (in 'inline-tdata.stan', line 2, column 26 to line 4, column 3)"}; -struct foo_functor__ { - Eigen::Matrix - operator()(const int& N, const int& M, std::ostream* pstream__) const; -}; +Eigen::Matrix +foo(const int& N, const int& M, std::ostream* pstream__); Eigen::Matrix foo(const int& N, const int& M, std::ostream* pstream__) { using local_scalar_t__ = double; @@ -11672,10 +11481,6 @@ foo(const int& N, const int& M, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -Eigen::Matrix -foo_functor__::operator()(const int& N, const int& M, std::ostream* pstream__) const { - return foo(N, M, pstream__); -} class inline_tdata_model final : public model_base_crtp { private: int N; @@ -11978,17 +11783,15 @@ static constexpr std::array locations_array__ = " (in 'inliner-same-names.stan', line 7, column 4 to column 22)", " (in 'inliner-same-names.stan', line 9, column 4 to column 15)", " (in 'inliner-same-names.stan', line 2, column 24 to line 10, column 3)"}; -struct foo_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& oR, std::ostream* pstream__) const; -}; template , stan::is_vt_not_complex>* = nullptr> Eigen::Matrix>,-1,1> +foo(const T0__& oR_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>*> +Eigen::Matrix>,-1,1> foo(const T0__& oR_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; int current_statement__ = 0; @@ -12015,13 +11818,6 @@ foo(const T0__& oR_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,1> -foo_functor__::operator()(const T0__& oR, std::ostream* pstream__) const { - return foo(oR, pstream__); -} class inliner_same_names_model final : public model_base_crtp { private: int N; @@ -12479,46 +12275,38 @@ static constexpr std::array locations_array__ = " (in 'inlining-fail2.stan', line 153, column 4 to line 156, column 5)", " (in 'inlining-fail2.stan', line 157, column 4 to column 26)", " (in 'inlining-fail2.stan', line 148, column 33 to line 158, column 3)"}; -struct prob_uncaptured_functor__ { - template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix, - stan::base_type_t>,-1,-1> - operator()(const T0__& p, const T1__& phi, std::ostream* pstream__) const; -}; -struct first_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; -struct seq_cprob_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& gamma, std::ostream* pstream__) const; -}; -struct last_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; -struct jolly_seber_lp_functor__ { - template , - 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>* = nullptr> - void - operator()(const std::vector>& y, const std::vector& - first, const std::vector& last, const T3__& p, const T4__& - phi, const T5__& gamma, const T6__& chi, T_lp__& lp__, - T_lp_accum__& lp_accum__, std::ostream* pstream__) const; -}; +int first_capture(const std::vector& y_i, std::ostream* pstream__); +int last_capture(const std::vector& y_i, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const T0__& p_arg__, const T1__& phi_arg__, std::ostream* + pstream__); +template , + 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>* = nullptr> +void +jolly_seber_lp(const std::vector>& y, + const std::vector& first, const std::vector& last, + const T3__& p_arg__, const T4__& phi_arg__, const T5__& + gamma_arg__, const T6__& chi_arg__, T_lp__& lp__, + T_lp_accum__& lp_accum__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix>,-1,1> +seq_cprob(const T0__& gamma_arg__, std::ostream* pstream__); int first_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -12543,11 +12331,6 @@ int first_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -first_capture_functor__::operator()(const std::vector& y_i, - std::ostream* pstream__) const { - return first_capture(y_i, pstream__); -} int last_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -12575,16 +12358,11 @@ int last_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -last_capture_functor__::operator()(const std::vector& y_i, std::ostream* - pstream__) const { - return last_capture(y_i, pstream__); -} template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix, stan::base_type_t>,-1,-1> prob_uncaptured(const T0__& p_arg__, const T1__& phi_arg__, std::ostream* @@ -12646,17 +12424,6 @@ prob_uncaptured(const T0__& p_arg__, const T1__& phi_arg__, std::ostream* stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured_functor__::operator()(const T0__& p, const T1__& phi, - std::ostream* pstream__) const { - return prob_uncaptured(p, phi, pstream__); -} template , @@ -12666,7 +12433,7 @@ template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> void jolly_seber_lp(const std::vector>& y, const std::vector& first, const std::vector& last, @@ -12894,30 +12661,9 @@ jolly_seber_lp(const std::vector>& y, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - 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>*> -void -jolly_seber_lp_functor__::operator()(const std::vector>& y, - const std::vector& first, - const std::vector& last, - const T3__& p, const T4__& phi, - const T5__& gamma, const T6__& chi, - T_lp__& lp__, T_lp_accum__& lp_accum__, - std::ostream* pstream__) const { - return jolly_seber_lp(y, first, last, p, phi, gamma, chi, lp__, - lp_accum__, pstream__); -} template , - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix>,-1,1> seq_cprob(const T0__& gamma_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; @@ -12959,13 +12705,6 @@ seq_cprob(const T0__& gamma_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,1> -seq_cprob_functor__::operator()(const T0__& gamma, std::ostream* pstream__) const { - return seq_cprob(gamma, pstream__); -} class inlining_fail2_model final : public model_base_crtp { private: int M; @@ -14736,23 +14475,17 @@ static constexpr std::array locations_array__ = " (in 'lcm-fails2.stan', line 27, column 4 to line 44, column 5)", " (in 'lcm-fails2.stan', line 45, column 4 to column 15)", " (in 'lcm-fails2.stan', line 24, column 74 to line 46, column 3)"}; -struct last_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; -struct prob_uncaptured_functor__ { - template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix, - stan::base_type_t>,-1,-1> - operator()(const int& nind, const int& n_occasions, const T2__& p, - const T3__& phi, std::ostream* pstream__) const; -}; -struct first_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; +int first_capture(const std::vector& y_i, std::ostream* pstream__); +int last_capture(const std::vector& y_i, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, + const T3__& phi_arg__, std::ostream* pstream__); int first_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -14777,11 +14510,6 @@ int first_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -first_capture_functor__::operator()(const std::vector& y_i, - std::ostream* pstream__) const { - return first_capture(y_i, pstream__); -} int last_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -14809,16 +14537,11 @@ int last_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -last_capture_functor__::operator()(const std::vector& y_i, std::ostream* - pstream__) const { - return last_capture(y_i, pstream__); -} template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix, stan::base_type_t>,-1,-1> prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, @@ -14874,18 +14597,6 @@ prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured_functor__::operator()(const int& nind, const int& - n_occasions, const T2__& p, const T3__& - phi, std::ostream* pstream__) const { - return prob_uncaptured(nind, n_occasions, p, phi, pstream__); -} class lcm_fails2_model final : public model_base_crtp { private: int nind; @@ -15474,29 +15185,22 @@ static constexpr std::array locations_array__ = " (in 'lupdf-inlining.stan', line 5, column 34 to line 7, column 5)", " (in 'lupdf-inlining.stan', line 9, column 8 to column 32)", " (in 'lupdf-inlining.stan', line 8, column 26 to line 10, column 5)"}; -struct foo_lpdf_functor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const T0__& x, const T1__& mu, std::ostream* pstream__) const; -}; -struct bar_lpmf_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const int& n, const T1__& mu, std::ostream* pstream__) const; -}; -struct baz_lpdf_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const T0__& x, std::ostream* pstream__) const; -}; template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t +foo_lpdf(const T0__& x, const T1__& mu, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t +bar_lpmf(const int& n, const T1__& mu, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t baz_lpdf(const T0__& x, std::ostream* pstream__); +template , + stan::is_stan_scalar>*> +stan::promote_args_t foo_lpdf(const T0__& x, const T1__& mu, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -15510,16 +15214,8 @@ foo_lpdf(const T0__& x, const T1__& mu, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar>*> -stan::promote_args_t -foo_lpdf_functor__::operator()(const T0__& x, const T1__& mu, std::ostream* - pstream__) const { - return foo_lpdf(x, mu, pstream__); -} template >* = nullptr> + stan::require_all_t>*> stan::promote_args_t bar_lpmf(const int& n, const T1__& mu, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -15534,15 +15230,8 @@ bar_lpmf(const int& n, const T1__& mu, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -bar_lpmf_functor__::operator()(const int& n, const T1__& mu, std::ostream* - pstream__) const { - return bar_lpmf(n, mu, pstream__); -} template >* = nullptr> + stan::require_all_t>*> stan::promote_args_t baz_lpdf(const T0__& x, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -15556,12 +15245,6 @@ stan::promote_args_t baz_lpdf(const T0__& x, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -baz_lpdf_functor__::operator()(const T0__& x, std::ostream* pstream__) const { - return baz_lpdf(x, pstream__); -} class lupdf_inlining_model final : public model_base_crtp { private: int n; @@ -17314,25 +16997,19 @@ static constexpr std::array locations_array__ = " (in 'optimizations.stan', line 15, column 8 to column 20)", " (in 'optimizations.stan', line 16, column 8 to column 18)", " (in 'optimizations.stan', line 14, column 18 to line 17, column 5)"}; -struct nrfun_lp_functor__ { - template >* = nullptr> - void - operator()(const T0__& x, const int& y, T_lp__& lp__, T_lp_accum__& - lp_accum__, std::ostream* pstream__) const; -}; -struct rfun_lp_functor__ { - template int - operator()(T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) const; -}; -struct rfun_functor__ { - int operator()(const int& y, std::ostream* pstream__) const; -}; template >* = nullptr> void +nrfun_lp(const T0__& x, const int& y, T_lp__& lp__, T_lp_accum__& lp_accum__, + std::ostream* pstream__); +int rfun(const int& y, std::ostream* pstream__); +template int +rfun_lp(T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__); +template >*> +void nrfun_lp(const T0__& x, const int& y, T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -17352,15 +17029,6 @@ nrfun_lp(const T0__& x, const int& y, T_lp__& lp__, T_lp_accum__& lp_accum__, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -void -nrfun_lp_functor__::operator()(const T0__& x, const int& y, T_lp__& lp__, - T_lp_accum__& lp_accum__, std::ostream* - pstream__) const { - return nrfun_lp(x, y, lp__, lp_accum__, pstream__); -} int rfun(const int& y, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -17382,9 +17050,6 @@ int rfun(const int& y, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int rfun_functor__::operator()(const int& y, std::ostream* pstream__) const { - return rfun(y, pstream__); -} template int rfun_lp(T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) { using local_scalar_t__ = double; @@ -17401,11 +17066,6 @@ rfun_lp(T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template int -rfun_lp_functor__::operator()(T_lp__& lp__, T_lp_accum__& lp_accum__, - std::ostream* pstream__) const { - return rfun_lp(lp__, lp_accum__, pstream__); -} class optimizations_model final : public model_base_crtp { private: @@ -18053,15 +17713,11 @@ static constexpr std::array locations_array__ = " (in 'overloaded-fn.stan', line 2, column 20 to line 4, column 4)", " (in 'overloaded-fn.stan', line 7, column 5 to column 20)", " (in 'overloaded-fn.stan', line 6, column 19 to line 8, column 4)"}; -struct dumb_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const T0__& x, std::ostream* pstream__) const; - double operator()(const int& x, std::ostream* pstream__) const; -}; template >* = nullptr> +stan::promote_args_t dumb(const T0__& x, std::ostream* pstream__); +double dumb(const int& x, std::ostream* pstream__); +template >*> stan::promote_args_t dumb(const T0__& x, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -18078,11 +17734,6 @@ stan::promote_args_t dumb(const T0__& x, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -dumb_functor__::operator()(const T0__& x, std::ostream* pstream__) const { - return dumb(x, pstream__); -} double dumb(const int& x, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -18099,10 +17750,6 @@ double dumb(const int& x, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -double -dumb_functor__::operator()(const int& x, std::ostream* pstream__) const { - return dumb(x, pstream__); -} class overloaded_fn_model final : public model_base_crtp { private: diff --git a/test/integration/good/compiler-optimizations/cppO1.expected b/test/integration/good/compiler-optimizations/cppO1.expected index 5997dbfc65..623f7a0add 100644 --- a/test/integration/good/compiler-optimizations/cppO1.expected +++ b/test/integration/good/compiler-optimizations/cppO1.expected @@ -561,6 +561,15 @@ static constexpr std::array locations_array__ = " (in 'ad-level-failing.stan', line 17, column 4 to column 48)", " (in 'ad-level-failing.stan', line 19, column 4 to column 16)", " (in 'ad-level-failing.stan', line 11, column 61 to line 20, column 3)"}; +template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +std::vector> +simple_SIR(const T0__& t, const std::vector& y, + const std::vector& theta, const std::vector& x_r, + const std::vector& x_i, std::ostream* pstream__); struct simple_SIR_functor__ { template , @@ -570,13 +579,15 @@ struct simple_SIR_functor__ { std::vector> operator()(const T0__& t, const std::vector& y, const std::vector& theta, const std::vector& x_r, - const std::vector& x_i, std::ostream* pstream__) const; + const std::vector& x_i, std::ostream* pstream__) const { + return simple_SIR(t, y, theta, x_r, x_i, pstream__); + } }; template , stan::is_stan_scalar, stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> + stan::is_stan_scalar>*> std::vector> simple_SIR(const T0__& t, const std::vector& y, const std::vector& theta, const std::vector& x_r, @@ -628,19 +639,6 @@ simple_SIR(const T0__& t, const std::vector& y, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>*> -std::vector> -simple_SIR_functor__::operator()(const T0__& t, const std::vector& y, - const std::vector& theta, - const std::vector& x_r, - const std::vector& x_i, std::ostream* - pstream__) const { - return simple_SIR(t, y, theta, x_r, x_i, pstream__); -} class ad_level_failing_model final : public model_base_crtp { private: int N_t; @@ -1185,23 +1183,17 @@ static constexpr std::array locations_array__ = " (in 'copy_fail.stan', line 21, column 4 to column 13)", " (in 'copy_fail.stan', line 12, column 36 to line 22, column 3)", " (in 'copy_fail.stan', line 24, column 74 to line 46, column 3)"}; -struct last_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; -struct prob_uncaptured_functor__ { - template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix, - stan::base_type_t>,-1,-1> - operator()(const int& nind, const int& n_occasions, const T2__& p, - const T3__& phi, std::ostream* pstream__) const; -}; -struct first_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; +int first_capture(const std::vector& y_i, std::ostream* pstream__); +int last_capture(const std::vector& y_i, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, + const T3__& phi_arg__, std::ostream* pstream__); int first_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -1226,11 +1218,6 @@ int first_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -first_capture_functor__::operator()(const std::vector& y_i, - std::ostream* pstream__) const { - return first_capture(y_i, pstream__); -} int last_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -1258,16 +1245,11 @@ int last_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -last_capture_functor__::operator()(const std::vector& y_i, std::ostream* - pstream__) const { - return last_capture(y_i, pstream__); -} template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix, stan::base_type_t>,-1,-1> prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, @@ -1324,18 +1306,6 @@ prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured_functor__::operator()(const int& nind, const int& - n_occasions, const T2__& p, const T3__& - phi, std::ostream* pstream__) const { - return prob_uncaptured(nind, n_occasions, p, phi, pstream__); -} class copy_fail_model final : public model_base_crtp { private: int nind; @@ -5882,23 +5852,17 @@ static constexpr std::array locations_array__ = " (in 'expr-prop-fail5.stan', line 21, column 4 to column 13)", " (in 'expr-prop-fail5.stan', line 12, column 36 to line 22, column 3)", " (in 'expr-prop-fail5.stan', line 24, column 74 to line 48, column 3)"}; -struct last_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; -struct prob_uncaptured_functor__ { - template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix, - stan::base_type_t>,-1,-1> - operator()(const int& nind, const int& n_occasions, const T2__& p, - const T3__& phi, std::ostream* pstream__) const; -}; -struct first_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; +int first_capture(const std::vector& y_i, std::ostream* pstream__); +int last_capture(const std::vector& y_i, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, + const T3__& phi_arg__, std::ostream* pstream__); int first_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -5923,11 +5887,6 @@ int first_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -first_capture_functor__::operator()(const std::vector& y_i, - std::ostream* pstream__) const { - return first_capture(y_i, pstream__); -} int last_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -5955,16 +5914,11 @@ int last_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -last_capture_functor__::operator()(const std::vector& y_i, std::ostream* - pstream__) const { - return last_capture(y_i, pstream__); -} template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix, stan::base_type_t>,-1,-1> prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, @@ -6021,18 +5975,6 @@ prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured_functor__::operator()(const int& nind, const int& - n_occasions, const T2__& p, const T3__& - phi, std::ostream* pstream__) const { - return prob_uncaptured(nind, n_occasions, p, phi, pstream__); -} class expr_prop_fail5_model final : public model_base_crtp { private: int nind; @@ -6955,41 +6897,35 @@ static constexpr std::array locations_array__ = " (in 'expr-prop-fail6.stan', line 28, column 36 to line 36, column 3)", " (in 'expr-prop-fail6.stan', line 48, column 47 to line 65, column 3)", " (in 'expr-prop-fail6.stan', line 81, column 74 to line 143, column 3)"}; -struct js_super_lp_functor__ { - template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - void - operator()(const std::vector>& y, const std::vector& - first, const std::vector& last, const T3__& p, const T4__& - phi, const T5__& psi, const T6__& nu, const T7__& chi, T_lp__& - lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) const; -}; -struct last_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; -struct prob_uncaptured_functor__ { - template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix, - stan::base_type_t>,-1,-1> - operator()(const T0__& p, const T1__& phi, std::ostream* pstream__) const; -}; -struct first_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; +int first_capture(const std::vector& y_i, std::ostream* pstream__); +int last_capture(const std::vector& y_i, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const T0__& p_arg__, const T1__& phi_arg__, std::ostream* + pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +void +js_super_lp(const std::vector>& y, const std::vector& + first, const std::vector& last, const T3__& p_arg__, + const T4__& phi_arg__, const T5__& psi, const T6__& nu_arg__, + const T7__& chi_arg__, T_lp__& lp__, T_lp_accum__& lp_accum__, + std::ostream* pstream__); int first_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -7014,11 +6950,6 @@ int first_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -first_capture_functor__::operator()(const std::vector& y_i, - std::ostream* pstream__) const { - return first_capture(y_i, pstream__); -} int last_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -7046,16 +6977,11 @@ int last_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -last_capture_functor__::operator()(const std::vector& y_i, std::ostream* - pstream__) const { - return last_capture(y_i, pstream__); -} template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix, stan::base_type_t>,-1,-1> prob_uncaptured(const T0__& p_arg__, const T1__& phi_arg__, std::ostream* @@ -7118,17 +7044,6 @@ prob_uncaptured(const T0__& p_arg__, const T1__& phi_arg__, std::ostream* stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured_functor__::operator()(const T0__& p, const T1__& phi, - std::ostream* pstream__) const { - return prob_uncaptured(p, phi, pstream__); -} template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> void js_super_lp(const std::vector>& y, const std::vector& first, const std::vector& last, const T3__& p_arg__, @@ -7362,29 +7277,6 @@ js_super_lp(const std::vector>& y, const std::vector& stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -void -js_super_lp_functor__::operator()(const std::vector>& y, - const std::vector& first, - const std::vector& last, const T3__& - p, const T4__& phi, const T5__& psi, - const T6__& nu, const T7__& chi, T_lp__& - lp__, T_lp_accum__& lp_accum__, - std::ostream* pstream__) const { - return js_super_lp(y, first, last, p, phi, psi, nu, chi, lp__, - lp_accum__, pstream__); -} class expr_prop_fail6_model final : public model_base_crtp { private: int M; @@ -9878,23 +9770,17 @@ static constexpr std::array locations_array__ = " (in 'fails-test.stan', line 21, column 4 to column 13)", " (in 'fails-test.stan', line 12, column 36 to line 22, column 3)", " (in 'fails-test.stan', line 24, column 74 to line 46, column 3)"}; -struct last_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; -struct prob_uncaptured_functor__ { - template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix, - stan::base_type_t>,-1,-1> - operator()(const int& nind, const int& n_occasions, const T2__& p, - const T3__& phi, std::ostream* pstream__) const; -}; -struct first_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; +int first_capture(const std::vector& y_i, std::ostream* pstream__); +int last_capture(const std::vector& y_i, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, + const T3__& phi_arg__, std::ostream* pstream__); int first_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -9919,11 +9805,6 @@ int first_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -first_capture_functor__::operator()(const std::vector& y_i, - std::ostream* pstream__) const { - return first_capture(y_i, pstream__); -} int last_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -9951,16 +9832,11 @@ int last_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -last_capture_functor__::operator()(const std::vector& y_i, std::ostream* - pstream__) const { - return last_capture(y_i, pstream__); -} template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix, stan::base_type_t>,-1,-1> prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, @@ -10017,18 +9893,6 @@ prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured_functor__::operator()(const int& nind, const int& - n_occasions, const T2__& p, const T3__& - phi, std::ostream* pstream__) const { - return prob_uncaptured(nind, n_occasions, p, phi, pstream__); -} class fails_test_model final : public model_base_crtp { private: int nind; @@ -10801,22 +10665,17 @@ static constexpr std::array locations_array__ = " (in 'function-in-function-loops.stan', line 6, column 6 to column 15)", " (in 'function-in-function-loops.stan', line 13, column 8 to column 43)", " (in 'function-in-function-loops.stan', line 9, column 24 to line 16, column 3)"}; -struct summer_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - stan::promote_args_t> - operator()(const T0__& et, std::ostream* pstream__) const; -}; -struct do_something_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const T0__& x, std::ostream* pstream__) const; -}; template >* = nullptr> stan::promote_args_t +do_something(const T0__& x, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +stan::promote_args_t> +summer(const T0__& et_arg__, std::ostream* pstream__); +template >*> +stan::promote_args_t do_something(const T0__& x, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -10833,14 +10692,9 @@ do_something(const T0__& x, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -do_something_functor__::operator()(const T0__& x, std::ostream* pstream__) const { - return do_something(x, pstream__); -} template , - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> stan::promote_args_t> summer(const T0__& et_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; @@ -10872,13 +10726,6 @@ summer(const T0__& et_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -stan::promote_args_t> -summer_functor__::operator()(const T0__& et, std::ostream* pstream__) const { - return summer(et, pstream__); -} class function_in_function_loops_model final : public model_base_crtp { private: int N; @@ -11191,24 +11038,20 @@ static constexpr std::array locations_array__ = " (in 'inline-functions-varmat.stan', line 2, column 34 to line 4, column 3)", " (in 'inline-functions-varmat.stan', line 10, column 6 to column 15)", " (in 'inline-functions-varmat.stan', line 8, column 6 to column 15)"}; -struct single_ret_fun_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& A, std::ostream* pstream__) const; -}; -struct multi_ret_fun_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& A, std::ostream* pstream__) const; -}; template , stan::is_vt_not_complex>* = nullptr> Eigen::Matrix>,-1,1> +single_ret_fun(const T0__& A_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix>,-1,1> +multi_ret_fun(const T0__& A_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>*> +Eigen::Matrix>,-1,1> single_ret_fun(const T0__& A_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; int current_statement__ = 0; @@ -11230,13 +11073,6 @@ template , stan::is_vt_not_complex>*> Eigen::Matrix>,-1,1> -single_ret_fun_functor__::operator()(const T0__& A, std::ostream* pstream__) const { - return single_ret_fun(A, pstream__); -} -template , - stan::is_vt_not_complex>* = nullptr> -Eigen::Matrix>,-1,1> multi_ret_fun(const T0__& A_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; int current_statement__ = 0; @@ -11263,13 +11099,6 @@ multi_ret_fun(const T0__& A_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,1> -multi_ret_fun_functor__::operator()(const T0__& A, std::ostream* pstream__) const { - return multi_ret_fun(A, pstream__); -} class inline_functions_varmat_model final : public model_base_crtp { private: @@ -11696,10 +11525,8 @@ static constexpr std::array locations_array__ = " (in 'inline-tdata.stan', line 10, column 3 to column 31)", " (in 'inline-tdata.stan', line 3, column 4 to column 31)", " (in 'inline-tdata.stan', line 2, column 26 to line 4, column 3)"}; -struct foo_functor__ { - Eigen::Matrix - operator()(const int& N, const int& M, std::ostream* pstream__) const; -}; +Eigen::Matrix +foo(const int& N, const int& M, std::ostream* pstream__); Eigen::Matrix foo(const int& N, const int& M, std::ostream* pstream__) { using local_scalar_t__ = double; @@ -11717,10 +11544,6 @@ foo(const int& N, const int& M, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -Eigen::Matrix -foo_functor__::operator()(const int& N, const int& M, std::ostream* pstream__) const { - return foo(N, M, pstream__); -} class inline_tdata_model final : public model_base_crtp { private: int N; @@ -12023,17 +11846,15 @@ static constexpr std::array locations_array__ = " (in 'inliner-same-names.stan', line 17, column 9 to column 10)", " (in 'inliner-same-names.stan', line 9, column 4 to column 15)", " (in 'inliner-same-names.stan', line 2, column 24 to line 10, column 3)"}; -struct foo_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& oR, std::ostream* pstream__) const; -}; template , stan::is_vt_not_complex>* = nullptr> Eigen::Matrix>,-1,1> +foo(const T0__& oR_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>*> +Eigen::Matrix>,-1,1> foo(const T0__& oR_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; int current_statement__ = 0; @@ -12059,13 +11880,6 @@ foo(const T0__& oR_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,1> -foo_functor__::operator()(const T0__& oR, std::ostream* pstream__) const { - return foo(oR, pstream__); -} class inliner_same_names_model final : public model_base_crtp { private: int N; @@ -12556,46 +12370,38 @@ static constexpr std::array locations_array__ = " (in 'inlining-fail2.stan', line 48, column 47 to line 65, column 3)", " (in 'inlining-fail2.stan', line 79, column 70 to line 137, column 3)", " (in 'inlining-fail2.stan', line 148, column 33 to line 158, column 3)"}; -struct prob_uncaptured_functor__ { - template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix, - stan::base_type_t>,-1,-1> - operator()(const T0__& p, const T1__& phi, std::ostream* pstream__) const; -}; -struct first_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; -struct seq_cprob_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& gamma, std::ostream* pstream__) const; -}; -struct last_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; -struct jolly_seber_lp_functor__ { - template , - 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>* = nullptr> - void - operator()(const std::vector>& y, const std::vector& - first, const std::vector& last, const T3__& p, const T4__& - phi, const T5__& gamma, const T6__& chi, T_lp__& lp__, - T_lp_accum__& lp_accum__, std::ostream* pstream__) const; -}; +int first_capture(const std::vector& y_i, std::ostream* pstream__); +int last_capture(const std::vector& y_i, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const T0__& p_arg__, const T1__& phi_arg__, std::ostream* + pstream__); +template , + 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>* = nullptr> +void +jolly_seber_lp(const std::vector>& y, + const std::vector& first, const std::vector& last, + const T3__& p_arg__, const T4__& phi_arg__, const T5__& + gamma_arg__, const T6__& chi_arg__, T_lp__& lp__, + T_lp_accum__& lp_accum__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix>,-1,1> +seq_cprob(const T0__& gamma_arg__, std::ostream* pstream__); int first_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -12620,11 +12426,6 @@ int first_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -first_capture_functor__::operator()(const std::vector& y_i, - std::ostream* pstream__) const { - return first_capture(y_i, pstream__); -} int last_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -12652,16 +12453,11 @@ int last_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -last_capture_functor__::operator()(const std::vector& y_i, std::ostream* - pstream__) const { - return last_capture(y_i, pstream__); -} template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix, stan::base_type_t>,-1,-1> prob_uncaptured(const T0__& p_arg__, const T1__& phi_arg__, std::ostream* @@ -12724,17 +12520,6 @@ prob_uncaptured(const T0__& p_arg__, const T1__& phi_arg__, std::ostream* stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured_functor__::operator()(const T0__& p, const T1__& phi, - std::ostream* pstream__) const { - return prob_uncaptured(p, phi, pstream__); -} template , @@ -12744,7 +12529,7 @@ template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> void jolly_seber_lp(const std::vector>& y, const std::vector& first, const std::vector& last, @@ -12968,30 +12753,9 @@ jolly_seber_lp(const std::vector>& y, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - 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>*> -void -jolly_seber_lp_functor__::operator()(const std::vector>& y, - const std::vector& first, - const std::vector& last, - const T3__& p, const T4__& phi, - const T5__& gamma, const T6__& chi, - T_lp__& lp__, T_lp_accum__& lp_accum__, - std::ostream* pstream__) const { - return jolly_seber_lp(y, first, last, p, phi, gamma, chi, lp__, - lp_accum__, pstream__); -} template , - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix>,-1,1> seq_cprob(const T0__& gamma_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; @@ -13033,13 +12797,6 @@ seq_cprob(const T0__& gamma_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,1> -seq_cprob_functor__::operator()(const T0__& gamma, std::ostream* pstream__) const { - return seq_cprob(gamma, pstream__); -} class inlining_fail2_model final : public model_base_crtp { private: int M; @@ -15230,23 +14987,17 @@ static constexpr std::array locations_array__ = " (in 'lcm-fails2.stan', line 21, column 4 to column 13)", " (in 'lcm-fails2.stan', line 12, column 36 to line 22, column 3)", " (in 'lcm-fails2.stan', line 24, column 74 to line 46, column 3)"}; -struct last_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; -struct prob_uncaptured_functor__ { - template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix, - stan::base_type_t>,-1,-1> - operator()(const int& nind, const int& n_occasions, const T2__& p, - const T3__& phi, std::ostream* pstream__) const; -}; -struct first_capture_functor__ { - int operator()(const std::vector& y_i, std::ostream* pstream__) const; -}; +int first_capture(const std::vector& y_i, std::ostream* pstream__); +int last_capture(const std::vector& y_i, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, + const T3__& phi_arg__, std::ostream* pstream__); int first_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -15271,11 +15022,6 @@ int first_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -first_capture_functor__::operator()(const std::vector& y_i, - std::ostream* pstream__) const { - return first_capture(y_i, pstream__); -} int last_capture(const std::vector& y_i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -15303,16 +15049,11 @@ int last_capture(const std::vector& y_i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -last_capture_functor__::operator()(const std::vector& y_i, std::ostream* - pstream__) const { - return last_capture(y_i, pstream__); -} template , stan::is_vt_not_complex, stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix, stan::base_type_t>,-1,-1> prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, @@ -15369,18 +15110,6 @@ prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured_functor__::operator()(const int& nind, const int& - n_occasions, const T2__& p, const T3__& - phi, std::ostream* pstream__) const { - return prob_uncaptured(nind, n_occasions, p, phi, pstream__); -} class lcm_fails2_model final : public model_base_crtp { private: int nind; @@ -16084,29 +15813,22 @@ static constexpr std::array locations_array__ = " (in 'lupdf-inlining.stan', line 5, column 34 to line 7, column 5)", " (in 'lupdf-inlining.stan', line 9, column 8 to column 32)", " (in 'lupdf-inlining.stan', line 8, column 26 to line 10, column 5)"}; -struct foo_lpdf_functor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const T0__& x, const T1__& mu, std::ostream* pstream__) const; -}; -struct bar_lpmf_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const int& n, const T1__& mu, std::ostream* pstream__) const; -}; -struct baz_lpdf_functor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const T0__& x, std::ostream* pstream__) const; -}; template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t +foo_lpdf(const T0__& x, const T1__& mu, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t +bar_lpmf(const int& n, const T1__& mu, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t baz_lpdf(const T0__& x, std::ostream* pstream__); +template , + stan::is_stan_scalar>*> +stan::promote_args_t foo_lpdf(const T0__& x, const T1__& mu, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -16120,16 +15842,8 @@ foo_lpdf(const T0__& x, const T1__& mu, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_stan_scalar>*> -stan::promote_args_t -foo_lpdf_functor__::operator()(const T0__& x, const T1__& mu, std::ostream* - pstream__) const { - return foo_lpdf(x, mu, pstream__); -} template >* = nullptr> + stan::require_all_t>*> stan::promote_args_t bar_lpmf(const int& n, const T1__& mu, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -16144,15 +15858,8 @@ bar_lpmf(const int& n, const T1__& mu, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -bar_lpmf_functor__::operator()(const int& n, const T1__& mu, std::ostream* - pstream__) const { - return bar_lpmf(n, mu, pstream__); -} template >* = nullptr> + stan::require_all_t>*> stan::promote_args_t baz_lpdf(const T0__& x, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; int current_statement__ = 0; @@ -16166,12 +15873,6 @@ stan::promote_args_t baz_lpdf(const T0__& x, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -stan::promote_args_t -baz_lpdf_functor__::operator()(const T0__& x, std::ostream* pstream__) const { - return baz_lpdf(x, pstream__); -} class lupdf_inlining_model final : public model_base_crtp { private: int n; @@ -17911,25 +17612,19 @@ static constexpr std::array locations_array__ = " (in 'optimizations.stan', line 11, column 8 to column 21)", " (in 'optimizations.stan', line 16, column 8 to column 18)", " (in 'optimizations.stan', line 14, column 18 to line 17, column 5)"}; -struct nrfun_lp_functor__ { - template >* = nullptr> - void - operator()(const T0__& x, const int& y, T_lp__& lp__, T_lp_accum__& - lp_accum__, std::ostream* pstream__) const; -}; -struct rfun_lp_functor__ { - template int - operator()(T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) const; -}; -struct rfun_functor__ { - int operator()(const int& y, std::ostream* pstream__) const; -}; template >* = nullptr> void +nrfun_lp(const T0__& x, const int& y, T_lp__& lp__, T_lp_accum__& lp_accum__, + std::ostream* pstream__); +int rfun(const int& y, std::ostream* pstream__); +template int +rfun_lp(T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__); +template >*> +void nrfun_lp(const T0__& x, const int& y, T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t; @@ -17949,15 +17644,6 @@ nrfun_lp(const T0__& x, const int& y, T_lp__& lp__, T_lp_accum__& lp_accum__, stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template >*> -void -nrfun_lp_functor__::operator()(const T0__& x, const int& y, T_lp__& lp__, - T_lp_accum__& lp_accum__, std::ostream* - pstream__) const { - return nrfun_lp(x, y, lp__, lp_accum__, pstream__); -} int rfun(const int& y, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -17979,9 +17665,6 @@ int rfun(const int& y, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int rfun_functor__::operator()(const int& y, std::ostream* pstream__) const { - return rfun(y, pstream__); -} template int rfun_lp(T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) { using local_scalar_t__ = double; @@ -17998,11 +17681,6 @@ rfun_lp(T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template int -rfun_lp_functor__::operator()(T_lp__& lp__, T_lp_accum__& lp_accum__, - std::ostream* pstream__) const { - return rfun_lp(lp__, lp_accum__, pstream__); -} class optimizations_model final : public model_base_crtp { private: diff --git a/test/integration/good/compiler-optimizations/mem_patterns/cpp.expected b/test/integration/good/compiler-optimizations/mem_patterns/cpp.expected index 4fc996e109..880301c956 100644 --- a/test/integration/good/compiler-optimizations/mem_patterns/cpp.expected +++ b/test/integration/good/compiler-optimizations/mem_patterns/cpp.expected @@ -2685,16 +2685,12 @@ static constexpr std::array locations_array__ = " (in 'indexing.stan', line 2, column 22 to line 4, column 3)", " (in 'indexing.stan', line 6, column 4 to column 13)", " (in 'indexing.stan', line 5, column 27 to line 7, column 3)"}; -struct udf_fun_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& A, std::ostream* pstream__) const; -}; -struct mask_fun_functor__ { - int operator()(const int& i, std::ostream* pstream__) const; -}; +int mask_fun(const int& i, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix>,-1,1> +udf_fun(const T0__& A_arg__, std::ostream* pstream__); int mask_fun(const int& i, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -2711,13 +2707,9 @@ int mask_fun(const int& i, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int -mask_fun_functor__::operator()(const int& i, std::ostream* pstream__) const { - return mask_fun(i, pstream__); -} template , - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix>,-1,1> udf_fun(const T0__& A_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; @@ -2736,13 +2728,6 @@ udf_fun(const T0__& A_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,1> -udf_fun_functor__::operator()(const T0__& A, std::ostream* pstream__) const { - return udf_fun(A, pstream__); -} class indexing_model final : public model_base_crtp { private: int N; @@ -4758,25 +4743,22 @@ static constexpr std::array locations_array__ = " (in 'reductions_allowed.stan', line 2, column 31 to line 4, column 5)", " (in 'reductions_allowed.stan', line 7, column 8 to column 25)", " (in 'reductions_allowed.stan', line 6, column 48 to line 8, column 5)"}; -struct nono_func_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,-1> - operator()(const T0__& x, std::ostream* pstream__) const; -}; -struct okay_reduction_functor__ { - template , - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,-1> - operator()(const T0__& sum_x, const T1__& y, std::ostream* pstream__) const; -}; template , stan::is_vt_not_complex>* = nullptr> Eigen::Matrix>,-1,-1> +nono_func(const T0__& x_arg__, std::ostream* pstream__); +template , + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix>,-1,-1> +okay_reduction(const T0__& sum_x, const T1__& y_arg__, std::ostream* + pstream__); +template , + stan::is_vt_not_complex>*> +Eigen::Matrix>,-1,-1> nono_func(const T0__& x_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; int current_statement__ = 0; @@ -4794,17 +4776,10 @@ nono_func(const T0__& x_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,-1> -nono_func_functor__::operator()(const T0__& x, std::ostream* pstream__) const { - return nono_func(x, pstream__); -} template , stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix>,-1,-1> okay_reduction(const T0__& sum_x, const T1__& y_arg__, std::ostream* pstream__) { @@ -4825,15 +4800,6 @@ okay_reduction(const T0__& sum_x, const T1__& y_arg__, std::ostream* stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,-1> -okay_reduction_functor__::operator()(const T0__& sum_x, const T1__& y, - std::ostream* pstream__) const { - return okay_reduction(sum_x, y, pstream__); -} class reductions_allowed_model final : public model_base_crtp { private: double data_r; @@ -5306,16 +5272,12 @@ static constexpr std::array locations_array__ = " (in 'return_types_and_udfs_demotes.stan', line 10, column 29 to line 13, column 5)", " (in 'return_types_and_udfs_demotes.stan', line 15, column 8 to column 17)", " (in 'return_types_and_udfs_demotes.stan', line 14, column 39 to line 16, column 5)"}; -struct mat_ret_user_func_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,-1> - operator()(const T0__& A, std::ostream* pstream__) const; -}; -struct empty_user_func_functor__ { - Eigen::Matrix operator()(std::ostream* pstream__) const; -}; +Eigen::Matrix empty_user_func(std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix>,-1,-1> +mat_ret_user_func(const T0__& A_arg__, std::ostream* pstream__); Eigen::Matrix empty_user_func(std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; @@ -5334,13 +5296,9 @@ Eigen::Matrix empty_user_func(std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -Eigen::Matrix -empty_user_func_functor__::operator()(std::ostream* pstream__) const { - return empty_user_func(pstream__); -} template , - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix>,-1,-1> mat_ret_user_func(const T0__& A_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; @@ -5359,14 +5317,6 @@ mat_ret_user_func(const T0__& A_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,-1> -mat_ret_user_func_functor__::operator()(const T0__& A, std::ostream* - pstream__) const { - return mat_ret_user_func(A, pstream__); -} class return_types_and_udfs_demotes_model final : public model_base_crtp { private: @@ -6265,25 +6215,22 @@ static constexpr std::array locations_array__ = " (in 'tp_reused.stan', line 2, column 31 to line 4, column 5)", " (in 'tp_reused.stan', line 7, column 8 to column 25)", " (in 'tp_reused.stan', line 6, column 48 to line 8, column 5)"}; -struct nono_func_functor__ { - template , - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,-1> - operator()(const T0__& x, std::ostream* pstream__) const; -}; -struct okay_reduction_functor__ { - template , - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,-1> - operator()(const T0__& sum_x, const T1__& y, std::ostream* pstream__) const; -}; template , stan::is_vt_not_complex>* = nullptr> Eigen::Matrix>,-1,-1> +nono_func(const T0__& x_arg__, std::ostream* pstream__); +template , + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix>,-1,-1> +okay_reduction(const T0__& sum_x, const T1__& y_arg__, std::ostream* + pstream__); +template , + stan::is_vt_not_complex>*> +Eigen::Matrix>,-1,-1> nono_func(const T0__& x_arg__, std::ostream* pstream__) { using local_scalar_t__ = stan::promote_args_t>; int current_statement__ = 0; @@ -6301,17 +6248,10 @@ nono_func(const T0__& x_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,-1> -nono_func_functor__::operator()(const T0__& x, std::ostream* pstream__) const { - return nono_func(x, pstream__); -} template , stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> + stan::is_vt_not_complex>*> Eigen::Matrix>,-1,-1> okay_reduction(const T0__& sum_x, const T1__& y_arg__, std::ostream* pstream__) { @@ -6332,15 +6272,6 @@ okay_reduction(const T0__& sum_x, const T1__& y_arg__, std::ostream* stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -template , - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix>,-1,-1> -okay_reduction_functor__::operator()(const T0__& sum_x, const T1__& y, - std::ostream* pstream__) const { - return okay_reduction(sum_x, y, pstream__); -} class tp_reused_model final : public model_base_crtp { private: double data_r; From fa22a37e263d670582a8c4e4a72edc537f88a151 Mon Sep 17 00:00:00 2001 From: Niko Huurre Date: Mon, 9 Jan 2023 14:30:52 +0200 Subject: [PATCH 03/13] allow shadowing userdef functions --- src/frontend/Typechecker.ml | 34 +++++++++++++++++------ test/integration/bad/functions-bad18.stan | 4 +-- test/integration/bad/stanc.expected | 13 ++++----- 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/frontend/Typechecker.ml b/src/frontend/Typechecker.ml index ca25ac1573..ff6b0e5d43 100644 --- a/src/frontend/Typechecker.ml +++ b/src/frontend/Typechecker.ml @@ -111,9 +111,8 @@ let verify_name_fresh_var loc tenv name = Semantic_error.ident_has_unnormalized_suffix loc name |> error else if List.exists (Env.find tenv name) ~f:(function - | {kind= `StanMath; _} -> - false (* user variables can shadow library names *) - | _ -> true ) + | {kind= `Variable _; _} -> true + | _ -> false (* user variables can shadow function names *) ) then Semantic_error.ident_in_use loc name |> error (** verify that the variable being declared is previous unused. *) @@ -1579,15 +1578,9 @@ and check_fundef loc cf tenv return_ty id args body = let arg_types = List.map ~f:(fun (w, y, _) -> (w, y)) args in let arg_identifiers = List.map ~f:(fun (_, _, z) -> z) args in let arg_names = List.map ~f:(fun x -> x.name) arg_identifiers in - verify_fundef_overloaded loc tenv id arg_types return_ty ; - let defined = get_fn_decl_or_defn loc tenv id arg_types return_ty body in verify_fundef_dist_rt loc id return_ty ; verify_pdf_fundef_first_arg_ty loc id arg_types ; verify_pmf_fundef_first_arg_ty loc id arg_types ; - let tenv = - add_function tenv id.name - (UFun (arg_types, return_ty, Fun_kind.suffix_from_name id.name, AoS)) - defined in List.iter ~f:(fun id -> verify_name_fresh tenv id ~is_udf:false) arg_identifiers ; @@ -1682,6 +1675,28 @@ let verify_functions_have_defn tenv function_block_stmts_opt = | Some {stmts= []; _} | None -> () | Some {stmts= ls; _} -> List.iter ~f:verify_fun_def_body_in_block ls +let add_userdefined_functions tenv stmts_opt = + match stmts_opt with + | None -> tenv + | Some {stmts; _} -> + let f tenv (s : Ast.untyped_statement) = + match s with + | {stmt= FunDef {returntype; funname; arguments; body}; smeta= {loc}} -> + let arg_types = List.map arguments ~f:(fun (a, t, _) -> (a, t)) in + verify_fundef_overloaded loc tenv funname arg_types returntype ; + let defined = + get_fn_decl_or_defn loc tenv funname arg_types returntype body + in + add_function tenv funname.name + (UFun + ( arg_types + , returntype + , Fun_kind.suffix_from_name funname.name + , AoS ) ) + defined + | _ -> tenv in + List.fold ~init:tenv ~f stmts + let check_toplevel_block block tenv stmts_opt = let cf = context block in match stmts_opt with @@ -1714,6 +1729,7 @@ let check_program_exn warnings := [] ; (* create a new type environment which has only stan-math functions *) let tenv = Env.stan_math_environment in + let tenv = add_userdefined_functions tenv fb in let tenv, typed_fb = check_toplevel_block Functions tenv fb in verify_functions_have_defn tenv typed_fb ; let tenv, typed_db = check_toplevel_block Data tenv db in diff --git a/test/integration/bad/functions-bad18.stan b/test/integration/bad/functions-bad18.stan index 8b83bd609b..37a9631025 100644 --- a/test/integration/bad/functions-bad18.stan +++ b/test/integration/bad/functions-bad18.stan @@ -4,9 +4,9 @@ functions { } } parameters { - real foo; // should be name conflict here + real foo; } model { foo ~ normal(0.0, 1.0); - foo(); + foo(); // the function has been shadowed, this `foo` is a number } diff --git a/test/integration/bad/stanc.expected b/test/integration/bad/stanc.expected index 27b6d61631..1784db8a3f 100644 --- a/test/integration/bad/stanc.expected +++ b/test/integration/bad/stanc.expected @@ -1193,17 +1193,16 @@ Semantic error in 'functions-bad17.stan', line 2, column 2 to line 4, column 3: Real return type required for probability functions ending in _log, _lpdf, _lupdf, _lpmf, _lupmf, _cdf, _lcdf, or _lccdf. $ ../../../../install/default/bin/stanc functions-bad18.stan -Semantic error in 'functions-bad18.stan', line 7, column 7 to column 10: +Semantic error in 'functions-bad18.stan', line 11, column 2 to column 8: ------------------------------------------------- - 5: } - 6: parameters { - 7: real foo; // should be name conflict here - ^ - 8: } 9: model { + 10: foo ~ normal(0.0, 1.0); + 11: foo(); // the function has been shadowed, this `foo` is a number + ^ + 12: } ------------------------------------------------- -Identifier 'foo' is already in use. +A non-returning function was expected but a non-function value 'foo' was supplied. $ ../../../../install/default/bin/stanc functions-bad19.stan Semantic error in 'functions-bad19.stan', line 4, column 2 to line 6, column 3: ------------------------------------------------- From 8c86341c2df6f6ab8c2510a99d423bb5931e36d4 Mon Sep 17 00:00:00 2001 From: Niko Huurre Date: Mon, 9 Jan 2023 16:16:38 +0200 Subject: [PATCH 04/13] deprecate forward declarations --- src/frontend/Ast.ml | 5 ++ src/frontend/Canonicalize.ml | 11 ++++- src/frontend/Deprecation_analysis.ml | 43 +++++++++++++---- src/frontend/Deprecation_analysis.mli | 11 +++++ src/frontend/Typechecker.ml | 2 +- src/middle/Fun_kind.ml | 2 +- src/middle/Mem_pattern.ml | 2 +- src/middle/UnsizedType.ml | 11 ++--- .../cli-args/canonicalize/canonical.expected | 2 +- .../cli-args/canonicalize/deprecated.stan | 1 + .../canonicalize/deprecations-only.expected | 2 +- .../canonicalize/everything-but.expected | 46 +++++++++++++------ .../cli-args/max-line-length/long.expected | 4 -- .../cli-args/max-line-length/mother.stan | 6 +-- .../cli-args/max-line-length/short.expected | 8 ---- .../downstream/rstanarm/inlined.expected | 39 ++++++++++++++++ .../downstream/rstanarm/pretty.expected | 39 ++++++++++++++++ test/integration/good/code-gen/cpp.expected | 8 ++++ test/integration/good/code-gen/mir.expected | 8 ---- test/integration/good/code-gen/mother.stan | 6 +-- .../standalone_functions/cpp.expected | 2 + .../good/code-gen/transformed_mir.expected | 8 ---- .../good/overloading/pretty.expected | 4 ++ test/integration/good/pretty.expected | 12 +++++ 24 files changed, 214 insertions(+), 68 deletions(-) diff --git a/src/frontend/Ast.ml b/src/frontend/Ast.ml index 0867311172..253d6e2165 100644 --- a/src/frontend/Ast.ml +++ b/src/frontend/Ast.ml @@ -302,6 +302,11 @@ let rec lvalue_of_expr {expr; emeta} = let rec id_of_lvalue {lval; _} = match lval with LVariable s -> s | LIndexed (l, _) -> id_of_lvalue l +let type_of_arguments : + (UnsizedType.autodifftype * UnsizedType.t * 'a) list + -> UnsizedType.argumentlist = + List.map ~f:(fun (a, t, _) -> (a, t)) + (* XXX: the parser produces inaccurate locations: smeta.loc.begin_loc is the last token before the current statement and all the whitespace between two statements appears as if it were part of the second statement. diff --git a/src/frontend/Canonicalize.ml b/src/frontend/Canonicalize.ml index 1e84a62681..a2cdf0ea81 100644 --- a/src/frontend/Canonicalize.ml +++ b/src/frontend/Canonicalize.ml @@ -261,7 +261,16 @@ let repair_syntax program settings = let canonicalize_program program settings : typed_program = let program = if settings.deprecations then - program + let fundefs = userdef_functions program in + let drop_forwarddecl = function + | {stmt= FunDef {body= {stmt= Skip; _}; funname; arguments; _}; _} + when is_redundant_forwarddecl fundefs funname arguments -> + false + | _ -> true in + { program with + functionblock= + Option.map program.functionblock ~f:(fun x -> + {x with stmts= List.filter ~f:drop_forwarddecl x.stmts} ) } |> map_program (replace_deprecated_stmt (collect_userdef_distributions program)) else program in diff --git a/src/frontend/Deprecation_analysis.ml b/src/frontend/Deprecation_analysis.ml index fca5ee2343..038a29d561 100644 --- a/src/frontend/Deprecation_analysis.ml +++ b/src/frontend/Deprecation_analysis.ml @@ -45,6 +45,21 @@ let is_deprecated_distribution name = let rename_deprecated map name = Map.find map name |> Option.map ~f:fst |> Option.value ~default:name +let userdef_functions program = + match program.functionblock with + | None -> [] + | Some {stmts; _} -> + List.filter_map stmts ~f:(function + | {stmt= FunDef {body= {stmt= Skip; _}; _}; _} -> None + | {stmt= FunDef {funname; arguments; _}; _} -> + Some (funname.name, Ast.type_of_arguments arguments) + | _ -> None ) + +let is_redundant_forwarddecl fundefs funname arguments = + let equal (id1, a1) (id2, a2) = + String.equal id1 id2 && UnsizedType.equal_argumentlist a1 a2 in + List.mem ~equal fundefs (funname.name, Ast.type_of_arguments arguments) + let userdef_distributions stmts = let open String in List.filter_map @@ -156,9 +171,15 @@ let rec collect_deprecated_expr (acc : (Location_span.t * string) list) let collect_deprecated_lval acc l = fold_lval_with collect_deprecated_expr (fun x _ -> x) acc l -let rec collect_deprecated_stmt (acc : (Location_span.t * string) list) {stmt; _} - : (Location_span.t * string) list = +let rec collect_deprecated_stmt fundefs (acc : (Location_span.t * string) list) + {stmt; _} : (Location_span.t * string) list = match stmt with + | FunDef {body= {stmt= Skip; _}; funname; arguments; _} + when is_redundant_forwarddecl fundefs funname arguments -> + acc + @ [ ( funname.id_loc + , "Forward declarations are deprecated and not needed for recursion." + ) ] | FunDef { body ; funname= {name; id_loc} @@ -174,8 +195,8 @@ let rec collect_deprecated_stmt (acc : (Location_span.t * string) list) {stmt; _ ^ "' instead if you intend on using this function in ~ \ statements or calling unnormalized probability functions \ inside of it." ) ] in - collect_deprecated_stmt acc body - | FunDef {body; _} -> collect_deprecated_stmt acc body + collect_deprecated_stmt fundefs acc body + | FunDef {body; _} -> collect_deprecated_stmt fundefs acc body | IfThenElse ({emeta= {type_= UReal; loc; _}; _}, ifb, elseb) -> let acc = acc @@ -184,8 +205,10 @@ let rec collect_deprecated_stmt (acc : (Location_span.t * string) list) {stmt; _ Stan 2.34. Use an explicit != 0 comparison instead. This can be \ automatically changed using the canonicalize flag for stanc" ) ] in - let acc = collect_deprecated_stmt acc ifb in - Option.value_map ~default:acc ~f:(collect_deprecated_stmt acc) elseb + let acc = collect_deprecated_stmt fundefs acc ifb in + Option.value_map ~default:acc + ~f:(collect_deprecated_stmt fundefs acc) + elseb | While ({emeta= {type_= UReal; loc; _}; _}, body) -> let acc = acc @@ -194,9 +217,10 @@ let rec collect_deprecated_stmt (acc : (Location_span.t * string) list) {stmt; _ Stan 2.34. Use an explicit != 0 comparison instead. This can be \ automatically changed using the canonicalize flag for stanc" ) ] in - collect_deprecated_stmt acc body + collect_deprecated_stmt fundefs acc body | _ -> - fold_statement collect_deprecated_expr collect_deprecated_stmt + fold_statement collect_deprecated_expr + (collect_deprecated_stmt fundefs) collect_deprecated_lval (fun l _ -> l) acc stmt @@ -208,4 +232,5 @@ let collect_userdef_distributions program = |> String.Map.of_alist_exn let collect_warnings (program : typed_program) = - fold_program collect_deprecated_stmt [] program + let fundefs = userdef_functions program in + fold_program (collect_deprecated_stmt fundefs) [] program diff --git a/src/frontend/Deprecation_analysis.mli b/src/frontend/Deprecation_analysis.mli index 6f41cf6133..28c8091afd 100644 --- a/src/frontend/Deprecation_analysis.mli +++ b/src/frontend/Deprecation_analysis.mli @@ -18,5 +18,16 @@ val is_deprecated_distribution : string -> bool val deprecated_distributions : (string * string) String.Map.t val deprecated_functions : (string * string) String.Map.t val rename_deprecated : (string * string) String.Map.t -> string -> string + +val userdef_functions : + ('a, 'b, 'c, 'd) statement_with program + -> (string * Middle.UnsizedType.argumentlist) list + +val is_redundant_forwarddecl : + (string * Middle.UnsizedType.argumentlist) list + -> identifier + -> (Middle.UnsizedType.autodifftype * Middle.UnsizedType.t * 'a) list + -> bool + val userdef_distributions : untyped_statement block option -> string list val collect_warnings : typed_program -> Warnings.t list diff --git a/src/frontend/Typechecker.ml b/src/frontend/Typechecker.ml index ff6b0e5d43..0d86dc7390 100644 --- a/src/frontend/Typechecker.ml +++ b/src/frontend/Typechecker.ml @@ -1682,7 +1682,7 @@ let add_userdefined_functions tenv stmts_opt = let f tenv (s : Ast.untyped_statement) = match s with | {stmt= FunDef {returntype; funname; arguments; body}; smeta= {loc}} -> - let arg_types = List.map arguments ~f:(fun (a, t, _) -> (a, t)) in + let arg_types = Ast.type_of_arguments arguments in verify_fundef_overloaded loc tenv funname arg_types returntype ; let defined = get_fn_decl_or_defn loc tenv funname arg_types returntype body diff --git a/src/middle/Fun_kind.ml b/src/middle/Fun_kind.ml index ffd7168797..6910d605bd 100644 --- a/src/middle/Fun_kind.ml +++ b/src/middle/Fun_kind.ml @@ -6,7 +6,7 @@ open Core_kernel open Core_kernel.Poly type 'propto suffix = FnPlain | FnRng | FnLpdf of 'propto | FnTarget -[@@deriving compare, sexp, hash, map] +[@@deriving compare, sexp, hash, map, equal] let without_propto = map_suffix (function true | false -> ()) diff --git a/src/middle/Mem_pattern.ml b/src/middle/Mem_pattern.ml index 897bbd3044..fc25eda3df 100644 --- a/src/middle/Mem_pattern.ml +++ b/src/middle/Mem_pattern.ml @@ -11,7 +11,7 @@ open Core_kernel.Poly * (fyi a var in the C++ code is an alias for var_value) * **) -type t = AoS | SoA [@@deriving sexp, compare, map, hash, fold] +type t = AoS | SoA [@@deriving sexp, compare, map, hash, fold, equal] let pp ppf = function | AoS -> Fmt.string ppf "AoS" diff --git a/src/middle/UnsizedType.ml b/src/middle/UnsizedType.ml index b56d7cbe4b..5f19095e11 100644 --- a/src/middle/UnsizedType.ml +++ b/src/middle/UnsizedType.ml @@ -14,16 +14,15 @@ type t = | UComplexRowVector | UComplexMatrix | UArray of t - | UFun of - (autodifftype * t) list - * returntype - * bool Fun_kind.suffix - * Mem_pattern.t + | UFun of argumentlist * returntype * bool Fun_kind.suffix * Mem_pattern.t | UMathLibraryFunction +and argumentlist = (autodifftype * t) list + and autodifftype = DataOnly | AutoDiffable -and returntype = Void | ReturnType of t [@@deriving compare, hash, sexp] +and returntype = Void | ReturnType of t +[@@deriving compare, hash, sexp, equal] let pp_autodifftype ppf = function | DataOnly -> Fmt.string ppf "data " diff --git a/test/integration/cli-args/canonicalize/canonical.expected b/test/integration/cli-args/canonicalize/canonical.expected index bda76dda0d..038704f352 100644 --- a/test/integration/cli-args/canonicalize/canonical.expected +++ b/test/integration/cli-args/canonicalize/canonical.expected @@ -240,7 +240,7 @@ generated quantities { x_r, x_i); } -Warning in 'deprecated.stan', line 36, column 2: Nested multi-indexing on the +Warning in 'deprecated.stan', line 37, column 2: Nested multi-indexing on the left hand side of assignment does not behave the same as nested indexing in expressions. This is considered a bug and will be disallowed in Stan 2.32.0. The indexing can be automatically fixed using the canonicalize diff --git a/test/integration/cli-args/canonicalize/deprecated.stan b/test/integration/cli-args/canonicalize/deprecated.stan index e6811810ba..9832b711a5 100644 --- a/test/integration/cli-args/canonicalize/deprecated.stan +++ b/test/integration/cli-args/canonicalize/deprecated.stan @@ -1,4 +1,5 @@ functions { + real[] sho(real t, real[] y, real[] theta, real[] x, int[] x_int); real[] sho(real t, real[] y, real[] theta, real[] x, int[] x_int) { real dydt[2]; dydt[1] <- y[2]; diff --git a/test/integration/cli-args/canonicalize/deprecations-only.expected b/test/integration/cli-args/canonicalize/deprecations-only.expected index 754a8e5673..225447859d 100644 --- a/test/integration/cli-args/canonicalize/deprecations-only.expected +++ b/test/integration/cli-args/canonicalize/deprecations-only.expected @@ -220,7 +220,7 @@ generated quantities { x_r, x_i); } -Warning in 'deprecated.stan', line 36, column 2: Nested multi-indexing on the +Warning in 'deprecated.stan', line 37, column 2: Nested multi-indexing on the left hand side of assignment does not behave the same as nested indexing in expressions. This is considered a bug and will be disallowed in Stan 2.32.0. The indexing can be automatically fixed using the canonicalize diff --git a/test/integration/cli-args/canonicalize/everything-but.expected b/test/integration/cli-args/canonicalize/everything-but.expected index aaadaefeca..c0b75c9a57 100644 --- a/test/integration/cli-args/canonicalize/everything-but.expected +++ b/test/integration/cli-args/canonicalize/everything-but.expected @@ -169,41 +169,61 @@ Warning in 'deprecated.stan', line 2, column 55: Declaration of arrays by placing brackets after a type is deprecated and will be removed in Stan 2.32.0. Instead use the array keyword before the type. This can be changed automatically using the auto-format flag to stanc -Warning in 'deprecated.stan', line 3, column 4: Declaration of arrays by +Warning in 'deprecated.stan', line 3, column 2: Declaration of arrays by + placing brackets after a type is deprecated and will be removed in Stan + 2.32.0. Instead use the array keyword before the type. This can be + changed automatically using the auto-format flag to stanc +Warning in 'deprecated.stan', line 3, column 21: Declaration of arrays by + placing brackets after a type is deprecated and will be removed in Stan + 2.32.0. Instead use the array keyword before the type. This can be + changed automatically using the auto-format flag to stanc +Warning in 'deprecated.stan', line 3, column 31: Declaration of arrays by + placing brackets after a type is deprecated and will be removed in Stan + 2.32.0. Instead use the array keyword before the type. This can be + changed automatically using the auto-format flag to stanc +Warning in 'deprecated.stan', line 3, column 45: Declaration of arrays by + placing brackets after a type is deprecated and will be removed in Stan + 2.32.0. Instead use the array keyword before the type. This can be + changed automatically using the auto-format flag to stanc +Warning in 'deprecated.stan', line 3, column 55: Declaration of arrays by + placing brackets after a type is deprecated and will be removed in Stan + 2.32.0. Instead use the array keyword before the type. This can be + changed automatically using the auto-format flag to stanc +Warning in 'deprecated.stan', line 4, column 4: Declaration of arrays by placing brackets after a variable name is deprecated and will be removed in Stan 2.32.0. Instead use the array keyword before the type. This can be changed automatically using the auto-format flag to stanc -Warning in 'deprecated.stan', line 4, column 12: assignment operator <- is +Warning in 'deprecated.stan', line 5, column 12: assignment operator <- is deprecated in the Stan language and will be removed in Stan 2.32.0; use = instead. This can be done automatically with the canonicalize flag for stanc -Warning in 'deprecated.stan', line 5, column 12: assignment operator <- is +Warning in 'deprecated.stan', line 6, column 12: assignment operator <- is deprecated in the Stan language and will be removed in Stan 2.32.0; use = instead. This can be done automatically with the canonicalize flag for stanc -Warning in 'deprecated.stan', line 34, column 2: Declaration of arrays by +Warning in 'deprecated.stan', line 35, column 2: Declaration of arrays by placing brackets after a variable name is deprecated and will be removed in Stan 2.32.0. Instead use the array keyword before the type. This can be changed automatically using the auto-format flag to stanc -Warning in 'deprecated.stan', line 54, column 4: increment_log_prob(...); is +Warning in 'deprecated.stan', line 55, column 4: increment_log_prob(...); is deprecated and will be removed in Stan 2.32.0. Use target += ...; instead. This can be done automatically with the canonicalize flag for stanc -Warning in 'deprecated.stan', line 58, column 4: increment_log_prob(...); is +Warning in 'deprecated.stan', line 59, column 4: increment_log_prob(...); is deprecated and will be removed in Stan 2.32.0. Use target += ...; instead. This can be done automatically with the canonicalize flag for stanc -Warning in 'deprecated.stan', line 78, column 20: get_lp() function is +Warning in 'deprecated.stan', line 79, column 20: get_lp() function is deprecated. It will be removed in Stan 2.32.0. Use target() instead. This can be done automatically with the canonicalize flag for stanc -Semantic error in 'deprecated.stan', line 46, column 6 to column 18: +Semantic error in 'deprecated.stan', line 47, column 6 to column 18: ------------------------------------------------- - 44: target += binomial_coefficient_log(10, 10); - 45: - 46: c ~ poisson_lpmf(3.0); + 45: target += binomial_coefficient_log(10, 10); + 46: + 47: c ~ poisson_lpmf(3.0); ^ - 47: c ~ poisson_log(3.0); - 48: c ~ poisson_log_log(3.0); + 48: c ~ poisson_log(3.0); + 49: c ~ poisson_log_log(3.0); ------------------------------------------------- ~ statement should refer to a distribution without its "_lpdf/_lupdf" or "_lpmf/_lupmf" suffix. diff --git a/test/integration/cli-args/max-line-length/long.expected b/test/integration/cli-args/max-line-length/long.expected index 66dd8bd75f..6df22206ab 100644 --- a/test/integration/cli-args/max-line-length/long.expected +++ b/test/integration/cli-args/max-line-length/long.expected @@ -7,8 +7,6 @@ // generate_transform_inits_method(prog.parameter_decl_, o); functions { - int foo(int n); - int foo(int n) { if (n == 0) { return 1; @@ -16,8 +14,6 @@ functions { return n * foo(n - 1); } - array[] real sho(real t, array[] real y, array[] real theta, data array[] real x, data array[] int x_int); - array[] real sho(real t, array[] real y, array[] real theta, data array[] real x, data array[] int x_int) { array[2] real dydt; dydt[1] = y[2]; diff --git a/test/integration/cli-args/max-line-length/mother.stan b/test/integration/cli-args/max-line-length/mother.stan index 0ce7ba0c88..c1928c7e13 100644 --- a/test/integration/cli-args/max-line-length/mother.stan +++ b/test/integration/cli-args/max-line-length/mother.stan @@ -6,7 +6,7 @@ // generate_transform_inits_method(prog.parameter_decl_, o); functions { - int foo(int n); + int foo(int n) { if (n == 0) { @@ -15,8 +15,8 @@ functions { return n * foo(n - 1); } - array[] real sho(real t, array[] real y, array[] real theta, - data array[] real x, data array[] int x_int); + + array[] real sho(real t, array[] real y, array[] real theta, data array[] real x, data array[] int x_int) { diff --git a/test/integration/cli-args/max-line-length/short.expected b/test/integration/cli-args/max-line-length/short.expected index 1ee706d95b..0c23043e16 100644 --- a/test/integration/cli-args/max-line-length/short.expected +++ b/test/integration/cli-args/max-line-length/short.expected @@ -7,8 +7,6 @@ // generate_transform_inits_method(prog.parameter_decl_, o); functions { - int foo(int n); - int foo(int n) { if (n == 0) { return 1; @@ -16,12 +14,6 @@ functions { return n * foo(n - 1); } - array[] real sho(real t, - array[] real y, - array[] real theta, - data array[] real x, - data array[] int x_int); - array[] real sho(real t, array[] real y, array[] real theta, diff --git a/test/integration/downstream/rstanarm/inlined.expected b/test/integration/downstream/rstanarm/inlined.expected index 639bd492e9..803b5bd0e9 100644 --- a/test/integration/downstream/rstanarm/inlined.expected +++ b/test/integration/downstream/rstanarm/inlined.expected @@ -946,6 +946,9 @@ generated quantities { } } +Warning in './/functions/bernoulli_likelihoods.stan', line 84, column 7, included from +'bernoulli.stan', line 7, column 2: Forward + declarations are deprecated and not needed for recursion. $ ../../../../../install/default/bin/stanc --include-paths="." --auto-format --canonicalize=includes --allow-undefined binomial.stan // This file is part of rstanarm. // Copyright (C) 2015, 2016 2017 Trustees of Columbia University @@ -3298,6 +3301,36 @@ generated quantities { } } +Warning in './/functions/SSfunctions.stan', line 1, column 7, included from +'continuous.stan', line 9, column 2: Forward + declarations are deprecated and not needed for recursion. +Warning in './/functions/SSfunctions.stan', line 2, column 7, included from +'continuous.stan', line 9, column 2: Forward + declarations are deprecated and not needed for recursion. +Warning in './/functions/SSfunctions.stan', line 3, column 7, included from +'continuous.stan', line 9, column 2: Forward + declarations are deprecated and not needed for recursion. +Warning in './/functions/SSfunctions.stan', line 4, column 7, included from +'continuous.stan', line 9, column 2: Forward + declarations are deprecated and not needed for recursion. +Warning in './/functions/SSfunctions.stan', line 5, column 7, included from +'continuous.stan', line 9, column 2: Forward + declarations are deprecated and not needed for recursion. +Warning in './/functions/SSfunctions.stan', line 6, column 7, included from +'continuous.stan', line 9, column 2: Forward + declarations are deprecated and not needed for recursion. +Warning in './/functions/SSfunctions.stan', line 7, column 7, included from +'continuous.stan', line 9, column 2: Forward + declarations are deprecated and not needed for recursion. +Warning in './/functions/SSfunctions.stan', line 8, column 7, included from +'continuous.stan', line 9, column 2: Forward + declarations are deprecated and not needed for recursion. +Warning in './/functions/SSfunctions.stan', line 9, column 7, included from +'continuous.stan', line 9, column 2: Forward + declarations are deprecated and not needed for recursion. +Warning in './/functions/SSfunctions.stan', line 10, column 7, included from +'continuous.stan', line 9, column 2: Forward + declarations are deprecated and not needed for recursion. $ ../../../../../install/default/bin/stanc --include-paths="." --auto-format --canonicalize=includes --allow-undefined count.stan // This file is part of rstanarm. // Copyright (C) 2015, 2016 2017 Trustees of Columbia University @@ -7211,6 +7244,9 @@ generated quantities { - dot_product(a_xbar, a_beta); } +Warning in './/functions/bernoulli_likelihoods.stan', line 84, column 7, included from +'jm.stan', line 8, column 0: Forward + declarations are deprecated and not needed for recursion. $ ../../../../../install/default/bin/stanc --include-paths="." --auto-format --canonicalize=includes --allow-undefined lm.stan // This file is part of rstanarm. // Copyright (C) 2015, 2016 2017 Trustees of Columbia University @@ -9270,6 +9306,9 @@ generated quantities { } } +Warning in './/functions/bernoulli_likelihoods.stan', line 84, column 7, included from +'mvmer.stan', line 8, column 0: Forward + declarations are deprecated and not needed for recursion. $ ../../../../../install/default/bin/stanc --include-paths="." --auto-format --canonicalize=includes --allow-undefined polr.stan // This file is part of rstanarm. // Copyright (C) 2015, 2016 2017 Trustees of Columbia University diff --git a/test/integration/downstream/rstanarm/pretty.expected b/test/integration/downstream/rstanarm/pretty.expected index 66d3b734c2..c0ac345cf6 100644 --- a/test/integration/downstream/rstanarm/pretty.expected +++ b/test/integration/downstream/rstanarm/pretty.expected @@ -200,6 +200,9 @@ generated quantities { } } +Warning in './/functions/bernoulli_likelihoods.stan', line 84, column 7, included from +'bernoulli.stan', line 7, column 2: Forward + declarations are deprecated and not needed for recursion. $ ../../../../../install/default/bin/stanc --include-paths="." --auto-format --allow-undefined binomial.stan #include /pre/Columbia_copyright.stan #include /pre/license.stan @@ -711,6 +714,36 @@ generated quantities { } } +Warning in './/functions/SSfunctions.stan', line 1, column 7, included from +'continuous.stan', line 9, column 2: Forward + declarations are deprecated and not needed for recursion. +Warning in './/functions/SSfunctions.stan', line 2, column 7, included from +'continuous.stan', line 9, column 2: Forward + declarations are deprecated and not needed for recursion. +Warning in './/functions/SSfunctions.stan', line 3, column 7, included from +'continuous.stan', line 9, column 2: Forward + declarations are deprecated and not needed for recursion. +Warning in './/functions/SSfunctions.stan', line 4, column 7, included from +'continuous.stan', line 9, column 2: Forward + declarations are deprecated and not needed for recursion. +Warning in './/functions/SSfunctions.stan', line 5, column 7, included from +'continuous.stan', line 9, column 2: Forward + declarations are deprecated and not needed for recursion. +Warning in './/functions/SSfunctions.stan', line 6, column 7, included from +'continuous.stan', line 9, column 2: Forward + declarations are deprecated and not needed for recursion. +Warning in './/functions/SSfunctions.stan', line 7, column 7, included from +'continuous.stan', line 9, column 2: Forward + declarations are deprecated and not needed for recursion. +Warning in './/functions/SSfunctions.stan', line 8, column 7, included from +'continuous.stan', line 9, column 2: Forward + declarations are deprecated and not needed for recursion. +Warning in './/functions/SSfunctions.stan', line 9, column 7, included from +'continuous.stan', line 9, column 2: Forward + declarations are deprecated and not needed for recursion. +Warning in './/functions/SSfunctions.stan', line 10, column 7, included from +'continuous.stan', line 9, column 2: Forward + declarations are deprecated and not needed for recursion. $ ../../../../../install/default/bin/stanc --include-paths="." --auto-format --allow-undefined count.stan #include /pre/Columbia_copyright.stan #include /pre/license.stan @@ -1080,6 +1113,9 @@ generated quantities { - dot_product(a_xbar, a_beta); } +Warning in './/functions/bernoulli_likelihoods.stan', line 84, column 7, included from +'jm.stan', line 8, column 0: Forward + declarations are deprecated and not needed for recursion. $ ../../../../../install/default/bin/stanc --include-paths="." --auto-format --allow-undefined lm.stan #include /pre/Columbia_copyright.stan #include /pre/license.stan @@ -1276,6 +1312,9 @@ generated quantities { #include /gqs/gen_quantities_mvmer.stan } +Warning in './/functions/bernoulli_likelihoods.stan', line 84, column 7, included from +'mvmer.stan', line 8, column 0: Forward + declarations are deprecated and not needed for recursion. $ ../../../../../install/default/bin/stanc --include-paths="." --auto-format --allow-undefined polr.stan #include /pre/Columbia_copyright.stan #include /pre/license.stan diff --git a/test/integration/good/code-gen/cpp.expected b/test/integration/good/code-gen/cpp.expected index 05f9ed8fb3..5c41415ce7 100644 --- a/test/integration/good/code-gen/cpp.expected +++ b/test/integration/good/code-gen/cpp.expected @@ -19573,6 +19573,10 @@ stan::math::profile_map& get_stan_profile_data() { return overloading_templating_model_namespace::profiles__; } #endif +Warning in 'overloading_templating.stan', line 4, column 7: Forward + declarations are deprecated and not needed for recursion. +Warning in 'overloading_templating.stan', line 5, column 7: Forward + declarations are deprecated and not needed for recursion. $ ../../../../../install/default/bin/stanc --print-cpp param-constraint.stan // Code generated by %%NAME%% %%VERSION%% #include @@ -21188,6 +21192,10 @@ stan::math::profile_map& get_stan_profile_data() { return recursive_slicing_model_namespace::profiles__; } #endif +Warning in 'recursive-slicing.stan', line 33, column 7: Forward declarations + are deprecated and not needed for recursion. +Warning in 'recursive-slicing.stan', line 34, column 7: Forward declarations + are deprecated and not needed for recursion. $ ../../../../../install/default/bin/stanc --print-cpp reduce_sum_m1.stan // Code generated by %%NAME%% %%VERSION%% #include diff --git a/test/integration/good/code-gen/mir.expected b/test/integration/good/code-gen/mir.expected index a23cf5dfe4..5fbfd70c1e 100644 --- a/test/integration/good/code-gen/mir.expected +++ b/test/integration/good/code-gen/mir.expected @@ -1,8 +1,6 @@ $ ../../../../../install/default/bin/stanc --debug-mir mother.stan ((functions_block (((fdrt (UInt)) (fdname foo) (fdsuffix FnPlain) - (fdargs ((AutoDiffable n UInt))) (fdbody ()) (fdloc )) - ((fdrt (UInt)) (fdname foo) (fdsuffix FnPlain) (fdargs ((AutoDiffable n UInt))) (fdbody (((pattern @@ -46,12 +44,6 @@ (meta ))))) (meta )))) (fdloc )) - ((fdrt ((UArray UReal))) (fdname sho) (fdsuffix FnPlain) - (fdargs - ((AutoDiffable t UReal) (AutoDiffable y (UArray UReal)) - (AutoDiffable theta (UArray UReal)) (DataOnly x (UArray UReal)) - (DataOnly x_int (UArray UInt)))) - (fdbody ()) (fdloc )) ((fdrt ((UArray UReal))) (fdname sho) (fdsuffix FnPlain) (fdargs ((AutoDiffable t UReal) (AutoDiffable y (UArray UReal)) diff --git a/test/integration/good/code-gen/mother.stan b/test/integration/good/code-gen/mother.stan index 58edf580d0..252fcadf2e 100644 --- a/test/integration/good/code-gen/mother.stan +++ b/test/integration/good/code-gen/mother.stan @@ -6,7 +6,7 @@ // generate_transform_inits_method(prog.parameter_decl_, o); functions { - int foo(int n); + int foo(int n) { if (n == 0) @@ -14,8 +14,8 @@ functions { return n * foo(n - 1); } - array[] real sho(real t, array[] real y, array[] real theta, - data array[] real x, data array[] int x_int); + + array[] real sho(real t, array[] real y, array[] real theta, data array[] real x, data array[] int x_int) { diff --git a/test/integration/good/code-gen/standalone_functions/cpp.expected b/test/integration/good/code-gen/standalone_functions/cpp.expected index 63b77049ed..ec0f7cf67a 100644 --- a/test/integration/good/code-gen/standalone_functions/cpp.expected +++ b/test/integration/good/code-gen/standalone_functions/cpp.expected @@ -281,6 +281,8 @@ auto test_lpdf(const double& a, const double& b, std::ostream* pstream__ = nullptr) { return basic_model_namespace::test_lpdf(a, b, pstream__); } +Warning in 'basic.stan', line 2, column 7: Forward declarations are + deprecated and not needed for recursion. $ ../../../../../../install/default/bin/stanc --standalone-functions --print-cpp basic.stanfunctions // Code generated by %%NAME%% %%VERSION%% #include diff --git a/test/integration/good/code-gen/transformed_mir.expected b/test/integration/good/code-gen/transformed_mir.expected index 400c01a5d9..fdc4b98f90 100644 --- a/test/integration/good/code-gen/transformed_mir.expected +++ b/test/integration/good/code-gen/transformed_mir.expected @@ -1,8 +1,6 @@ $ ../../../../../install/default/bin/stanc --debug-transformed-mir mother.stan ((functions_block (((fdrt (UInt)) (fdname foo) (fdsuffix FnPlain) - (fdargs ((AutoDiffable n UInt))) (fdbody ()) (fdloc )) - ((fdrt (UInt)) (fdname foo) (fdsuffix FnPlain) (fdargs ((AutoDiffable n UInt))) (fdbody (((pattern @@ -49,12 +47,6 @@ (meta ))))) (meta )))) (fdloc )) - ((fdrt ((UArray UReal))) (fdname sho) (fdsuffix FnPlain) - (fdargs - ((AutoDiffable t UReal) (AutoDiffable y (UArray UReal)) - (AutoDiffable theta (UArray UReal)) (DataOnly x (UArray UReal)) - (DataOnly x_int (UArray UInt)))) - (fdbody ()) (fdloc )) ((fdrt ((UArray UReal))) (fdname sho) (fdsuffix FnPlain) (fdargs ((AutoDiffable t UReal) (AutoDiffable y (UArray UReal)) diff --git a/test/integration/good/overloading/pretty.expected b/test/integration/good/overloading/pretty.expected index 8b005caa87..7346c3e61c 100644 --- a/test/integration/good/overloading/pretty.expected +++ b/test/integration/good/overloading/pretty.expected @@ -68,6 +68,10 @@ transformed data { } } +Warning in 'forward_decl.stan', line 2, column 6: Forward declarations are + deprecated and not needed for recursion. +Warning in 'forward_decl.stan', line 3, column 6: Forward declarations are + deprecated and not needed for recursion. $ ../../../../../install/default/bin/stanc --auto-format is_real.stan functions { int is_real(real x) { diff --git a/test/integration/good/pretty.expected b/test/integration/good/pretty.expected index 819bd77df9..5ccfb7ba0a 100644 --- a/test/integration/good/pretty.expected +++ b/test/integration/good/pretty.expected @@ -2921,6 +2921,8 @@ model { ); } +Warning in 'fun_log_forward_decl.stan', line 6, column 7: Forward + declarations are deprecated and not needed for recursion. $ ../../../../install/default/bin/stanc --auto-format functions-fwd-ref.stan functions { int foo(int n); @@ -2938,6 +2940,8 @@ model { y ~ normal(0, 1); } +Warning in 'functions-fwd-ref.stan', line 3, column 6: Forward declarations + are deprecated and not needed for recursion. $ ../../../../install/default/bin/stanc --auto-format functions-good-void.stan functions { void linear_regression_lp(vector x, vector y, real alpha, real beta, @@ -4067,6 +4071,8 @@ model { theta ~ normal(0, 1); } +Warning in 'multiple_funs.stan', line 2, column 6: Forward declarations are + deprecated and not needed for recursion. $ ../../../../install/default/bin/stanc --auto-format neg_binomial_2_log_glm_old_performance.stan transformed data { int N = 50; @@ -5572,6 +5578,12 @@ generated quantities { gq_d2 = my_fun3(gq_d1); } +Warning in 'validate_functions.stan', line 2, column 7: Forward declarations + are deprecated and not needed for recursion. +Warning in 'validate_functions.stan', line 3, column 7: Forward declarations + are deprecated and not needed for recursion. +Warning in 'validate_functions.stan', line 4, column 7: Forward declarations + are deprecated and not needed for recursion. $ ../../../../install/default/bin/stanc --auto-format validate_int_divide_good.stan data { int i; From 0eb4dcce55017a151c4345d2b3c5a38ff256f671 Mon Sep 17 00:00:00 2001 From: Niko Huurre Date: Mon, 9 Jan 2023 19:09:37 +0200 Subject: [PATCH 05/13] fix overloaded udfs in higher-order functions --- src/stan_math_backend/Lower_functions.ml | 28 +- test/integration/good/code-gen/cpp.expected | 936 +++++++++--------- test/integration/good/code-gen/lir.expected | 44 +- .../good/code-gen/ode/cpp.expected | 68 +- .../standalone_functions/cpp.expected | 2 +- 5 files changed, 544 insertions(+), 534 deletions(-) diff --git a/src/stan_math_backend/Lower_functions.ml b/src/stan_math_backend/Lower_functions.ml index c91b122eb8..0bd43f9935 100644 --- a/src/stan_math_backend/Lower_functions.ml +++ b/src/stan_math_backend/Lower_functions.ml @@ -246,11 +246,12 @@ let get_functor_requirements (p : Program.Numbered.t) = let rec find_functors_expr init = function | {pattern= FunApp (StanLib (hof, FnPlain, _), args); _} -> let f accum = function - | {pattern= Var name; _} as e - when UnsizedType.is_fun_type (Expr.Typed.type_of e) -> + | { pattern= Var name + ; meta= {Expr.Typed.Meta.type_= UnsizedType.UFun (args, _, _, _); _} + } -> Map.add_multi accum ~key:(Utils.stdlib_distribution_name name) - ~data:(Lower_expr.functor_type hof) + ~data:(Lower_expr.functor_type hof, List.map ~f:snd args) | e -> find_functors_expr accum e in List.fold ~init ~f args | {pattern; _} -> Pattern.fold find_functors_expr init pattern in @@ -267,20 +268,31 @@ let collect_functors_functions (p : Program.Numbered.t) : defn list = | {fdname; fdbody= Some _; _} -> Some fdname | _ -> None ) |> String.Set.of_list in + let structs = String.Table.create () in let fun_decls, fun_defns = p.functions_block |> List.filter_map ~f:(fun d -> if Set.mem fun_has_def d.fdname && Option.is_none d.fdbody then None else let functors = - Map.find_multi functor_required d.fdname |> List.stable_dedup - in + Map.find_multi functor_required d.fdname + |> List.stable_dedup + |> List.filter_map ~f:(fun (x, ts) -> + if + List.equal UnsizedType.equal ts + (List.map ~f:(fun (_, _, t) -> t) d.fdargs) + then Some x + else None ) in let fn, st = lower_fun_def functors d in + List.iter st ~f:(fun s -> + Hashtbl.update structs s.struct_name ~f:(function + | Some x -> {x with body= x.body @ s.body} + | None -> s ) ) ; let decl, defn = Cpp.split_fun_decl_defn fn in - Some - (FunDef decl :: List.map ~f:(fun s -> Struct s) st, FunDef defn) ) + Some (FunDef decl, FunDef defn) ) |> List.unzip in - List.concat fun_decls @ fun_defns + let structs = Hashtbl.data structs |> List.map ~f:(fun s -> Struct s) in + fun_decls @ structs @ fun_defns let lower_standalone_fun_def namespace_fun Program.{fdname; fdsuffix; fdargs; fdbody; fdrt; _} = diff --git a/test/integration/good/code-gen/cpp.expected b/test/integration/good/code-gen/cpp.expected index 5c41415ce7..75e1f80e4d 100644 --- a/test/integration/good/code-gen/cpp.expected +++ b/test/integration/good/code-gen/cpp.expected @@ -3642,6 +3642,16 @@ Eigen::Matrix, algebra_system(const T0__& x_arg__, const T1__& y_arg__, const std::vector& dat, const std::vector& dat_int, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,1> +binomialf(const T0__& phi_arg__, const T1__& theta_arg__, + const std::vector& x_r, const std::vector& x_i, + std::ostream* pstream__); struct algebra_system_functor__ { template , @@ -3656,16 +3666,6 @@ struct algebra_system_functor__ { return algebra_system(x, y, dat, dat_int, pstream__); } }; -template , - stan::is_vt_not_complex, - stan::is_col_vector, - stan::is_vt_not_complex>* = nullptr> -Eigen::Matrix, - stan::base_type_t>,-1,1> -binomialf(const T0__& phi_arg__, const T1__& theta_arg__, - const std::vector& x_r, const std::vector& x_i, - std::ostream* pstream__); struct binomialf_functor__ { template , @@ -10760,19 +10760,6 @@ std::vector> sho(const T0__& t, const std::vector& y, const std::vector& theta, const std::vector& x, const std::vector& x_int, std::ostream* pstream__); -struct sho_functor__ { - template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - std::vector> - operator()(const T0__& t, const std::vector& y, - const std::vector& theta, const std::vector& x, - const std::vector& x_int, std::ostream* pstream__) const { - return sho(t, y, theta, x, x_int, pstream__); - } -}; template , stan::is_stan_scalar, @@ -10782,19 +10769,6 @@ stan::promote_args_t integrand(const T0__& x, const T1__& xc, const std::vector& theta, const std::vector& x_r, const std::vector& x_i, std::ostream* pstream__); -struct integrand_functor__ { - template , - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const T0__& x, const T1__& xc, const std::vector& theta, - const std::vector& x_r, const std::vector& x_i, - std::ostream* pstream__) const { - return integrand(x, xc, theta, x_r, x_i, pstream__); - } -}; template , stan::is_vt_not_complex, @@ -10806,21 +10780,6 @@ Eigen::Matrix, foo(const T0__& shared_params_arg__, const T1__& job_params_arg__, const std::vector& data_r, const std::vector& data_i, std::ostream* pstream__); -struct foo_functor__ { - template , - stan::is_vt_not_complex, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar>* = nullptr> - Eigen::Matrix, - stan::base_type_t, T2__>,-1,1> - operator()(const T0__& shared_params, const T1__& job_params, - const std::vector& data_r, const std::vector& data_i, - std::ostream* pstream__) const { - return foo(shared_params, job_params, data_r, data_i, pstream__); - } -}; template , stan::is_vt_not_complex, @@ -10832,21 +10791,6 @@ Eigen::Matrix, goo(const T0__& shared_params_arg__, const T1__& job_params_arg__, const std::vector& data_r, const std::vector& data_i, std::ostream* pstream__); -struct goo_functor__ { - template , - stan::is_vt_not_complex, - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar>* = nullptr> - Eigen::Matrix, - stan::base_type_t, T2__>,-1,1> - operator()(const T0__& shared_params, const T1__& job_params, - const std::vector& data_r, const std::vector& data_i, - std::ostream* pstream__) const { - return goo(shared_params, job_params, data_r, data_i, pstream__); - } -}; template >* = nullptr> stan::promote_args_t @@ -10862,6 +10806,49 @@ Eigen::Matrix, algebra_system(const T0__& x_arg__, const T1__& y_arg__, const std::vector& dat, const std::vector& dat_int, std::ostream* pstream__); +struct goo_functor__ { + template , + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar>* = nullptr> + Eigen::Matrix, + stan::base_type_t, T2__>,-1,1> + operator()(const T0__& shared_params, const T1__& job_params, + const std::vector& data_r, const std::vector& data_i, + std::ostream* pstream__) const { + return goo(shared_params, job_params, data_r, data_i, pstream__); + } +}; +struct foo_functor__ { + template , + stan::is_vt_not_complex, + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar>* = nullptr> + Eigen::Matrix, + stan::base_type_t, T2__>,-1,1> + operator()(const T0__& shared_params, const T1__& job_params, + const std::vector& data_r, const std::vector& data_i, + std::ostream* pstream__) const { + return foo(shared_params, job_params, data_r, data_i, pstream__); + } +}; +struct integrand_functor__ { + template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> + stan::promote_args_t + operator()(const T0__& x, const T1__& xc, const std::vector& theta, + const std::vector& x_r, const std::vector& x_i, + std::ostream* pstream__) const { + return integrand(x, xc, theta, x_r, x_i, pstream__); + } +}; struct algebra_system_functor__ { template , @@ -10876,6 +10863,19 @@ struct algebra_system_functor__ { return algebra_system(x, y, dat, dat_int, pstream__); } }; +struct sho_functor__ { + template , + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> + std::vector> + operator()(const T0__& t, const std::vector& y, + const std::vector& theta, const std::vector& x, + const std::vector& x_int, std::ostream* pstream__) const { + return sho(t, y, theta, x, x_int, pstream__); + } +}; template , stan::is_stan_scalar, @@ -21235,21 +21235,17 @@ template g(const std::vector& y_slice, const int& start, const int& end, std::ostream* pstream__); -struct g_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__) const { - return g(y_slice, (start + 1), (end + 1), pstream__); - } -}; template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t h(const std::vector& y_slice, const int& start, const int& end, const std::vector& a, std::ostream* pstream__); +template >* = nullptr> +stan::promote_args_t +foo_lpdf(const std::vector& y_slice, const int& start, const int& end, + std::ostream* pstream__); struct h_rsfunctor__ { template , @@ -21260,11 +21256,15 @@ struct h_rsfunctor__ { return h(y_slice, (start + 1), (end + 1), a, pstream__); } }; -template >* = nullptr> -stan::promote_args_t -foo_lpdf(const std::vector& y_slice, const int& start, const int& end, - std::ostream* pstream__); +struct g_rsfunctor__ { + template >* = nullptr> + stan::promote_args_t + operator()(const std::vector& y_slice, const int& start, const int& + end, std::ostream* pstream__) const { + return g(y_slice, (start + 1), (end + 1), pstream__); + } +}; template struct foo_lpdf_rsfunctor__ { template g1(const std::vector& y_slice, const int& start, const int& end, std::ostream* pstream__); -struct g1_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__) const { - return g1(y_slice, (start + 1), (end + 1), pstream__); - } -}; template >* = nullptr> stan::promote_args_t g2(const std::vector>& y_slice, const int& start, const int& end, std::ostream* pstream__); -struct g2_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>& y_slice, const int& - start, const int& end, std::ostream* pstream__) const { - return g2(y_slice, (start + 1), (end + 1), pstream__); - } -}; template >* = nullptr> stan::promote_args_t g3(const std::vector>& y_slice, const int& start, const int& end, std::ostream* pstream__); -struct g3_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>& y_slice, const int& - start, const int& end, std::ostream* pstream__) const { - return g3(y_slice, (start + 1), (end + 1), pstream__); - } -}; template >* = nullptr> stan::promote_args_t g4(const std::vector>& y_slice, const int& start, const int& end, std::ostream* pstream__); -struct g4_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>& y_slice, - const int& start, const int& end, std::ostream* pstream__) const { - return g4(y_slice, (start + 1), (end + 1), pstream__); - } -}; template >* = nullptr> stan::promote_args_t g5(const std::vector>& y_slice, const int& start, const int& end, std::ostream* pstream__); -struct g5_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>& y_slice, const int& start, - const int& end, std::ostream* pstream__) const { - return g5(y_slice, (start + 1), (end + 1), pstream__); - } -}; template >* = nullptr> stan::promote_args_t g6(const std::vector>>& y_slice, const int& start, const int& end, std::ostream* pstream__); -struct g6_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>>& - y_slice, const int& start, const int& end, std::ostream* - pstream__) const { - return g6(y_slice, (start + 1), (end + 1), pstream__); - } -}; template >* = nullptr> stan::promote_args_t g7(const std::vector>>& y_slice, const int& start, const int& end, std::ostream* pstream__); -struct g7_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>>& - y_slice, const int& start, const int& end, std::ostream* - pstream__) const { - return g7(y_slice, (start + 1), (end + 1), pstream__); - } -}; template >* = nullptr> stan::promote_args_t g8(const std::vector>>& y_slice, const int& start, const int& end, std::ostream* pstream__); -struct g8_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>>& - y_slice, const int& start, const int& end, std::ostream* - pstream__) const { - return g8(y_slice, (start + 1), (end + 1), pstream__); - } -}; template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t h1(const std::vector& y, const int& start, const int& end, const std::vector& a, std::ostream* pstream__); -struct h1_rsfunctor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y, const int& start, const int& end, - std::ostream* pstream__, const std::vector& a) const { - return h1(y, (start + 1), (end + 1), a, pstream__); - } -}; template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t h2(const std::vector& y, const int& start, const int& end, const std::vector>& a, std::ostream* pstream__); -struct h2_rsfunctor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y, const int& start, const int& end, - std::ostream* pstream__, - const std::vector>& a) const { - return h2(y, (start + 1), (end + 1), a, pstream__); - } -}; template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t h3(const std::vector& y, const int& start, const int& end, const std::vector>& a, std::ostream* pstream__); -struct h3_rsfunctor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y, const int& start, const int& end, - std::ostream* pstream__, - const std::vector>& a) const { - return h3(y, (start + 1), (end + 1), a, pstream__); - } -}; template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t h4(const std::vector& y, const int& start, const int& end, const std::vector>& a, std::ostream* pstream__); -struct h4_rsfunctor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y, const int& start, const int& end, - std::ostream* pstream__, - const std::vector>& a) const { - return h4(y, (start + 1), (end + 1), a, pstream__); - } -}; template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t h5(const std::vector& y, const int& start, const int& end, const std::vector>& a, std::ostream* pstream__); +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +h6(const std::vector& y, const int& start, const int& end, + const std::vector>>& a, std::ostream* + pstream__); +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +h7(const std::vector& y, const int& start, const int& end, + const std::vector>>& a, std::ostream* + pstream__); +template , + stan::is_stan_scalar>* = nullptr> +stan::promote_args_t +h8(const std::vector& y, const int& start, const int& end, + const std::vector>>& a, + std::ostream* pstream__); struct h5_rsfunctor__ { template , @@ -22070,31 +21973,25 @@ struct h5_rsfunctor__ { return h5(y, (start + 1), (end + 1), a, pstream__); } }; -template , - stan::is_stan_scalar>* = nullptr> -stan::promote_args_t -h6(const std::vector& y, const int& start, const int& end, - const std::vector>>& a, std::ostream* - pstream__); -struct h6_rsfunctor__ { +struct h1_rsfunctor__ { template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t operator()(const std::vector& y, const int& start, const int& end, - std::ostream* pstream__, - const std::vector>>& a) const { - return h6(y, (start + 1), (end + 1), a, pstream__); + std::ostream* pstream__, const std::vector& a) const { + return h1(y, (start + 1), (end + 1), a, pstream__); + } +}; +struct g3_rsfunctor__ { + template >* = nullptr> + stan::promote_args_t + operator()(const std::vector>& y_slice, const int& + start, const int& end, std::ostream* pstream__) const { + return g3(y_slice, (start + 1), (end + 1), pstream__); } }; -template , - stan::is_stan_scalar>* = nullptr> -stan::promote_args_t -h7(const std::vector& y, const int& start, const int& end, - const std::vector>>& a, std::ostream* - pstream__); struct h7_rsfunctor__ { template , @@ -22106,13 +22003,47 @@ struct h7_rsfunctor__ { return h7(y, (start + 1), (end + 1), a, pstream__); } }; -template , - stan::is_stan_scalar>* = nullptr> -stan::promote_args_t -h8(const std::vector& y, const int& start, const int& end, - const std::vector>>& a, - std::ostream* pstream__); +struct h3_rsfunctor__ { + template , + stan::is_stan_scalar>* = nullptr> + stan::promote_args_t + operator()(const std::vector& y, const int& start, const int& end, + std::ostream* pstream__, + const std::vector>& a) const { + return h3(y, (start + 1), (end + 1), a, pstream__); + } +}; +struct g2_rsfunctor__ { + template >* = nullptr> + stan::promote_args_t + operator()(const std::vector>& y_slice, const int& + start, const int& end, std::ostream* pstream__) const { + return g2(y_slice, (start + 1), (end + 1), pstream__); + } +}; +struct g8_rsfunctor__ { + template >* = nullptr> + stan::promote_args_t + operator()(const std::vector>>& + y_slice, const int& start, const int& end, std::ostream* + pstream__) const { + return g8(y_slice, (start + 1), (end + 1), pstream__); + } +}; +struct h2_rsfunctor__ { + template , + stan::is_stan_scalar>* = nullptr> + stan::promote_args_t + operator()(const std::vector& y, const int& start, const int& end, + std::ostream* pstream__, + const std::vector>& a) const { + return h2(y, (start + 1), (end + 1), a, pstream__); + } +}; struct h8_rsfunctor__ { template , @@ -22124,6 +22055,75 @@ struct h8_rsfunctor__ { return h8(y, (start + 1), (end + 1), a, pstream__); } }; +struct g7_rsfunctor__ { + template >* = nullptr> + stan::promote_args_t + operator()(const std::vector>>& + y_slice, const int& start, const int& end, std::ostream* + pstream__) const { + return g7(y_slice, (start + 1), (end + 1), pstream__); + } +}; +struct g4_rsfunctor__ { + template >* = nullptr> + stan::promote_args_t + operator()(const std::vector>& y_slice, + const int& start, const int& end, std::ostream* pstream__) const { + return g4(y_slice, (start + 1), (end + 1), pstream__); + } +}; +struct h4_rsfunctor__ { + template , + stan::is_stan_scalar>* = nullptr> + stan::promote_args_t + operator()(const std::vector& y, const int& start, const int& end, + std::ostream* pstream__, + const std::vector>& a) const { + return h4(y, (start + 1), (end + 1), a, pstream__); + } +}; +struct g6_rsfunctor__ { + template >* = nullptr> + stan::promote_args_t + operator()(const std::vector>>& + y_slice, const int& start, const int& end, std::ostream* + pstream__) const { + return g6(y_slice, (start + 1), (end + 1), pstream__); + } +}; +struct g5_rsfunctor__ { + template >* = nullptr> + stan::promote_args_t + operator()(const std::vector>& y_slice, const int& start, + const int& end, std::ostream* pstream__) const { + return g5(y_slice, (start + 1), (end + 1), pstream__); + } +}; +struct h6_rsfunctor__ { + template , + stan::is_stan_scalar>* = nullptr> + stan::promote_args_t + operator()(const std::vector& y, const int& start, const int& end, + std::ostream* pstream__, + const std::vector>>& a) const { + return h6(y, (start + 1), (end + 1), a, pstream__); + } +}; +struct g1_rsfunctor__ { + template >* = nullptr> + stan::promote_args_t + operator()(const std::vector& y_slice, const int& start, const int& + end, std::ostream* pstream__) const { + return g1(y_slice, (start + 1), (end + 1), pstream__); + } +}; template >*> stan::promote_args_t g1(const std::vector& y_slice, const int& start, const int& end, @@ -24199,190 +24199,66 @@ template f1(const std::vector& y_slice, const int& start, const int& end, std::ostream* pstream__); -struct f1_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__) const { - return f1(y_slice, (start + 1), (end + 1), pstream__); - } -}; template >* = nullptr> stan::promote_args_t f1a(const std::vector& y_slice, const int& start, const int& end, std::ostream* pstream__); -struct f1a_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__) const { - return f1a(y_slice, (start + 1), (end + 1), pstream__); - } -}; template >* = nullptr> stan::promote_args_t f2(const std::vector>& y_slice, const int& start, const int& end, std::ostream* pstream__); -struct f2_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>& y_slice, const int& - start, const int& end, std::ostream* pstream__) const { - return f2(y_slice, (start + 1), (end + 1), pstream__); - } -}; template >* = nullptr> stan::promote_args_t f3(const std::vector>& y_slice, const int& start, const int& end, std::ostream* pstream__); -struct f3_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>& y_slice, const int& - start, const int& end, std::ostream* pstream__) const { - return f3(y_slice, (start + 1), (end + 1), pstream__); - } -}; template >* = nullptr> stan::promote_args_t f4(const std::vector>& y_slice, const int& start, const int& end, std::ostream* pstream__); -struct f4_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>& y_slice, - const int& start, const int& end, std::ostream* pstream__) const { - return f4(y_slice, (start + 1), (end + 1), pstream__); - } -}; template >* = nullptr> stan::promote_args_t f5(const std::vector>& y_slice, const int& start, const int& end, std::ostream* pstream__); -struct f5_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>& y_slice, const int& start, - const int& end, std::ostream* pstream__) const { - return f5(y_slice, (start + 1), (end + 1), pstream__); - } -}; template >* = nullptr> stan::promote_args_t f6(const std::vector>>& y_slice, const int& start, const int& end, std::ostream* pstream__); -struct f6_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>>& - y_slice, const int& start, const int& end, std::ostream* - pstream__) const { - return f6(y_slice, (start + 1), (end + 1), pstream__); - } -}; template >* = nullptr> stan::promote_args_t f7(const std::vector>>& y_slice, const int& start, const int& end, std::ostream* pstream__); -struct f7_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>>& - y_slice, const int& start, const int& end, std::ostream* - pstream__) const { - return f7(y_slice, (start + 1), (end + 1), pstream__); - } -}; template >* = nullptr> stan::promote_args_t f8(const std::vector>>& y_slice, const int& start, const int& end, std::ostream* pstream__); -struct f8_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>>& - y_slice, const int& start, const int& end, std::ostream* - pstream__) const { - return f8(y_slice, (start + 1), (end + 1), pstream__); - } -}; double f9(const std::vector& y_slice, const int& start, const int& end, std::ostream* pstream__); -struct f9_rsfunctor__ { - double - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__) const { - return f9(y_slice, (start + 1), (end + 1), pstream__); - } -}; double f10(const std::vector>& y_slice, const int& start, const int& end, std::ostream* pstream__); -struct f10_rsfunctor__ { - double - operator()(const std::vector>& y_slice, const int& start, - const int& end, std::ostream* pstream__) const { - return f10(y_slice, (start + 1), (end + 1), pstream__); - } -}; double f11(const std::vector>>& y_slice, const int& start, const int& end, std::ostream* pstream__); -struct f11_rsfunctor__ { - double - operator()(const std::vector>>& y_slice, - const int& start, const int& end, std::ostream* pstream__) const { - return f11(y_slice, (start + 1), (end + 1), pstream__); - } -}; template >* = nullptr> stan::promote_args_t f12(const std::vector>>& y_slice, const int& start, const int& end, std::ostream* pstream__); -struct f12_rsfunctor__ { - template >* = nullptr> - stan::promote_args_t - operator()(const std::vector>>& y_slice, - const int& start, const int& end, std::ostream* pstream__) const { - return f12(y_slice, (start + 1), (end + 1), pstream__); - } -}; template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t g1(const std::vector& y_slice, const int& start, const int& end, const T3__& a, std::ostream* pstream__); -struct g1_rsfunctor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__, const T3__& a) const { - return g1(y_slice, (start + 1), (end + 1), a, pstream__); - } -}; template , stan::is_col_vector, @@ -24390,17 +24266,6 @@ template > g2(const std::vector& y_slice, const int& start, const int& end, const T3__& a_arg__, std::ostream* pstream__); -struct g2_rsfunctor__ { - template , - stan::is_col_vector, - stan::is_vt_not_complex>* = nullptr> - stan::promote_args_t> - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__, const T3__& a) const { - return g2(y_slice, (start + 1), (end + 1), a, pstream__); - } -}; template , stan::is_row_vector, @@ -24408,17 +24273,6 @@ template > g3(const std::vector& y_slice, const int& start, const int& end, const T3__& a_arg__, std::ostream* pstream__); -struct g3_rsfunctor__ { - template , - stan::is_row_vector, - stan::is_vt_not_complex>* = nullptr> - stan::promote_args_t> - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__, const T3__& a) const { - return g3(y_slice, (start + 1), (end + 1), a, pstream__); - } -}; template , stan::is_eigen_matrix_dynamic, @@ -24426,101 +24280,36 @@ template > g4(const std::vector& y_slice, const int& start, const int& end, const T3__& a_arg__, std::ostream* pstream__); -struct g4_rsfunctor__ { - template , - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> - stan::promote_args_t> - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__, const T3__& a) const { - return g4(y_slice, (start + 1), (end + 1), a, pstream__); - } -}; template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t g5(const std::vector& y_slice, const int& start, const int& end, const std::vector& a, std::ostream* pstream__); -struct g5_rsfunctor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__, const std::vector& a) const { - return g5(y_slice, (start + 1), (end + 1), a, pstream__); - } -}; template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t g6(const std::vector& y_slice, const int& start, const int& end, const std::vector>& a, std::ostream* pstream__); -struct g6_rsfunctor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__, - const std::vector>& a) const { - return g6(y_slice, (start + 1), (end + 1), a, pstream__); - } -}; template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t g7(const std::vector& y_slice, const int& start, const int& end, const std::vector>& a, std::ostream* pstream__); -struct g7_rsfunctor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__, - const std::vector>& a) const { - return g7(y_slice, (start + 1), (end + 1), a, pstream__); - } -}; template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t g8(const std::vector& y_slice, const int& start, const int& end, const std::vector>& a, std::ostream* pstream__); -struct g8_rsfunctor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__, - const std::vector>& a) const { - return g8(y_slice, (start + 1), (end + 1), a, pstream__); - } -}; template , stan::is_stan_scalar>* = nullptr> stan::promote_args_t g9(const std::vector& y_slice, const int& start, const int& end, const std::vector>& a, std::ostream* pstream__); -struct g9_rsfunctor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__, - const std::vector>& a) const { - return g9(y_slice, (start + 1), (end + 1), a, pstream__); - } -}; template , stan::is_stan_scalar>* = nullptr> @@ -24528,17 +24317,6 @@ stan::promote_args_t g10(const std::vector& y_slice, const int& start, const int& end, const std::vector>>& a, std::ostream* pstream__); -struct g10_rsfunctor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__, - const std::vector>>& a) const { - return g10(y_slice, (start + 1), (end + 1), a, pstream__); - } -}; template , stan::is_stan_scalar>* = nullptr> @@ -24546,17 +24324,6 @@ stan::promote_args_t g11(const std::vector& y_slice, const int& start, const int& end, const std::vector>>& a, std::ostream* pstream__); -struct g11_rsfunctor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__, - const std::vector>>& a) const { - return g11(y_slice, (start + 1), (end + 1), a, pstream__); - } -}; template , stan::is_stan_scalar>* = nullptr> @@ -24564,17 +24331,6 @@ stan::promote_args_t g12(const std::vector& y_slice, const int& start, const int& end, const std::vector>>& a, std::ostream* pstream__); -struct g12_rsfunctor__ { - template , - stan::is_stan_scalar>* = nullptr> - stan::promote_args_t - operator()(const std::vector& y_slice, const int& start, const int& - end, std::ostream* pstream__, - const std::vector>>& a) const { - return g12(y_slice, (start + 1), (end + 1), a, pstream__); - } -}; template & y_slice, const int& start, const int& end, const std::vector>>& p, const std::vector>>& q, std::ostream* pstream__); +double r(std::ostream* pstream__); +struct f11_rsfunctor__ { + double + operator()(const std::vector>>& y_slice, + const int& start, const int& end, std::ostream* pstream__) const { + return f11(y_slice, (start + 1), (end + 1), pstream__); + } +}; +struct f10_rsfunctor__ { + double + operator()(const std::vector>& y_slice, const int& start, + const int& end, std::ostream* pstream__) const { + return f10(y_slice, (start + 1), (end + 1), pstream__); + } +}; +struct g8_rsfunctor__ { + template , + stan::is_stan_scalar>* = nullptr> + stan::promote_args_t + operator()(const std::vector& y_slice, const int& start, const int& + end, std::ostream* pstream__, + const std::vector>& a) const { + return g8(y_slice, (start + 1), (end + 1), a, pstream__); + } +}; +struct g7_rsfunctor__ { + template , + stan::is_stan_scalar>* = nullptr> + stan::promote_args_t + operator()(const std::vector& y_slice, const int& start, const int& + end, std::ostream* pstream__, + const std::vector>& a) const { + return g7(y_slice, (start + 1), (end + 1), a, pstream__); + } +}; +struct g4_rsfunctor__ { + template , + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> + stan::promote_args_t> + operator()(const std::vector& y_slice, const int& start, const int& + end, std::ostream* pstream__, const T3__& a) const { + return g4(y_slice, (start + 1), (end + 1), a, pstream__); + } +}; +struct g6_rsfunctor__ { + template , + stan::is_stan_scalar>* = nullptr> + stan::promote_args_t + operator()(const std::vector& y_slice, const int& start, const int& + end, std::ostream* pstream__, + const std::vector>& a) const { + return g6(y_slice, (start + 1), (end + 1), a, pstream__); + } +}; +struct g11_rsfunctor__ { + template , + stan::is_stan_scalar>* = nullptr> + stan::promote_args_t + operator()(const std::vector& y_slice, const int& start, const int& + end, std::ostream* pstream__, + const std::vector>>& a) const { + return g11(y_slice, (start + 1), (end + 1), a, pstream__); + } +}; +struct f5_rsfunctor__ { + template >* = nullptr> + stan::promote_args_t + operator()(const std::vector>& y_slice, const int& start, + const int& end, std::ostream* pstream__) const { + return f5(y_slice, (start + 1), (end + 1), pstream__); + } +}; +struct f1_rsfunctor__ { + template >* = nullptr> + stan::promote_args_t + operator()(const std::vector& y_slice, const int& start, const int& + end, std::ostream* pstream__) const { + return f1(y_slice, (start + 1), (end + 1), pstream__); + } +}; +struct g5_rsfunctor__ { + template , + stan::is_stan_scalar>* = nullptr> + stan::promote_args_t + operator()(const std::vector& y_slice, const int& start, const int& + end, std::ostream* pstream__, const std::vector& a) const { + return g5(y_slice, (start + 1), (end + 1), a, pstream__); + } +}; +struct g9_rsfunctor__ { + template , + stan::is_stan_scalar>* = nullptr> + stan::promote_args_t + operator()(const std::vector& y_slice, const int& start, const int& + end, std::ostream* pstream__, + const std::vector>& a) const { + return g9(y_slice, (start + 1), (end + 1), a, pstream__); + } +}; +struct g1_rsfunctor__ { + template , + stan::is_stan_scalar>* = nullptr> + stan::promote_args_t + operator()(const std::vector& y_slice, const int& start, const int& + end, std::ostream* pstream__, const T3__& a) const { + return g1(y_slice, (start + 1), (end + 1), a, pstream__); + } +}; +struct f12_rsfunctor__ { + template >* = nullptr> + stan::promote_args_t + operator()(const std::vector>>& y_slice, + const int& start, const int& end, std::ostream* pstream__) const { + return f12(y_slice, (start + 1), (end + 1), pstream__); + } +}; +struct g3_rsfunctor__ { + template , + stan::is_row_vector, + stan::is_vt_not_complex>* = nullptr> + stan::promote_args_t> + operator()(const std::vector& y_slice, const int& start, const int& + end, std::ostream* pstream__, const T3__& a) const { + return g3(y_slice, (start + 1), (end + 1), a, pstream__); + } +}; +struct f3_rsfunctor__ { + template >* = nullptr> + stan::promote_args_t + operator()(const std::vector>& y_slice, const int& + start, const int& end, std::ostream* pstream__) const { + return f3(y_slice, (start + 1), (end + 1), pstream__); + } +}; +struct f2_rsfunctor__ { + template >* = nullptr> + stan::promote_args_t + operator()(const std::vector>& y_slice, const int& + start, const int& end, std::ostream* pstream__) const { + return f2(y_slice, (start + 1), (end + 1), pstream__); + } +}; +struct f6_rsfunctor__ { + template >* = nullptr> + stan::promote_args_t + operator()(const std::vector>>& + y_slice, const int& start, const int& end, std::ostream* + pstream__) const { + return f6(y_slice, (start + 1), (end + 1), pstream__); + } +}; +struct g2_rsfunctor__ { + template , + stan::is_col_vector, + stan::is_vt_not_complex>* = nullptr> + stan::promote_args_t> + operator()(const std::vector& y_slice, const int& start, const int& + end, std::ostream* pstream__, const T3__& a) const { + return g2(y_slice, (start + 1), (end + 1), a, pstream__); + } +}; +struct g10_rsfunctor__ { + template , + stan::is_stan_scalar>* = nullptr> + stan::promote_args_t + operator()(const std::vector& y_slice, const int& start, const int& + end, std::ostream* pstream__, + const std::vector>>& a) const { + return g10(y_slice, (start + 1), (end + 1), a, pstream__); + } +}; +struct f8_rsfunctor__ { + template >* = nullptr> + stan::promote_args_t + operator()(const std::vector>>& + y_slice, const int& start, const int& end, std::ostream* + pstream__) const { + return f8(y_slice, (start + 1), (end + 1), pstream__); + } +}; +struct g12_rsfunctor__ { + template , + stan::is_stan_scalar>* = nullptr> + stan::promote_args_t + operator()(const std::vector& y_slice, const int& start, const int& + end, std::ostream* pstream__, + const std::vector>>& a) const { + return g12(y_slice, (start + 1), (end + 1), a, pstream__); + } +}; +struct f9_rsfunctor__ { + double + operator()(const std::vector& y_slice, const int& start, const int& + end, std::ostream* pstream__) const { + return f9(y_slice, (start + 1), (end + 1), pstream__); + } +}; +struct f4_rsfunctor__ { + template >* = nullptr> + stan::promote_args_t + operator()(const std::vector>& y_slice, + const int& start, const int& end, std::ostream* pstream__) const { + return f4(y_slice, (start + 1), (end + 1), pstream__); + } +}; struct s_rsfunctor__ { template >* = nullptr> + stan::promote_args_t + operator()(const std::vector>>& + y_slice, const int& start, const int& end, std::ostream* + pstream__) const { + return f7(y_slice, (start + 1), (end + 1), pstream__); + } +}; +struct f1a_rsfunctor__ { + template >* = nullptr> + stan::promote_args_t + operator()(const std::vector& y_slice, const int& start, const int& + end, std::ostream* pstream__) const { + return f1a(y_slice, (start + 1), (end + 1), pstream__); + } +}; template >*> stan::promote_args_t f1(const std::vector& y_slice, const int& start, const int& end, diff --git a/test/integration/good/code-gen/lir.expected b/test/integration/good/code-gen/lir.expected index 42e62026e6..d2d090f8d0 100644 --- a/test/integration/good/code-gen/lir.expected +++ b/test/integration/good/code-gen/lir.expected @@ -1955,6 +1955,28 @@ ((Const (Ref (StdVector Int))) dat_int) ((Pointer (TypeLiteral std::ostream)) pstream__))) (cv_qualifiers ()) (body ()))) + (FunDef + ((templates_init + ((((Typename T0__) (Typename T1__) (RequireIs stan::is_col_vector T0__) + (RequireIs stan::is_vt_not_complex T0__) + (RequireIs stan::is_col_vector T1__) + (RequireIs stan::is_vt_not_complex T1__))) + true)) + (inline false) + (return_type + (Matrix + (TypeTrait stan::promote_args_t + ((TemplateType stan::base_type_t) + (TemplateType stan::base_type_t))) + -1 1)) + (name binomialf) + (args + (((Const (Ref (TemplateType T0__))) phi_arg__) + ((Const (Ref (TemplateType T1__))) theta_arg__) + ((Const (Ref (StdVector Double))) x_r) + ((Const (Ref (StdVector Int))) x_i) + ((Pointer (TypeLiteral std::ostream)) pstream__))) + (cv_qualifiers ()) (body ()))) (Struct ((param ()) (struct_name algebra_system_functor__) (body @@ -1986,28 +2008,6 @@ (((Return ((FunCall algebra_system () ((Var x) (Var y) (Var dat) (Var dat_int) (Var pstream__)))))))))))))) - (FunDef - ((templates_init - ((((Typename T0__) (Typename T1__) (RequireIs stan::is_col_vector T0__) - (RequireIs stan::is_vt_not_complex T0__) - (RequireIs stan::is_col_vector T1__) - (RequireIs stan::is_vt_not_complex T1__))) - true)) - (inline false) - (return_type - (Matrix - (TypeTrait stan::promote_args_t - ((TemplateType stan::base_type_t) - (TemplateType stan::base_type_t))) - -1 1)) - (name binomialf) - (args - (((Const (Ref (TemplateType T0__))) phi_arg__) - ((Const (Ref (TemplateType T1__))) theta_arg__) - ((Const (Ref (StdVector Double))) x_r) - ((Const (Ref (StdVector Int))) x_i) - ((Pointer (TypeLiteral std::ostream)) pstream__))) - (cv_qualifiers ()) (body ()))) (Struct ((param ()) (struct_name binomialf_functor__) (body diff --git a/test/integration/good/code-gen/ode/cpp.expected b/test/integration/good/code-gen/ode/cpp.expected index b51074200a..11dbd8b8d2 100644 --- a/test/integration/good/code-gen/ode/cpp.expected +++ b/test/integration/good/code-gen/ode/cpp.expected @@ -48,16 +48,6 @@ template >* = nullptr> Eigen::Matrix>,-1,1> f_0_arg(const T0__& t, const T1__& z_arg__, std::ostream* pstream__); -struct f_0_arg_variadic2_functor__ { - template , - stan::is_col_vector, - stan::is_vt_not_complex>* = nullptr> - Eigen::Matrix>,-1,1> - operator()(const T0__& t, const T1__& z, std::ostream* pstream__) const { - return f_0_arg(t, z, pstream__); - } -}; template , stan::is_col_vector, @@ -66,6 +56,14 @@ template , T2__>,-1,1> f_1_arg(const T0__& t, const T1__& z_arg__, const T2__& a, std::ostream* pstream__); +template , + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar>* = nullptr> +Eigen::Matrix, T3__>,-1,1> +f_2_arg(const T0__& t, const T1__& z_arg__, const int& b, const T3__& a, + std::ostream* pstream__); struct f_1_arg_variadic2_functor__ { template , @@ -78,14 +76,6 @@ struct f_1_arg_variadic2_functor__ { return f_1_arg(t, z, a, pstream__); } }; -template , - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar>* = nullptr> -Eigen::Matrix, T3__>,-1,1> -f_2_arg(const T0__& t, const T1__& z_arg__, const int& b, const T3__& a, - std::ostream* pstream__); struct f_2_arg_variadic2_functor__ { template , @@ -98,6 +88,16 @@ struct f_2_arg_variadic2_functor__ { return f_2_arg(t, z, b, a, pstream__); } }; +struct f_0_arg_variadic2_functor__ { + template , + stan::is_col_vector, + stan::is_vt_not_complex>* = nullptr> + Eigen::Matrix>,-1,1> + operator()(const T0__& t, const T1__& z, std::ostream* pstream__) const { + return f_0_arg(t, z, pstream__); + } +}; template , stan::is_col_vector, @@ -716,6 +716,21 @@ Eigen::Matrix, T2__, T3__, simple_SIR(const T0__& t, const T1__& y_arg__, const T2__& beta, const T3__& kappa, const T4__& gamma, const T5__& xi, const T6__& delta, std::ostream* pstream__); +template , + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar, + stan::is_stan_scalar>* = nullptr> +Eigen::Matrix, T2__, T3__, + T4__, stan::promote_args_t>,-1,1> +simple_SIR(const T0__& t, const T1__& y_arg__, const T2__& beta, const T3__& + kappa, const T4__& gamma, const T5__& xi, const T6__& delta, + const int& unused, std::ostream* pstream__); struct simple_SIR_variadic2_functor__ { template , - stan::is_col_vector, - stan::is_vt_not_complex, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar, - stan::is_stan_scalar>* = nullptr> -Eigen::Matrix, T2__, T3__, - T4__, stan::promote_args_t>,-1,1> -simple_SIR(const T0__& t, const T1__& y_arg__, const T2__& beta, const T3__& - kappa, const T4__& gamma, const T5__& xi, const T6__& delta, - const int& unused, std::ostream* pstream__); -struct simple_SIR_variadic2_functor__ { template , diff --git a/test/integration/good/code-gen/standalone_functions/cpp.expected b/test/integration/good/code-gen/standalone_functions/cpp.expected index ec0f7cf67a..11e94ce437 100644 --- a/test/integration/good/code-gen/standalone_functions/cpp.expected +++ b/test/integration/good/code-gen/standalone_functions/cpp.expected @@ -599,6 +599,7 @@ std::vector> integrand_ode(const T0__& r, const std::vector& f, const std::vector& theta, const std::vector& x_r, const std::vector& x_i, std::ostream* pstream__); +double ode_integrate(std::ostream* pstream__); struct integrand_ode_functor__ { template , @@ -612,7 +613,6 @@ struct integrand_ode_functor__ { return integrand_ode(r, f, theta, x_r, x_i, pstream__); } }; -double ode_integrate(std::ostream* pstream__); template , stan::is_vt_not_complex>*> From 2ef0793b11d3add5203776fbbcc4637b23b27d05 Mon Sep 17 00:00:00 2001 From: Niko Huurre Date: Mon, 9 Jan 2023 19:38:51 +0200 Subject: [PATCH 06/13] cleanup tests --- .../cli-args/max-line-length/mother.stan | 4 - test/integration/good/code-gen/cpp.expected | 1434 ++++++++-------- test/integration/good/code-gen/lir.expected | 1522 ++++++++--------- test/integration/good/code-gen/mother.stan | 4 - .../good/code-gen/overloading_templating.stan | 6 +- .../good/code-gen/recursive-slicing.stan | 4 +- .../code-gen/standalone_functions/basic.stan | 1 - .../standalone_functions/cpp.expected | 42 +- test/integration/good/multiple_funs.stan | 1 - .../good/overloading/pretty.expected | 23 - test/integration/good/pretty.expected | 54 - test/integration/good/validate_functions.stan | 3 - .../{ => warning}/fun_log_forward_decl.stan | 0 .../good/{ => warning}/functions-fwd-ref.stan | 0 .../overloaded_forward_decl.stan} | 0 test/integration/good/warning/pretty.expected | 65 + 16 files changed, 1564 insertions(+), 1599 deletions(-) rename test/integration/good/{ => warning}/fun_log_forward_decl.stan (100%) rename test/integration/good/{ => warning}/functions-fwd-ref.stan (100%) rename test/integration/good/{overloading/forward_decl.stan => warning/overloaded_forward_decl.stan} (100%) diff --git a/test/integration/cli-args/max-line-length/mother.stan b/test/integration/cli-args/max-line-length/mother.stan index c1928c7e13..c6905b3677 100644 --- a/test/integration/cli-args/max-line-length/mother.stan +++ b/test/integration/cli-args/max-line-length/mother.stan @@ -7,7 +7,6 @@ functions { - int foo(int n) { if (n == 0) { return 1; @@ -15,9 +14,6 @@ functions { return n * foo(n - 1); } - - - array[] real sho(real t, array[] real y, array[] real theta, data array[] real x, data array[] int x_int) { array[2] real dydt; diff --git a/test/integration/good/code-gen/cpp.expected b/test/integration/good/code-gen/cpp.expected index 75e1f80e4d..d1b0adad95 100644 --- a/test/integration/good/code-gen/cpp.expected +++ b/test/integration/good/code-gen/cpp.expected @@ -2399,793 +2399,793 @@ using namespace stan::math; stan::math::profile_map profiles__; static constexpr std::array locations_array__ = {" (found before start of program)", - " (in 'mother.stan', line 603, column 2 to column 14)", - " (in 'mother.stan', line 604, column 2 to column 29)", - " (in 'mother.stan', line 605, column 2 to column 30)", - " (in 'mother.stan', line 606, column 2 to column 58)", - " (in 'mother.stan', line 607, column 2 to column 51)", - " (in 'mother.stan', line 608, column 2 to column 47)", - " (in 'mother.stan', line 609, column 2 to column 38)", - " (in 'mother.stan', line 610, column 2 to column 44)", - " (in 'mother.stan', line 611, column 2 to column 27)", - " (in 'mother.stan', line 612, column 2 to column 30)", - " (in 'mother.stan', line 613, column 2 to column 36)", - " (in 'mother.stan', line 614, column 2 to column 26)", - " (in 'mother.stan', line 615, column 2 to column 38)", - " (in 'mother.stan', line 616, column 2 to column 44)", - " (in 'mother.stan', line 617, column 2 to column 21)", - " (in 'mother.stan', line 618, column 2 to column 54)", - " (in 'mother.stan', line 619, column 2 to column 23)", - " (in 'mother.stan', line 620, column 2 to column 35)", - " (in 'mother.stan', line 621, column 2 to column 41)", - " (in 'mother.stan', line 622, column 2 to column 39)", - " (in 'mother.stan', line 623, column 2 to column 36)", - " (in 'mother.stan', line 624, column 2 to column 48)", - " (in 'mother.stan', line 625, column 2 to column 16)", - " (in 'mother.stan', line 626, column 2 to column 16)", - " (in 'mother.stan', line 629, column 2 to column 39)", - " (in 'mother.stan', line 630, column 2 to column 45)", - " (in 'mother.stan', line 631, column 2 to column 28)", - " (in 'mother.stan', line 632, column 2 to column 31)", - " (in 'mother.stan', line 633, column 2 to column 37)", - " (in 'mother.stan', line 634, column 2 to column 27)", - " (in 'mother.stan', line 635, column 2 to column 39)", - " (in 'mother.stan', line 636, column 2 to column 45)", - " (in 'mother.stan', line 637, column 2 to column 22)", - " (in 'mother.stan', line 638, column 2 to column 55)", - " (in 'mother.stan', line 639, column 2 to column 24)", - " (in 'mother.stan', line 640, column 2 to column 36)", - " (in 'mother.stan', line 641, column 2 to column 42)", - " (in 'mother.stan', line 642, column 2 to column 40)", - " (in 'mother.stan', line 643, column 2 to column 37)", - " (in 'mother.stan', line 644, column 2 to column 49)", - " (in 'mother.stan', line 645, column 2 to column 20)", - " (in 'mother.stan', line 646, column 2 to column 15)", - " (in 'mother.stan', line 648, column 2 to column 31)", - " (in 'mother.stan', line 649, column 2 to column 31)", - " (in 'mother.stan', line 650, column 2 to column 23)", - " (in 'mother.stan', line 651, column 2 to column 23)", - " (in 'mother.stan', line 653, column 2 to column 25)", - " (in 'mother.stan', line 654, column 2 to column 31)", - " (in 'mother.stan', line 655, column 2 to column 31)", - " (in 'mother.stan', line 657, column 2 to column 27)", - " (in 'mother.stan', line 658, column 2 to column 27)", - " (in 'mother.stan', line 659, column 2 to column 33)", - " (in 'mother.stan', line 661, column 2 to column 41)", - " (in 'mother.stan', line 662, column 2 to column 36)", - " (in 'mother.stan', line 668, column 10 to column 38)", - " (in 'mother.stan', line 667, column 25 to line 669, column 9)", - " (in 'mother.stan', line 667, column 8 to line 669, column 9)", - " (in 'mother.stan', line 666, column 23 to line 670, column 7)", - " (in 'mother.stan', line 666, column 6 to line 670, column 7)", - " (in 'mother.stan', line 665, column 21 to line 671, column 5)", - " (in 'mother.stan', line 665, column 4 to line 671, column 5)", - " (in 'mother.stan', line 664, column 19 to line 672, column 3)", - " (in 'mother.stan', line 664, column 2 to line 672, column 3)", - " (in 'mother.stan', line 675, column 4 to column 32)", - " (in 'mother.stan', line 674, column 2 to line 675, column 32)", - " (in 'mother.stan', line 676, column 2 to column 29)", - " (in 'mother.stan', line 677, column 2 to column 31)", - " (in 'mother.stan', line 678, column 2 to column 31)", - " (in 'mother.stan', line 680, column 2 to column 63)", - " (in 'mother.stan', line 681, column 2 to line 682, column 31)", - " (in 'mother.stan', line 683, column 2 to line 684, column 31)", - " (in 'mother.stan', line 685, column 2 to column 65)", - " (in 'mother.stan', line 686, column 2 to line 687, column 31)", - " (in 'mother.stan', line 688, column 2 to column 67)", - " (in 'mother.stan', line 689, column 2 to line 690, column 37)", - " (in 'mother.stan', line 692, column 2 to column 29)", - " (in 'mother.stan', line 693, column 2 to column 29)", - " (in 'mother.stan', line 737, column 2 to column 32)", - " (in 'mother.stan', line 738, column 2 to column 27)", - " (in 'mother.stan', line 739, column 2 to column 39)", - " (in 'mother.stan', line 740, column 2 to column 45)", - " (in 'mother.stan', line 741, column 2 to column 28)", - " (in 'mother.stan', line 742, column 2 to column 31)", - " (in 'mother.stan', line 743, column 2 to column 37)", - " (in 'mother.stan', line 744, column 2 to column 27)", - " (in 'mother.stan', line 745, column 2 to column 39)", - " (in 'mother.stan', line 746, column 2 to column 45)", - " (in 'mother.stan', line 747, column 2 to column 55)", - " (in 'mother.stan', line 748, column 2 to column 24)", - " (in 'mother.stan', line 749, column 2 to column 36)", - " (in 'mother.stan', line 750, column 2 to column 42)", - " (in 'mother.stan', line 751, column 2 to column 40)", - " (in 'mother.stan', line 752, column 2 to column 37)", - " (in 'mother.stan', line 753, column 2 to column 49)", - " (in 'mother.stan', line 754, column 2 to column 35)", - " (in 'mother.stan', line 755, column 2 to column 37)", - " (in 'mother.stan', line 756, column 2 to column 33)", - " (in 'mother.stan', line 757, column 2 to column 33)", - " (in 'mother.stan', line 758, column 2 to column 33)", - " (in 'mother.stan', line 759, column 2 to column 34)", - " (in 'mother.stan', line 760, column 2 to column 34)", - " (in 'mother.stan', line 761, column 2 to column 34)", - " (in 'mother.stan', line 762, column 2 to column 34)", - " (in 'mother.stan', line 763, column 2 to column 30)", - " (in 'mother.stan', line 765, column 2 to column 39)", + " (in 'mother.stan', line 599, column 2 to column 14)", + " (in 'mother.stan', line 600, column 2 to column 29)", + " (in 'mother.stan', line 601, column 2 to column 30)", + " (in 'mother.stan', line 602, column 2 to column 58)", + " (in 'mother.stan', line 603, column 2 to column 51)", + " (in 'mother.stan', line 604, column 2 to column 47)", + " (in 'mother.stan', line 605, column 2 to column 38)", + " (in 'mother.stan', line 606, column 2 to column 44)", + " (in 'mother.stan', line 607, column 2 to column 27)", + " (in 'mother.stan', line 608, column 2 to column 30)", + " (in 'mother.stan', line 609, column 2 to column 36)", + " (in 'mother.stan', line 610, column 2 to column 26)", + " (in 'mother.stan', line 611, column 2 to column 38)", + " (in 'mother.stan', line 612, column 2 to column 44)", + " (in 'mother.stan', line 613, column 2 to column 21)", + " (in 'mother.stan', line 614, column 2 to column 54)", + " (in 'mother.stan', line 615, column 2 to column 23)", + " (in 'mother.stan', line 616, column 2 to column 35)", + " (in 'mother.stan', line 617, column 2 to column 41)", + " (in 'mother.stan', line 618, column 2 to column 39)", + " (in 'mother.stan', line 619, column 2 to column 36)", + " (in 'mother.stan', line 620, column 2 to column 48)", + " (in 'mother.stan', line 621, column 2 to column 16)", + " (in 'mother.stan', line 622, column 2 to column 16)", + " (in 'mother.stan', line 625, column 2 to column 39)", + " (in 'mother.stan', line 626, column 2 to column 45)", + " (in 'mother.stan', line 627, column 2 to column 28)", + " (in 'mother.stan', line 628, column 2 to column 31)", + " (in 'mother.stan', line 629, column 2 to column 37)", + " (in 'mother.stan', line 630, column 2 to column 27)", + " (in 'mother.stan', line 631, column 2 to column 39)", + " (in 'mother.stan', line 632, column 2 to column 45)", + " (in 'mother.stan', line 633, column 2 to column 22)", + " (in 'mother.stan', line 634, column 2 to column 55)", + " (in 'mother.stan', line 635, column 2 to column 24)", + " (in 'mother.stan', line 636, column 2 to column 36)", + " (in 'mother.stan', line 637, column 2 to column 42)", + " (in 'mother.stan', line 638, column 2 to column 40)", + " (in 'mother.stan', line 639, column 2 to column 37)", + " (in 'mother.stan', line 640, column 2 to column 49)", + " (in 'mother.stan', line 641, column 2 to column 20)", + " (in 'mother.stan', line 642, column 2 to column 15)", + " (in 'mother.stan', line 644, column 2 to column 31)", + " (in 'mother.stan', line 645, column 2 to column 31)", + " (in 'mother.stan', line 646, column 2 to column 23)", + " (in 'mother.stan', line 647, column 2 to column 23)", + " (in 'mother.stan', line 649, column 2 to column 25)", + " (in 'mother.stan', line 650, column 2 to column 31)", + " (in 'mother.stan', line 651, column 2 to column 31)", + " (in 'mother.stan', line 653, column 2 to column 27)", + " (in 'mother.stan', line 654, column 2 to column 27)", + " (in 'mother.stan', line 655, column 2 to column 33)", + " (in 'mother.stan', line 657, column 2 to column 41)", + " (in 'mother.stan', line 658, column 2 to column 36)", + " (in 'mother.stan', line 664, column 10 to column 38)", + " (in 'mother.stan', line 663, column 25 to line 665, column 9)", + " (in 'mother.stan', line 663, column 8 to line 665, column 9)", + " (in 'mother.stan', line 662, column 23 to line 666, column 7)", + " (in 'mother.stan', line 662, column 6 to line 666, column 7)", + " (in 'mother.stan', line 661, column 21 to line 667, column 5)", + " (in 'mother.stan', line 661, column 4 to line 667, column 5)", + " (in 'mother.stan', line 660, column 19 to line 668, column 3)", + " (in 'mother.stan', line 660, column 2 to line 668, column 3)", + " (in 'mother.stan', line 671, column 4 to column 32)", + " (in 'mother.stan', line 670, column 2 to line 671, column 32)", + " (in 'mother.stan', line 672, column 2 to column 29)", + " (in 'mother.stan', line 673, column 2 to column 31)", + " (in 'mother.stan', line 674, column 2 to column 31)", + " (in 'mother.stan', line 676, column 2 to column 63)", + " (in 'mother.stan', line 677, column 2 to line 678, column 31)", + " (in 'mother.stan', line 679, column 2 to line 680, column 31)", + " (in 'mother.stan', line 681, column 2 to column 65)", + " (in 'mother.stan', line 682, column 2 to line 683, column 31)", + " (in 'mother.stan', line 684, column 2 to column 67)", + " (in 'mother.stan', line 685, column 2 to line 686, column 37)", + " (in 'mother.stan', line 688, column 2 to column 29)", + " (in 'mother.stan', line 689, column 2 to column 29)", + " (in 'mother.stan', line 733, column 2 to column 32)", + " (in 'mother.stan', line 734, column 2 to column 27)", + " (in 'mother.stan', line 735, column 2 to column 39)", + " (in 'mother.stan', line 736, column 2 to column 45)", + " (in 'mother.stan', line 737, column 2 to column 28)", + " (in 'mother.stan', line 738, column 2 to column 31)", + " (in 'mother.stan', line 739, column 2 to column 37)", + " (in 'mother.stan', line 740, column 2 to column 27)", + " (in 'mother.stan', line 741, column 2 to column 39)", + " (in 'mother.stan', line 742, column 2 to column 45)", + " (in 'mother.stan', line 743, column 2 to column 55)", + " (in 'mother.stan', line 744, column 2 to column 24)", + " (in 'mother.stan', line 745, column 2 to column 36)", + " (in 'mother.stan', line 746, column 2 to column 42)", + " (in 'mother.stan', line 747, column 2 to column 40)", + " (in 'mother.stan', line 748, column 2 to column 37)", + " (in 'mother.stan', line 749, column 2 to column 49)", + " (in 'mother.stan', line 750, column 2 to column 35)", + " (in 'mother.stan', line 751, column 2 to column 37)", + " (in 'mother.stan', line 752, column 2 to column 33)", + " (in 'mother.stan', line 753, column 2 to column 33)", + " (in 'mother.stan', line 754, column 2 to column 33)", + " (in 'mother.stan', line 755, column 2 to column 34)", + " (in 'mother.stan', line 756, column 2 to column 34)", + " (in 'mother.stan', line 757, column 2 to column 34)", + " (in 'mother.stan', line 758, column 2 to column 34)", + " (in 'mother.stan', line 759, column 2 to column 30)", + " (in 'mother.stan', line 761, column 2 to column 39)", + " (in 'mother.stan', line 762, column 2 to column 31)", + " (in 'mother.stan', line 763, column 2 to column 23)", + " (in 'mother.stan', line 764, column 2 to column 23)", + " (in 'mother.stan', line 765, column 2 to column 25)", " (in 'mother.stan', line 766, column 2 to column 31)", - " (in 'mother.stan', line 767, column 2 to column 23)", - " (in 'mother.stan', line 768, column 2 to column 23)", - " (in 'mother.stan', line 769, column 2 to column 25)", + " (in 'mother.stan', line 767, column 2 to column 31)", + " (in 'mother.stan', line 769, column 2 to column 38)", " (in 'mother.stan', line 770, column 2 to column 31)", " (in 'mother.stan', line 771, column 2 to column 31)", - " (in 'mother.stan', line 773, column 2 to column 38)", - " (in 'mother.stan', line 774, column 2 to column 31)", - " (in 'mother.stan', line 775, column 2 to column 31)", - " (in 'mother.stan', line 777, column 2 to column 27)", - " (in 'mother.stan', line 778, column 2 to column 27)", - " (in 'mother.stan', line 779, column 2 to column 33)", - " (in 'mother.stan', line 785, column 10 to column 38)", - " (in 'mother.stan', line 784, column 25 to line 786, column 9)", - " (in 'mother.stan', line 784, column 8 to line 786, column 9)", - " (in 'mother.stan', line 783, column 23 to line 787, column 7)", - " (in 'mother.stan', line 783, column 6 to line 787, column 7)", - " (in 'mother.stan', line 782, column 21 to line 788, column 5)", - " (in 'mother.stan', line 782, column 4 to line 788, column 5)", - " (in 'mother.stan', line 781, column 19 to line 789, column 3)", - " (in 'mother.stan', line 781, column 2 to line 789, column 3)", - " (in 'mother.stan', line 792, column 4 to column 32)", - " (in 'mother.stan', line 791, column 2 to line 792, column 32)", - " (in 'mother.stan', line 798, column 8 to column 49)", - " (in 'mother.stan', line 797, column 6 to line 798, column 49)", - " (in 'mother.stan', line 796, column 4 to line 798, column 49)", - " (in 'mother.stan', line 795, column 2 to line 798, column 49)", - " (in 'mother.stan', line 803, column 6 to column 60)", - " (in 'mother.stan', line 802, column 4 to line 803, column 60)", - " (in 'mother.stan', line 801, column 2 to line 803, column 60)", - " (in 'mother.stan', line 805, column 2 to column 45)", - " (in 'mother.stan', line 807, column 4 to column 37)", - " (in 'mother.stan', line 806, column 2 to line 807, column 37)", - " (in 'mother.stan', line 812, column 6 to column 51)", - " (in 'mother.stan', line 811, column 4 to line 812, column 51)", - " (in 'mother.stan', line 810, column 2 to line 812, column 51)", - " (in 'mother.stan', line 813, column 2 to column 41)", - " (in 'mother.stan', line 816, column 4 to column 37)", - " (in 'mother.stan', line 815, column 2 to line 816, column 37)", - " (in 'mother.stan', line 822, column 8 to column 68)", - " (in 'mother.stan', line 821, column 6 to line 822, column 68)", - " (in 'mother.stan', line 820, column 4 to line 822, column 68)", - " (in 'mother.stan', line 819, column 2 to line 822, column 68)", - " (in 'mother.stan', line 823, column 2 to column 50)", - " (in 'mother.stan', line 825, column 4 to column 37)", - " (in 'mother.stan', line 824, column 2 to line 825, column 37)", - " (in 'mother.stan', line 827, column 2 to column 40)", - " (in 'mother.stan', line 828, column 2 to column 42)", - " (in 'mother.stan', line 696, column 2 to column 16)", - " (in 'mother.stan', line 697, column 2 to column 26)", - " (in 'mother.stan', line 698, column 2 to column 29)", - " (in 'mother.stan', line 699, column 2 to column 24)", - " (in 'mother.stan', line 700, column 2 to column 24)", - " (in 'mother.stan', line 701, column 2 to column 35)", - " (in 'mother.stan', line 703, column 2 to column 38)", - " (in 'mother.stan', line 704, column 2 to column 38)", - " (in 'mother.stan', line 706, column 2 to column 41)", - " (in 'mother.stan', line 708, column 4 to column 42)", - " (in 'mother.stan', line 709, column 4 to column 46)", - " (in 'mother.stan', line 710, column 4 to column 46)", - " (in 'mother.stan', line 713, column 8 to column 68)", - " (in 'mother.stan', line 714, column 8 to column 76)", - " (in 'mother.stan', line 715, column 8 to column 76)", - " (in 'mother.stan', line 716, column 8 to column 65)", - " (in 'mother.stan', line 712, column 23 to line 717, column 7)", - " (in 'mother.stan', line 712, column 6 to line 717, column 7)", - " (in 'mother.stan', line 711, column 21 to line 718, column 5)", - " (in 'mother.stan', line 711, column 4 to line 718, column 5)", - " (in 'mother.stan', line 707, column 19 to line 719, column 3)", - " (in 'mother.stan', line 707, column 2 to line 719, column 3)", - " (in 'mother.stan', line 722, column 6 to column 47)", - " (in 'mother.stan', line 721, column 21 to line 723, column 5)", - " (in 'mother.stan', line 721, column 4 to line 723, column 5)", - " (in 'mother.stan', line 720, column 19 to line 724, column 3)", - " (in 'mother.stan', line 720, column 2 to line 724, column 3)", - " (in 'mother.stan', line 726, column 4 to column 47)", - " (in 'mother.stan', line 725, column 19 to line 727, column 3)", - " (in 'mother.stan', line 725, column 2 to line 727, column 3)", - " (in 'mother.stan', line 728, column 2 to column 38)", - " (in 'mother.stan', line 729, column 2 to column 38)", - " (in 'mother.stan', line 730, column 2 to column 38)", - " (in 'mother.stan', line 731, column 2 to column 39)", - " (in 'mother.stan', line 732, column 2 to column 39)", - " (in 'mother.stan', line 734, column 2 to column 53)", - " (in 'mother.stan', line 352, column 2 to column 17)", - " (in 'mother.stan', line 353, column 2 to column 17)", - " (in 'mother.stan', line 354, column 2 to column 30)", + " (in 'mother.stan', line 773, column 2 to column 27)", + " (in 'mother.stan', line 774, column 2 to column 27)", + " (in 'mother.stan', line 775, column 2 to column 33)", + " (in 'mother.stan', line 781, column 10 to column 38)", + " (in 'mother.stan', line 780, column 25 to line 782, column 9)", + " (in 'mother.stan', line 780, column 8 to line 782, column 9)", + " (in 'mother.stan', line 779, column 23 to line 783, column 7)", + " (in 'mother.stan', line 779, column 6 to line 783, column 7)", + " (in 'mother.stan', line 778, column 21 to line 784, column 5)", + " (in 'mother.stan', line 778, column 4 to line 784, column 5)", + " (in 'mother.stan', line 777, column 19 to line 785, column 3)", + " (in 'mother.stan', line 777, column 2 to line 785, column 3)", + " (in 'mother.stan', line 788, column 4 to column 32)", + " (in 'mother.stan', line 787, column 2 to line 788, column 32)", + " (in 'mother.stan', line 794, column 8 to column 49)", + " (in 'mother.stan', line 793, column 6 to line 794, column 49)", + " (in 'mother.stan', line 792, column 4 to line 794, column 49)", + " (in 'mother.stan', line 791, column 2 to line 794, column 49)", + " (in 'mother.stan', line 799, column 6 to column 60)", + " (in 'mother.stan', line 798, column 4 to line 799, column 60)", + " (in 'mother.stan', line 797, column 2 to line 799, column 60)", + " (in 'mother.stan', line 801, column 2 to column 45)", + " (in 'mother.stan', line 803, column 4 to column 37)", + " (in 'mother.stan', line 802, column 2 to line 803, column 37)", + " (in 'mother.stan', line 808, column 6 to column 51)", + " (in 'mother.stan', line 807, column 4 to line 808, column 51)", + " (in 'mother.stan', line 806, column 2 to line 808, column 51)", + " (in 'mother.stan', line 809, column 2 to column 41)", + " (in 'mother.stan', line 812, column 4 to column 37)", + " (in 'mother.stan', line 811, column 2 to line 812, column 37)", + " (in 'mother.stan', line 818, column 8 to column 68)", + " (in 'mother.stan', line 817, column 6 to line 818, column 68)", + " (in 'mother.stan', line 816, column 4 to line 818, column 68)", + " (in 'mother.stan', line 815, column 2 to line 818, column 68)", + " (in 'mother.stan', line 819, column 2 to column 50)", + " (in 'mother.stan', line 821, column 4 to column 37)", + " (in 'mother.stan', line 820, column 2 to line 821, column 37)", + " (in 'mother.stan', line 823, column 2 to column 40)", + " (in 'mother.stan', line 824, column 2 to column 42)", + " (in 'mother.stan', line 692, column 2 to column 16)", + " (in 'mother.stan', line 693, column 2 to column 26)", + " (in 'mother.stan', line 694, column 2 to column 29)", + " (in 'mother.stan', line 695, column 2 to column 24)", + " (in 'mother.stan', line 696, column 2 to column 24)", + " (in 'mother.stan', line 697, column 2 to column 35)", + " (in 'mother.stan', line 699, column 2 to column 38)", + " (in 'mother.stan', line 700, column 2 to column 38)", + " (in 'mother.stan', line 702, column 2 to column 41)", + " (in 'mother.stan', line 704, column 4 to column 42)", + " (in 'mother.stan', line 705, column 4 to column 46)", + " (in 'mother.stan', line 706, column 4 to column 46)", + " (in 'mother.stan', line 709, column 8 to column 68)", + " (in 'mother.stan', line 710, column 8 to column 76)", + " (in 'mother.stan', line 711, column 8 to column 76)", + " (in 'mother.stan', line 712, column 8 to column 65)", + " (in 'mother.stan', line 708, column 23 to line 713, column 7)", + " (in 'mother.stan', line 708, column 6 to line 713, column 7)", + " (in 'mother.stan', line 707, column 21 to line 714, column 5)", + " (in 'mother.stan', line 707, column 4 to line 714, column 5)", + " (in 'mother.stan', line 703, column 19 to line 715, column 3)", + " (in 'mother.stan', line 703, column 2 to line 715, column 3)", + " (in 'mother.stan', line 718, column 6 to column 47)", + " (in 'mother.stan', line 717, column 21 to line 719, column 5)", + " (in 'mother.stan', line 717, column 4 to line 719, column 5)", + " (in 'mother.stan', line 716, column 19 to line 720, column 3)", + " (in 'mother.stan', line 716, column 2 to line 720, column 3)", + " (in 'mother.stan', line 722, column 4 to column 47)", + " (in 'mother.stan', line 721, column 19 to line 723, column 3)", + " (in 'mother.stan', line 721, column 2 to line 723, column 3)", + " (in 'mother.stan', line 724, column 2 to column 38)", + " (in 'mother.stan', line 725, column 2 to column 38)", + " (in 'mother.stan', line 726, column 2 to column 38)", + " (in 'mother.stan', line 727, column 2 to column 39)", + " (in 'mother.stan', line 728, column 2 to column 39)", + " (in 'mother.stan', line 730, column 2 to column 53)", + " (in 'mother.stan', line 348, column 2 to column 17)", + " (in 'mother.stan', line 349, column 2 to column 17)", + " (in 'mother.stan', line 350, column 2 to column 30)", + " (in 'mother.stan', line 351, column 8 to column 9)", + " (in 'mother.stan', line 351, column 2 to column 36)", + " (in 'mother.stan', line 352, column 8 to column 9)", + " (in 'mother.stan', line 352, column 11 to column 12)", + " (in 'mother.stan', line 352, column 14 to column 15)", + " (in 'mother.stan', line 352, column 2 to column 42)", + " (in 'mother.stan', line 353, column 2 to column 32)", + " (in 'mother.stan', line 354, column 8 to column 9)", + " (in 'mother.stan', line 354, column 2 to column 29)", " (in 'mother.stan', line 355, column 8 to column 9)", - " (in 'mother.stan', line 355, column 2 to column 36)", - " (in 'mother.stan', line 356, column 8 to column 9)", - " (in 'mother.stan', line 356, column 11 to column 12)", - " (in 'mother.stan', line 356, column 14 to column 15)", - " (in 'mother.stan', line 356, column 2 to column 42)", - " (in 'mother.stan', line 357, column 2 to column 32)", + " (in 'mother.stan', line 355, column 11 to column 12)", + " (in 'mother.stan', line 355, column 14 to column 15)", + " (in 'mother.stan', line 355, column 2 to column 35)", + " (in 'mother.stan', line 356, column 9 to column 10)", + " (in 'mother.stan', line 356, column 2 to column 18)", + " (in 'mother.stan', line 357, column 8 to column 9)", + " (in 'mother.stan', line 357, column 18 to column 19)", + " (in 'mother.stan', line 357, column 2 to column 30)", " (in 'mother.stan', line 358, column 8 to column 9)", - " (in 'mother.stan', line 358, column 2 to column 29)", - " (in 'mother.stan', line 359, column 8 to column 9)", - " (in 'mother.stan', line 359, column 11 to column 12)", - " (in 'mother.stan', line 359, column 14 to column 15)", - " (in 'mother.stan', line 359, column 2 to column 35)", - " (in 'mother.stan', line 360, column 9 to column 10)", - " (in 'mother.stan', line 360, column 2 to column 18)", + " (in 'mother.stan', line 358, column 11 to column 12)", + " (in 'mother.stan', line 358, column 14 to column 15)", + " (in 'mother.stan', line 358, column 24 to column 25)", + " (in 'mother.stan', line 358, column 2 to column 36)", + " (in 'mother.stan', line 359, column 13 to column 14)", + " (in 'mother.stan', line 359, column 2 to column 26)", + " (in 'mother.stan', line 360, column 8 to column 9)", + " (in 'mother.stan', line 360, column 22 to column 23)", + " (in 'mother.stan', line 360, column 2 to column 38)", " (in 'mother.stan', line 361, column 8 to column 9)", - " (in 'mother.stan', line 361, column 18 to column 19)", - " (in 'mother.stan', line 361, column 2 to column 30)", - " (in 'mother.stan', line 362, column 8 to column 9)", - " (in 'mother.stan', line 362, column 11 to column 12)", - " (in 'mother.stan', line 362, column 14 to column 15)", - " (in 'mother.stan', line 362, column 24 to column 25)", - " (in 'mother.stan', line 362, column 2 to column 36)", - " (in 'mother.stan', line 363, column 13 to column 14)", - " (in 'mother.stan', line 363, column 2 to column 26)", + " (in 'mother.stan', line 361, column 11 to column 12)", + " (in 'mother.stan', line 361, column 14 to column 15)", + " (in 'mother.stan', line 361, column 28 to column 29)", + " (in 'mother.stan', line 361, column 2 to column 44)", + " (in 'mother.stan', line 362, column 2 to column 54)", + " (in 'mother.stan', line 363, column 10 to column 11)", + " (in 'mother.stan', line 363, column 2 to column 23)", " (in 'mother.stan', line 364, column 8 to column 9)", - " (in 'mother.stan', line 364, column 22 to column 23)", - " (in 'mother.stan', line 364, column 2 to column 38)", + " (in 'mother.stan', line 364, column 19 to column 20)", + " (in 'mother.stan', line 364, column 2 to column 35)", " (in 'mother.stan', line 365, column 8 to column 9)", " (in 'mother.stan', line 365, column 11 to column 12)", " (in 'mother.stan', line 365, column 14 to column 15)", - " (in 'mother.stan', line 365, column 28 to column 29)", - " (in 'mother.stan', line 365, column 2 to column 44)", - " (in 'mother.stan', line 366, column 2 to column 54)", - " (in 'mother.stan', line 367, column 10 to column 11)", - " (in 'mother.stan', line 367, column 2 to column 23)", + " (in 'mother.stan', line 365, column 25 to column 26)", + " (in 'mother.stan', line 365, column 2 to column 41)", + " (in 'mother.stan', line 366, column 2 to column 39)", + " (in 'mother.stan', line 367, column 2 to column 36)", " (in 'mother.stan', line 368, column 8 to column 9)", - " (in 'mother.stan', line 368, column 19 to column 20)", - " (in 'mother.stan', line 368, column 2 to column 35)", - " (in 'mother.stan', line 369, column 8 to column 9)", - " (in 'mother.stan', line 369, column 11 to column 12)", - " (in 'mother.stan', line 369, column 14 to column 15)", - " (in 'mother.stan', line 369, column 25 to column 26)", - " (in 'mother.stan', line 369, column 2 to column 41)", - " (in 'mother.stan', line 370, column 2 to column 39)", - " (in 'mother.stan', line 371, column 2 to column 36)", - " (in 'mother.stan', line 372, column 8 to column 9)", - " (in 'mother.stan', line 372, column 2 to column 48)", - " (in 'mother.stan', line 373, column 2 to column 12)", + " (in 'mother.stan', line 368, column 2 to column 48)", + " (in 'mother.stan', line 369, column 2 to column 12)", + " (in 'mother.stan', line 370, column 8 to column 13)", + " (in 'mother.stan', line 370, column 2 to column 31)", + " (in 'mother.stan', line 371, column 8 to column 13)", + " (in 'mother.stan', line 371, column 2 to column 37)", + " (in 'mother.stan', line 372, column 8 to column 13)", + " (in 'mother.stan', line 372, column 2 to column 40)", + " (in 'mother.stan', line 373, column 2 to column 14)", " (in 'mother.stan', line 374, column 8 to column 13)", - " (in 'mother.stan', line 374, column 2 to column 31)", + " (in 'mother.stan', line 374, column 2 to column 33)", " (in 'mother.stan', line 375, column 8 to column 13)", - " (in 'mother.stan', line 375, column 2 to column 37)", + " (in 'mother.stan', line 375, column 2 to column 39)", " (in 'mother.stan', line 376, column 8 to column 13)", - " (in 'mother.stan', line 376, column 2 to column 40)", - " (in 'mother.stan', line 377, column 2 to column 14)", + " (in 'mother.stan', line 376, column 2 to column 42)", + " (in 'mother.stan', line 377, column 9 to column 14)", + " (in 'mother.stan', line 377, column 16 to column 21)", + " (in 'mother.stan', line 377, column 2 to column 32)", " (in 'mother.stan', line 378, column 8 to column 13)", - " (in 'mother.stan', line 378, column 2 to column 33)", + " (in 'mother.stan', line 378, column 22 to column 27)", + " (in 'mother.stan', line 378, column 29 to column 34)", + " (in 'mother.stan', line 378, column 2 to column 51)", " (in 'mother.stan', line 379, column 8 to column 13)", - " (in 'mother.stan', line 379, column 2 to column 39)", + " (in 'mother.stan', line 379, column 25 to column 30)", + " (in 'mother.stan', line 379, column 32 to column 37)", + " (in 'mother.stan', line 379, column 2 to column 57)", " (in 'mother.stan', line 380, column 8 to column 13)", - " (in 'mother.stan', line 380, column 2 to column 42)", + " (in 'mother.stan', line 380, column 28 to column 33)", + " (in 'mother.stan', line 380, column 35 to column 40)", + " (in 'mother.stan', line 380, column 2 to column 60)", " (in 'mother.stan', line 381, column 9 to column 14)", - " (in 'mother.stan', line 381, column 16 to column 21)", - " (in 'mother.stan', line 381, column 2 to column 32)", + " (in 'mother.stan', line 381, column 2 to column 25)", " (in 'mother.stan', line 382, column 8 to column 13)", " (in 'mother.stan', line 382, column 22 to column 27)", - " (in 'mother.stan', line 382, column 29 to column 34)", - " (in 'mother.stan', line 382, column 2 to column 51)", + " (in 'mother.stan', line 382, column 2 to column 44)", " (in 'mother.stan', line 383, column 8 to column 13)", " (in 'mother.stan', line 383, column 25 to column 30)", - " (in 'mother.stan', line 383, column 32 to column 37)", - " (in 'mother.stan', line 383, column 2 to column 57)", + " (in 'mother.stan', line 383, column 2 to column 50)", " (in 'mother.stan', line 384, column 8 to column 13)", " (in 'mother.stan', line 384, column 28 to column 33)", - " (in 'mother.stan', line 384, column 35 to column 40)", - " (in 'mother.stan', line 384, column 2 to column 60)", - " (in 'mother.stan', line 385, column 9 to column 14)", - " (in 'mother.stan', line 385, column 2 to column 25)", + " (in 'mother.stan', line 384, column 2 to column 53)", + " (in 'mother.stan', line 385, column 13 to column 18)", + " (in 'mother.stan', line 385, column 2 to column 33)", " (in 'mother.stan', line 386, column 8 to column 13)", - " (in 'mother.stan', line 386, column 22 to column 27)", - " (in 'mother.stan', line 386, column 2 to column 44)", + " (in 'mother.stan', line 386, column 26 to column 31)", + " (in 'mother.stan', line 386, column 2 to column 52)", " (in 'mother.stan', line 387, column 8 to column 13)", - " (in 'mother.stan', line 387, column 25 to column 30)", - " (in 'mother.stan', line 387, column 2 to column 50)", + " (in 'mother.stan', line 387, column 29 to column 34)", + " (in 'mother.stan', line 387, column 2 to column 58)", " (in 'mother.stan', line 388, column 8 to column 13)", - " (in 'mother.stan', line 388, column 28 to column 33)", - " (in 'mother.stan', line 388, column 2 to column 53)", - " (in 'mother.stan', line 389, column 13 to column 18)", - " (in 'mother.stan', line 389, column 2 to column 33)", - " (in 'mother.stan', line 390, column 8 to column 13)", - " (in 'mother.stan', line 390, column 26 to column 31)", - " (in 'mother.stan', line 390, column 2 to column 52)", - " (in 'mother.stan', line 391, column 8 to column 13)", - " (in 'mother.stan', line 391, column 29 to column 34)", - " (in 'mother.stan', line 391, column 2 to column 58)", - " (in 'mother.stan', line 392, column 8 to column 13)", - " (in 'mother.stan', line 392, column 32 to column 37)", - " (in 'mother.stan', line 392, column 2 to column 61)", - " (in 'mother.stan', line 395, column 2 to column 13)", - " (in 'mother.stan', line 396, column 8 to column 9)", - " (in 'mother.stan', line 396, column 2 to column 21)", - " (in 'mother.stan', line 397, column 8 to column 9)", - " (in 'mother.stan', line 397, column 2 to column 40)", - " (in 'mother.stan', line 398, column 2 to column 15)", - " (in 'mother.stan', line 399, column 2 to column 20)", - " (in 'mother.stan', line 400, column 2 to column 29)", - " (in 'mother.stan', line 401, column 2 to column 55)", - " (in 'mother.stan', line 402, column 10 to column 11)", - " (in 'mother.stan', line 402, column 2 to column 24)", - " (in 'mother.stan', line 403, column 8 to column 9)", - " (in 'mother.stan', line 403, column 19 to column 20)", - " (in 'mother.stan', line 403, column 2 to column 36)", - " (in 'mother.stan', line 404, column 8 to column 9)", - " (in 'mother.stan', line 404, column 11 to column 12)", - " (in 'mother.stan', line 404, column 14 to column 15)", - " (in 'mother.stan', line 404, column 25 to column 26)", - " (in 'mother.stan', line 404, column 2 to column 42)", - " (in 'mother.stan', line 405, column 2 to column 40)", - " (in 'mother.stan', line 406, column 2 to column 37)", - " (in 'mother.stan', line 407, column 2 to column 14)", - " (in 'mother.stan', line 408, column 2 to column 14)", - " (in 'mother.stan', line 409, column 2 to column 20)", - " (in 'mother.stan', line 410, column 2 to column 23)", - " (in 'mother.stan', line 411, column 2 to column 23)", - " (in 'mother.stan', line 412, column 2 to column 22)", - " (in 'mother.stan', line 413, column 2 to column 18)", - " (in 'mother.stan', line 414, column 2 to column 18)", - " (in 'mother.stan', line 419, column 10 to column 38)", - " (in 'mother.stan', line 418, column 25 to line 420, column 9)", - " (in 'mother.stan', line 418, column 8 to line 420, column 9)", - " (in 'mother.stan', line 417, column 23 to line 421, column 7)", - " (in 'mother.stan', line 417, column 6 to line 421, column 7)", - " (in 'mother.stan', line 416, column 21 to line 422, column 5)", - " (in 'mother.stan', line 416, column 4 to line 422, column 5)", - " (in 'mother.stan', line 415, column 19 to line 423, column 3)", - " (in 'mother.stan', line 415, column 2 to line 423, column 3)", - " (in 'mother.stan', line 425, column 4 to column 28)", - " (in 'mother.stan', line 427, column 6 to column 36)", - " (in 'mother.stan', line 430, column 10 to column 46)", - " (in 'mother.stan', line 429, column 25 to line 431, column 9)", - " (in 'mother.stan', line 429, column 8 to line 431, column 9)", - " (in 'mother.stan', line 428, column 23 to line 432, column 7)", - " (in 'mother.stan', line 428, column 6 to line 432, column 7)", - " (in 'mother.stan', line 426, column 21 to line 433, column 5)", - " (in 'mother.stan', line 426, column 4 to line 433, column 5)", - " (in 'mother.stan', line 424, column 19 to line 434, column 3)", - " (in 'mother.stan', line 424, column 2 to line 434, column 3)", - " (in 'mother.stan', line 437, column 6 to column 42)", - " (in 'mother.stan', line 438, column 6 to column 65)", - " (in 'mother.stan', line 436, column 21 to line 439, column 5)", - " (in 'mother.stan', line 436, column 4 to line 439, column 5)", - " (in 'mother.stan', line 435, column 19 to line 440, column 3)", - " (in 'mother.stan', line 435, column 2 to line 440, column 3)", - " (in 'mother.stan', line 441, column 2 to column 62)", - " (in 'mother.stan', line 442, column 2 to column 62)", - " (in 'mother.stan', line 444, column 4 to column 11)", - " (in 'mother.stan', line 445, column 4 to column 35)", + " (in 'mother.stan', line 388, column 32 to column 37)", + " (in 'mother.stan', line 388, column 2 to column 61)", + " (in 'mother.stan', line 391, column 2 to column 13)", + " (in 'mother.stan', line 392, column 8 to column 9)", + " (in 'mother.stan', line 392, column 2 to column 21)", + " (in 'mother.stan', line 393, column 8 to column 9)", + " (in 'mother.stan', line 393, column 2 to column 40)", + " (in 'mother.stan', line 394, column 2 to column 15)", + " (in 'mother.stan', line 395, column 2 to column 20)", + " (in 'mother.stan', line 396, column 2 to column 29)", + " (in 'mother.stan', line 397, column 2 to column 55)", + " (in 'mother.stan', line 398, column 10 to column 11)", + " (in 'mother.stan', line 398, column 2 to column 24)", + " (in 'mother.stan', line 399, column 8 to column 9)", + " (in 'mother.stan', line 399, column 19 to column 20)", + " (in 'mother.stan', line 399, column 2 to column 36)", + " (in 'mother.stan', line 400, column 8 to column 9)", + " (in 'mother.stan', line 400, column 11 to column 12)", + " (in 'mother.stan', line 400, column 14 to column 15)", + " (in 'mother.stan', line 400, column 25 to column 26)", + " (in 'mother.stan', line 400, column 2 to column 42)", + " (in 'mother.stan', line 401, column 2 to column 40)", + " (in 'mother.stan', line 402, column 2 to column 37)", + " (in 'mother.stan', line 403, column 2 to column 14)", + " (in 'mother.stan', line 404, column 2 to column 14)", + " (in 'mother.stan', line 405, column 2 to column 20)", + " (in 'mother.stan', line 406, column 2 to column 23)", + " (in 'mother.stan', line 407, column 2 to column 23)", + " (in 'mother.stan', line 408, column 2 to column 22)", + " (in 'mother.stan', line 409, column 2 to column 18)", + " (in 'mother.stan', line 410, column 2 to column 18)", + " (in 'mother.stan', line 415, column 10 to column 38)", + " (in 'mother.stan', line 414, column 25 to line 416, column 9)", + " (in 'mother.stan', line 414, column 8 to line 416, column 9)", + " (in 'mother.stan', line 413, column 23 to line 417, column 7)", + " (in 'mother.stan', line 413, column 6 to line 417, column 7)", + " (in 'mother.stan', line 412, column 21 to line 418, column 5)", + " (in 'mother.stan', line 412, column 4 to line 418, column 5)", + " (in 'mother.stan', line 411, column 19 to line 419, column 3)", + " (in 'mother.stan', line 411, column 2 to line 419, column 3)", + " (in 'mother.stan', line 421, column 4 to column 28)", + " (in 'mother.stan', line 423, column 6 to column 36)", + " (in 'mother.stan', line 426, column 10 to column 46)", + " (in 'mother.stan', line 425, column 25 to line 427, column 9)", + " (in 'mother.stan', line 425, column 8 to line 427, column 9)", + " (in 'mother.stan', line 424, column 23 to line 428, column 7)", + " (in 'mother.stan', line 424, column 6 to line 428, column 7)", + " (in 'mother.stan', line 422, column 21 to line 429, column 5)", + " (in 'mother.stan', line 422, column 4 to line 429, column 5)", + " (in 'mother.stan', line 420, column 19 to line 430, column 3)", + " (in 'mother.stan', line 420, column 2 to line 430, column 3)", + " (in 'mother.stan', line 433, column 6 to column 42)", + " (in 'mother.stan', line 434, column 6 to column 65)", + " (in 'mother.stan', line 432, column 21 to line 435, column 5)", + " (in 'mother.stan', line 432, column 4 to line 435, column 5)", + " (in 'mother.stan', line 431, column 19 to line 436, column 3)", + " (in 'mother.stan', line 431, column 2 to line 436, column 3)", + " (in 'mother.stan', line 437, column 2 to column 62)", + " (in 'mother.stan', line 438, column 2 to column 62)", + " (in 'mother.stan', line 440, column 4 to column 11)", + " (in 'mother.stan', line 441, column 4 to column 35)", + " (in 'mother.stan', line 442, column 4 to line 444, column 5)", + " (in 'mother.stan', line 443, column 6 to column 12)", + " (in 'mother.stan', line 445, column 4 to column 40)", + " (in 'mother.stan', line 446, column 14 to column 28)", " (in 'mother.stan', line 446, column 4 to line 448, column 5)", " (in 'mother.stan', line 447, column 6 to column 12)", - " (in 'mother.stan', line 449, column 4 to column 40)", - " (in 'mother.stan', line 450, column 14 to column 28)", - " (in 'mother.stan', line 450, column 4 to line 452, column 5)", - " (in 'mother.stan', line 451, column 6 to column 12)", - " (in 'mother.stan', line 443, column 2 to line 453, column 3)", - " (in 'mother.stan', line 455, column 2 to column 25)", - " (in 'mother.stan', line 456, column 2 to column 37)", - " (in 'mother.stan', line 457, column 2 to column 37)", - " (in 'mother.stan', line 458, column 2 to column 39)", - " (in 'mother.stan', line 460, column 2 to column 30)", - " (in 'mother.stan', line 461, column 2 to column 33)", - " (in 'mother.stan', line 463, column 2 to column 35)", - " (in 'mother.stan', line 465, column 2 to column 29)", + " (in 'mother.stan', line 439, column 2 to line 449, column 3)", + " (in 'mother.stan', line 451, column 2 to column 25)", + " (in 'mother.stan', line 452, column 2 to column 37)", + " (in 'mother.stan', line 453, column 2 to column 37)", + " (in 'mother.stan', line 454, column 2 to column 39)", + " (in 'mother.stan', line 456, column 2 to column 30)", + " (in 'mother.stan', line 457, column 2 to column 33)", + " (in 'mother.stan', line 459, column 2 to column 35)", + " (in 'mother.stan', line 461, column 2 to column 29)", + " (in 'mother.stan', line 462, column 8 to column 13)", + " (in 'mother.stan', line 462, column 2 to column 48)", + " (in 'mother.stan', line 463, column 8 to column 13)", + " (in 'mother.stan', line 463, column 2 to column 54)", + " (in 'mother.stan', line 464, column 8 to column 13)", + " (in 'mother.stan', line 464, column 2 to column 57)", + " (in 'mother.stan', line 465, column 9 to column 14)", + " (in 'mother.stan', line 465, column 16 to column 21)", + " (in 'mother.stan', line 465, column 2 to column 47)", " (in 'mother.stan', line 466, column 8 to column 13)", - " (in 'mother.stan', line 466, column 2 to column 48)", + " (in 'mother.stan', line 466, column 22 to column 27)", + " (in 'mother.stan', line 466, column 29 to column 34)", + " (in 'mother.stan', line 466, column 2 to column 66)", " (in 'mother.stan', line 467, column 8 to column 13)", - " (in 'mother.stan', line 467, column 2 to column 54)", + " (in 'mother.stan', line 467, column 25 to column 30)", + " (in 'mother.stan', line 467, column 32 to column 37)", + " (in 'mother.stan', line 467, column 2 to column 72)", " (in 'mother.stan', line 468, column 8 to column 13)", - " (in 'mother.stan', line 468, column 2 to column 57)", + " (in 'mother.stan', line 468, column 28 to column 33)", + " (in 'mother.stan', line 468, column 35 to column 40)", + " (in 'mother.stan', line 468, column 2 to column 75)", " (in 'mother.stan', line 469, column 9 to column 14)", - " (in 'mother.stan', line 469, column 16 to column 21)", - " (in 'mother.stan', line 469, column 2 to column 47)", + " (in 'mother.stan', line 469, column 2 to column 40)", " (in 'mother.stan', line 470, column 8 to column 13)", " (in 'mother.stan', line 470, column 22 to column 27)", - " (in 'mother.stan', line 470, column 29 to column 34)", - " (in 'mother.stan', line 470, column 2 to column 66)", + " (in 'mother.stan', line 470, column 2 to column 59)", " (in 'mother.stan', line 471, column 8 to column 13)", " (in 'mother.stan', line 471, column 25 to column 30)", - " (in 'mother.stan', line 471, column 32 to column 37)", - " (in 'mother.stan', line 471, column 2 to column 72)", + " (in 'mother.stan', line 471, column 2 to column 65)", " (in 'mother.stan', line 472, column 8 to column 13)", " (in 'mother.stan', line 472, column 28 to column 33)", - " (in 'mother.stan', line 472, column 35 to column 40)", - " (in 'mother.stan', line 472, column 2 to column 75)", - " (in 'mother.stan', line 473, column 9 to column 14)", - " (in 'mother.stan', line 473, column 2 to column 40)", + " (in 'mother.stan', line 472, column 2 to column 68)", + " (in 'mother.stan', line 473, column 13 to column 18)", + " (in 'mother.stan', line 473, column 2 to column 48)", " (in 'mother.stan', line 474, column 8 to column 13)", - " (in 'mother.stan', line 474, column 22 to column 27)", - " (in 'mother.stan', line 474, column 2 to column 59)", + " (in 'mother.stan', line 474, column 26 to column 31)", + " (in 'mother.stan', line 474, column 2 to column 67)", " (in 'mother.stan', line 475, column 8 to column 13)", - " (in 'mother.stan', line 475, column 25 to column 30)", - " (in 'mother.stan', line 475, column 2 to column 65)", + " (in 'mother.stan', line 475, column 29 to column 34)", + " (in 'mother.stan', line 475, column 2 to column 73)", " (in 'mother.stan', line 476, column 8 to column 13)", - " (in 'mother.stan', line 476, column 28 to column 33)", - " (in 'mother.stan', line 476, column 2 to column 68)", - " (in 'mother.stan', line 477, column 13 to column 18)", - " (in 'mother.stan', line 477, column 2 to column 48)", - " (in 'mother.stan', line 478, column 8 to column 13)", - " (in 'mother.stan', line 478, column 26 to column 31)", - " (in 'mother.stan', line 478, column 2 to column 67)", - " (in 'mother.stan', line 479, column 8 to column 13)", - " (in 'mother.stan', line 479, column 29 to column 34)", - " (in 'mother.stan', line 479, column 2 to column 73)", - " (in 'mother.stan', line 480, column 8 to column 13)", - " (in 'mother.stan', line 480, column 32 to column 37)", - " (in 'mother.stan', line 480, column 2 to column 76)", - " (in 'mother.stan', line 482, column 2 to column 41)", - " (in 'mother.stan', line 483, column 2 to column 42)", - " (in 'mother.stan', line 484, column 2 to column 42)", - " (in 'mother.stan', line 485, column 2 to column 43)", - " (in 'mother.stan', line 486, column 2 to column 53)", - " (in 'mother.stan', line 487, column 2 to column 54)", - " (in 'mother.stan', line 488, column 2 to column 59)", - " (in 'mother.stan', line 489, column 2 to column 60)", + " (in 'mother.stan', line 476, column 32 to column 37)", + " (in 'mother.stan', line 476, column 2 to column 76)", + " (in 'mother.stan', line 478, column 2 to column 41)", + " (in 'mother.stan', line 479, column 2 to column 42)", + " (in 'mother.stan', line 480, column 2 to column 42)", + " (in 'mother.stan', line 481, column 2 to column 43)", + " (in 'mother.stan', line 482, column 2 to column 53)", + " (in 'mother.stan', line 483, column 2 to column 54)", + " (in 'mother.stan', line 484, column 2 to column 59)", + " (in 'mother.stan', line 485, column 2 to column 60)", + " (in 'mother.stan', line 486, column 2 to column 59)", + " (in 'mother.stan', line 487, column 2 to column 60)", + " (in 'mother.stan', line 488, column 2 to column 53)", + " (in 'mother.stan', line 489, column 2 to column 54)", " (in 'mother.stan', line 490, column 2 to column 59)", " (in 'mother.stan', line 491, column 2 to column 60)", - " (in 'mother.stan', line 492, column 2 to column 53)", - " (in 'mother.stan', line 493, column 2 to column 54)", - " (in 'mother.stan', line 494, column 2 to column 59)", - " (in 'mother.stan', line 495, column 2 to column 60)", - " (in 'mother.stan', line 496, column 2 to column 59)", + " (in 'mother.stan', line 492, column 2 to column 59)", + " (in 'mother.stan', line 493, column 2 to column 60)", + " (in 'mother.stan', line 495, column 2 to column 54)", + " (in 'mother.stan', line 496, column 2 to column 55)", " (in 'mother.stan', line 497, column 2 to column 60)", - " (in 'mother.stan', line 499, column 2 to column 54)", - " (in 'mother.stan', line 500, column 2 to column 55)", - " (in 'mother.stan', line 501, column 2 to column 60)", - " (in 'mother.stan', line 502, column 2 to column 61)", - " (in 'mother.stan', line 503, column 2 to column 60)", - " (in 'mother.stan', line 504, column 2 to column 61)", - " (in 'mother.stan', line 506, column 2 to column 54)", - " (in 'mother.stan', line 507, column 2 to column 55)", - " (in 'mother.stan', line 508, column 2 to column 60)", - " (in 'mother.stan', line 509, column 2 to column 61)", - " (in 'mother.stan', line 510, column 2 to column 60)", - " (in 'mother.stan', line 511, column 2 to column 61)", - " (in 'mother.stan', line 513, column 2 to column 59)", - " (in 'mother.stan', line 514, column 2 to column 61)", - " (in 'mother.stan', line 515, column 2 to column 68)", - " (in 'mother.stan', line 516, column 2 to column 70)", - " (in 'mother.stan', line 517, column 2 to column 68)", - " (in 'mother.stan', line 518, column 2 to column 70)", - " (in 'mother.stan', line 520, column 2 to column 46)", - " (in 'mother.stan', line 521, column 2 to column 47)", - " (in 'mother.stan', line 522, column 2 to column 62)", - " (in 'mother.stan', line 523, column 2 to column 60)", - " (in 'mother.stan', line 524, column 2 to column 58)", - " (in 'mother.stan', line 525, column 2 to column 58)", - " (in 'mother.stan', line 526, column 2 to column 59)", - " (in 'mother.stan', line 527, column 2 to column 64)", - " (in 'mother.stan', line 528, column 2 to column 65)", - " (in 'mother.stan', line 529, column 2 to column 64)", - " (in 'mother.stan', line 530, column 2 to column 65)", - " (in 'mother.stan', line 532, column 2 to column 46)", - " (in 'mother.stan', line 533, column 2 to column 47)", - " (in 'mother.stan', line 534, column 2 to column 58)", - " (in 'mother.stan', line 535, column 2 to column 59)", - " (in 'mother.stan', line 536, column 2 to column 64)", - " (in 'mother.stan', line 537, column 2 to column 65)", - " (in 'mother.stan', line 538, column 2 to column 64)", - " (in 'mother.stan', line 539, column 2 to column 65)", - " (in 'mother.stan', line 541, column 2 to column 49)", - " (in 'mother.stan', line 542, column 2 to column 62)", - " (in 'mother.stan', line 543, column 2 to column 60)", - " (in 'mother.stan', line 544, column 2 to column 67)", - " (in 'mother.stan', line 545, column 2 to column 76)", - " (in 'mother.stan', line 546, column 2 to column 76)", - " (in 'mother.stan', line 548, column 2 to column 54)", - " (in 'mother.stan', line 549, column 2 to column 55)", - " (in 'mother.stan', line 550, column 2 to column 66)", - " (in 'mother.stan', line 551, column 2 to column 67)", - " (in 'mother.stan', line 552, column 2 to column 72)", - " (in 'mother.stan', line 553, column 2 to column 73)", - " (in 'mother.stan', line 554, column 2 to column 72)", - " (in 'mother.stan', line 555, column 2 to column 73)", - " (in 'mother.stan', line 557, column 2 to column 54)", - " (in 'mother.stan', line 558, column 2 to column 55)", - " (in 'mother.stan', line 559, column 2 to column 66)", - " (in 'mother.stan', line 560, column 2 to column 67)", - " (in 'mother.stan', line 561, column 2 to column 72)", - " (in 'mother.stan', line 562, column 2 to column 73)", - " (in 'mother.stan', line 563, column 2 to column 72)", - " (in 'mother.stan', line 564, column 2 to column 73)", - " (in 'mother.stan', line 566, column 2 to column 61)", - " (in 'mother.stan', line 567, column 2 to line 568, column 60)", - " (in 'mother.stan', line 569, column 2 to line 570, column 66)", - " (in 'mother.stan', line 571, column 2 to line 572, column 66)", - " (in 'mother.stan', line 574, column 2 to column 46)", - " (in 'mother.stan', line 575, column 2 to column 47)", - " (in 'mother.stan', line 576, column 2 to column 62)", - " (in 'mother.stan', line 577, column 2 to column 60)", - " (in 'mother.stan', line 578, column 2 to column 58)", - " (in 'mother.stan', line 579, column 2 to column 59)", - " (in 'mother.stan', line 580, column 2 to column 64)", - " (in 'mother.stan', line 581, column 2 to column 65)", - " (in 'mother.stan', line 582, column 2 to column 64)", - " (in 'mother.stan', line 583, column 2 to column 65)", - " (in 'mother.stan', line 585, column 2 to column 46)", - " (in 'mother.stan', line 586, column 2 to column 47)", - " (in 'mother.stan', line 587, column 2 to column 58)", - " (in 'mother.stan', line 588, column 2 to column 59)", - " (in 'mother.stan', line 589, column 2 to column 64)", - " (in 'mother.stan', line 590, column 2 to column 65)", - " (in 'mother.stan', line 591, column 2 to column 64)", - " (in 'mother.stan', line 592, column 2 to column 65)", - " (in 'mother.stan', line 594, column 2 to column 49)", - " (in 'mother.stan', line 595, column 2 to column 67)", - " (in 'mother.stan', line 596, column 2 to column 76)", - " (in 'mother.stan', line 597, column 2 to column 76)", - " (in 'mother.stan', line 599, column 2 to column 26)", - " (in 'mother.stan', line 600, column 2 to column 43)", + " (in 'mother.stan', line 498, column 2 to column 61)", + " (in 'mother.stan', line 499, column 2 to column 60)", + " (in 'mother.stan', line 500, column 2 to column 61)", + " (in 'mother.stan', line 502, column 2 to column 54)", + " (in 'mother.stan', line 503, column 2 to column 55)", + " (in 'mother.stan', line 504, column 2 to column 60)", + " (in 'mother.stan', line 505, column 2 to column 61)", + " (in 'mother.stan', line 506, column 2 to column 60)", + " (in 'mother.stan', line 507, column 2 to column 61)", + " (in 'mother.stan', line 509, column 2 to column 59)", + " (in 'mother.stan', line 510, column 2 to column 61)", + " (in 'mother.stan', line 511, column 2 to column 68)", + " (in 'mother.stan', line 512, column 2 to column 70)", + " (in 'mother.stan', line 513, column 2 to column 68)", + " (in 'mother.stan', line 514, column 2 to column 70)", + " (in 'mother.stan', line 516, column 2 to column 46)", + " (in 'mother.stan', line 517, column 2 to column 47)", + " (in 'mother.stan', line 518, column 2 to column 62)", + " (in 'mother.stan', line 519, column 2 to column 60)", + " (in 'mother.stan', line 520, column 2 to column 58)", + " (in 'mother.stan', line 521, column 2 to column 58)", + " (in 'mother.stan', line 522, column 2 to column 59)", + " (in 'mother.stan', line 523, column 2 to column 64)", + " (in 'mother.stan', line 524, column 2 to column 65)", + " (in 'mother.stan', line 525, column 2 to column 64)", + " (in 'mother.stan', line 526, column 2 to column 65)", + " (in 'mother.stan', line 528, column 2 to column 46)", + " (in 'mother.stan', line 529, column 2 to column 47)", + " (in 'mother.stan', line 530, column 2 to column 58)", + " (in 'mother.stan', line 531, column 2 to column 59)", + " (in 'mother.stan', line 532, column 2 to column 64)", + " (in 'mother.stan', line 533, column 2 to column 65)", + " (in 'mother.stan', line 534, column 2 to column 64)", + " (in 'mother.stan', line 535, column 2 to column 65)", + " (in 'mother.stan', line 537, column 2 to column 49)", + " (in 'mother.stan', line 538, column 2 to column 62)", + " (in 'mother.stan', line 539, column 2 to column 60)", + " (in 'mother.stan', line 540, column 2 to column 67)", + " (in 'mother.stan', line 541, column 2 to column 76)", + " (in 'mother.stan', line 542, column 2 to column 76)", + " (in 'mother.stan', line 544, column 2 to column 54)", + " (in 'mother.stan', line 545, column 2 to column 55)", + " (in 'mother.stan', line 546, column 2 to column 66)", + " (in 'mother.stan', line 547, column 2 to column 67)", + " (in 'mother.stan', line 548, column 2 to column 72)", + " (in 'mother.stan', line 549, column 2 to column 73)", + " (in 'mother.stan', line 550, column 2 to column 72)", + " (in 'mother.stan', line 551, column 2 to column 73)", + " (in 'mother.stan', line 553, column 2 to column 54)", + " (in 'mother.stan', line 554, column 2 to column 55)", + " (in 'mother.stan', line 555, column 2 to column 66)", + " (in 'mother.stan', line 556, column 2 to column 67)", + " (in 'mother.stan', line 557, column 2 to column 72)", + " (in 'mother.stan', line 558, column 2 to column 73)", + " (in 'mother.stan', line 559, column 2 to column 72)", + " (in 'mother.stan', line 560, column 2 to column 73)", + " (in 'mother.stan', line 562, column 2 to column 61)", + " (in 'mother.stan', line 563, column 2 to line 564, column 60)", + " (in 'mother.stan', line 565, column 2 to line 566, column 66)", + " (in 'mother.stan', line 567, column 2 to line 568, column 66)", + " (in 'mother.stan', line 570, column 2 to column 46)", + " (in 'mother.stan', line 571, column 2 to column 47)", + " (in 'mother.stan', line 572, column 2 to column 62)", + " (in 'mother.stan', line 573, column 2 to column 60)", + " (in 'mother.stan', line 574, column 2 to column 58)", + " (in 'mother.stan', line 575, column 2 to column 59)", + " (in 'mother.stan', line 576, column 2 to column 64)", + " (in 'mother.stan', line 577, column 2 to column 65)", + " (in 'mother.stan', line 578, column 2 to column 64)", + " (in 'mother.stan', line 579, column 2 to column 65)", + " (in 'mother.stan', line 581, column 2 to column 46)", + " (in 'mother.stan', line 582, column 2 to column 47)", + " (in 'mother.stan', line 583, column 2 to column 58)", + " (in 'mother.stan', line 584, column 2 to column 59)", + " (in 'mother.stan', line 585, column 2 to column 64)", + " (in 'mother.stan', line 586, column 2 to column 65)", + " (in 'mother.stan', line 587, column 2 to column 64)", + " (in 'mother.stan', line 588, column 2 to column 65)", + " (in 'mother.stan', line 590, column 2 to column 49)", + " (in 'mother.stan', line 591, column 2 to column 67)", + " (in 'mother.stan', line 592, column 2 to column 76)", + " (in 'mother.stan', line 593, column 2 to column 76)", + " (in 'mother.stan', line 595, column 2 to column 26)", + " (in 'mother.stan', line 596, column 2 to column 43)", + " (in 'mother.stan', line 605, column 8 to column 9)", + " (in 'mother.stan', line 606, column 8 to column 9)", + " (in 'mother.stan', line 606, column 11 to column 12)", + " (in 'mother.stan', line 606, column 14 to column 15)", + " (in 'mother.stan', line 607, column 18 to column 19)", + " (in 'mother.stan', line 608, column 8 to column 9)", + " (in 'mother.stan', line 608, column 18 to column 19)", " (in 'mother.stan', line 609, column 8 to column 9)", - " (in 'mother.stan', line 610, column 8 to column 9)", - " (in 'mother.stan', line 610, column 11 to column 12)", - " (in 'mother.stan', line 610, column 14 to column 15)", - " (in 'mother.stan', line 611, column 18 to column 19)", + " (in 'mother.stan', line 609, column 11 to column 12)", + " (in 'mother.stan', line 609, column 14 to column 15)", + " (in 'mother.stan', line 609, column 24 to column 25)", + " (in 'mother.stan', line 610, column 13 to column 14)", + " (in 'mother.stan', line 611, column 8 to column 9)", + " (in 'mother.stan', line 611, column 22 to column 23)", " (in 'mother.stan', line 612, column 8 to column 9)", - " (in 'mother.stan', line 612, column 18 to column 19)", - " (in 'mother.stan', line 613, column 8 to column 9)", - " (in 'mother.stan', line 613, column 11 to column 12)", - " (in 'mother.stan', line 613, column 14 to column 15)", - " (in 'mother.stan', line 613, column 24 to column 25)", - " (in 'mother.stan', line 614, column 13 to column 14)", - " (in 'mother.stan', line 615, column 8 to column 9)", - " (in 'mother.stan', line 615, column 22 to column 23)", + " (in 'mother.stan', line 612, column 11 to column 12)", + " (in 'mother.stan', line 612, column 14 to column 15)", + " (in 'mother.stan', line 612, column 28 to column 29)", + " (in 'mother.stan', line 615, column 10 to column 11)", " (in 'mother.stan', line 616, column 8 to column 9)", - " (in 'mother.stan', line 616, column 11 to column 12)", - " (in 'mother.stan', line 616, column 14 to column 15)", - " (in 'mother.stan', line 616, column 28 to column 29)", - " (in 'mother.stan', line 619, column 10 to column 11)", + " (in 'mother.stan', line 616, column 19 to column 20)", + " (in 'mother.stan', line 617, column 8 to column 9)", + " (in 'mother.stan', line 617, column 11 to column 12)", + " (in 'mother.stan', line 617, column 14 to column 15)", + " (in 'mother.stan', line 617, column 25 to column 26)", + " (in 'mother.stan', line 618, column 22 to column 23)", + " (in 'mother.stan', line 619, column 22 to column 23)", " (in 'mother.stan', line 620, column 8 to column 9)", - " (in 'mother.stan', line 620, column 19 to column 20)", - " (in 'mother.stan', line 621, column 8 to column 9)", - " (in 'mother.stan', line 621, column 11 to column 12)", - " (in 'mother.stan', line 621, column 14 to column 15)", - " (in 'mother.stan', line 621, column 25 to column 26)", - " (in 'mother.stan', line 622, column 22 to column 23)", - " (in 'mother.stan', line 623, column 22 to column 23)", - " (in 'mother.stan', line 624, column 8 to column 9)", - " (in 'mother.stan', line 624, column 31 to column 32)", + " (in 'mother.stan', line 620, column 31 to column 32)", + " (in 'mother.stan', line 625, column 8 to column 9)", + " (in 'mother.stan', line 626, column 8 to column 9)", + " (in 'mother.stan', line 626, column 11 to column 12)", + " (in 'mother.stan', line 626, column 14 to column 15)", + " (in 'mother.stan', line 627, column 18 to column 19)", + " (in 'mother.stan', line 628, column 8 to column 9)", + " (in 'mother.stan', line 628, column 18 to column 19)", " (in 'mother.stan', line 629, column 8 to column 9)", - " (in 'mother.stan', line 630, column 8 to column 9)", - " (in 'mother.stan', line 630, column 11 to column 12)", - " (in 'mother.stan', line 630, column 14 to column 15)", - " (in 'mother.stan', line 631, column 18 to column 19)", + " (in 'mother.stan', line 629, column 11 to column 12)", + " (in 'mother.stan', line 629, column 14 to column 15)", + " (in 'mother.stan', line 629, column 24 to column 25)", + " (in 'mother.stan', line 630, column 13 to column 14)", + " (in 'mother.stan', line 631, column 8 to column 9)", + " (in 'mother.stan', line 631, column 22 to column 23)", " (in 'mother.stan', line 632, column 8 to column 9)", - " (in 'mother.stan', line 632, column 18 to column 19)", - " (in 'mother.stan', line 633, column 8 to column 9)", - " (in 'mother.stan', line 633, column 11 to column 12)", - " (in 'mother.stan', line 633, column 14 to column 15)", - " (in 'mother.stan', line 633, column 24 to column 25)", - " (in 'mother.stan', line 634, column 13 to column 14)", - " (in 'mother.stan', line 635, column 8 to column 9)", - " (in 'mother.stan', line 635, column 22 to column 23)", + " (in 'mother.stan', line 632, column 11 to column 12)", + " (in 'mother.stan', line 632, column 14 to column 15)", + " (in 'mother.stan', line 632, column 28 to column 29)", + " (in 'mother.stan', line 635, column 10 to column 11)", " (in 'mother.stan', line 636, column 8 to column 9)", - " (in 'mother.stan', line 636, column 11 to column 12)", - " (in 'mother.stan', line 636, column 14 to column 15)", - " (in 'mother.stan', line 636, column 28 to column 29)", - " (in 'mother.stan', line 639, column 10 to column 11)", + " (in 'mother.stan', line 636, column 19 to column 20)", + " (in 'mother.stan', line 637, column 8 to column 9)", + " (in 'mother.stan', line 637, column 11 to column 12)", + " (in 'mother.stan', line 637, column 14 to column 15)", + " (in 'mother.stan', line 637, column 25 to column 26)", " (in 'mother.stan', line 640, column 8 to column 9)", - " (in 'mother.stan', line 640, column 19 to column 20)", - " (in 'mother.stan', line 641, column 8 to column 9)", - " (in 'mother.stan', line 641, column 11 to column 12)", - " (in 'mother.stan', line 641, column 14 to column 15)", - " (in 'mother.stan', line 641, column 25 to column 26)", - " (in 'mother.stan', line 644, column 8 to column 9)", + " (in 'mother.stan', line 735, column 8 to column 9)", + " (in 'mother.stan', line 736, column 8 to column 9)", + " (in 'mother.stan', line 736, column 11 to column 12)", + " (in 'mother.stan', line 736, column 14 to column 15)", + " (in 'mother.stan', line 737, column 18 to column 19)", + " (in 'mother.stan', line 738, column 8 to column 9)", + " (in 'mother.stan', line 738, column 18 to column 19)", " (in 'mother.stan', line 739, column 8 to column 9)", - " (in 'mother.stan', line 740, column 8 to column 9)", - " (in 'mother.stan', line 740, column 11 to column 12)", - " (in 'mother.stan', line 740, column 14 to column 15)", - " (in 'mother.stan', line 741, column 18 to column 19)", + " (in 'mother.stan', line 739, column 11 to column 12)", + " (in 'mother.stan', line 739, column 14 to column 15)", + " (in 'mother.stan', line 739, column 24 to column 25)", + " (in 'mother.stan', line 740, column 13 to column 14)", + " (in 'mother.stan', line 741, column 8 to column 9)", + " (in 'mother.stan', line 741, column 22 to column 23)", " (in 'mother.stan', line 742, column 8 to column 9)", - " (in 'mother.stan', line 742, column 18 to column 19)", - " (in 'mother.stan', line 743, column 8 to column 9)", - " (in 'mother.stan', line 743, column 11 to column 12)", - " (in 'mother.stan', line 743, column 14 to column 15)", - " (in 'mother.stan', line 743, column 24 to column 25)", - " (in 'mother.stan', line 744, column 13 to column 14)", + " (in 'mother.stan', line 742, column 11 to column 12)", + " (in 'mother.stan', line 742, column 14 to column 15)", + " (in 'mother.stan', line 742, column 28 to column 29)", + " (in 'mother.stan', line 744, column 10 to column 11)", " (in 'mother.stan', line 745, column 8 to column 9)", - " (in 'mother.stan', line 745, column 22 to column 23)", + " (in 'mother.stan', line 745, column 19 to column 20)", " (in 'mother.stan', line 746, column 8 to column 9)", " (in 'mother.stan', line 746, column 11 to column 12)", " (in 'mother.stan', line 746, column 14 to column 15)", - " (in 'mother.stan', line 746, column 28 to column 29)", - " (in 'mother.stan', line 748, column 10 to column 11)", + " (in 'mother.stan', line 746, column 25 to column 26)", " (in 'mother.stan', line 749, column 8 to column 9)", - " (in 'mother.stan', line 749, column 19 to column 20)", - " (in 'mother.stan', line 750, column 8 to column 9)", - " (in 'mother.stan', line 750, column 11 to column 12)", - " (in 'mother.stan', line 750, column 14 to column 15)", - " (in 'mother.stan', line 750, column 25 to column 26)", - " (in 'mother.stan', line 753, column 8 to column 9)", - " (in 'mother.stan', line 13, column 6 to column 15)", - " (in 'mother.stan', line 12, column 4 to line 13, column 15)", - " (in 'mother.stan', line 14, column 4 to column 26)", - " (in 'mother.stan', line 11, column 17 to line 15, column 3)", - " (in 'mother.stan', line 22, column 4 to column 23)", - " (in 'mother.stan', line 23, column 4 to column 19)", - " (in 'mother.stan', line 24, column 4 to column 38)", - " (in 'mother.stan', line 25, column 4 to column 16)", - " (in 'mother.stan', line 21, column 64 to line 26, column 3)", + " (in 'mother.stan', line 12, column 6 to column 15)", + " (in 'mother.stan', line 11, column 4 to line 12, column 15)", + " (in 'mother.stan', line 13, column 4 to column 26)", + " (in 'mother.stan', line 10, column 17 to line 14, column 3)", + " (in 'mother.stan', line 18, column 4 to column 23)", + " (in 'mother.stan', line 19, column 4 to column 19)", + " (in 'mother.stan', line 20, column 4 to column 38)", + " (in 'mother.stan', line 21, column 4 to column 16)", + " (in 'mother.stan', line 17, column 64 to line 22, column 3)", + " (in 'mother.stan', line 25, column 4 to column 15)", + " (in 'mother.stan', line 24, column 18 to line 26, column 3)", " (in 'mother.stan', line 29, column 4 to column 15)", - " (in 'mother.stan', line 28, column 18 to line 30, column 3)", + " (in 'mother.stan', line 28, column 24 to line 30, column 3)", " (in 'mother.stan', line 33, column 4 to column 15)", - " (in 'mother.stan', line 32, column 24 to line 34, column 3)", + " (in 'mother.stan', line 32, column 32 to line 34, column 3)", " (in 'mother.stan', line 37, column 4 to column 15)", - " (in 'mother.stan', line 36, column 32 to line 38, column 3)", + " (in 'mother.stan', line 36, column 36 to line 38, column 3)", " (in 'mother.stan', line 41, column 4 to column 15)", " (in 'mother.stan', line 40, column 36 to line 42, column 3)", " (in 'mother.stan', line 45, column 4 to column 15)", - " (in 'mother.stan', line 44, column 36 to line 46, column 3)", - " (in 'mother.stan', line 49, column 4 to column 15)", - " (in 'mother.stan', line 48, column 37 to line 50, column 3)", - " (in 'mother.stan', line 52, column 4 to column 33)", - " (in 'mother.stan', line 51, column 36 to line 53, column 3)", - " (in 'mother.stan', line 56, column 4 to column 36)", - " (in 'mother.stan', line 57, column 4 to column 27)", - " (in 'mother.stan', line 55, column 30 to line 58, column 3)", - " (in 'mother.stan', line 62, column 14 to column 20)", - " (in 'mother.stan', line 62, column 4 to column 20)", - " (in 'mother.stan', line 63, column 14 to column 23)", - " (in 'mother.stan', line 63, column 4 to column 23)", - " (in 'mother.stan', line 67, column 6 to column 12)", - " (in 'mother.stan', line 66, column 4 to line 67, column 12)", - " (in 'mother.stan', line 69, column 6 to column 15)", - " (in 'mother.stan', line 68, column 4 to line 69, column 15)", - " (in 'mother.stan', line 73, column 6 to column 12)", - " (in 'mother.stan', line 74, column 6 to column 12)", - " (in 'mother.stan', line 75, column 6 to column 12)", - " (in 'mother.stan', line 72, column 14 to line 76, column 5)", - " (in 'mother.stan', line 72, column 4 to line 76, column 5)", - " (in 'mother.stan', line 85, column 8 to column 14)", - " (in 'mother.stan', line 83, column 8 to column 14)", - " (in 'mother.stan', line 82, column 11 to line 85, column 14)", + " (in 'mother.stan', line 44, column 37 to line 46, column 3)", + " (in 'mother.stan', line 48, column 4 to column 33)", + " (in 'mother.stan', line 47, column 36 to line 49, column 3)", + " (in 'mother.stan', line 52, column 4 to column 36)", + " (in 'mother.stan', line 53, column 4 to column 27)", + " (in 'mother.stan', line 51, column 30 to line 54, column 3)", + " (in 'mother.stan', line 58, column 14 to column 20)", + " (in 'mother.stan', line 58, column 4 to column 20)", + " (in 'mother.stan', line 59, column 14 to column 23)", + " (in 'mother.stan', line 59, column 4 to column 23)", + " (in 'mother.stan', line 63, column 6 to column 12)", + " (in 'mother.stan', line 62, column 4 to line 63, column 12)", + " (in 'mother.stan', line 65, column 6 to column 15)", + " (in 'mother.stan', line 64, column 4 to line 65, column 15)", + " (in 'mother.stan', line 69, column 6 to column 12)", + " (in 'mother.stan', line 70, column 6 to column 12)", + " (in 'mother.stan', line 71, column 6 to column 12)", + " (in 'mother.stan', line 68, column 14 to line 72, column 5)", + " (in 'mother.stan', line 68, column 4 to line 72, column 5)", " (in 'mother.stan', line 81, column 8 to column 14)", - " (in 'mother.stan', line 80, column 6 to line 85, column 14)", - " (in 'mother.stan', line 79, column 14 to line 86, column 5)", - " (in 'mother.stan', line 79, column 4 to line 86, column 5)", - " (in 'mother.stan', line 89, column 24 to column 30)", - " (in 'mother.stan', line 89, column 14 to column 30)", - " (in 'mother.stan', line 89, column 4 to column 30)", - " (in 'mother.stan', line 94, column 8 to column 14)", - " (in 'mother.stan', line 93, column 6 to line 94, column 14)", - " (in 'mother.stan', line 92, column 14 to line 95, column 5)", - " (in 'mother.stan', line 92, column 4 to line 95, column 5)", - " (in 'mother.stan', line 99, column 6 to column 25)", - " (in 'mother.stan', line 100, column 6 to column 12)", + " (in 'mother.stan', line 79, column 8 to column 14)", + " (in 'mother.stan', line 78, column 11 to line 81, column 14)", + " (in 'mother.stan', line 77, column 8 to column 14)", + " (in 'mother.stan', line 76, column 6 to line 81, column 14)", + " (in 'mother.stan', line 75, column 14 to line 82, column 5)", + " (in 'mother.stan', line 75, column 4 to line 82, column 5)", + " (in 'mother.stan', line 85, column 24 to column 30)", + " (in 'mother.stan', line 85, column 14 to column 30)", + " (in 'mother.stan', line 85, column 4 to column 30)", + " (in 'mother.stan', line 90, column 8 to column 14)", + " (in 'mother.stan', line 89, column 6 to line 90, column 14)", + " (in 'mother.stan', line 88, column 14 to line 91, column 5)", + " (in 'mother.stan', line 88, column 4 to line 91, column 5)", + " (in 'mother.stan', line 95, column 6 to column 25)", + " (in 'mother.stan', line 96, column 6 to column 12)", + " (in 'mother.stan', line 97, column 6 to line 100, column 7)", + " (in 'mother.stan', line 98, column 8 to column 14)", + " (in 'mother.stan', line 99, column 8 to column 14)", " (in 'mother.stan', line 101, column 6 to line 104, column 7)", " (in 'mother.stan', line 102, column 8 to column 14)", - " (in 'mother.stan', line 103, column 8 to column 14)", - " (in 'mother.stan', line 105, column 6 to line 108, column 7)", - " (in 'mother.stan', line 106, column 8 to column 14)", - " (in 'mother.stan', line 107, column 8 to column 17)", - " (in 'mother.stan', line 109, column 6 to line 115, column 7)", - " (in 'mother.stan', line 110, column 8 to line 113, column 9)", - " (in 'mother.stan', line 111, column 10 to column 16)", - " (in 'mother.stan', line 112, column 10 to column 16)", - " (in 'mother.stan', line 114, column 8 to column 14)", - " (in 'mother.stan', line 98, column 14 to line 116, column 5)", - " (in 'mother.stan', line 98, column 4 to line 116, column 5)", - " (in 'mother.stan', line 120, column 6 to column 13)", - " (in 'mother.stan', line 121, column 6 to column 22)", + " (in 'mother.stan', line 103, column 8 to column 17)", + " (in 'mother.stan', line 105, column 6 to line 111, column 7)", + " (in 'mother.stan', line 106, column 8 to line 109, column 9)", + " (in 'mother.stan', line 107, column 10 to column 16)", + " (in 'mother.stan', line 108, column 10 to column 16)", + " (in 'mother.stan', line 110, column 8 to column 14)", + " (in 'mother.stan', line 94, column 14 to line 112, column 5)", + " (in 'mother.stan', line 94, column 4 to line 112, column 5)", + " (in 'mother.stan', line 116, column 6 to column 13)", + " (in 'mother.stan', line 117, column 6 to column 22)", + " (in 'mother.stan', line 118, column 6 to line 121, column 7)", + " (in 'mother.stan', line 119, column 8 to column 14)", + " (in 'mother.stan', line 120, column 8 to column 14)", " (in 'mother.stan', line 122, column 6 to line 125, column 7)", - " (in 'mother.stan', line 123, column 8 to column 14)", - " (in 'mother.stan', line 124, column 8 to column 14)", - " (in 'mother.stan', line 126, column 6 to line 129, column 7)", - " (in 'mother.stan', line 127, column 8 to column 16)", - " (in 'mother.stan', line 128, column 8 to column 17)", - " (in 'mother.stan', line 119, column 14 to line 130, column 5)", - " (in 'mother.stan', line 119, column 4 to line 130, column 5)", - " (in 'mother.stan', line 134, column 6 to column 13)", - " (in 'mother.stan', line 135, column 6 to column 19)", + " (in 'mother.stan', line 123, column 8 to column 16)", + " (in 'mother.stan', line 124, column 8 to column 17)", + " (in 'mother.stan', line 115, column 14 to line 126, column 5)", + " (in 'mother.stan', line 115, column 4 to line 126, column 5)", + " (in 'mother.stan', line 130, column 6 to column 13)", + " (in 'mother.stan', line 131, column 6 to column 19)", + " (in 'mother.stan', line 132, column 6 to line 135, column 7)", + " (in 'mother.stan', line 133, column 8 to column 14)", + " (in 'mother.stan', line 134, column 8 to column 14)", " (in 'mother.stan', line 136, column 6 to line 139, column 7)", - " (in 'mother.stan', line 137, column 8 to column 14)", - " (in 'mother.stan', line 138, column 8 to column 14)", - " (in 'mother.stan', line 140, column 6 to line 143, column 7)", - " (in 'mother.stan', line 141, column 8 to column 16)", - " (in 'mother.stan', line 142, column 8 to column 17)", - " (in 'mother.stan', line 133, column 14 to line 144, column 5)", - " (in 'mother.stan', line 133, column 4 to line 144, column 5)", - " (in 'mother.stan', line 148, column 6 to column 13)", - " (in 'mother.stan', line 149, column 6 to column 23)", + " (in 'mother.stan', line 137, column 8 to column 16)", + " (in 'mother.stan', line 138, column 8 to column 17)", + " (in 'mother.stan', line 129, column 14 to line 140, column 5)", + " (in 'mother.stan', line 129, column 4 to line 140, column 5)", + " (in 'mother.stan', line 144, column 6 to column 13)", + " (in 'mother.stan', line 145, column 6 to column 23)", + " (in 'mother.stan', line 146, column 6 to line 149, column 7)", + " (in 'mother.stan', line 147, column 8 to column 14)", + " (in 'mother.stan', line 148, column 8 to column 14)", " (in 'mother.stan', line 150, column 6 to line 153, column 7)", - " (in 'mother.stan', line 151, column 8 to column 14)", - " (in 'mother.stan', line 152, column 8 to column 14)", - " (in 'mother.stan', line 154, column 6 to line 157, column 7)", - " (in 'mother.stan', line 155, column 8 to column 16)", - " (in 'mother.stan', line 156, column 8 to column 17)", - " (in 'mother.stan', line 147, column 14 to line 158, column 5)", - " (in 'mother.stan', line 147, column 4 to line 158, column 5)", - " (in 'mother.stan', line 162, column 6 to column 12)", - " (in 'mother.stan', line 163, column 6 to column 12)", - " (in 'mother.stan', line 165, column 8 to column 14)", - " (in 'mother.stan', line 166, column 8 to column 14)", - " (in 'mother.stan', line 167, column 8 to column 14)", - " (in 'mother.stan', line 164, column 6 to line 168, column 7)", - " (in 'mother.stan', line 161, column 14 to line 169, column 5)", - " (in 'mother.stan', line 161, column 4 to line 169, column 5)", - " (in 'mother.stan', line 171, column 4 to column 13)", - " (in 'mother.stan', line 60, column 19 to line 172, column 3)", - " (in 'mother.stan', line 175, column 4 to column 20)", - " (in 'mother.stan', line 176, column 4 to column 10)", - " (in 'mother.stan', line 177, column 4 to line 178, column 12)", - " (in 'mother.stan', line 178, column 6 to column 12)", - " (in 'mother.stan', line 179, column 4 to column 13)", - " (in 'mother.stan', line 174, column 19 to line 180, column 3)", - " (in 'mother.stan', line 183, column 4 to column 27)", - " (in 'mother.stan', line 182, column 36 to line 184, column 3)", - " (in 'mother.stan', line 187, column 4 to column 24)", - " (in 'mother.stan', line 186, column 22 to line 188, column 3)", - " (in 'mother.stan', line 191, column 4 to column 54)", - " (in 'mother.stan', line 190, column 29 to line 192, column 3)", - " (in 'mother.stan', line 195, column 4 to column 18)", - " (in 'mother.stan', line 196, column 4 to column 19)", - " (in 'mother.stan', line 197, column 4 to column 26)", - " (in 'mother.stan', line 198, column 4 to column 38)", - " (in 'mother.stan', line 200, column 6 to line 201, column 23)", - " (in 'mother.stan', line 199, column 4 to line 201, column 23)", - " (in 'mother.stan', line 203, column 6 to line 204, column 23)", - " (in 'mother.stan', line 202, column 4 to line 204, column 23)", - " (in 'mother.stan', line 205, column 4 to column 32)", - " (in 'mother.stan', line 194, column 59 to line 206, column 3)", - " (in 'mother.stan', line 210, column 4 to column 22)", + " (in 'mother.stan', line 151, column 8 to column 16)", + " (in 'mother.stan', line 152, column 8 to column 17)", + " (in 'mother.stan', line 143, column 14 to line 154, column 5)", + " (in 'mother.stan', line 143, column 4 to line 154, column 5)", + " (in 'mother.stan', line 158, column 6 to column 12)", + " (in 'mother.stan', line 159, column 6 to column 12)", + " (in 'mother.stan', line 161, column 8 to column 14)", + " (in 'mother.stan', line 162, column 8 to column 14)", + " (in 'mother.stan', line 163, column 8 to column 14)", + " (in 'mother.stan', line 160, column 6 to line 164, column 7)", + " (in 'mother.stan', line 157, column 14 to line 165, column 5)", + " (in 'mother.stan', line 157, column 4 to line 165, column 5)", + " (in 'mother.stan', line 167, column 4 to column 13)", + " (in 'mother.stan', line 56, column 19 to line 168, column 3)", + " (in 'mother.stan', line 171, column 4 to column 20)", + " (in 'mother.stan', line 172, column 4 to column 10)", + " (in 'mother.stan', line 173, column 4 to line 174, column 12)", + " (in 'mother.stan', line 174, column 6 to column 12)", + " (in 'mother.stan', line 175, column 4 to column 13)", + " (in 'mother.stan', line 170, column 19 to line 176, column 3)", + " (in 'mother.stan', line 179, column 4 to column 27)", + " (in 'mother.stan', line 178, column 36 to line 180, column 3)", + " (in 'mother.stan', line 183, column 4 to column 24)", + " (in 'mother.stan', line 182, column 22 to line 184, column 3)", + " (in 'mother.stan', line 187, column 4 to column 54)", + " (in 'mother.stan', line 186, column 29 to line 188, column 3)", + " (in 'mother.stan', line 191, column 4 to column 18)", + " (in 'mother.stan', line 192, column 4 to column 19)", + " (in 'mother.stan', line 193, column 4 to column 26)", + " (in 'mother.stan', line 194, column 4 to column 38)", + " (in 'mother.stan', line 196, column 6 to line 197, column 23)", + " (in 'mother.stan', line 195, column 4 to line 197, column 23)", + " (in 'mother.stan', line 199, column 6 to line 200, column 23)", + " (in 'mother.stan', line 198, column 4 to line 200, column 23)", + " (in 'mother.stan', line 201, column 4 to column 32)", + " (in 'mother.stan', line 190, column 59 to line 202, column 3)", + " (in 'mother.stan', line 206, column 4 to column 22)", + " (in 'mother.stan', line 205, column 66 to line 207, column 3)", + " (in 'mother.stan', line 210, column 4 to column 14)", " (in 'mother.stan', line 209, column 66 to line 211, column 3)", - " (in 'mother.stan', line 214, column 4 to column 14)", - " (in 'mother.stan', line 213, column 66 to line 215, column 3)", - " (in 'mother.stan', line 217, column 4 to column 14)", - " (in 'mother.stan', line 216, column 78 to line 218, column 3)", - " (in 'mother.stan', line 221, column 11 to column 20)", - " (in 'mother.stan', line 221, column 22 to column 31)", - " (in 'mother.stan', line 221, column 4 to column 35)", - " (in 'mother.stan', line 222, column 4 to column 12)", - " (in 'mother.stan', line 223, column 4 to column 16)", - " (in 'mother.stan', line 224, column 4 to column 24)", - " (in 'mother.stan', line 225, column 4 to column 13)", - " (in 'mother.stan', line 220, column 49 to line 226, column 3)", - " (in 'mother.stan', line 230, column 4 to column 16)", - " (in 'mother.stan', line 229, column 63 to line 231, column 3)", - " (in 'mother.stan', line 236, column 4 to column 14)", - " (in 'mother.stan', line 235, column 62 to line 237, column 3)", - " (in 'mother.stan', line 243, column 4 to column 14)", - " (in 'mother.stan', line 242, column 58 to line 244, column 3)", - " (in 'mother.stan', line 250, column 4 to column 14)", - " (in 'mother.stan', line 249, column 59 to line 251, column 3)", - " (in 'mother.stan', line 256, column 4 to column 14)", - " (in 'mother.stan', line 255, column 63 to line 257, column 3)", - " (in 'mother.stan', line 263, column 4 to column 14)", - " (in 'mother.stan', line 262, column 59 to line 264, column 3)", - " (in 'mother.stan', line 270, column 4 to column 14)", - " (in 'mother.stan', line 269, column 60 to line 271, column 3)", - " (in 'mother.stan', line 277, column 4 to column 14)", - " (in 'mother.stan', line 276, column 33 to line 278, column 3)", - " (in 'mother.stan', line 284, column 4 to column 14)", - " (in 'mother.stan', line 283, column 61 to line 285, column 3)", - " (in 'mother.stan', line 291, column 4 to column 14)", - " (in 'mother.stan', line 290, column 62 to line 292, column 3)", - " (in 'mother.stan', line 298, column 4 to column 15)", - " (in 'mother.stan', line 297, column 34 to line 299, column 3)", - " (in 'mother.stan', line 305, column 4 to column 15)", - " (in 'mother.stan', line 304, column 62 to line 306, column 3)", - " (in 'mother.stan', line 312, column 4 to column 15)", - " (in 'mother.stan', line 311, column 63 to line 313, column 3)", - " (in 'mother.stan', line 315, column 4 to column 10)", - " (in 'mother.stan', line 316, column 4 to column 11)", - " (in 'mother.stan', line 317, column 4 to column 25)", - " (in 'mother.stan', line 318, column 4 to column 40)", - " (in 'mother.stan', line 319, column 4 to column 27)", - " (in 'mother.stan', line 314, column 15 to line 320, column 3)", - " (in 'mother.stan', line 322, column 4 to line 323, column 45)", - " (in 'mother.stan', line 321, column 18 to line 324, column 3)", - " (in 'mother.stan', line 326, column 4 to column 44)", - " (in 'mother.stan', line 325, column 18 to line 327, column 3)", - " (in 'mother.stan', line 329, column 4 to column 33)", - " (in 'mother.stan', line 330, column 4 to column 13)", + " (in 'mother.stan', line 213, column 4 to column 14)", + " (in 'mother.stan', line 212, column 78 to line 214, column 3)", + " (in 'mother.stan', line 217, column 11 to column 20)", + " (in 'mother.stan', line 217, column 22 to column 31)", + " (in 'mother.stan', line 217, column 4 to column 35)", + " (in 'mother.stan', line 218, column 4 to column 12)", + " (in 'mother.stan', line 219, column 4 to column 16)", + " (in 'mother.stan', line 220, column 4 to column 24)", + " (in 'mother.stan', line 221, column 4 to column 13)", + " (in 'mother.stan', line 216, column 49 to line 222, column 3)", + " (in 'mother.stan', line 226, column 4 to column 16)", + " (in 'mother.stan', line 225, column 63 to line 227, column 3)", + " (in 'mother.stan', line 232, column 4 to column 14)", + " (in 'mother.stan', line 231, column 62 to line 233, column 3)", + " (in 'mother.stan', line 239, column 4 to column 14)", + " (in 'mother.stan', line 238, column 58 to line 240, column 3)", + " (in 'mother.stan', line 246, column 4 to column 14)", + " (in 'mother.stan', line 245, column 59 to line 247, column 3)", + " (in 'mother.stan', line 252, column 4 to column 14)", + " (in 'mother.stan', line 251, column 63 to line 253, column 3)", + " (in 'mother.stan', line 259, column 4 to column 14)", + " (in 'mother.stan', line 258, column 59 to line 260, column 3)", + " (in 'mother.stan', line 266, column 4 to column 14)", + " (in 'mother.stan', line 265, column 60 to line 267, column 3)", + " (in 'mother.stan', line 273, column 4 to column 14)", + " (in 'mother.stan', line 272, column 33 to line 274, column 3)", + " (in 'mother.stan', line 280, column 4 to column 14)", + " (in 'mother.stan', line 279, column 61 to line 281, column 3)", + " (in 'mother.stan', line 287, column 4 to column 14)", + " (in 'mother.stan', line 286, column 62 to line 288, column 3)", + " (in 'mother.stan', line 294, column 4 to column 15)", + " (in 'mother.stan', line 293, column 34 to line 295, column 3)", + " (in 'mother.stan', line 301, column 4 to column 15)", + " (in 'mother.stan', line 300, column 62 to line 302, column 3)", + " (in 'mother.stan', line 308, column 4 to column 15)", + " (in 'mother.stan', line 307, column 63 to line 309, column 3)", + " (in 'mother.stan', line 311, column 4 to column 10)", + " (in 'mother.stan', line 312, column 4 to column 11)", + " (in 'mother.stan', line 313, column 4 to column 25)", + " (in 'mother.stan', line 314, column 4 to column 40)", + " (in 'mother.stan', line 315, column 4 to column 27)", + " (in 'mother.stan', line 310, column 15 to line 316, column 3)", + " (in 'mother.stan', line 318, column 4 to line 319, column 45)", + " (in 'mother.stan', line 317, column 18 to line 320, column 3)", + " (in 'mother.stan', line 322, column 4 to column 44)", + " (in 'mother.stan', line 321, column 18 to line 323, column 3)", + " (in 'mother.stan', line 325, column 4 to column 33)", + " (in 'mother.stan', line 326, column 4 to column 13)", + " (in 'mother.stan', line 324, column 27 to line 327, column 3)", + " (in 'mother.stan', line 329, column 4 to column 57)", + " (in 'mother.stan', line 330, column 4 to column 30)", " (in 'mother.stan', line 328, column 27 to line 331, column 3)", - " (in 'mother.stan', line 333, column 4 to column 57)", - " (in 'mother.stan', line 334, column 4 to column 30)", - " (in 'mother.stan', line 332, column 27 to line 335, column 3)", - " (in 'mother.stan', line 338, column 4 to column 18)", - " (in 'mother.stan', line 339, column 4 to column 25)", - " (in 'mother.stan', line 340, column 4 to column 25)", - " (in 'mother.stan', line 341, column 4 to column 15)", - " (in 'mother.stan', line 337, column 45 to line 342, column 3)", - " (in 'mother.stan', line 346, column 4 to column 19)", - " (in 'mother.stan', line 347, column 4 to column 18)", - " (in 'mother.stan', line 348, column 4 to column 16)", - " (in 'mother.stan', line 345, column 41 to line 349, column 3)"}; + " (in 'mother.stan', line 334, column 4 to column 18)", + " (in 'mother.stan', line 335, column 4 to column 25)", + " (in 'mother.stan', line 336, column 4 to column 25)", + " (in 'mother.stan', line 337, column 4 to column 15)", + " (in 'mother.stan', line 333, column 45 to line 338, column 3)", + " (in 'mother.stan', line 342, column 4 to column 19)", + " (in 'mother.stan', line 343, column 4 to column 18)", + " (in 'mother.stan', line 344, column 4 to column 16)", + " (in 'mother.stan', line 341, column 41 to line 345, column 3)"}; int foo(const int& n, std::ostream* pstream__); template , @@ -19573,10 +19573,6 @@ stan::math::profile_map& get_stan_profile_data() { return overloading_templating_model_namespace::profiles__; } #endif -Warning in 'overloading_templating.stan', line 4, column 7: Forward - declarations are deprecated and not needed for recursion. -Warning in 'overloading_templating.stan', line 5, column 7: Forward - declarations are deprecated and not needed for recursion. $ ../../../../../install/default/bin/stanc --print-cpp param-constraint.stan // Code generated by %%NAME%% %%VERSION%% #include @@ -21192,10 +21188,6 @@ stan::math::profile_map& get_stan_profile_data() { return recursive_slicing_model_namespace::profiles__; } #endif -Warning in 'recursive-slicing.stan', line 33, column 7: Forward declarations - are deprecated and not needed for recursion. -Warning in 'recursive-slicing.stan', line 34, column 7: Forward declarations - are deprecated and not needed for recursion. $ ../../../../../install/default/bin/stanc --print-cpp reduce_sum_m1.stan // Code generated by %%NAME%% %%VERSION%% #include diff --git a/test/integration/good/code-gen/lir.expected b/test/integration/good/code-gen/lir.expected index d2d090f8d0..4fab348021 100644 --- a/test/integration/good/code-gen/lir.expected +++ b/test/integration/good/code-gen/lir.expected @@ -16,1059 +16,1059 @@ (Assignment (ArrayLiteral ((Literal "\" (found before start of program)\"") - (Literal "\" (in 'mother.stan', line 603, column 2 to column 14)\"") - (Literal "\" (in 'mother.stan', line 604, column 2 to column 29)\"") - (Literal "\" (in 'mother.stan', line 605, column 2 to column 30)\"") - (Literal "\" (in 'mother.stan', line 606, column 2 to column 58)\"") - (Literal "\" (in 'mother.stan', line 607, column 2 to column 51)\"") - (Literal "\" (in 'mother.stan', line 608, column 2 to column 47)\"") - (Literal "\" (in 'mother.stan', line 609, column 2 to column 38)\"") - (Literal "\" (in 'mother.stan', line 610, column 2 to column 44)\"") - (Literal "\" (in 'mother.stan', line 611, column 2 to column 27)\"") - (Literal "\" (in 'mother.stan', line 612, column 2 to column 30)\"") - (Literal "\" (in 'mother.stan', line 613, column 2 to column 36)\"") - (Literal "\" (in 'mother.stan', line 614, column 2 to column 26)\"") - (Literal "\" (in 'mother.stan', line 615, column 2 to column 38)\"") - (Literal "\" (in 'mother.stan', line 616, column 2 to column 44)\"") - (Literal "\" (in 'mother.stan', line 617, column 2 to column 21)\"") - (Literal "\" (in 'mother.stan', line 618, column 2 to column 54)\"") - (Literal "\" (in 'mother.stan', line 619, column 2 to column 23)\"") - (Literal "\" (in 'mother.stan', line 620, column 2 to column 35)\"") - (Literal "\" (in 'mother.stan', line 621, column 2 to column 41)\"") - (Literal "\" (in 'mother.stan', line 622, column 2 to column 39)\"") - (Literal "\" (in 'mother.stan', line 623, column 2 to column 36)\"") - (Literal "\" (in 'mother.stan', line 624, column 2 to column 48)\"") - (Literal "\" (in 'mother.stan', line 625, column 2 to column 16)\"") - (Literal "\" (in 'mother.stan', line 626, column 2 to column 16)\"") - (Literal "\" (in 'mother.stan', line 629, column 2 to column 39)\"") - (Literal "\" (in 'mother.stan', line 630, column 2 to column 45)\"") - (Literal "\" (in 'mother.stan', line 631, column 2 to column 28)\"") - (Literal "\" (in 'mother.stan', line 632, column 2 to column 31)\"") - (Literal "\" (in 'mother.stan', line 633, column 2 to column 37)\"") - (Literal "\" (in 'mother.stan', line 634, column 2 to column 27)\"") - (Literal "\" (in 'mother.stan', line 635, column 2 to column 39)\"") - (Literal "\" (in 'mother.stan', line 636, column 2 to column 45)\"") - (Literal "\" (in 'mother.stan', line 637, column 2 to column 22)\"") - (Literal "\" (in 'mother.stan', line 638, column 2 to column 55)\"") - (Literal "\" (in 'mother.stan', line 639, column 2 to column 24)\"") - (Literal "\" (in 'mother.stan', line 640, column 2 to column 36)\"") - (Literal "\" (in 'mother.stan', line 641, column 2 to column 42)\"") - (Literal "\" (in 'mother.stan', line 642, column 2 to column 40)\"") - (Literal "\" (in 'mother.stan', line 643, column 2 to column 37)\"") - (Literal "\" (in 'mother.stan', line 644, column 2 to column 49)\"") - (Literal "\" (in 'mother.stan', line 645, column 2 to column 20)\"") - (Literal "\" (in 'mother.stan', line 646, column 2 to column 15)\"") - (Literal "\" (in 'mother.stan', line 648, column 2 to column 31)\"") - (Literal "\" (in 'mother.stan', line 649, column 2 to column 31)\"") - (Literal "\" (in 'mother.stan', line 650, column 2 to column 23)\"") - (Literal "\" (in 'mother.stan', line 651, column 2 to column 23)\"") - (Literal "\" (in 'mother.stan', line 653, column 2 to column 25)\"") - (Literal "\" (in 'mother.stan', line 654, column 2 to column 31)\"") - (Literal "\" (in 'mother.stan', line 655, column 2 to column 31)\"") - (Literal "\" (in 'mother.stan', line 657, column 2 to column 27)\"") - (Literal "\" (in 'mother.stan', line 658, column 2 to column 27)\"") - (Literal "\" (in 'mother.stan', line 659, column 2 to column 33)\"") - (Literal "\" (in 'mother.stan', line 661, column 2 to column 41)\"") - (Literal "\" (in 'mother.stan', line 662, column 2 to column 36)\"") - (Literal - "\" (in 'mother.stan', line 668, column 10 to column 38)\"") - (Literal - "\" (in 'mother.stan', line 667, column 25 to line 669, column 9)\"") - (Literal - "\" (in 'mother.stan', line 667, column 8 to line 669, column 9)\"") - (Literal - "\" (in 'mother.stan', line 666, column 23 to line 670, column 7)\"") - (Literal - "\" (in 'mother.stan', line 666, column 6 to line 670, column 7)\"") - (Literal - "\" (in 'mother.stan', line 665, column 21 to line 671, column 5)\"") - (Literal - "\" (in 'mother.stan', line 665, column 4 to line 671, column 5)\"") - (Literal - "\" (in 'mother.stan', line 664, column 19 to line 672, column 3)\"") - (Literal - "\" (in 'mother.stan', line 664, column 2 to line 672, column 3)\"") - (Literal "\" (in 'mother.stan', line 675, column 4 to column 32)\"") - (Literal - "\" (in 'mother.stan', line 674, column 2 to line 675, column 32)\"") - (Literal "\" (in 'mother.stan', line 676, column 2 to column 29)\"") - (Literal "\" (in 'mother.stan', line 677, column 2 to column 31)\"") - (Literal "\" (in 'mother.stan', line 678, column 2 to column 31)\"") - (Literal "\" (in 'mother.stan', line 680, column 2 to column 63)\"") - (Literal - "\" (in 'mother.stan', line 681, column 2 to line 682, column 31)\"") - (Literal - "\" (in 'mother.stan', line 683, column 2 to line 684, column 31)\"") - (Literal "\" (in 'mother.stan', line 685, column 2 to column 65)\"") - (Literal - "\" (in 'mother.stan', line 686, column 2 to line 687, column 31)\"") - (Literal "\" (in 'mother.stan', line 688, column 2 to column 67)\"") - (Literal - "\" (in 'mother.stan', line 689, column 2 to line 690, column 37)\"") - (Literal "\" (in 'mother.stan', line 692, column 2 to column 29)\"") - (Literal "\" (in 'mother.stan', line 693, column 2 to column 29)\"") - (Literal "\" (in 'mother.stan', line 737, column 2 to column 32)\"") - (Literal "\" (in 'mother.stan', line 738, column 2 to column 27)\"") - (Literal "\" (in 'mother.stan', line 739, column 2 to column 39)\"") - (Literal "\" (in 'mother.stan', line 740, column 2 to column 45)\"") - (Literal "\" (in 'mother.stan', line 741, column 2 to column 28)\"") - (Literal "\" (in 'mother.stan', line 742, column 2 to column 31)\"") - (Literal "\" (in 'mother.stan', line 743, column 2 to column 37)\"") - (Literal "\" (in 'mother.stan', line 744, column 2 to column 27)\"") - (Literal "\" (in 'mother.stan', line 745, column 2 to column 39)\"") - (Literal "\" (in 'mother.stan', line 746, column 2 to column 45)\"") - (Literal "\" (in 'mother.stan', line 747, column 2 to column 55)\"") - (Literal "\" (in 'mother.stan', line 748, column 2 to column 24)\"") - (Literal "\" (in 'mother.stan', line 749, column 2 to column 36)\"") - (Literal "\" (in 'mother.stan', line 750, column 2 to column 42)\"") - (Literal "\" (in 'mother.stan', line 751, column 2 to column 40)\"") - (Literal "\" (in 'mother.stan', line 752, column 2 to column 37)\"") - (Literal "\" (in 'mother.stan', line 753, column 2 to column 49)\"") - (Literal "\" (in 'mother.stan', line 754, column 2 to column 35)\"") - (Literal "\" (in 'mother.stan', line 755, column 2 to column 37)\"") - (Literal "\" (in 'mother.stan', line 756, column 2 to column 33)\"") - (Literal "\" (in 'mother.stan', line 757, column 2 to column 33)\"") - (Literal "\" (in 'mother.stan', line 758, column 2 to column 33)\"") - (Literal "\" (in 'mother.stan', line 759, column 2 to column 34)\"") - (Literal "\" (in 'mother.stan', line 760, column 2 to column 34)\"") - (Literal "\" (in 'mother.stan', line 761, column 2 to column 34)\"") - (Literal "\" (in 'mother.stan', line 762, column 2 to column 34)\"") - (Literal "\" (in 'mother.stan', line 763, column 2 to column 30)\"") - (Literal "\" (in 'mother.stan', line 765, column 2 to column 39)\"") + (Literal "\" (in 'mother.stan', line 599, column 2 to column 14)\"") + (Literal "\" (in 'mother.stan', line 600, column 2 to column 29)\"") + (Literal "\" (in 'mother.stan', line 601, column 2 to column 30)\"") + (Literal "\" (in 'mother.stan', line 602, column 2 to column 58)\"") + (Literal "\" (in 'mother.stan', line 603, column 2 to column 51)\"") + (Literal "\" (in 'mother.stan', line 604, column 2 to column 47)\"") + (Literal "\" (in 'mother.stan', line 605, column 2 to column 38)\"") + (Literal "\" (in 'mother.stan', line 606, column 2 to column 44)\"") + (Literal "\" (in 'mother.stan', line 607, column 2 to column 27)\"") + (Literal "\" (in 'mother.stan', line 608, column 2 to column 30)\"") + (Literal "\" (in 'mother.stan', line 609, column 2 to column 36)\"") + (Literal "\" (in 'mother.stan', line 610, column 2 to column 26)\"") + (Literal "\" (in 'mother.stan', line 611, column 2 to column 38)\"") + (Literal "\" (in 'mother.stan', line 612, column 2 to column 44)\"") + (Literal "\" (in 'mother.stan', line 613, column 2 to column 21)\"") + (Literal "\" (in 'mother.stan', line 614, column 2 to column 54)\"") + (Literal "\" (in 'mother.stan', line 615, column 2 to column 23)\"") + (Literal "\" (in 'mother.stan', line 616, column 2 to column 35)\"") + (Literal "\" (in 'mother.stan', line 617, column 2 to column 41)\"") + (Literal "\" (in 'mother.stan', line 618, column 2 to column 39)\"") + (Literal "\" (in 'mother.stan', line 619, column 2 to column 36)\"") + (Literal "\" (in 'mother.stan', line 620, column 2 to column 48)\"") + (Literal "\" (in 'mother.stan', line 621, column 2 to column 16)\"") + (Literal "\" (in 'mother.stan', line 622, column 2 to column 16)\"") + (Literal "\" (in 'mother.stan', line 625, column 2 to column 39)\"") + (Literal "\" (in 'mother.stan', line 626, column 2 to column 45)\"") + (Literal "\" (in 'mother.stan', line 627, column 2 to column 28)\"") + (Literal "\" (in 'mother.stan', line 628, column 2 to column 31)\"") + (Literal "\" (in 'mother.stan', line 629, column 2 to column 37)\"") + (Literal "\" (in 'mother.stan', line 630, column 2 to column 27)\"") + (Literal "\" (in 'mother.stan', line 631, column 2 to column 39)\"") + (Literal "\" (in 'mother.stan', line 632, column 2 to column 45)\"") + (Literal "\" (in 'mother.stan', line 633, column 2 to column 22)\"") + (Literal "\" (in 'mother.stan', line 634, column 2 to column 55)\"") + (Literal "\" (in 'mother.stan', line 635, column 2 to column 24)\"") + (Literal "\" (in 'mother.stan', line 636, column 2 to column 36)\"") + (Literal "\" (in 'mother.stan', line 637, column 2 to column 42)\"") + (Literal "\" (in 'mother.stan', line 638, column 2 to column 40)\"") + (Literal "\" (in 'mother.stan', line 639, column 2 to column 37)\"") + (Literal "\" (in 'mother.stan', line 640, column 2 to column 49)\"") + (Literal "\" (in 'mother.stan', line 641, column 2 to column 20)\"") + (Literal "\" (in 'mother.stan', line 642, column 2 to column 15)\"") + (Literal "\" (in 'mother.stan', line 644, column 2 to column 31)\"") + (Literal "\" (in 'mother.stan', line 645, column 2 to column 31)\"") + (Literal "\" (in 'mother.stan', line 646, column 2 to column 23)\"") + (Literal "\" (in 'mother.stan', line 647, column 2 to column 23)\"") + (Literal "\" (in 'mother.stan', line 649, column 2 to column 25)\"") + (Literal "\" (in 'mother.stan', line 650, column 2 to column 31)\"") + (Literal "\" (in 'mother.stan', line 651, column 2 to column 31)\"") + (Literal "\" (in 'mother.stan', line 653, column 2 to column 27)\"") + (Literal "\" (in 'mother.stan', line 654, column 2 to column 27)\"") + (Literal "\" (in 'mother.stan', line 655, column 2 to column 33)\"") + (Literal "\" (in 'mother.stan', line 657, column 2 to column 41)\"") + (Literal "\" (in 'mother.stan', line 658, column 2 to column 36)\"") + (Literal + "\" (in 'mother.stan', line 664, column 10 to column 38)\"") + (Literal + "\" (in 'mother.stan', line 663, column 25 to line 665, column 9)\"") + (Literal + "\" (in 'mother.stan', line 663, column 8 to line 665, column 9)\"") + (Literal + "\" (in 'mother.stan', line 662, column 23 to line 666, column 7)\"") + (Literal + "\" (in 'mother.stan', line 662, column 6 to line 666, column 7)\"") + (Literal + "\" (in 'mother.stan', line 661, column 21 to line 667, column 5)\"") + (Literal + "\" (in 'mother.stan', line 661, column 4 to line 667, column 5)\"") + (Literal + "\" (in 'mother.stan', line 660, column 19 to line 668, column 3)\"") + (Literal + "\" (in 'mother.stan', line 660, column 2 to line 668, column 3)\"") + (Literal "\" (in 'mother.stan', line 671, column 4 to column 32)\"") + (Literal + "\" (in 'mother.stan', line 670, column 2 to line 671, column 32)\"") + (Literal "\" (in 'mother.stan', line 672, column 2 to column 29)\"") + (Literal "\" (in 'mother.stan', line 673, column 2 to column 31)\"") + (Literal "\" (in 'mother.stan', line 674, column 2 to column 31)\"") + (Literal "\" (in 'mother.stan', line 676, column 2 to column 63)\"") + (Literal + "\" (in 'mother.stan', line 677, column 2 to line 678, column 31)\"") + (Literal + "\" (in 'mother.stan', line 679, column 2 to line 680, column 31)\"") + (Literal "\" (in 'mother.stan', line 681, column 2 to column 65)\"") + (Literal + "\" (in 'mother.stan', line 682, column 2 to line 683, column 31)\"") + (Literal "\" (in 'mother.stan', line 684, column 2 to column 67)\"") + (Literal + "\" (in 'mother.stan', line 685, column 2 to line 686, column 37)\"") + (Literal "\" (in 'mother.stan', line 688, column 2 to column 29)\"") + (Literal "\" (in 'mother.stan', line 689, column 2 to column 29)\"") + (Literal "\" (in 'mother.stan', line 733, column 2 to column 32)\"") + (Literal "\" (in 'mother.stan', line 734, column 2 to column 27)\"") + (Literal "\" (in 'mother.stan', line 735, column 2 to column 39)\"") + (Literal "\" (in 'mother.stan', line 736, column 2 to column 45)\"") + (Literal "\" (in 'mother.stan', line 737, column 2 to column 28)\"") + (Literal "\" (in 'mother.stan', line 738, column 2 to column 31)\"") + (Literal "\" (in 'mother.stan', line 739, column 2 to column 37)\"") + (Literal "\" (in 'mother.stan', line 740, column 2 to column 27)\"") + (Literal "\" (in 'mother.stan', line 741, column 2 to column 39)\"") + (Literal "\" (in 'mother.stan', line 742, column 2 to column 45)\"") + (Literal "\" (in 'mother.stan', line 743, column 2 to column 55)\"") + (Literal "\" (in 'mother.stan', line 744, column 2 to column 24)\"") + (Literal "\" (in 'mother.stan', line 745, column 2 to column 36)\"") + (Literal "\" (in 'mother.stan', line 746, column 2 to column 42)\"") + (Literal "\" (in 'mother.stan', line 747, column 2 to column 40)\"") + (Literal "\" (in 'mother.stan', line 748, column 2 to column 37)\"") + (Literal "\" (in 'mother.stan', line 749, column 2 to column 49)\"") + (Literal "\" (in 'mother.stan', line 750, column 2 to column 35)\"") + (Literal "\" (in 'mother.stan', line 751, column 2 to column 37)\"") + (Literal "\" (in 'mother.stan', line 752, column 2 to column 33)\"") + (Literal "\" (in 'mother.stan', line 753, column 2 to column 33)\"") + (Literal "\" (in 'mother.stan', line 754, column 2 to column 33)\"") + (Literal "\" (in 'mother.stan', line 755, column 2 to column 34)\"") + (Literal "\" (in 'mother.stan', line 756, column 2 to column 34)\"") + (Literal "\" (in 'mother.stan', line 757, column 2 to column 34)\"") + (Literal "\" (in 'mother.stan', line 758, column 2 to column 34)\"") + (Literal "\" (in 'mother.stan', line 759, column 2 to column 30)\"") + (Literal "\" (in 'mother.stan', line 761, column 2 to column 39)\"") + (Literal "\" (in 'mother.stan', line 762, column 2 to column 31)\"") + (Literal "\" (in 'mother.stan', line 763, column 2 to column 23)\"") + (Literal "\" (in 'mother.stan', line 764, column 2 to column 23)\"") + (Literal "\" (in 'mother.stan', line 765, column 2 to column 25)\"") (Literal "\" (in 'mother.stan', line 766, column 2 to column 31)\"") - (Literal "\" (in 'mother.stan', line 767, column 2 to column 23)\"") - (Literal "\" (in 'mother.stan', line 768, column 2 to column 23)\"") - (Literal "\" (in 'mother.stan', line 769, column 2 to column 25)\"") + (Literal "\" (in 'mother.stan', line 767, column 2 to column 31)\"") + (Literal "\" (in 'mother.stan', line 769, column 2 to column 38)\"") (Literal "\" (in 'mother.stan', line 770, column 2 to column 31)\"") (Literal "\" (in 'mother.stan', line 771, column 2 to column 31)\"") - (Literal "\" (in 'mother.stan', line 773, column 2 to column 38)\"") - (Literal "\" (in 'mother.stan', line 774, column 2 to column 31)\"") - (Literal "\" (in 'mother.stan', line 775, column 2 to column 31)\"") - (Literal "\" (in 'mother.stan', line 777, column 2 to column 27)\"") - (Literal "\" (in 'mother.stan', line 778, column 2 to column 27)\"") - (Literal "\" (in 'mother.stan', line 779, column 2 to column 33)\"") + (Literal "\" (in 'mother.stan', line 773, column 2 to column 27)\"") + (Literal "\" (in 'mother.stan', line 774, column 2 to column 27)\"") + (Literal "\" (in 'mother.stan', line 775, column 2 to column 33)\"") (Literal - "\" (in 'mother.stan', line 785, column 10 to column 38)\"") + "\" (in 'mother.stan', line 781, column 10 to column 38)\"") (Literal - "\" (in 'mother.stan', line 784, column 25 to line 786, column 9)\"") + "\" (in 'mother.stan', line 780, column 25 to line 782, column 9)\"") (Literal - "\" (in 'mother.stan', line 784, column 8 to line 786, column 9)\"") + "\" (in 'mother.stan', line 780, column 8 to line 782, column 9)\"") (Literal - "\" (in 'mother.stan', line 783, column 23 to line 787, column 7)\"") + "\" (in 'mother.stan', line 779, column 23 to line 783, column 7)\"") (Literal - "\" (in 'mother.stan', line 783, column 6 to line 787, column 7)\"") + "\" (in 'mother.stan', line 779, column 6 to line 783, column 7)\"") (Literal - "\" (in 'mother.stan', line 782, column 21 to line 788, column 5)\"") + "\" (in 'mother.stan', line 778, column 21 to line 784, column 5)\"") (Literal - "\" (in 'mother.stan', line 782, column 4 to line 788, column 5)\"") + "\" (in 'mother.stan', line 778, column 4 to line 784, column 5)\"") (Literal - "\" (in 'mother.stan', line 781, column 19 to line 789, column 3)\"") + "\" (in 'mother.stan', line 777, column 19 to line 785, column 3)\"") (Literal - "\" (in 'mother.stan', line 781, column 2 to line 789, column 3)\"") - (Literal "\" (in 'mother.stan', line 792, column 4 to column 32)\"") + "\" (in 'mother.stan', line 777, column 2 to line 785, column 3)\"") + (Literal "\" (in 'mother.stan', line 788, column 4 to column 32)\"") (Literal - "\" (in 'mother.stan', line 791, column 2 to line 792, column 32)\"") - (Literal "\" (in 'mother.stan', line 798, column 8 to column 49)\"") + "\" (in 'mother.stan', line 787, column 2 to line 788, column 32)\"") + (Literal "\" (in 'mother.stan', line 794, column 8 to column 49)\"") (Literal - "\" (in 'mother.stan', line 797, column 6 to line 798, column 49)\"") + "\" (in 'mother.stan', line 793, column 6 to line 794, column 49)\"") (Literal - "\" (in 'mother.stan', line 796, column 4 to line 798, column 49)\"") + "\" (in 'mother.stan', line 792, column 4 to line 794, column 49)\"") (Literal - "\" (in 'mother.stan', line 795, column 2 to line 798, column 49)\"") - (Literal "\" (in 'mother.stan', line 803, column 6 to column 60)\"") + "\" (in 'mother.stan', line 791, column 2 to line 794, column 49)\"") + (Literal "\" (in 'mother.stan', line 799, column 6 to column 60)\"") (Literal - "\" (in 'mother.stan', line 802, column 4 to line 803, column 60)\"") + "\" (in 'mother.stan', line 798, column 4 to line 799, column 60)\"") (Literal - "\" (in 'mother.stan', line 801, column 2 to line 803, column 60)\"") - (Literal "\" (in 'mother.stan', line 805, column 2 to column 45)\"") - (Literal "\" (in 'mother.stan', line 807, column 4 to column 37)\"") + "\" (in 'mother.stan', line 797, column 2 to line 799, column 60)\"") + (Literal "\" (in 'mother.stan', line 801, column 2 to column 45)\"") + (Literal "\" (in 'mother.stan', line 803, column 4 to column 37)\"") (Literal - "\" (in 'mother.stan', line 806, column 2 to line 807, column 37)\"") - (Literal "\" (in 'mother.stan', line 812, column 6 to column 51)\"") + "\" (in 'mother.stan', line 802, column 2 to line 803, column 37)\"") + (Literal "\" (in 'mother.stan', line 808, column 6 to column 51)\"") (Literal - "\" (in 'mother.stan', line 811, column 4 to line 812, column 51)\"") + "\" (in 'mother.stan', line 807, column 4 to line 808, column 51)\"") (Literal - "\" (in 'mother.stan', line 810, column 2 to line 812, column 51)\"") - (Literal "\" (in 'mother.stan', line 813, column 2 to column 41)\"") - (Literal "\" (in 'mother.stan', line 816, column 4 to column 37)\"") + "\" (in 'mother.stan', line 806, column 2 to line 808, column 51)\"") + (Literal "\" (in 'mother.stan', line 809, column 2 to column 41)\"") + (Literal "\" (in 'mother.stan', line 812, column 4 to column 37)\"") (Literal - "\" (in 'mother.stan', line 815, column 2 to line 816, column 37)\"") - (Literal "\" (in 'mother.stan', line 822, column 8 to column 68)\"") + "\" (in 'mother.stan', line 811, column 2 to line 812, column 37)\"") + (Literal "\" (in 'mother.stan', line 818, column 8 to column 68)\"") (Literal - "\" (in 'mother.stan', line 821, column 6 to line 822, column 68)\"") + "\" (in 'mother.stan', line 817, column 6 to line 818, column 68)\"") (Literal - "\" (in 'mother.stan', line 820, column 4 to line 822, column 68)\"") + "\" (in 'mother.stan', line 816, column 4 to line 818, column 68)\"") (Literal - "\" (in 'mother.stan', line 819, column 2 to line 822, column 68)\"") - (Literal "\" (in 'mother.stan', line 823, column 2 to column 50)\"") - (Literal "\" (in 'mother.stan', line 825, column 4 to column 37)\"") + "\" (in 'mother.stan', line 815, column 2 to line 818, column 68)\"") + (Literal "\" (in 'mother.stan', line 819, column 2 to column 50)\"") + (Literal "\" (in 'mother.stan', line 821, column 4 to column 37)\"") (Literal - "\" (in 'mother.stan', line 824, column 2 to line 825, column 37)\"") - (Literal "\" (in 'mother.stan', line 827, column 2 to column 40)\"") - (Literal "\" (in 'mother.stan', line 828, column 2 to column 42)\"") - (Literal "\" (in 'mother.stan', line 696, column 2 to column 16)\"") - (Literal "\" (in 'mother.stan', line 697, column 2 to column 26)\"") - (Literal "\" (in 'mother.stan', line 698, column 2 to column 29)\"") - (Literal "\" (in 'mother.stan', line 699, column 2 to column 24)\"") - (Literal "\" (in 'mother.stan', line 700, column 2 to column 24)\"") - (Literal "\" (in 'mother.stan', line 701, column 2 to column 35)\"") - (Literal "\" (in 'mother.stan', line 703, column 2 to column 38)\"") - (Literal "\" (in 'mother.stan', line 704, column 2 to column 38)\"") - (Literal "\" (in 'mother.stan', line 706, column 2 to column 41)\"") - (Literal "\" (in 'mother.stan', line 708, column 4 to column 42)\"") - (Literal "\" (in 'mother.stan', line 709, column 4 to column 46)\"") - (Literal "\" (in 'mother.stan', line 710, column 4 to column 46)\"") - (Literal "\" (in 'mother.stan', line 713, column 8 to column 68)\"") - (Literal "\" (in 'mother.stan', line 714, column 8 to column 76)\"") - (Literal "\" (in 'mother.stan', line 715, column 8 to column 76)\"") - (Literal "\" (in 'mother.stan', line 716, column 8 to column 65)\"") + "\" (in 'mother.stan', line 820, column 2 to line 821, column 37)\"") + (Literal "\" (in 'mother.stan', line 823, column 2 to column 40)\"") + (Literal "\" (in 'mother.stan', line 824, column 2 to column 42)\"") + (Literal "\" (in 'mother.stan', line 692, column 2 to column 16)\"") + (Literal "\" (in 'mother.stan', line 693, column 2 to column 26)\"") + (Literal "\" (in 'mother.stan', line 694, column 2 to column 29)\"") + (Literal "\" (in 'mother.stan', line 695, column 2 to column 24)\"") + (Literal "\" (in 'mother.stan', line 696, column 2 to column 24)\"") + (Literal "\" (in 'mother.stan', line 697, column 2 to column 35)\"") + (Literal "\" (in 'mother.stan', line 699, column 2 to column 38)\"") + (Literal "\" (in 'mother.stan', line 700, column 2 to column 38)\"") + (Literal "\" (in 'mother.stan', line 702, column 2 to column 41)\"") + (Literal "\" (in 'mother.stan', line 704, column 4 to column 42)\"") + (Literal "\" (in 'mother.stan', line 705, column 4 to column 46)\"") + (Literal "\" (in 'mother.stan', line 706, column 4 to column 46)\"") + (Literal "\" (in 'mother.stan', line 709, column 8 to column 68)\"") + (Literal "\" (in 'mother.stan', line 710, column 8 to column 76)\"") + (Literal "\" (in 'mother.stan', line 711, column 8 to column 76)\"") + (Literal "\" (in 'mother.stan', line 712, column 8 to column 65)\"") (Literal - "\" (in 'mother.stan', line 712, column 23 to line 717, column 7)\"") + "\" (in 'mother.stan', line 708, column 23 to line 713, column 7)\"") (Literal - "\" (in 'mother.stan', line 712, column 6 to line 717, column 7)\"") + "\" (in 'mother.stan', line 708, column 6 to line 713, column 7)\"") (Literal - "\" (in 'mother.stan', line 711, column 21 to line 718, column 5)\"") + "\" (in 'mother.stan', line 707, column 21 to line 714, column 5)\"") (Literal - "\" (in 'mother.stan', line 711, column 4 to line 718, column 5)\"") + "\" (in 'mother.stan', line 707, column 4 to line 714, column 5)\"") (Literal - "\" (in 'mother.stan', line 707, column 19 to line 719, column 3)\"") + "\" (in 'mother.stan', line 703, column 19 to line 715, column 3)\"") (Literal - "\" (in 'mother.stan', line 707, column 2 to line 719, column 3)\"") - (Literal "\" (in 'mother.stan', line 722, column 6 to column 47)\"") + "\" (in 'mother.stan', line 703, column 2 to line 715, column 3)\"") + (Literal "\" (in 'mother.stan', line 718, column 6 to column 47)\"") (Literal - "\" (in 'mother.stan', line 721, column 21 to line 723, column 5)\"") + "\" (in 'mother.stan', line 717, column 21 to line 719, column 5)\"") (Literal - "\" (in 'mother.stan', line 721, column 4 to line 723, column 5)\"") + "\" (in 'mother.stan', line 717, column 4 to line 719, column 5)\"") (Literal - "\" (in 'mother.stan', line 720, column 19 to line 724, column 3)\"") + "\" (in 'mother.stan', line 716, column 19 to line 720, column 3)\"") (Literal - "\" (in 'mother.stan', line 720, column 2 to line 724, column 3)\"") - (Literal "\" (in 'mother.stan', line 726, column 4 to column 47)\"") + "\" (in 'mother.stan', line 716, column 2 to line 720, column 3)\"") + (Literal "\" (in 'mother.stan', line 722, column 4 to column 47)\"") (Literal - "\" (in 'mother.stan', line 725, column 19 to line 727, column 3)\"") + "\" (in 'mother.stan', line 721, column 19 to line 723, column 3)\"") (Literal - "\" (in 'mother.stan', line 725, column 2 to line 727, column 3)\"") - (Literal "\" (in 'mother.stan', line 728, column 2 to column 38)\"") - (Literal "\" (in 'mother.stan', line 729, column 2 to column 38)\"") - (Literal "\" (in 'mother.stan', line 730, column 2 to column 38)\"") - (Literal "\" (in 'mother.stan', line 731, column 2 to column 39)\"") - (Literal "\" (in 'mother.stan', line 732, column 2 to column 39)\"") - (Literal "\" (in 'mother.stan', line 734, column 2 to column 53)\"") - (Literal "\" (in 'mother.stan', line 352, column 2 to column 17)\"") - (Literal "\" (in 'mother.stan', line 353, column 2 to column 17)\"") - (Literal "\" (in 'mother.stan', line 354, column 2 to column 30)\"") + "\" (in 'mother.stan', line 721, column 2 to line 723, column 3)\"") + (Literal "\" (in 'mother.stan', line 724, column 2 to column 38)\"") + (Literal "\" (in 'mother.stan', line 725, column 2 to column 38)\"") + (Literal "\" (in 'mother.stan', line 726, column 2 to column 38)\"") + (Literal "\" (in 'mother.stan', line 727, column 2 to column 39)\"") + (Literal "\" (in 'mother.stan', line 728, column 2 to column 39)\"") + (Literal "\" (in 'mother.stan', line 730, column 2 to column 53)\"") + (Literal "\" (in 'mother.stan', line 348, column 2 to column 17)\"") + (Literal "\" (in 'mother.stan', line 349, column 2 to column 17)\"") + (Literal "\" (in 'mother.stan', line 350, column 2 to column 30)\"") + (Literal "\" (in 'mother.stan', line 351, column 8 to column 9)\"") + (Literal "\" (in 'mother.stan', line 351, column 2 to column 36)\"") + (Literal "\" (in 'mother.stan', line 352, column 8 to column 9)\"") + (Literal + "\" (in 'mother.stan', line 352, column 11 to column 12)\"") + (Literal + "\" (in 'mother.stan', line 352, column 14 to column 15)\"") + (Literal "\" (in 'mother.stan', line 352, column 2 to column 42)\"") + (Literal "\" (in 'mother.stan', line 353, column 2 to column 32)\"") + (Literal "\" (in 'mother.stan', line 354, column 8 to column 9)\"") + (Literal "\" (in 'mother.stan', line 354, column 2 to column 29)\"") (Literal "\" (in 'mother.stan', line 355, column 8 to column 9)\"") - (Literal "\" (in 'mother.stan', line 355, column 2 to column 36)\"") - (Literal "\" (in 'mother.stan', line 356, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 356, column 11 to column 12)\"") + "\" (in 'mother.stan', line 355, column 11 to column 12)\"") (Literal - "\" (in 'mother.stan', line 356, column 14 to column 15)\"") - (Literal "\" (in 'mother.stan', line 356, column 2 to column 42)\"") - (Literal "\" (in 'mother.stan', line 357, column 2 to column 32)\"") + "\" (in 'mother.stan', line 355, column 14 to column 15)\"") + (Literal "\" (in 'mother.stan', line 355, column 2 to column 35)\"") + (Literal "\" (in 'mother.stan', line 356, column 9 to column 10)\"") + (Literal "\" (in 'mother.stan', line 356, column 2 to column 18)\"") + (Literal "\" (in 'mother.stan', line 357, column 8 to column 9)\"") + (Literal + "\" (in 'mother.stan', line 357, column 18 to column 19)\"") + (Literal "\" (in 'mother.stan', line 357, column 2 to column 30)\"") (Literal "\" (in 'mother.stan', line 358, column 8 to column 9)\"") - (Literal "\" (in 'mother.stan', line 358, column 2 to column 29)\"") - (Literal "\" (in 'mother.stan', line 359, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 359, column 11 to column 12)\"") + "\" (in 'mother.stan', line 358, column 11 to column 12)\"") (Literal - "\" (in 'mother.stan', line 359, column 14 to column 15)\"") - (Literal "\" (in 'mother.stan', line 359, column 2 to column 35)\"") - (Literal "\" (in 'mother.stan', line 360, column 9 to column 10)\"") - (Literal "\" (in 'mother.stan', line 360, column 2 to column 18)\"") - (Literal "\" (in 'mother.stan', line 361, column 8 to column 9)\"") + "\" (in 'mother.stan', line 358, column 14 to column 15)\"") (Literal - "\" (in 'mother.stan', line 361, column 18 to column 19)\"") - (Literal "\" (in 'mother.stan', line 361, column 2 to column 30)\"") - (Literal "\" (in 'mother.stan', line 362, column 8 to column 9)\"") + "\" (in 'mother.stan', line 358, column 24 to column 25)\"") + (Literal "\" (in 'mother.stan', line 358, column 2 to column 36)\"") + (Literal + "\" (in 'mother.stan', line 359, column 13 to column 14)\"") + (Literal "\" (in 'mother.stan', line 359, column 2 to column 26)\"") + (Literal "\" (in 'mother.stan', line 360, column 8 to column 9)\"") + (Literal + "\" (in 'mother.stan', line 360, column 22 to column 23)\"") + (Literal "\" (in 'mother.stan', line 360, column 2 to column 38)\"") + (Literal "\" (in 'mother.stan', line 361, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 362, column 11 to column 12)\"") + "\" (in 'mother.stan', line 361, column 11 to column 12)\"") (Literal - "\" (in 'mother.stan', line 362, column 14 to column 15)\"") + "\" (in 'mother.stan', line 361, column 14 to column 15)\"") (Literal - "\" (in 'mother.stan', line 362, column 24 to column 25)\"") - (Literal "\" (in 'mother.stan', line 362, column 2 to column 36)\"") + "\" (in 'mother.stan', line 361, column 28 to column 29)\"") + (Literal "\" (in 'mother.stan', line 361, column 2 to column 44)\"") + (Literal "\" (in 'mother.stan', line 362, column 2 to column 54)\"") (Literal - "\" (in 'mother.stan', line 363, column 13 to column 14)\"") - (Literal "\" (in 'mother.stan', line 363, column 2 to column 26)\"") + "\" (in 'mother.stan', line 363, column 10 to column 11)\"") + (Literal "\" (in 'mother.stan', line 363, column 2 to column 23)\"") (Literal "\" (in 'mother.stan', line 364, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 364, column 22 to column 23)\"") - (Literal "\" (in 'mother.stan', line 364, column 2 to column 38)\"") + "\" (in 'mother.stan', line 364, column 19 to column 20)\"") + (Literal "\" (in 'mother.stan', line 364, column 2 to column 35)\"") (Literal "\" (in 'mother.stan', line 365, column 8 to column 9)\"") (Literal "\" (in 'mother.stan', line 365, column 11 to column 12)\"") (Literal "\" (in 'mother.stan', line 365, column 14 to column 15)\"") (Literal - "\" (in 'mother.stan', line 365, column 28 to column 29)\"") - (Literal "\" (in 'mother.stan', line 365, column 2 to column 44)\"") - (Literal "\" (in 'mother.stan', line 366, column 2 to column 54)\"") - (Literal - "\" (in 'mother.stan', line 367, column 10 to column 11)\"") - (Literal "\" (in 'mother.stan', line 367, column 2 to column 23)\"") + "\" (in 'mother.stan', line 365, column 25 to column 26)\"") + (Literal "\" (in 'mother.stan', line 365, column 2 to column 41)\"") + (Literal "\" (in 'mother.stan', line 366, column 2 to column 39)\"") + (Literal "\" (in 'mother.stan', line 367, column 2 to column 36)\"") (Literal "\" (in 'mother.stan', line 368, column 8 to column 9)\"") - (Literal - "\" (in 'mother.stan', line 368, column 19 to column 20)\"") - (Literal "\" (in 'mother.stan', line 368, column 2 to column 35)\"") - (Literal "\" (in 'mother.stan', line 369, column 8 to column 9)\"") - (Literal - "\" (in 'mother.stan', line 369, column 11 to column 12)\"") - (Literal - "\" (in 'mother.stan', line 369, column 14 to column 15)\"") - (Literal - "\" (in 'mother.stan', line 369, column 25 to column 26)\"") - (Literal "\" (in 'mother.stan', line 369, column 2 to column 41)\"") - (Literal "\" (in 'mother.stan', line 370, column 2 to column 39)\"") - (Literal "\" (in 'mother.stan', line 371, column 2 to column 36)\"") - (Literal "\" (in 'mother.stan', line 372, column 8 to column 9)\"") - (Literal "\" (in 'mother.stan', line 372, column 2 to column 48)\"") - (Literal "\" (in 'mother.stan', line 373, column 2 to column 12)\"") + (Literal "\" (in 'mother.stan', line 368, column 2 to column 48)\"") + (Literal "\" (in 'mother.stan', line 369, column 2 to column 12)\"") + (Literal "\" (in 'mother.stan', line 370, column 8 to column 13)\"") + (Literal "\" (in 'mother.stan', line 370, column 2 to column 31)\"") + (Literal "\" (in 'mother.stan', line 371, column 8 to column 13)\"") + (Literal "\" (in 'mother.stan', line 371, column 2 to column 37)\"") + (Literal "\" (in 'mother.stan', line 372, column 8 to column 13)\"") + (Literal "\" (in 'mother.stan', line 372, column 2 to column 40)\"") + (Literal "\" (in 'mother.stan', line 373, column 2 to column 14)\"") (Literal "\" (in 'mother.stan', line 374, column 8 to column 13)\"") - (Literal "\" (in 'mother.stan', line 374, column 2 to column 31)\"") + (Literal "\" (in 'mother.stan', line 374, column 2 to column 33)\"") (Literal "\" (in 'mother.stan', line 375, column 8 to column 13)\"") - (Literal "\" (in 'mother.stan', line 375, column 2 to column 37)\"") + (Literal "\" (in 'mother.stan', line 375, column 2 to column 39)\"") (Literal "\" (in 'mother.stan', line 376, column 8 to column 13)\"") - (Literal "\" (in 'mother.stan', line 376, column 2 to column 40)\"") - (Literal "\" (in 'mother.stan', line 377, column 2 to column 14)\"") + (Literal "\" (in 'mother.stan', line 376, column 2 to column 42)\"") + (Literal "\" (in 'mother.stan', line 377, column 9 to column 14)\"") + (Literal + "\" (in 'mother.stan', line 377, column 16 to column 21)\"") + (Literal "\" (in 'mother.stan', line 377, column 2 to column 32)\"") (Literal "\" (in 'mother.stan', line 378, column 8 to column 13)\"") - (Literal "\" (in 'mother.stan', line 378, column 2 to column 33)\"") + (Literal + "\" (in 'mother.stan', line 378, column 22 to column 27)\"") + (Literal + "\" (in 'mother.stan', line 378, column 29 to column 34)\"") + (Literal "\" (in 'mother.stan', line 378, column 2 to column 51)\"") (Literal "\" (in 'mother.stan', line 379, column 8 to column 13)\"") - (Literal "\" (in 'mother.stan', line 379, column 2 to column 39)\"") + (Literal + "\" (in 'mother.stan', line 379, column 25 to column 30)\"") + (Literal + "\" (in 'mother.stan', line 379, column 32 to column 37)\"") + (Literal "\" (in 'mother.stan', line 379, column 2 to column 57)\"") (Literal "\" (in 'mother.stan', line 380, column 8 to column 13)\"") - (Literal "\" (in 'mother.stan', line 380, column 2 to column 42)\"") - (Literal "\" (in 'mother.stan', line 381, column 9 to column 14)\"") (Literal - "\" (in 'mother.stan', line 381, column 16 to column 21)\"") - (Literal "\" (in 'mother.stan', line 381, column 2 to column 32)\"") + "\" (in 'mother.stan', line 380, column 28 to column 33)\"") + (Literal + "\" (in 'mother.stan', line 380, column 35 to column 40)\"") + (Literal "\" (in 'mother.stan', line 380, column 2 to column 60)\"") + (Literal "\" (in 'mother.stan', line 381, column 9 to column 14)\"") + (Literal "\" (in 'mother.stan', line 381, column 2 to column 25)\"") (Literal "\" (in 'mother.stan', line 382, column 8 to column 13)\"") (Literal "\" (in 'mother.stan', line 382, column 22 to column 27)\"") - (Literal - "\" (in 'mother.stan', line 382, column 29 to column 34)\"") - (Literal "\" (in 'mother.stan', line 382, column 2 to column 51)\"") + (Literal "\" (in 'mother.stan', line 382, column 2 to column 44)\"") (Literal "\" (in 'mother.stan', line 383, column 8 to column 13)\"") (Literal "\" (in 'mother.stan', line 383, column 25 to column 30)\"") - (Literal - "\" (in 'mother.stan', line 383, column 32 to column 37)\"") - (Literal "\" (in 'mother.stan', line 383, column 2 to column 57)\"") + (Literal "\" (in 'mother.stan', line 383, column 2 to column 50)\"") (Literal "\" (in 'mother.stan', line 384, column 8 to column 13)\"") (Literal "\" (in 'mother.stan', line 384, column 28 to column 33)\"") + (Literal "\" (in 'mother.stan', line 384, column 2 to column 53)\"") (Literal - "\" (in 'mother.stan', line 384, column 35 to column 40)\"") - (Literal "\" (in 'mother.stan', line 384, column 2 to column 60)\"") - (Literal "\" (in 'mother.stan', line 385, column 9 to column 14)\"") - (Literal "\" (in 'mother.stan', line 385, column 2 to column 25)\"") + "\" (in 'mother.stan', line 385, column 13 to column 18)\"") + (Literal "\" (in 'mother.stan', line 385, column 2 to column 33)\"") (Literal "\" (in 'mother.stan', line 386, column 8 to column 13)\"") (Literal - "\" (in 'mother.stan', line 386, column 22 to column 27)\"") - (Literal "\" (in 'mother.stan', line 386, column 2 to column 44)\"") + "\" (in 'mother.stan', line 386, column 26 to column 31)\"") + (Literal "\" (in 'mother.stan', line 386, column 2 to column 52)\"") (Literal "\" (in 'mother.stan', line 387, column 8 to column 13)\"") (Literal - "\" (in 'mother.stan', line 387, column 25 to column 30)\"") - (Literal "\" (in 'mother.stan', line 387, column 2 to column 50)\"") + "\" (in 'mother.stan', line 387, column 29 to column 34)\"") + (Literal "\" (in 'mother.stan', line 387, column 2 to column 58)\"") (Literal "\" (in 'mother.stan', line 388, column 8 to column 13)\"") (Literal - "\" (in 'mother.stan', line 388, column 28 to column 33)\"") - (Literal "\" (in 'mother.stan', line 388, column 2 to column 53)\"") + "\" (in 'mother.stan', line 388, column 32 to column 37)\"") + (Literal "\" (in 'mother.stan', line 388, column 2 to column 61)\"") + (Literal "\" (in 'mother.stan', line 391, column 2 to column 13)\"") + (Literal "\" (in 'mother.stan', line 392, column 8 to column 9)\"") + (Literal "\" (in 'mother.stan', line 392, column 2 to column 21)\"") + (Literal "\" (in 'mother.stan', line 393, column 8 to column 9)\"") + (Literal "\" (in 'mother.stan', line 393, column 2 to column 40)\"") + (Literal "\" (in 'mother.stan', line 394, column 2 to column 15)\"") + (Literal "\" (in 'mother.stan', line 395, column 2 to column 20)\"") + (Literal "\" (in 'mother.stan', line 396, column 2 to column 29)\"") + (Literal "\" (in 'mother.stan', line 397, column 2 to column 55)\"") (Literal - "\" (in 'mother.stan', line 389, column 13 to column 18)\"") - (Literal "\" (in 'mother.stan', line 389, column 2 to column 33)\"") - (Literal "\" (in 'mother.stan', line 390, column 8 to column 13)\"") + "\" (in 'mother.stan', line 398, column 10 to column 11)\"") + (Literal "\" (in 'mother.stan', line 398, column 2 to column 24)\"") + (Literal "\" (in 'mother.stan', line 399, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 390, column 26 to column 31)\"") - (Literal "\" (in 'mother.stan', line 390, column 2 to column 52)\"") - (Literal "\" (in 'mother.stan', line 391, column 8 to column 13)\"") + "\" (in 'mother.stan', line 399, column 19 to column 20)\"") + (Literal "\" (in 'mother.stan', line 399, column 2 to column 36)\"") + (Literal "\" (in 'mother.stan', line 400, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 391, column 29 to column 34)\"") - (Literal "\" (in 'mother.stan', line 391, column 2 to column 58)\"") - (Literal "\" (in 'mother.stan', line 392, column 8 to column 13)\"") + "\" (in 'mother.stan', line 400, column 11 to column 12)\"") (Literal - "\" (in 'mother.stan', line 392, column 32 to column 37)\"") - (Literal "\" (in 'mother.stan', line 392, column 2 to column 61)\"") - (Literal "\" (in 'mother.stan', line 395, column 2 to column 13)\"") - (Literal "\" (in 'mother.stan', line 396, column 8 to column 9)\"") - (Literal "\" (in 'mother.stan', line 396, column 2 to column 21)\"") - (Literal "\" (in 'mother.stan', line 397, column 8 to column 9)\"") - (Literal "\" (in 'mother.stan', line 397, column 2 to column 40)\"") - (Literal "\" (in 'mother.stan', line 398, column 2 to column 15)\"") - (Literal "\" (in 'mother.stan', line 399, column 2 to column 20)\"") - (Literal "\" (in 'mother.stan', line 400, column 2 to column 29)\"") - (Literal "\" (in 'mother.stan', line 401, column 2 to column 55)\"") + "\" (in 'mother.stan', line 400, column 14 to column 15)\"") (Literal - "\" (in 'mother.stan', line 402, column 10 to column 11)\"") - (Literal "\" (in 'mother.stan', line 402, column 2 to column 24)\"") - (Literal "\" (in 'mother.stan', line 403, column 8 to column 9)\"") + "\" (in 'mother.stan', line 400, column 25 to column 26)\"") + (Literal "\" (in 'mother.stan', line 400, column 2 to column 42)\"") + (Literal "\" (in 'mother.stan', line 401, column 2 to column 40)\"") + (Literal "\" (in 'mother.stan', line 402, column 2 to column 37)\"") + (Literal "\" (in 'mother.stan', line 403, column 2 to column 14)\"") + (Literal "\" (in 'mother.stan', line 404, column 2 to column 14)\"") + (Literal "\" (in 'mother.stan', line 405, column 2 to column 20)\"") + (Literal "\" (in 'mother.stan', line 406, column 2 to column 23)\"") + (Literal "\" (in 'mother.stan', line 407, column 2 to column 23)\"") + (Literal "\" (in 'mother.stan', line 408, column 2 to column 22)\"") + (Literal "\" (in 'mother.stan', line 409, column 2 to column 18)\"") + (Literal "\" (in 'mother.stan', line 410, column 2 to column 18)\"") (Literal - "\" (in 'mother.stan', line 403, column 19 to column 20)\"") - (Literal "\" (in 'mother.stan', line 403, column 2 to column 36)\"") - (Literal "\" (in 'mother.stan', line 404, column 8 to column 9)\"") + "\" (in 'mother.stan', line 415, column 10 to column 38)\"") (Literal - "\" (in 'mother.stan', line 404, column 11 to column 12)\"") + "\" (in 'mother.stan', line 414, column 25 to line 416, column 9)\"") (Literal - "\" (in 'mother.stan', line 404, column 14 to column 15)\"") + "\" (in 'mother.stan', line 414, column 8 to line 416, column 9)\"") (Literal - "\" (in 'mother.stan', line 404, column 25 to column 26)\"") - (Literal "\" (in 'mother.stan', line 404, column 2 to column 42)\"") - (Literal "\" (in 'mother.stan', line 405, column 2 to column 40)\"") - (Literal "\" (in 'mother.stan', line 406, column 2 to column 37)\"") - (Literal "\" (in 'mother.stan', line 407, column 2 to column 14)\"") - (Literal "\" (in 'mother.stan', line 408, column 2 to column 14)\"") - (Literal "\" (in 'mother.stan', line 409, column 2 to column 20)\"") - (Literal "\" (in 'mother.stan', line 410, column 2 to column 23)\"") - (Literal "\" (in 'mother.stan', line 411, column 2 to column 23)\"") - (Literal "\" (in 'mother.stan', line 412, column 2 to column 22)\"") - (Literal "\" (in 'mother.stan', line 413, column 2 to column 18)\"") - (Literal "\" (in 'mother.stan', line 414, column 2 to column 18)\"") + "\" (in 'mother.stan', line 413, column 23 to line 417, column 7)\"") (Literal - "\" (in 'mother.stan', line 419, column 10 to column 38)\"") + "\" (in 'mother.stan', line 413, column 6 to line 417, column 7)\"") (Literal - "\" (in 'mother.stan', line 418, column 25 to line 420, column 9)\"") + "\" (in 'mother.stan', line 412, column 21 to line 418, column 5)\"") (Literal - "\" (in 'mother.stan', line 418, column 8 to line 420, column 9)\"") + "\" (in 'mother.stan', line 412, column 4 to line 418, column 5)\"") (Literal - "\" (in 'mother.stan', line 417, column 23 to line 421, column 7)\"") + "\" (in 'mother.stan', line 411, column 19 to line 419, column 3)\"") (Literal - "\" (in 'mother.stan', line 417, column 6 to line 421, column 7)\"") + "\" (in 'mother.stan', line 411, column 2 to line 419, column 3)\"") + (Literal "\" (in 'mother.stan', line 421, column 4 to column 28)\"") + (Literal "\" (in 'mother.stan', line 423, column 6 to column 36)\"") (Literal - "\" (in 'mother.stan', line 416, column 21 to line 422, column 5)\"") + "\" (in 'mother.stan', line 426, column 10 to column 46)\"") (Literal - "\" (in 'mother.stan', line 416, column 4 to line 422, column 5)\"") + "\" (in 'mother.stan', line 425, column 25 to line 427, column 9)\"") (Literal - "\" (in 'mother.stan', line 415, column 19 to line 423, column 3)\"") + "\" (in 'mother.stan', line 425, column 8 to line 427, column 9)\"") (Literal - "\" (in 'mother.stan', line 415, column 2 to line 423, column 3)\"") - (Literal "\" (in 'mother.stan', line 425, column 4 to column 28)\"") - (Literal "\" (in 'mother.stan', line 427, column 6 to column 36)\"") + "\" (in 'mother.stan', line 424, column 23 to line 428, column 7)\"") (Literal - "\" (in 'mother.stan', line 430, column 10 to column 46)\"") + "\" (in 'mother.stan', line 424, column 6 to line 428, column 7)\"") (Literal - "\" (in 'mother.stan', line 429, column 25 to line 431, column 9)\"") + "\" (in 'mother.stan', line 422, column 21 to line 429, column 5)\"") (Literal - "\" (in 'mother.stan', line 429, column 8 to line 431, column 9)\"") + "\" (in 'mother.stan', line 422, column 4 to line 429, column 5)\"") (Literal - "\" (in 'mother.stan', line 428, column 23 to line 432, column 7)\"") + "\" (in 'mother.stan', line 420, column 19 to line 430, column 3)\"") (Literal - "\" (in 'mother.stan', line 428, column 6 to line 432, column 7)\"") + "\" (in 'mother.stan', line 420, column 2 to line 430, column 3)\"") + (Literal "\" (in 'mother.stan', line 433, column 6 to column 42)\"") + (Literal "\" (in 'mother.stan', line 434, column 6 to column 65)\"") (Literal - "\" (in 'mother.stan', line 426, column 21 to line 433, column 5)\"") + "\" (in 'mother.stan', line 432, column 21 to line 435, column 5)\"") (Literal - "\" (in 'mother.stan', line 426, column 4 to line 433, column 5)\"") + "\" (in 'mother.stan', line 432, column 4 to line 435, column 5)\"") (Literal - "\" (in 'mother.stan', line 424, column 19 to line 434, column 3)\"") + "\" (in 'mother.stan', line 431, column 19 to line 436, column 3)\"") (Literal - "\" (in 'mother.stan', line 424, column 2 to line 434, column 3)\"") - (Literal "\" (in 'mother.stan', line 437, column 6 to column 42)\"") - (Literal "\" (in 'mother.stan', line 438, column 6 to column 65)\"") + "\" (in 'mother.stan', line 431, column 2 to line 436, column 3)\"") + (Literal "\" (in 'mother.stan', line 437, column 2 to column 62)\"") + (Literal "\" (in 'mother.stan', line 438, column 2 to column 62)\"") + (Literal "\" (in 'mother.stan', line 440, column 4 to column 11)\"") + (Literal "\" (in 'mother.stan', line 441, column 4 to column 35)\"") (Literal - "\" (in 'mother.stan', line 436, column 21 to line 439, column 5)\"") + "\" (in 'mother.stan', line 442, column 4 to line 444, column 5)\"") + (Literal "\" (in 'mother.stan', line 443, column 6 to column 12)\"") + (Literal "\" (in 'mother.stan', line 445, column 4 to column 40)\"") (Literal - "\" (in 'mother.stan', line 436, column 4 to line 439, column 5)\"") - (Literal - "\" (in 'mother.stan', line 435, column 19 to line 440, column 3)\"") - (Literal - "\" (in 'mother.stan', line 435, column 2 to line 440, column 3)\"") - (Literal "\" (in 'mother.stan', line 441, column 2 to column 62)\"") - (Literal "\" (in 'mother.stan', line 442, column 2 to column 62)\"") - (Literal "\" (in 'mother.stan', line 444, column 4 to column 11)\"") - (Literal "\" (in 'mother.stan', line 445, column 4 to column 35)\"") + "\" (in 'mother.stan', line 446, column 14 to column 28)\"") (Literal "\" (in 'mother.stan', line 446, column 4 to line 448, column 5)\"") (Literal "\" (in 'mother.stan', line 447, column 6 to column 12)\"") - (Literal "\" (in 'mother.stan', line 449, column 4 to column 40)\"") - (Literal - "\" (in 'mother.stan', line 450, column 14 to column 28)\"") - (Literal - "\" (in 'mother.stan', line 450, column 4 to line 452, column 5)\"") - (Literal "\" (in 'mother.stan', line 451, column 6 to column 12)\"") - (Literal - "\" (in 'mother.stan', line 443, column 2 to line 453, column 3)\"") - (Literal "\" (in 'mother.stan', line 455, column 2 to column 25)\"") - (Literal "\" (in 'mother.stan', line 456, column 2 to column 37)\"") - (Literal "\" (in 'mother.stan', line 457, column 2 to column 37)\"") - (Literal "\" (in 'mother.stan', line 458, column 2 to column 39)\"") - (Literal "\" (in 'mother.stan', line 460, column 2 to column 30)\"") - (Literal "\" (in 'mother.stan', line 461, column 2 to column 33)\"") - (Literal "\" (in 'mother.stan', line 463, column 2 to column 35)\"") - (Literal "\" (in 'mother.stan', line 465, column 2 to column 29)\"") + (Literal + "\" (in 'mother.stan', line 439, column 2 to line 449, column 3)\"") + (Literal "\" (in 'mother.stan', line 451, column 2 to column 25)\"") + (Literal "\" (in 'mother.stan', line 452, column 2 to column 37)\"") + (Literal "\" (in 'mother.stan', line 453, column 2 to column 37)\"") + (Literal "\" (in 'mother.stan', line 454, column 2 to column 39)\"") + (Literal "\" (in 'mother.stan', line 456, column 2 to column 30)\"") + (Literal "\" (in 'mother.stan', line 457, column 2 to column 33)\"") + (Literal "\" (in 'mother.stan', line 459, column 2 to column 35)\"") + (Literal "\" (in 'mother.stan', line 461, column 2 to column 29)\"") + (Literal "\" (in 'mother.stan', line 462, column 8 to column 13)\"") + (Literal "\" (in 'mother.stan', line 462, column 2 to column 48)\"") + (Literal "\" (in 'mother.stan', line 463, column 8 to column 13)\"") + (Literal "\" (in 'mother.stan', line 463, column 2 to column 54)\"") + (Literal "\" (in 'mother.stan', line 464, column 8 to column 13)\"") + (Literal "\" (in 'mother.stan', line 464, column 2 to column 57)\"") + (Literal "\" (in 'mother.stan', line 465, column 9 to column 14)\"") + (Literal + "\" (in 'mother.stan', line 465, column 16 to column 21)\"") + (Literal "\" (in 'mother.stan', line 465, column 2 to column 47)\"") (Literal "\" (in 'mother.stan', line 466, column 8 to column 13)\"") - (Literal "\" (in 'mother.stan', line 466, column 2 to column 48)\"") + (Literal + "\" (in 'mother.stan', line 466, column 22 to column 27)\"") + (Literal + "\" (in 'mother.stan', line 466, column 29 to column 34)\"") + (Literal "\" (in 'mother.stan', line 466, column 2 to column 66)\"") (Literal "\" (in 'mother.stan', line 467, column 8 to column 13)\"") - (Literal "\" (in 'mother.stan', line 467, column 2 to column 54)\"") + (Literal + "\" (in 'mother.stan', line 467, column 25 to column 30)\"") + (Literal + "\" (in 'mother.stan', line 467, column 32 to column 37)\"") + (Literal "\" (in 'mother.stan', line 467, column 2 to column 72)\"") (Literal "\" (in 'mother.stan', line 468, column 8 to column 13)\"") - (Literal "\" (in 'mother.stan', line 468, column 2 to column 57)\"") - (Literal "\" (in 'mother.stan', line 469, column 9 to column 14)\"") (Literal - "\" (in 'mother.stan', line 469, column 16 to column 21)\"") - (Literal "\" (in 'mother.stan', line 469, column 2 to column 47)\"") + "\" (in 'mother.stan', line 468, column 28 to column 33)\"") + (Literal + "\" (in 'mother.stan', line 468, column 35 to column 40)\"") + (Literal "\" (in 'mother.stan', line 468, column 2 to column 75)\"") + (Literal "\" (in 'mother.stan', line 469, column 9 to column 14)\"") + (Literal "\" (in 'mother.stan', line 469, column 2 to column 40)\"") (Literal "\" (in 'mother.stan', line 470, column 8 to column 13)\"") (Literal "\" (in 'mother.stan', line 470, column 22 to column 27)\"") - (Literal - "\" (in 'mother.stan', line 470, column 29 to column 34)\"") - (Literal "\" (in 'mother.stan', line 470, column 2 to column 66)\"") + (Literal "\" (in 'mother.stan', line 470, column 2 to column 59)\"") (Literal "\" (in 'mother.stan', line 471, column 8 to column 13)\"") (Literal "\" (in 'mother.stan', line 471, column 25 to column 30)\"") - (Literal - "\" (in 'mother.stan', line 471, column 32 to column 37)\"") - (Literal "\" (in 'mother.stan', line 471, column 2 to column 72)\"") + (Literal "\" (in 'mother.stan', line 471, column 2 to column 65)\"") (Literal "\" (in 'mother.stan', line 472, column 8 to column 13)\"") (Literal "\" (in 'mother.stan', line 472, column 28 to column 33)\"") + (Literal "\" (in 'mother.stan', line 472, column 2 to column 68)\"") (Literal - "\" (in 'mother.stan', line 472, column 35 to column 40)\"") - (Literal "\" (in 'mother.stan', line 472, column 2 to column 75)\"") - (Literal "\" (in 'mother.stan', line 473, column 9 to column 14)\"") - (Literal "\" (in 'mother.stan', line 473, column 2 to column 40)\"") + "\" (in 'mother.stan', line 473, column 13 to column 18)\"") + (Literal "\" (in 'mother.stan', line 473, column 2 to column 48)\"") (Literal "\" (in 'mother.stan', line 474, column 8 to column 13)\"") (Literal - "\" (in 'mother.stan', line 474, column 22 to column 27)\"") - (Literal "\" (in 'mother.stan', line 474, column 2 to column 59)\"") + "\" (in 'mother.stan', line 474, column 26 to column 31)\"") + (Literal "\" (in 'mother.stan', line 474, column 2 to column 67)\"") (Literal "\" (in 'mother.stan', line 475, column 8 to column 13)\"") (Literal - "\" (in 'mother.stan', line 475, column 25 to column 30)\"") - (Literal "\" (in 'mother.stan', line 475, column 2 to column 65)\"") + "\" (in 'mother.stan', line 475, column 29 to column 34)\"") + (Literal "\" (in 'mother.stan', line 475, column 2 to column 73)\"") (Literal "\" (in 'mother.stan', line 476, column 8 to column 13)\"") (Literal - "\" (in 'mother.stan', line 476, column 28 to column 33)\"") - (Literal "\" (in 'mother.stan', line 476, column 2 to column 68)\"") - (Literal - "\" (in 'mother.stan', line 477, column 13 to column 18)\"") - (Literal "\" (in 'mother.stan', line 477, column 2 to column 48)\"") - (Literal "\" (in 'mother.stan', line 478, column 8 to column 13)\"") - (Literal - "\" (in 'mother.stan', line 478, column 26 to column 31)\"") - (Literal "\" (in 'mother.stan', line 478, column 2 to column 67)\"") - (Literal "\" (in 'mother.stan', line 479, column 8 to column 13)\"") - (Literal - "\" (in 'mother.stan', line 479, column 29 to column 34)\"") - (Literal "\" (in 'mother.stan', line 479, column 2 to column 73)\"") - (Literal "\" (in 'mother.stan', line 480, column 8 to column 13)\"") - (Literal - "\" (in 'mother.stan', line 480, column 32 to column 37)\"") - (Literal "\" (in 'mother.stan', line 480, column 2 to column 76)\"") - (Literal "\" (in 'mother.stan', line 482, column 2 to column 41)\"") - (Literal "\" (in 'mother.stan', line 483, column 2 to column 42)\"") - (Literal "\" (in 'mother.stan', line 484, column 2 to column 42)\"") - (Literal "\" (in 'mother.stan', line 485, column 2 to column 43)\"") - (Literal "\" (in 'mother.stan', line 486, column 2 to column 53)\"") - (Literal "\" (in 'mother.stan', line 487, column 2 to column 54)\"") - (Literal "\" (in 'mother.stan', line 488, column 2 to column 59)\"") - (Literal "\" (in 'mother.stan', line 489, column 2 to column 60)\"") + "\" (in 'mother.stan', line 476, column 32 to column 37)\"") + (Literal "\" (in 'mother.stan', line 476, column 2 to column 76)\"") + (Literal "\" (in 'mother.stan', line 478, column 2 to column 41)\"") + (Literal "\" (in 'mother.stan', line 479, column 2 to column 42)\"") + (Literal "\" (in 'mother.stan', line 480, column 2 to column 42)\"") + (Literal "\" (in 'mother.stan', line 481, column 2 to column 43)\"") + (Literal "\" (in 'mother.stan', line 482, column 2 to column 53)\"") + (Literal "\" (in 'mother.stan', line 483, column 2 to column 54)\"") + (Literal "\" (in 'mother.stan', line 484, column 2 to column 59)\"") + (Literal "\" (in 'mother.stan', line 485, column 2 to column 60)\"") + (Literal "\" (in 'mother.stan', line 486, column 2 to column 59)\"") + (Literal "\" (in 'mother.stan', line 487, column 2 to column 60)\"") + (Literal "\" (in 'mother.stan', line 488, column 2 to column 53)\"") + (Literal "\" (in 'mother.stan', line 489, column 2 to column 54)\"") (Literal "\" (in 'mother.stan', line 490, column 2 to column 59)\"") (Literal "\" (in 'mother.stan', line 491, column 2 to column 60)\"") - (Literal "\" (in 'mother.stan', line 492, column 2 to column 53)\"") - (Literal "\" (in 'mother.stan', line 493, column 2 to column 54)\"") - (Literal "\" (in 'mother.stan', line 494, column 2 to column 59)\"") - (Literal "\" (in 'mother.stan', line 495, column 2 to column 60)\"") - (Literal "\" (in 'mother.stan', line 496, column 2 to column 59)\"") + (Literal "\" (in 'mother.stan', line 492, column 2 to column 59)\"") + (Literal "\" (in 'mother.stan', line 493, column 2 to column 60)\"") + (Literal "\" (in 'mother.stan', line 495, column 2 to column 54)\"") + (Literal "\" (in 'mother.stan', line 496, column 2 to column 55)\"") (Literal "\" (in 'mother.stan', line 497, column 2 to column 60)\"") - (Literal "\" (in 'mother.stan', line 499, column 2 to column 54)\"") - (Literal "\" (in 'mother.stan', line 500, column 2 to column 55)\"") - (Literal "\" (in 'mother.stan', line 501, column 2 to column 60)\"") - (Literal "\" (in 'mother.stan', line 502, column 2 to column 61)\"") - (Literal "\" (in 'mother.stan', line 503, column 2 to column 60)\"") - (Literal "\" (in 'mother.stan', line 504, column 2 to column 61)\"") - (Literal "\" (in 'mother.stan', line 506, column 2 to column 54)\"") - (Literal "\" (in 'mother.stan', line 507, column 2 to column 55)\"") - (Literal "\" (in 'mother.stan', line 508, column 2 to column 60)\"") - (Literal "\" (in 'mother.stan', line 509, column 2 to column 61)\"") - (Literal "\" (in 'mother.stan', line 510, column 2 to column 60)\"") - (Literal "\" (in 'mother.stan', line 511, column 2 to column 61)\"") - (Literal "\" (in 'mother.stan', line 513, column 2 to column 59)\"") - (Literal "\" (in 'mother.stan', line 514, column 2 to column 61)\"") - (Literal "\" (in 'mother.stan', line 515, column 2 to column 68)\"") - (Literal "\" (in 'mother.stan', line 516, column 2 to column 70)\"") - (Literal "\" (in 'mother.stan', line 517, column 2 to column 68)\"") - (Literal "\" (in 'mother.stan', line 518, column 2 to column 70)\"") - (Literal "\" (in 'mother.stan', line 520, column 2 to column 46)\"") - (Literal "\" (in 'mother.stan', line 521, column 2 to column 47)\"") - (Literal "\" (in 'mother.stan', line 522, column 2 to column 62)\"") - (Literal "\" (in 'mother.stan', line 523, column 2 to column 60)\"") - (Literal "\" (in 'mother.stan', line 524, column 2 to column 58)\"") - (Literal "\" (in 'mother.stan', line 525, column 2 to column 58)\"") - (Literal "\" (in 'mother.stan', line 526, column 2 to column 59)\"") - (Literal "\" (in 'mother.stan', line 527, column 2 to column 64)\"") - (Literal "\" (in 'mother.stan', line 528, column 2 to column 65)\"") - (Literal "\" (in 'mother.stan', line 529, column 2 to column 64)\"") - (Literal "\" (in 'mother.stan', line 530, column 2 to column 65)\"") - (Literal "\" (in 'mother.stan', line 532, column 2 to column 46)\"") - (Literal "\" (in 'mother.stan', line 533, column 2 to column 47)\"") - (Literal "\" (in 'mother.stan', line 534, column 2 to column 58)\"") - (Literal "\" (in 'mother.stan', line 535, column 2 to column 59)\"") - (Literal "\" (in 'mother.stan', line 536, column 2 to column 64)\"") - (Literal "\" (in 'mother.stan', line 537, column 2 to column 65)\"") - (Literal "\" (in 'mother.stan', line 538, column 2 to column 64)\"") - (Literal "\" (in 'mother.stan', line 539, column 2 to column 65)\"") - (Literal "\" (in 'mother.stan', line 541, column 2 to column 49)\"") - (Literal "\" (in 'mother.stan', line 542, column 2 to column 62)\"") - (Literal "\" (in 'mother.stan', line 543, column 2 to column 60)\"") - (Literal "\" (in 'mother.stan', line 544, column 2 to column 67)\"") - (Literal "\" (in 'mother.stan', line 545, column 2 to column 76)\"") - (Literal "\" (in 'mother.stan', line 546, column 2 to column 76)\"") - (Literal "\" (in 'mother.stan', line 548, column 2 to column 54)\"") - (Literal "\" (in 'mother.stan', line 549, column 2 to column 55)\"") - (Literal "\" (in 'mother.stan', line 550, column 2 to column 66)\"") - (Literal "\" (in 'mother.stan', line 551, column 2 to column 67)\"") - (Literal "\" (in 'mother.stan', line 552, column 2 to column 72)\"") - (Literal "\" (in 'mother.stan', line 553, column 2 to column 73)\"") - (Literal "\" (in 'mother.stan', line 554, column 2 to column 72)\"") - (Literal "\" (in 'mother.stan', line 555, column 2 to column 73)\"") - (Literal "\" (in 'mother.stan', line 557, column 2 to column 54)\"") - (Literal "\" (in 'mother.stan', line 558, column 2 to column 55)\"") - (Literal "\" (in 'mother.stan', line 559, column 2 to column 66)\"") - (Literal "\" (in 'mother.stan', line 560, column 2 to column 67)\"") - (Literal "\" (in 'mother.stan', line 561, column 2 to column 72)\"") - (Literal "\" (in 'mother.stan', line 562, column 2 to column 73)\"") - (Literal "\" (in 'mother.stan', line 563, column 2 to column 72)\"") - (Literal "\" (in 'mother.stan', line 564, column 2 to column 73)\"") - (Literal "\" (in 'mother.stan', line 566, column 2 to column 61)\"") - (Literal - "\" (in 'mother.stan', line 567, column 2 to line 568, column 60)\"") - (Literal - "\" (in 'mother.stan', line 569, column 2 to line 570, column 66)\"") - (Literal - "\" (in 'mother.stan', line 571, column 2 to line 572, column 66)\"") - (Literal "\" (in 'mother.stan', line 574, column 2 to column 46)\"") - (Literal "\" (in 'mother.stan', line 575, column 2 to column 47)\"") - (Literal "\" (in 'mother.stan', line 576, column 2 to column 62)\"") - (Literal "\" (in 'mother.stan', line 577, column 2 to column 60)\"") - (Literal "\" (in 'mother.stan', line 578, column 2 to column 58)\"") - (Literal "\" (in 'mother.stan', line 579, column 2 to column 59)\"") - (Literal "\" (in 'mother.stan', line 580, column 2 to column 64)\"") - (Literal "\" (in 'mother.stan', line 581, column 2 to column 65)\"") - (Literal "\" (in 'mother.stan', line 582, column 2 to column 64)\"") - (Literal "\" (in 'mother.stan', line 583, column 2 to column 65)\"") - (Literal "\" (in 'mother.stan', line 585, column 2 to column 46)\"") - (Literal "\" (in 'mother.stan', line 586, column 2 to column 47)\"") - (Literal "\" (in 'mother.stan', line 587, column 2 to column 58)\"") - (Literal "\" (in 'mother.stan', line 588, column 2 to column 59)\"") - (Literal "\" (in 'mother.stan', line 589, column 2 to column 64)\"") - (Literal "\" (in 'mother.stan', line 590, column 2 to column 65)\"") - (Literal "\" (in 'mother.stan', line 591, column 2 to column 64)\"") - (Literal "\" (in 'mother.stan', line 592, column 2 to column 65)\"") - (Literal "\" (in 'mother.stan', line 594, column 2 to column 49)\"") - (Literal "\" (in 'mother.stan', line 595, column 2 to column 67)\"") - (Literal "\" (in 'mother.stan', line 596, column 2 to column 76)\"") - (Literal "\" (in 'mother.stan', line 597, column 2 to column 76)\"") - (Literal "\" (in 'mother.stan', line 599, column 2 to column 26)\"") - (Literal "\" (in 'mother.stan', line 600, column 2 to column 43)\"") + (Literal "\" (in 'mother.stan', line 498, column 2 to column 61)\"") + (Literal "\" (in 'mother.stan', line 499, column 2 to column 60)\"") + (Literal "\" (in 'mother.stan', line 500, column 2 to column 61)\"") + (Literal "\" (in 'mother.stan', line 502, column 2 to column 54)\"") + (Literal "\" (in 'mother.stan', line 503, column 2 to column 55)\"") + (Literal "\" (in 'mother.stan', line 504, column 2 to column 60)\"") + (Literal "\" (in 'mother.stan', line 505, column 2 to column 61)\"") + (Literal "\" (in 'mother.stan', line 506, column 2 to column 60)\"") + (Literal "\" (in 'mother.stan', line 507, column 2 to column 61)\"") + (Literal "\" (in 'mother.stan', line 509, column 2 to column 59)\"") + (Literal "\" (in 'mother.stan', line 510, column 2 to column 61)\"") + (Literal "\" (in 'mother.stan', line 511, column 2 to column 68)\"") + (Literal "\" (in 'mother.stan', line 512, column 2 to column 70)\"") + (Literal "\" (in 'mother.stan', line 513, column 2 to column 68)\"") + (Literal "\" (in 'mother.stan', line 514, column 2 to column 70)\"") + (Literal "\" (in 'mother.stan', line 516, column 2 to column 46)\"") + (Literal "\" (in 'mother.stan', line 517, column 2 to column 47)\"") + (Literal "\" (in 'mother.stan', line 518, column 2 to column 62)\"") + (Literal "\" (in 'mother.stan', line 519, column 2 to column 60)\"") + (Literal "\" (in 'mother.stan', line 520, column 2 to column 58)\"") + (Literal "\" (in 'mother.stan', line 521, column 2 to column 58)\"") + (Literal "\" (in 'mother.stan', line 522, column 2 to column 59)\"") + (Literal "\" (in 'mother.stan', line 523, column 2 to column 64)\"") + (Literal "\" (in 'mother.stan', line 524, column 2 to column 65)\"") + (Literal "\" (in 'mother.stan', line 525, column 2 to column 64)\"") + (Literal "\" (in 'mother.stan', line 526, column 2 to column 65)\"") + (Literal "\" (in 'mother.stan', line 528, column 2 to column 46)\"") + (Literal "\" (in 'mother.stan', line 529, column 2 to column 47)\"") + (Literal "\" (in 'mother.stan', line 530, column 2 to column 58)\"") + (Literal "\" (in 'mother.stan', line 531, column 2 to column 59)\"") + (Literal "\" (in 'mother.stan', line 532, column 2 to column 64)\"") + (Literal "\" (in 'mother.stan', line 533, column 2 to column 65)\"") + (Literal "\" (in 'mother.stan', line 534, column 2 to column 64)\"") + (Literal "\" (in 'mother.stan', line 535, column 2 to column 65)\"") + (Literal "\" (in 'mother.stan', line 537, column 2 to column 49)\"") + (Literal "\" (in 'mother.stan', line 538, column 2 to column 62)\"") + (Literal "\" (in 'mother.stan', line 539, column 2 to column 60)\"") + (Literal "\" (in 'mother.stan', line 540, column 2 to column 67)\"") + (Literal "\" (in 'mother.stan', line 541, column 2 to column 76)\"") + (Literal "\" (in 'mother.stan', line 542, column 2 to column 76)\"") + (Literal "\" (in 'mother.stan', line 544, column 2 to column 54)\"") + (Literal "\" (in 'mother.stan', line 545, column 2 to column 55)\"") + (Literal "\" (in 'mother.stan', line 546, column 2 to column 66)\"") + (Literal "\" (in 'mother.stan', line 547, column 2 to column 67)\"") + (Literal "\" (in 'mother.stan', line 548, column 2 to column 72)\"") + (Literal "\" (in 'mother.stan', line 549, column 2 to column 73)\"") + (Literal "\" (in 'mother.stan', line 550, column 2 to column 72)\"") + (Literal "\" (in 'mother.stan', line 551, column 2 to column 73)\"") + (Literal "\" (in 'mother.stan', line 553, column 2 to column 54)\"") + (Literal "\" (in 'mother.stan', line 554, column 2 to column 55)\"") + (Literal "\" (in 'mother.stan', line 555, column 2 to column 66)\"") + (Literal "\" (in 'mother.stan', line 556, column 2 to column 67)\"") + (Literal "\" (in 'mother.stan', line 557, column 2 to column 72)\"") + (Literal "\" (in 'mother.stan', line 558, column 2 to column 73)\"") + (Literal "\" (in 'mother.stan', line 559, column 2 to column 72)\"") + (Literal "\" (in 'mother.stan', line 560, column 2 to column 73)\"") + (Literal "\" (in 'mother.stan', line 562, column 2 to column 61)\"") + (Literal + "\" (in 'mother.stan', line 563, column 2 to line 564, column 60)\"") + (Literal + "\" (in 'mother.stan', line 565, column 2 to line 566, column 66)\"") + (Literal + "\" (in 'mother.stan', line 567, column 2 to line 568, column 66)\"") + (Literal "\" (in 'mother.stan', line 570, column 2 to column 46)\"") + (Literal "\" (in 'mother.stan', line 571, column 2 to column 47)\"") + (Literal "\" (in 'mother.stan', line 572, column 2 to column 62)\"") + (Literal "\" (in 'mother.stan', line 573, column 2 to column 60)\"") + (Literal "\" (in 'mother.stan', line 574, column 2 to column 58)\"") + (Literal "\" (in 'mother.stan', line 575, column 2 to column 59)\"") + (Literal "\" (in 'mother.stan', line 576, column 2 to column 64)\"") + (Literal "\" (in 'mother.stan', line 577, column 2 to column 65)\"") + (Literal "\" (in 'mother.stan', line 578, column 2 to column 64)\"") + (Literal "\" (in 'mother.stan', line 579, column 2 to column 65)\"") + (Literal "\" (in 'mother.stan', line 581, column 2 to column 46)\"") + (Literal "\" (in 'mother.stan', line 582, column 2 to column 47)\"") + (Literal "\" (in 'mother.stan', line 583, column 2 to column 58)\"") + (Literal "\" (in 'mother.stan', line 584, column 2 to column 59)\"") + (Literal "\" (in 'mother.stan', line 585, column 2 to column 64)\"") + (Literal "\" (in 'mother.stan', line 586, column 2 to column 65)\"") + (Literal "\" (in 'mother.stan', line 587, column 2 to column 64)\"") + (Literal "\" (in 'mother.stan', line 588, column 2 to column 65)\"") + (Literal "\" (in 'mother.stan', line 590, column 2 to column 49)\"") + (Literal "\" (in 'mother.stan', line 591, column 2 to column 67)\"") + (Literal "\" (in 'mother.stan', line 592, column 2 to column 76)\"") + (Literal "\" (in 'mother.stan', line 593, column 2 to column 76)\"") + (Literal "\" (in 'mother.stan', line 595, column 2 to column 26)\"") + (Literal "\" (in 'mother.stan', line 596, column 2 to column 43)\"") + (Literal "\" (in 'mother.stan', line 605, column 8 to column 9)\"") + (Literal "\" (in 'mother.stan', line 606, column 8 to column 9)\"") + (Literal + "\" (in 'mother.stan', line 606, column 11 to column 12)\"") + (Literal + "\" (in 'mother.stan', line 606, column 14 to column 15)\"") + (Literal + "\" (in 'mother.stan', line 607, column 18 to column 19)\"") + (Literal "\" (in 'mother.stan', line 608, column 8 to column 9)\"") + (Literal + "\" (in 'mother.stan', line 608, column 18 to column 19)\"") (Literal "\" (in 'mother.stan', line 609, column 8 to column 9)\"") - (Literal "\" (in 'mother.stan', line 610, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 610, column 11 to column 12)\"") + "\" (in 'mother.stan', line 609, column 11 to column 12)\"") (Literal - "\" (in 'mother.stan', line 610, column 14 to column 15)\"") + "\" (in 'mother.stan', line 609, column 14 to column 15)\"") (Literal - "\" (in 'mother.stan', line 611, column 18 to column 19)\"") - (Literal "\" (in 'mother.stan', line 612, column 8 to column 9)\"") + "\" (in 'mother.stan', line 609, column 24 to column 25)\"") (Literal - "\" (in 'mother.stan', line 612, column 18 to column 19)\"") - (Literal "\" (in 'mother.stan', line 613, column 8 to column 9)\"") + "\" (in 'mother.stan', line 610, column 13 to column 14)\"") + (Literal "\" (in 'mother.stan', line 611, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 613, column 11 to column 12)\"") + "\" (in 'mother.stan', line 611, column 22 to column 23)\"") + (Literal "\" (in 'mother.stan', line 612, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 613, column 14 to column 15)\"") + "\" (in 'mother.stan', line 612, column 11 to column 12)\"") (Literal - "\" (in 'mother.stan', line 613, column 24 to column 25)\"") + "\" (in 'mother.stan', line 612, column 14 to column 15)\"") (Literal - "\" (in 'mother.stan', line 614, column 13 to column 14)\"") - (Literal "\" (in 'mother.stan', line 615, column 8 to column 9)\"") + "\" (in 'mother.stan', line 612, column 28 to column 29)\"") (Literal - "\" (in 'mother.stan', line 615, column 22 to column 23)\"") + "\" (in 'mother.stan', line 615, column 10 to column 11)\"") (Literal "\" (in 'mother.stan', line 616, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 616, column 11 to column 12)\"") + "\" (in 'mother.stan', line 616, column 19 to column 20)\"") + (Literal "\" (in 'mother.stan', line 617, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 616, column 14 to column 15)\"") + "\" (in 'mother.stan', line 617, column 11 to column 12)\"") (Literal - "\" (in 'mother.stan', line 616, column 28 to column 29)\"") + "\" (in 'mother.stan', line 617, column 14 to column 15)\"") (Literal - "\" (in 'mother.stan', line 619, column 10 to column 11)\"") - (Literal "\" (in 'mother.stan', line 620, column 8 to column 9)\"") + "\" (in 'mother.stan', line 617, column 25 to column 26)\"") (Literal - "\" (in 'mother.stan', line 620, column 19 to column 20)\"") - (Literal "\" (in 'mother.stan', line 621, column 8 to column 9)\"") + "\" (in 'mother.stan', line 618, column 22 to column 23)\"") (Literal - "\" (in 'mother.stan', line 621, column 11 to column 12)\"") + "\" (in 'mother.stan', line 619, column 22 to column 23)\"") + (Literal "\" (in 'mother.stan', line 620, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 621, column 14 to column 15)\"") + "\" (in 'mother.stan', line 620, column 31 to column 32)\"") + (Literal "\" (in 'mother.stan', line 625, column 8 to column 9)\"") + (Literal "\" (in 'mother.stan', line 626, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 621, column 25 to column 26)\"") + "\" (in 'mother.stan', line 626, column 11 to column 12)\"") (Literal - "\" (in 'mother.stan', line 622, column 22 to column 23)\"") + "\" (in 'mother.stan', line 626, column 14 to column 15)\"") (Literal - "\" (in 'mother.stan', line 623, column 22 to column 23)\"") - (Literal "\" (in 'mother.stan', line 624, column 8 to column 9)\"") + "\" (in 'mother.stan', line 627, column 18 to column 19)\"") + (Literal "\" (in 'mother.stan', line 628, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 624, column 31 to column 32)\"") + "\" (in 'mother.stan', line 628, column 18 to column 19)\"") (Literal "\" (in 'mother.stan', line 629, column 8 to column 9)\"") - (Literal "\" (in 'mother.stan', line 630, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 630, column 11 to column 12)\"") + "\" (in 'mother.stan', line 629, column 11 to column 12)\"") (Literal - "\" (in 'mother.stan', line 630, column 14 to column 15)\"") + "\" (in 'mother.stan', line 629, column 14 to column 15)\"") (Literal - "\" (in 'mother.stan', line 631, column 18 to column 19)\"") - (Literal "\" (in 'mother.stan', line 632, column 8 to column 9)\"") + "\" (in 'mother.stan', line 629, column 24 to column 25)\"") (Literal - "\" (in 'mother.stan', line 632, column 18 to column 19)\"") - (Literal "\" (in 'mother.stan', line 633, column 8 to column 9)\"") + "\" (in 'mother.stan', line 630, column 13 to column 14)\"") + (Literal "\" (in 'mother.stan', line 631, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 633, column 11 to column 12)\"") + "\" (in 'mother.stan', line 631, column 22 to column 23)\"") + (Literal "\" (in 'mother.stan', line 632, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 633, column 14 to column 15)\"") + "\" (in 'mother.stan', line 632, column 11 to column 12)\"") (Literal - "\" (in 'mother.stan', line 633, column 24 to column 25)\"") + "\" (in 'mother.stan', line 632, column 14 to column 15)\"") (Literal - "\" (in 'mother.stan', line 634, column 13 to column 14)\"") - (Literal "\" (in 'mother.stan', line 635, column 8 to column 9)\"") + "\" (in 'mother.stan', line 632, column 28 to column 29)\"") (Literal - "\" (in 'mother.stan', line 635, column 22 to column 23)\"") + "\" (in 'mother.stan', line 635, column 10 to column 11)\"") (Literal "\" (in 'mother.stan', line 636, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 636, column 11 to column 12)\"") + "\" (in 'mother.stan', line 636, column 19 to column 20)\"") + (Literal "\" (in 'mother.stan', line 637, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 636, column 14 to column 15)\"") + "\" (in 'mother.stan', line 637, column 11 to column 12)\"") (Literal - "\" (in 'mother.stan', line 636, column 28 to column 29)\"") + "\" (in 'mother.stan', line 637, column 14 to column 15)\"") (Literal - "\" (in 'mother.stan', line 639, column 10 to column 11)\"") + "\" (in 'mother.stan', line 637, column 25 to column 26)\"") (Literal "\" (in 'mother.stan', line 640, column 8 to column 9)\"") + (Literal "\" (in 'mother.stan', line 735, column 8 to column 9)\"") + (Literal "\" (in 'mother.stan', line 736, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 640, column 19 to column 20)\"") - (Literal "\" (in 'mother.stan', line 641, column 8 to column 9)\"") + "\" (in 'mother.stan', line 736, column 11 to column 12)\"") (Literal - "\" (in 'mother.stan', line 641, column 11 to column 12)\"") + "\" (in 'mother.stan', line 736, column 14 to column 15)\"") (Literal - "\" (in 'mother.stan', line 641, column 14 to column 15)\"") + "\" (in 'mother.stan', line 737, column 18 to column 19)\"") + (Literal "\" (in 'mother.stan', line 738, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 641, column 25 to column 26)\"") - (Literal "\" (in 'mother.stan', line 644, column 8 to column 9)\"") + "\" (in 'mother.stan', line 738, column 18 to column 19)\"") (Literal "\" (in 'mother.stan', line 739, column 8 to column 9)\"") - (Literal "\" (in 'mother.stan', line 740, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 740, column 11 to column 12)\"") + "\" (in 'mother.stan', line 739, column 11 to column 12)\"") (Literal - "\" (in 'mother.stan', line 740, column 14 to column 15)\"") + "\" (in 'mother.stan', line 739, column 14 to column 15)\"") (Literal - "\" (in 'mother.stan', line 741, column 18 to column 19)\"") - (Literal "\" (in 'mother.stan', line 742, column 8 to column 9)\"") + "\" (in 'mother.stan', line 739, column 24 to column 25)\"") (Literal - "\" (in 'mother.stan', line 742, column 18 to column 19)\"") - (Literal "\" (in 'mother.stan', line 743, column 8 to column 9)\"") + "\" (in 'mother.stan', line 740, column 13 to column 14)\"") + (Literal "\" (in 'mother.stan', line 741, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 743, column 11 to column 12)\"") + "\" (in 'mother.stan', line 741, column 22 to column 23)\"") + (Literal "\" (in 'mother.stan', line 742, column 8 to column 9)\"") + (Literal + "\" (in 'mother.stan', line 742, column 11 to column 12)\"") (Literal - "\" (in 'mother.stan', line 743, column 14 to column 15)\"") + "\" (in 'mother.stan', line 742, column 14 to column 15)\"") (Literal - "\" (in 'mother.stan', line 743, column 24 to column 25)\"") + "\" (in 'mother.stan', line 742, column 28 to column 29)\"") (Literal - "\" (in 'mother.stan', line 744, column 13 to column 14)\"") + "\" (in 'mother.stan', line 744, column 10 to column 11)\"") (Literal "\" (in 'mother.stan', line 745, column 8 to column 9)\"") (Literal - "\" (in 'mother.stan', line 745, column 22 to column 23)\"") + "\" (in 'mother.stan', line 745, column 19 to column 20)\"") (Literal "\" (in 'mother.stan', line 746, column 8 to column 9)\"") (Literal "\" (in 'mother.stan', line 746, column 11 to column 12)\"") (Literal "\" (in 'mother.stan', line 746, column 14 to column 15)\"") (Literal - "\" (in 'mother.stan', line 746, column 28 to column 29)\"") - (Literal - "\" (in 'mother.stan', line 748, column 10 to column 11)\"") + "\" (in 'mother.stan', line 746, column 25 to column 26)\"") (Literal "\" (in 'mother.stan', line 749, column 8 to column 9)\"") + (Literal "\" (in 'mother.stan', line 12, column 6 to column 15)\"") (Literal - "\" (in 'mother.stan', line 749, column 19 to column 20)\"") - (Literal "\" (in 'mother.stan', line 750, column 8 to column 9)\"") + "\" (in 'mother.stan', line 11, column 4 to line 12, column 15)\"") + (Literal "\" (in 'mother.stan', line 13, column 4 to column 26)\"") (Literal - "\" (in 'mother.stan', line 750, column 11 to column 12)\"") + "\" (in 'mother.stan', line 10, column 17 to line 14, column 3)\"") + (Literal "\" (in 'mother.stan', line 18, column 4 to column 23)\"") + (Literal "\" (in 'mother.stan', line 19, column 4 to column 19)\"") + (Literal "\" (in 'mother.stan', line 20, column 4 to column 38)\"") + (Literal "\" (in 'mother.stan', line 21, column 4 to column 16)\"") (Literal - "\" (in 'mother.stan', line 750, column 14 to column 15)\"") + "\" (in 'mother.stan', line 17, column 64 to line 22, column 3)\"") + (Literal "\" (in 'mother.stan', line 25, column 4 to column 15)\"") (Literal - "\" (in 'mother.stan', line 750, column 25 to column 26)\"") - (Literal "\" (in 'mother.stan', line 753, column 8 to column 9)\"") - (Literal "\" (in 'mother.stan', line 13, column 6 to column 15)\"") - (Literal - "\" (in 'mother.stan', line 12, column 4 to line 13, column 15)\"") - (Literal "\" (in 'mother.stan', line 14, column 4 to column 26)\"") - (Literal - "\" (in 'mother.stan', line 11, column 17 to line 15, column 3)\"") - (Literal "\" (in 'mother.stan', line 22, column 4 to column 23)\"") - (Literal "\" (in 'mother.stan', line 23, column 4 to column 19)\"") - (Literal "\" (in 'mother.stan', line 24, column 4 to column 38)\"") - (Literal "\" (in 'mother.stan', line 25, column 4 to column 16)\"") - (Literal - "\" (in 'mother.stan', line 21, column 64 to line 26, column 3)\"") + "\" (in 'mother.stan', line 24, column 18 to line 26, column 3)\"") (Literal "\" (in 'mother.stan', line 29, column 4 to column 15)\"") (Literal - "\" (in 'mother.stan', line 28, column 18 to line 30, column 3)\"") + "\" (in 'mother.stan', line 28, column 24 to line 30, column 3)\"") (Literal "\" (in 'mother.stan', line 33, column 4 to column 15)\"") (Literal - "\" (in 'mother.stan', line 32, column 24 to line 34, column 3)\"") + "\" (in 'mother.stan', line 32, column 32 to line 34, column 3)\"") (Literal "\" (in 'mother.stan', line 37, column 4 to column 15)\"") (Literal - "\" (in 'mother.stan', line 36, column 32 to line 38, column 3)\"") + "\" (in 'mother.stan', line 36, column 36 to line 38, column 3)\"") (Literal "\" (in 'mother.stan', line 41, column 4 to column 15)\"") (Literal "\" (in 'mother.stan', line 40, column 36 to line 42, column 3)\"") (Literal "\" (in 'mother.stan', line 45, column 4 to column 15)\"") (Literal - "\" (in 'mother.stan', line 44, column 36 to line 46, column 3)\"") - (Literal "\" (in 'mother.stan', line 49, column 4 to column 15)\"") + "\" (in 'mother.stan', line 44, column 37 to line 46, column 3)\"") + (Literal "\" (in 'mother.stan', line 48, column 4 to column 33)\"") (Literal - "\" (in 'mother.stan', line 48, column 37 to line 50, column 3)\"") - (Literal "\" (in 'mother.stan', line 52, column 4 to column 33)\"") + "\" (in 'mother.stan', line 47, column 36 to line 49, column 3)\"") + (Literal "\" (in 'mother.stan', line 52, column 4 to column 36)\"") + (Literal "\" (in 'mother.stan', line 53, column 4 to column 27)\"") (Literal - "\" (in 'mother.stan', line 51, column 36 to line 53, column 3)\"") - (Literal "\" (in 'mother.stan', line 56, column 4 to column 36)\"") - (Literal "\" (in 'mother.stan', line 57, column 4 to column 27)\"") + "\" (in 'mother.stan', line 51, column 30 to line 54, column 3)\"") + (Literal "\" (in 'mother.stan', line 58, column 14 to column 20)\"") + (Literal "\" (in 'mother.stan', line 58, column 4 to column 20)\"") + (Literal "\" (in 'mother.stan', line 59, column 14 to column 23)\"") + (Literal "\" (in 'mother.stan', line 59, column 4 to column 23)\"") + (Literal "\" (in 'mother.stan', line 63, column 6 to column 12)\"") (Literal - "\" (in 'mother.stan', line 55, column 30 to line 58, column 3)\"") - (Literal "\" (in 'mother.stan', line 62, column 14 to column 20)\"") - (Literal "\" (in 'mother.stan', line 62, column 4 to column 20)\"") - (Literal "\" (in 'mother.stan', line 63, column 14 to column 23)\"") - (Literal "\" (in 'mother.stan', line 63, column 4 to column 23)\"") - (Literal "\" (in 'mother.stan', line 67, column 6 to column 12)\"") + "\" (in 'mother.stan', line 62, column 4 to line 63, column 12)\"") + (Literal "\" (in 'mother.stan', line 65, column 6 to column 15)\"") (Literal - "\" (in 'mother.stan', line 66, column 4 to line 67, column 12)\"") - (Literal "\" (in 'mother.stan', line 69, column 6 to column 15)\"") + "\" (in 'mother.stan', line 64, column 4 to line 65, column 15)\"") + (Literal "\" (in 'mother.stan', line 69, column 6 to column 12)\"") + (Literal "\" (in 'mother.stan', line 70, column 6 to column 12)\"") + (Literal "\" (in 'mother.stan', line 71, column 6 to column 12)\"") (Literal - "\" (in 'mother.stan', line 68, column 4 to line 69, column 15)\"") - (Literal "\" (in 'mother.stan', line 73, column 6 to column 12)\"") - (Literal "\" (in 'mother.stan', line 74, column 6 to column 12)\"") - (Literal "\" (in 'mother.stan', line 75, column 6 to column 12)\"") + "\" (in 'mother.stan', line 68, column 14 to line 72, column 5)\"") (Literal - "\" (in 'mother.stan', line 72, column 14 to line 76, column 5)\"") + "\" (in 'mother.stan', line 68, column 4 to line 72, column 5)\"") + (Literal "\" (in 'mother.stan', line 81, column 8 to column 14)\"") + (Literal "\" (in 'mother.stan', line 79, column 8 to column 14)\"") (Literal - "\" (in 'mother.stan', line 72, column 4 to line 76, column 5)\"") - (Literal "\" (in 'mother.stan', line 85, column 8 to column 14)\"") - (Literal "\" (in 'mother.stan', line 83, column 8 to column 14)\"") + "\" (in 'mother.stan', line 78, column 11 to line 81, column 14)\"") + (Literal "\" (in 'mother.stan', line 77, column 8 to column 14)\"") (Literal - "\" (in 'mother.stan', line 82, column 11 to line 85, column 14)\"") - (Literal "\" (in 'mother.stan', line 81, column 8 to column 14)\"") + "\" (in 'mother.stan', line 76, column 6 to line 81, column 14)\"") (Literal - "\" (in 'mother.stan', line 80, column 6 to line 85, column 14)\"") + "\" (in 'mother.stan', line 75, column 14 to line 82, column 5)\"") (Literal - "\" (in 'mother.stan', line 79, column 14 to line 86, column 5)\"") + "\" (in 'mother.stan', line 75, column 4 to line 82, column 5)\"") + (Literal "\" (in 'mother.stan', line 85, column 24 to column 30)\"") + (Literal "\" (in 'mother.stan', line 85, column 14 to column 30)\"") + (Literal "\" (in 'mother.stan', line 85, column 4 to column 30)\"") + (Literal "\" (in 'mother.stan', line 90, column 8 to column 14)\"") (Literal - "\" (in 'mother.stan', line 79, column 4 to line 86, column 5)\"") - (Literal "\" (in 'mother.stan', line 89, column 24 to column 30)\"") - (Literal "\" (in 'mother.stan', line 89, column 14 to column 30)\"") - (Literal "\" (in 'mother.stan', line 89, column 4 to column 30)\"") - (Literal "\" (in 'mother.stan', line 94, column 8 to column 14)\"") + "\" (in 'mother.stan', line 89, column 6 to line 90, column 14)\"") (Literal - "\" (in 'mother.stan', line 93, column 6 to line 94, column 14)\"") + "\" (in 'mother.stan', line 88, column 14 to line 91, column 5)\"") (Literal - "\" (in 'mother.stan', line 92, column 14 to line 95, column 5)\"") + "\" (in 'mother.stan', line 88, column 4 to line 91, column 5)\"") + (Literal "\" (in 'mother.stan', line 95, column 6 to column 25)\"") + (Literal "\" (in 'mother.stan', line 96, column 6 to column 12)\"") (Literal - "\" (in 'mother.stan', line 92, column 4 to line 95, column 5)\"") - (Literal "\" (in 'mother.stan', line 99, column 6 to column 25)\"") - (Literal "\" (in 'mother.stan', line 100, column 6 to column 12)\"") + "\" (in 'mother.stan', line 97, column 6 to line 100, column 7)\"") + (Literal "\" (in 'mother.stan', line 98, column 8 to column 14)\"") + (Literal "\" (in 'mother.stan', line 99, column 8 to column 14)\"") (Literal "\" (in 'mother.stan', line 101, column 6 to line 104, column 7)\"") (Literal "\" (in 'mother.stan', line 102, column 8 to column 14)\"") - (Literal "\" (in 'mother.stan', line 103, column 8 to column 14)\"") + (Literal "\" (in 'mother.stan', line 103, column 8 to column 17)\"") (Literal - "\" (in 'mother.stan', line 105, column 6 to line 108, column 7)\"") - (Literal "\" (in 'mother.stan', line 106, column 8 to column 14)\"") - (Literal "\" (in 'mother.stan', line 107, column 8 to column 17)\"") + "\" (in 'mother.stan', line 105, column 6 to line 111, column 7)\"") (Literal - "\" (in 'mother.stan', line 109, column 6 to line 115, column 7)\"") + "\" (in 'mother.stan', line 106, column 8 to line 109, column 9)\"") (Literal - "\" (in 'mother.stan', line 110, column 8 to line 113, column 9)\"") + "\" (in 'mother.stan', line 107, column 10 to column 16)\"") (Literal - "\" (in 'mother.stan', line 111, column 10 to column 16)\"") + "\" (in 'mother.stan', line 108, column 10 to column 16)\"") + (Literal "\" (in 'mother.stan', line 110, column 8 to column 14)\"") (Literal - "\" (in 'mother.stan', line 112, column 10 to column 16)\"") - (Literal "\" (in 'mother.stan', line 114, column 8 to column 14)\"") + "\" (in 'mother.stan', line 94, column 14 to line 112, column 5)\"") (Literal - "\" (in 'mother.stan', line 98, column 14 to line 116, column 5)\"") + "\" (in 'mother.stan', line 94, column 4 to line 112, column 5)\"") + (Literal "\" (in 'mother.stan', line 116, column 6 to column 13)\"") + (Literal "\" (in 'mother.stan', line 117, column 6 to column 22)\"") (Literal - "\" (in 'mother.stan', line 98, column 4 to line 116, column 5)\"") - (Literal "\" (in 'mother.stan', line 120, column 6 to column 13)\"") - (Literal "\" (in 'mother.stan', line 121, column 6 to column 22)\"") + "\" (in 'mother.stan', line 118, column 6 to line 121, column 7)\"") + (Literal "\" (in 'mother.stan', line 119, column 8 to column 14)\"") + (Literal "\" (in 'mother.stan', line 120, column 8 to column 14)\"") (Literal "\" (in 'mother.stan', line 122, column 6 to line 125, column 7)\"") - (Literal "\" (in 'mother.stan', line 123, column 8 to column 14)\"") - (Literal "\" (in 'mother.stan', line 124, column 8 to column 14)\"") + (Literal "\" (in 'mother.stan', line 123, column 8 to column 16)\"") + (Literal "\" (in 'mother.stan', line 124, column 8 to column 17)\"") (Literal - "\" (in 'mother.stan', line 126, column 6 to line 129, column 7)\"") - (Literal "\" (in 'mother.stan', line 127, column 8 to column 16)\"") - (Literal "\" (in 'mother.stan', line 128, column 8 to column 17)\"") + "\" (in 'mother.stan', line 115, column 14 to line 126, column 5)\"") (Literal - "\" (in 'mother.stan', line 119, column 14 to line 130, column 5)\"") + "\" (in 'mother.stan', line 115, column 4 to line 126, column 5)\"") + (Literal "\" (in 'mother.stan', line 130, column 6 to column 13)\"") + (Literal "\" (in 'mother.stan', line 131, column 6 to column 19)\"") (Literal - "\" (in 'mother.stan', line 119, column 4 to line 130, column 5)\"") - (Literal "\" (in 'mother.stan', line 134, column 6 to column 13)\"") - (Literal "\" (in 'mother.stan', line 135, column 6 to column 19)\"") + "\" (in 'mother.stan', line 132, column 6 to line 135, column 7)\"") + (Literal "\" (in 'mother.stan', line 133, column 8 to column 14)\"") + (Literal "\" (in 'mother.stan', line 134, column 8 to column 14)\"") (Literal "\" (in 'mother.stan', line 136, column 6 to line 139, column 7)\"") - (Literal "\" (in 'mother.stan', line 137, column 8 to column 14)\"") - (Literal "\" (in 'mother.stan', line 138, column 8 to column 14)\"") + (Literal "\" (in 'mother.stan', line 137, column 8 to column 16)\"") + (Literal "\" (in 'mother.stan', line 138, column 8 to column 17)\"") (Literal - "\" (in 'mother.stan', line 140, column 6 to line 143, column 7)\"") - (Literal "\" (in 'mother.stan', line 141, column 8 to column 16)\"") - (Literal "\" (in 'mother.stan', line 142, column 8 to column 17)\"") + "\" (in 'mother.stan', line 129, column 14 to line 140, column 5)\"") (Literal - "\" (in 'mother.stan', line 133, column 14 to line 144, column 5)\"") + "\" (in 'mother.stan', line 129, column 4 to line 140, column 5)\"") + (Literal "\" (in 'mother.stan', line 144, column 6 to column 13)\"") + (Literal "\" (in 'mother.stan', line 145, column 6 to column 23)\"") (Literal - "\" (in 'mother.stan', line 133, column 4 to line 144, column 5)\"") - (Literal "\" (in 'mother.stan', line 148, column 6 to column 13)\"") - (Literal "\" (in 'mother.stan', line 149, column 6 to column 23)\"") + "\" (in 'mother.stan', line 146, column 6 to line 149, column 7)\"") + (Literal "\" (in 'mother.stan', line 147, column 8 to column 14)\"") + (Literal "\" (in 'mother.stan', line 148, column 8 to column 14)\"") (Literal "\" (in 'mother.stan', line 150, column 6 to line 153, column 7)\"") - (Literal "\" (in 'mother.stan', line 151, column 8 to column 14)\"") - (Literal "\" (in 'mother.stan', line 152, column 8 to column 14)\"") + (Literal "\" (in 'mother.stan', line 151, column 8 to column 16)\"") + (Literal "\" (in 'mother.stan', line 152, column 8 to column 17)\"") (Literal - "\" (in 'mother.stan', line 154, column 6 to line 157, column 7)\"") - (Literal "\" (in 'mother.stan', line 155, column 8 to column 16)\"") - (Literal "\" (in 'mother.stan', line 156, column 8 to column 17)\"") + "\" (in 'mother.stan', line 143, column 14 to line 154, column 5)\"") (Literal - "\" (in 'mother.stan', line 147, column 14 to line 158, column 5)\"") + "\" (in 'mother.stan', line 143, column 4 to line 154, column 5)\"") + (Literal "\" (in 'mother.stan', line 158, column 6 to column 12)\"") + (Literal "\" (in 'mother.stan', line 159, column 6 to column 12)\"") + (Literal "\" (in 'mother.stan', line 161, column 8 to column 14)\"") + (Literal "\" (in 'mother.stan', line 162, column 8 to column 14)\"") + (Literal "\" (in 'mother.stan', line 163, column 8 to column 14)\"") (Literal - "\" (in 'mother.stan', line 147, column 4 to line 158, column 5)\"") - (Literal "\" (in 'mother.stan', line 162, column 6 to column 12)\"") - (Literal "\" (in 'mother.stan', line 163, column 6 to column 12)\"") - (Literal "\" (in 'mother.stan', line 165, column 8 to column 14)\"") - (Literal "\" (in 'mother.stan', line 166, column 8 to column 14)\"") - (Literal "\" (in 'mother.stan', line 167, column 8 to column 14)\"") + "\" (in 'mother.stan', line 160, column 6 to line 164, column 7)\"") (Literal - "\" (in 'mother.stan', line 164, column 6 to line 168, column 7)\"") + "\" (in 'mother.stan', line 157, column 14 to line 165, column 5)\"") (Literal - "\" (in 'mother.stan', line 161, column 14 to line 169, column 5)\"") + "\" (in 'mother.stan', line 157, column 4 to line 165, column 5)\"") + (Literal "\" (in 'mother.stan', line 167, column 4 to column 13)\"") (Literal - "\" (in 'mother.stan', line 161, column 4 to line 169, column 5)\"") - (Literal "\" (in 'mother.stan', line 171, column 4 to column 13)\"") + "\" (in 'mother.stan', line 56, column 19 to line 168, column 3)\"") + (Literal "\" (in 'mother.stan', line 171, column 4 to column 20)\"") + (Literal "\" (in 'mother.stan', line 172, column 4 to column 10)\"") (Literal - "\" (in 'mother.stan', line 60, column 19 to line 172, column 3)\"") - (Literal "\" (in 'mother.stan', line 175, column 4 to column 20)\"") - (Literal "\" (in 'mother.stan', line 176, column 4 to column 10)\"") + "\" (in 'mother.stan', line 173, column 4 to line 174, column 12)\"") + (Literal "\" (in 'mother.stan', line 174, column 6 to column 12)\"") + (Literal "\" (in 'mother.stan', line 175, column 4 to column 13)\"") (Literal - "\" (in 'mother.stan', line 177, column 4 to line 178, column 12)\"") - (Literal "\" (in 'mother.stan', line 178, column 6 to column 12)\"") - (Literal "\" (in 'mother.stan', line 179, column 4 to column 13)\"") + "\" (in 'mother.stan', line 170, column 19 to line 176, column 3)\"") + (Literal "\" (in 'mother.stan', line 179, column 4 to column 27)\"") (Literal - "\" (in 'mother.stan', line 174, column 19 to line 180, column 3)\"") - (Literal "\" (in 'mother.stan', line 183, column 4 to column 27)\"") + "\" (in 'mother.stan', line 178, column 36 to line 180, column 3)\"") + (Literal "\" (in 'mother.stan', line 183, column 4 to column 24)\"") (Literal - "\" (in 'mother.stan', line 182, column 36 to line 184, column 3)\"") - (Literal "\" (in 'mother.stan', line 187, column 4 to column 24)\"") + "\" (in 'mother.stan', line 182, column 22 to line 184, column 3)\"") + (Literal "\" (in 'mother.stan', line 187, column 4 to column 54)\"") (Literal - "\" (in 'mother.stan', line 186, column 22 to line 188, column 3)\"") - (Literal "\" (in 'mother.stan', line 191, column 4 to column 54)\"") + "\" (in 'mother.stan', line 186, column 29 to line 188, column 3)\"") + (Literal "\" (in 'mother.stan', line 191, column 4 to column 18)\"") + (Literal "\" (in 'mother.stan', line 192, column 4 to column 19)\"") + (Literal "\" (in 'mother.stan', line 193, column 4 to column 26)\"") + (Literal "\" (in 'mother.stan', line 194, column 4 to column 38)\"") (Literal - "\" (in 'mother.stan', line 190, column 29 to line 192, column 3)\"") - (Literal "\" (in 'mother.stan', line 195, column 4 to column 18)\"") - (Literal "\" (in 'mother.stan', line 196, column 4 to column 19)\"") - (Literal "\" (in 'mother.stan', line 197, column 4 to column 26)\"") - (Literal "\" (in 'mother.stan', line 198, column 4 to column 38)\"") + "\" (in 'mother.stan', line 196, column 6 to line 197, column 23)\"") (Literal - "\" (in 'mother.stan', line 200, column 6 to line 201, column 23)\"") + "\" (in 'mother.stan', line 195, column 4 to line 197, column 23)\"") (Literal - "\" (in 'mother.stan', line 199, column 4 to line 201, column 23)\"") + "\" (in 'mother.stan', line 199, column 6 to line 200, column 23)\"") (Literal - "\" (in 'mother.stan', line 203, column 6 to line 204, column 23)\"") + "\" (in 'mother.stan', line 198, column 4 to line 200, column 23)\"") + (Literal "\" (in 'mother.stan', line 201, column 4 to column 32)\"") (Literal - "\" (in 'mother.stan', line 202, column 4 to line 204, column 23)\"") - (Literal "\" (in 'mother.stan', line 205, column 4 to column 32)\"") + "\" (in 'mother.stan', line 190, column 59 to line 202, column 3)\"") + (Literal "\" (in 'mother.stan', line 206, column 4 to column 22)\"") (Literal - "\" (in 'mother.stan', line 194, column 59 to line 206, column 3)\"") - (Literal "\" (in 'mother.stan', line 210, column 4 to column 22)\"") + "\" (in 'mother.stan', line 205, column 66 to line 207, column 3)\"") + (Literal "\" (in 'mother.stan', line 210, column 4 to column 14)\"") (Literal "\" (in 'mother.stan', line 209, column 66 to line 211, column 3)\"") - (Literal "\" (in 'mother.stan', line 214, column 4 to column 14)\"") + (Literal "\" (in 'mother.stan', line 213, column 4 to column 14)\"") (Literal - "\" (in 'mother.stan', line 213, column 66 to line 215, column 3)\"") - (Literal "\" (in 'mother.stan', line 217, column 4 to column 14)\"") + "\" (in 'mother.stan', line 212, column 78 to line 214, column 3)\"") (Literal - "\" (in 'mother.stan', line 216, column 78 to line 218, column 3)\"") + "\" (in 'mother.stan', line 217, column 11 to column 20)\"") (Literal - "\" (in 'mother.stan', line 221, column 11 to column 20)\"") + "\" (in 'mother.stan', line 217, column 22 to column 31)\"") + (Literal "\" (in 'mother.stan', line 217, column 4 to column 35)\"") + (Literal "\" (in 'mother.stan', line 218, column 4 to column 12)\"") + (Literal "\" (in 'mother.stan', line 219, column 4 to column 16)\"") + (Literal "\" (in 'mother.stan', line 220, column 4 to column 24)\"") + (Literal "\" (in 'mother.stan', line 221, column 4 to column 13)\"") (Literal - "\" (in 'mother.stan', line 221, column 22 to column 31)\"") - (Literal "\" (in 'mother.stan', line 221, column 4 to column 35)\"") - (Literal "\" (in 'mother.stan', line 222, column 4 to column 12)\"") - (Literal "\" (in 'mother.stan', line 223, column 4 to column 16)\"") - (Literal "\" (in 'mother.stan', line 224, column 4 to column 24)\"") - (Literal "\" (in 'mother.stan', line 225, column 4 to column 13)\"") + "\" (in 'mother.stan', line 216, column 49 to line 222, column 3)\"") + (Literal "\" (in 'mother.stan', line 226, column 4 to column 16)\"") (Literal - "\" (in 'mother.stan', line 220, column 49 to line 226, column 3)\"") - (Literal "\" (in 'mother.stan', line 230, column 4 to column 16)\"") + "\" (in 'mother.stan', line 225, column 63 to line 227, column 3)\"") + (Literal "\" (in 'mother.stan', line 232, column 4 to column 14)\"") (Literal - "\" (in 'mother.stan', line 229, column 63 to line 231, column 3)\"") - (Literal "\" (in 'mother.stan', line 236, column 4 to column 14)\"") + "\" (in 'mother.stan', line 231, column 62 to line 233, column 3)\"") + (Literal "\" (in 'mother.stan', line 239, column 4 to column 14)\"") (Literal - "\" (in 'mother.stan', line 235, column 62 to line 237, column 3)\"") - (Literal "\" (in 'mother.stan', line 243, column 4 to column 14)\"") + "\" (in 'mother.stan', line 238, column 58 to line 240, column 3)\"") + (Literal "\" (in 'mother.stan', line 246, column 4 to column 14)\"") (Literal - "\" (in 'mother.stan', line 242, column 58 to line 244, column 3)\"") - (Literal "\" (in 'mother.stan', line 250, column 4 to column 14)\"") + "\" (in 'mother.stan', line 245, column 59 to line 247, column 3)\"") + (Literal "\" (in 'mother.stan', line 252, column 4 to column 14)\"") (Literal - "\" (in 'mother.stan', line 249, column 59 to line 251, column 3)\"") - (Literal "\" (in 'mother.stan', line 256, column 4 to column 14)\"") + "\" (in 'mother.stan', line 251, column 63 to line 253, column 3)\"") + (Literal "\" (in 'mother.stan', line 259, column 4 to column 14)\"") (Literal - "\" (in 'mother.stan', line 255, column 63 to line 257, column 3)\"") - (Literal "\" (in 'mother.stan', line 263, column 4 to column 14)\"") + "\" (in 'mother.stan', line 258, column 59 to line 260, column 3)\"") + (Literal "\" (in 'mother.stan', line 266, column 4 to column 14)\"") (Literal - "\" (in 'mother.stan', line 262, column 59 to line 264, column 3)\"") - (Literal "\" (in 'mother.stan', line 270, column 4 to column 14)\"") + "\" (in 'mother.stan', line 265, column 60 to line 267, column 3)\"") + (Literal "\" (in 'mother.stan', line 273, column 4 to column 14)\"") (Literal - "\" (in 'mother.stan', line 269, column 60 to line 271, column 3)\"") - (Literal "\" (in 'mother.stan', line 277, column 4 to column 14)\"") + "\" (in 'mother.stan', line 272, column 33 to line 274, column 3)\"") + (Literal "\" (in 'mother.stan', line 280, column 4 to column 14)\"") (Literal - "\" (in 'mother.stan', line 276, column 33 to line 278, column 3)\"") - (Literal "\" (in 'mother.stan', line 284, column 4 to column 14)\"") + "\" (in 'mother.stan', line 279, column 61 to line 281, column 3)\"") + (Literal "\" (in 'mother.stan', line 287, column 4 to column 14)\"") (Literal - "\" (in 'mother.stan', line 283, column 61 to line 285, column 3)\"") - (Literal "\" (in 'mother.stan', line 291, column 4 to column 14)\"") + "\" (in 'mother.stan', line 286, column 62 to line 288, column 3)\"") + (Literal "\" (in 'mother.stan', line 294, column 4 to column 15)\"") (Literal - "\" (in 'mother.stan', line 290, column 62 to line 292, column 3)\"") - (Literal "\" (in 'mother.stan', line 298, column 4 to column 15)\"") + "\" (in 'mother.stan', line 293, column 34 to line 295, column 3)\"") + (Literal "\" (in 'mother.stan', line 301, column 4 to column 15)\"") (Literal - "\" (in 'mother.stan', line 297, column 34 to line 299, column 3)\"") - (Literal "\" (in 'mother.stan', line 305, column 4 to column 15)\"") + "\" (in 'mother.stan', line 300, column 62 to line 302, column 3)\"") + (Literal "\" (in 'mother.stan', line 308, column 4 to column 15)\"") (Literal - "\" (in 'mother.stan', line 304, column 62 to line 306, column 3)\"") - (Literal "\" (in 'mother.stan', line 312, column 4 to column 15)\"") + "\" (in 'mother.stan', line 307, column 63 to line 309, column 3)\"") + (Literal "\" (in 'mother.stan', line 311, column 4 to column 10)\"") + (Literal "\" (in 'mother.stan', line 312, column 4 to column 11)\"") + (Literal "\" (in 'mother.stan', line 313, column 4 to column 25)\"") + (Literal "\" (in 'mother.stan', line 314, column 4 to column 40)\"") + (Literal "\" (in 'mother.stan', line 315, column 4 to column 27)\"") (Literal - "\" (in 'mother.stan', line 311, column 63 to line 313, column 3)\"") - (Literal "\" (in 'mother.stan', line 315, column 4 to column 10)\"") - (Literal "\" (in 'mother.stan', line 316, column 4 to column 11)\"") - (Literal "\" (in 'mother.stan', line 317, column 4 to column 25)\"") - (Literal "\" (in 'mother.stan', line 318, column 4 to column 40)\"") - (Literal "\" (in 'mother.stan', line 319, column 4 to column 27)\"") + "\" (in 'mother.stan', line 310, column 15 to line 316, column 3)\"") (Literal - "\" (in 'mother.stan', line 314, column 15 to line 320, column 3)\"") + "\" (in 'mother.stan', line 318, column 4 to line 319, column 45)\"") (Literal - "\" (in 'mother.stan', line 322, column 4 to line 323, column 45)\"") + "\" (in 'mother.stan', line 317, column 18 to line 320, column 3)\"") + (Literal "\" (in 'mother.stan', line 322, column 4 to column 44)\"") (Literal - "\" (in 'mother.stan', line 321, column 18 to line 324, column 3)\"") - (Literal "\" (in 'mother.stan', line 326, column 4 to column 44)\"") + "\" (in 'mother.stan', line 321, column 18 to line 323, column 3)\"") + (Literal "\" (in 'mother.stan', line 325, column 4 to column 33)\"") + (Literal "\" (in 'mother.stan', line 326, column 4 to column 13)\"") (Literal - "\" (in 'mother.stan', line 325, column 18 to line 327, column 3)\"") - (Literal "\" (in 'mother.stan', line 329, column 4 to column 33)\"") - (Literal "\" (in 'mother.stan', line 330, column 4 to column 13)\"") + "\" (in 'mother.stan', line 324, column 27 to line 327, column 3)\"") + (Literal "\" (in 'mother.stan', line 329, column 4 to column 57)\"") + (Literal "\" (in 'mother.stan', line 330, column 4 to column 30)\"") (Literal "\" (in 'mother.stan', line 328, column 27 to line 331, column 3)\"") - (Literal "\" (in 'mother.stan', line 333, column 4 to column 57)\"") - (Literal "\" (in 'mother.stan', line 334, column 4 to column 30)\"") - (Literal - "\" (in 'mother.stan', line 332, column 27 to line 335, column 3)\"") - (Literal "\" (in 'mother.stan', line 338, column 4 to column 18)\"") - (Literal "\" (in 'mother.stan', line 339, column 4 to column 25)\"") - (Literal "\" (in 'mother.stan', line 340, column 4 to column 25)\"") - (Literal "\" (in 'mother.stan', line 341, column 4 to column 15)\"") + (Literal "\" (in 'mother.stan', line 334, column 4 to column 18)\"") + (Literal "\" (in 'mother.stan', line 335, column 4 to column 25)\"") + (Literal "\" (in 'mother.stan', line 336, column 4 to column 25)\"") + (Literal "\" (in 'mother.stan', line 337, column 4 to column 15)\"") (Literal - "\" (in 'mother.stan', line 337, column 45 to line 342, column 3)\"") - (Literal "\" (in 'mother.stan', line 346, column 4 to column 19)\"") - (Literal "\" (in 'mother.stan', line 347, column 4 to column 18)\"") - (Literal "\" (in 'mother.stan', line 348, column 4 to column 16)\"") + "\" (in 'mother.stan', line 333, column 45 to line 338, column 3)\"") + (Literal "\" (in 'mother.stan', line 342, column 4 to column 19)\"") + (Literal "\" (in 'mother.stan', line 343, column 4 to column 18)\"") + (Literal "\" (in 'mother.stan', line 344, column 4 to column 16)\"") (Literal - "\" (in 'mother.stan', line 345, column 41 to line 349, column 3)\""))))))) + "\" (in 'mother.stan', line 341, column 41 to line 345, column 3)\""))))))) (FunDef ((templates_init ((()) true)) (inline false) (return_type Int) (name foo) (args diff --git a/test/integration/good/code-gen/mother.stan b/test/integration/good/code-gen/mother.stan index 252fcadf2e..d048f03b14 100644 --- a/test/integration/good/code-gen/mother.stan +++ b/test/integration/good/code-gen/mother.stan @@ -7,16 +7,12 @@ functions { - int foo(int n) { if (n == 0) return 1; return n * foo(n - 1); } - - - array[] real sho(real t, array[] real y, array[] real theta, data array[] real x, data array[] int x_int) { array[2] real dydt; diff --git a/test/integration/good/code-gen/overloading_templating.stan b/test/integration/good/code-gen/overloading_templating.stan index fb177bdb9a..1be85a32f6 100644 --- a/test/integration/good/code-gen/overloading_templating.stan +++ b/test/integration/good/code-gen/overloading_templating.stan @@ -1,8 +1,8 @@ functions { - // test some forward decls - real foo(vector p); - real foo(int p); + + + real foo(int p){ return p + 1.0; diff --git a/test/integration/good/code-gen/recursive-slicing.stan b/test/integration/good/code-gen/recursive-slicing.stan index 1239925953..55971a35e2 100644 --- a/test/integration/good/code-gen/recursive-slicing.stan +++ b/test/integration/good/code-gen/recursive-slicing.stan @@ -30,8 +30,8 @@ real foo(real b){ // mutual recursion -vector test3(vector gamma); -vector test4(vector gamma); + + vector test4(vector gamma) { int D = num_elements(gamma); diff --git a/test/integration/good/code-gen/standalone_functions/basic.stan b/test/integration/good/code-gen/standalone_functions/basic.stan index 36277431ee..e15bc82e28 100644 --- a/test/integration/good/code-gen/standalone_functions/basic.stan +++ b/test/integration/good/code-gen/standalone_functions/basic.stan @@ -1,5 +1,4 @@ functions { - real array_fun(array[] real a); real my_log1p_exp(real x) { return log1p_exp(x); diff --git a/test/integration/good/code-gen/standalone_functions/cpp.expected b/test/integration/good/code-gen/standalone_functions/cpp.expected index 11e94ce437..81dee2deeb 100644 --- a/test/integration/good/code-gen/standalone_functions/cpp.expected +++ b/test/integration/good/code-gen/standalone_functions/cpp.expected @@ -7,26 +7,26 @@ using namespace stan::math; stan::math::profile_map profiles__; static constexpr std::array locations_array__ = {" (found before start of program)", - " (in 'basic.stan', line 5, column 4 to column 24)", - " (in 'basic.stan', line 4, column 28 to line 6, column 3)", - " (in 'basic.stan', line 9, column 4 to column 18)", - " (in 'basic.stan', line 8, column 33 to line 10, column 3)", - " (in 'basic.stan', line 13, column 4 to column 18)", - " (in 'basic.stan', line 12, column 36 to line 14, column 3)", - " (in 'basic.stan', line 17, column 11 to column 26)", - " (in 'basic.stan', line 17, column 4 to column 45)", - " (in 'basic.stan', line 18, column 4 to column 18)", - " (in 'basic.stan', line 16, column 38 to line 19, column 3)", - " (in 'basic.stan', line 22, column 4 to column 17)", - " (in 'basic.stan', line 21, column 44 to line 23, column 3)", - " (in 'basic.stan', line 26, column 4 to column 21)", - " (in 'basic.stan', line 25, column 27 to line 27, column 3)", - " (in 'basic.stan', line 31, column 4 to column 21)", - " (in 'basic.stan', line 30, column 23 to line 32, column 3)", - " (in 'basic.stan', line 35, column 4 to column 28)", - " (in 'basic.stan', line 34, column 24 to line 36, column 3)", - " (in 'basic.stan', line 39, column 4 to column 33)", - " (in 'basic.stan', line 38, column 33 to line 40, column 3)"}; + " (in 'basic.stan', line 4, column 4 to column 24)", + " (in 'basic.stan', line 3, column 28 to line 5, column 3)", + " (in 'basic.stan', line 8, column 4 to column 18)", + " (in 'basic.stan', line 7, column 33 to line 9, column 3)", + " (in 'basic.stan', line 12, column 4 to column 18)", + " (in 'basic.stan', line 11, column 36 to line 13, column 3)", + " (in 'basic.stan', line 16, column 11 to column 26)", + " (in 'basic.stan', line 16, column 4 to column 45)", + " (in 'basic.stan', line 17, column 4 to column 18)", + " (in 'basic.stan', line 15, column 38 to line 18, column 3)", + " (in 'basic.stan', line 21, column 4 to column 17)", + " (in 'basic.stan', line 20, column 44 to line 22, column 3)", + " (in 'basic.stan', line 25, column 4 to column 21)", + " (in 'basic.stan', line 24, column 27 to line 26, column 3)", + " (in 'basic.stan', line 30, column 4 to column 21)", + " (in 'basic.stan', line 29, column 23 to line 31, column 3)", + " (in 'basic.stan', line 34, column 4 to column 28)", + " (in 'basic.stan', line 33, column 24 to line 35, column 3)", + " (in 'basic.stan', line 38, column 4 to column 33)", + " (in 'basic.stan', line 37, column 33 to line 39, column 3)"}; template >* = nullptr> stan::promote_args_t @@ -281,8 +281,6 @@ auto test_lpdf(const double& a, const double& b, std::ostream* pstream__ = nullptr) { return basic_model_namespace::test_lpdf(a, b, pstream__); } -Warning in 'basic.stan', line 2, column 7: Forward declarations are - deprecated and not needed for recursion. $ ../../../../../../install/default/bin/stanc --standalone-functions --print-cpp basic.stanfunctions // Code generated by %%NAME%% %%VERSION%% #include diff --git a/test/integration/good/multiple_funs.stan b/test/integration/good/multiple_funs.stan index e86cf5edf5..4074f5e08d 100644 --- a/test/integration/good/multiple_funs.stan +++ b/test/integration/good/multiple_funs.stan @@ -1,5 +1,4 @@ functions { - int foo(int a); int foo(int a) { return a; } diff --git a/test/integration/good/overloading/pretty.expected b/test/integration/good/overloading/pretty.expected index 7346c3e61c..9df44c823d 100644 --- a/test/integration/good/overloading/pretty.expected +++ b/test/integration/good/overloading/pretty.expected @@ -49,29 +49,6 @@ model { y[t] ~ normal(y_hat[t], sigma); // independent normal noise } - $ ../../../../../install/default/bin/stanc --auto-format forward_decl.stan -functions { - int is_real(int x); - int is_real(real x); - - int is_real(real x) { - return 1; - } - - int is_real(int x) { - return 0; - } -} -transformed data { - if (is_real(1.5)) { - print(is_real(0)); - } -} - -Warning in 'forward_decl.stan', line 2, column 6: Forward declarations are - deprecated and not needed for recursion. -Warning in 'forward_decl.stan', line 3, column 6: Forward declarations are - deprecated and not needed for recursion. $ ../../../../../install/default/bin/stanc --auto-format is_real.stan functions { int is_real(real x) { diff --git a/test/integration/good/pretty.expected b/test/integration/good/pretty.expected index 5ccfb7ba0a..d08f39b3fe 100644 --- a/test/integration/good/pretty.expected +++ b/test/integration/good/pretty.expected @@ -2900,48 +2900,6 @@ model { foo_lp(); } - $ ../../../../install/default/bin/stanc --auto-format fun_log_forward_decl.stan -/** - * this one's for issue #1768, where there was a duplicate fun decl - * because of the instantiation of propto - */ -functions { - real n_lpdf(real y); - - real n_lpdf(real y) { - return -0.5 * square(y); - } -} -parameters { - real mu; -} -model { - mu ~ n(); - target += n_lpdf(mu /*check*/// both instantiations - ); -} - -Warning in 'fun_log_forward_decl.stan', line 6, column 7: Forward - declarations are deprecated and not needed for recursion. - $ ../../../../install/default/bin/stanc --auto-format functions-fwd-ref.stan -functions { - int foo(int n); - - int foo(int n) { - if (n == 0) - return 1; - return n * foo(n - 1); - } -} -parameters { - real y; -} -model { - y ~ normal(0, 1); -} - -Warning in 'functions-fwd-ref.stan', line 3, column 6: Forward declarations - are deprecated and not needed for recursion. $ ../../../../install/default/bin/stanc --auto-format functions-good-void.stan functions { void linear_regression_lp(vector x, vector y, real alpha, real beta, @@ -4056,7 +4014,6 @@ model { $ ../../../../install/default/bin/stanc --auto-format multiple_funs.stan functions { - int foo(int a); int foo(int a) { return a; } @@ -4071,8 +4028,6 @@ model { theta ~ normal(0, 1); } -Warning in 'multiple_funs.stan', line 2, column 6: Forward declarations are - deprecated and not needed for recursion. $ ../../../../install/default/bin/stanc --auto-format neg_binomial_2_log_glm_old_performance.stan transformed data { int N = 50; @@ -5546,9 +5501,6 @@ model { $ ../../../../install/default/bin/stanc --auto-format validate_functions.stan functions { - real my_fun(real x); - real my_fun2(real x, real y); - real my_fun3(data real x); real my_fun(real x) { return 2 * x; } @@ -5578,12 +5530,6 @@ generated quantities { gq_d2 = my_fun3(gq_d1); } -Warning in 'validate_functions.stan', line 2, column 7: Forward declarations - are deprecated and not needed for recursion. -Warning in 'validate_functions.stan', line 3, column 7: Forward declarations - are deprecated and not needed for recursion. -Warning in 'validate_functions.stan', line 4, column 7: Forward declarations - are deprecated and not needed for recursion. $ ../../../../install/default/bin/stanc --auto-format validate_int_divide_good.stan data { int i; diff --git a/test/integration/good/validate_functions.stan b/test/integration/good/validate_functions.stan index 033b60ef27..1af16b0fd5 100644 --- a/test/integration/good/validate_functions.stan +++ b/test/integration/good/validate_functions.stan @@ -1,7 +1,4 @@ functions { - real my_fun(real x); - real my_fun2(real x, real y); - real my_fun3(data real x); real my_fun(real x) { return 2 * x; } diff --git a/test/integration/good/fun_log_forward_decl.stan b/test/integration/good/warning/fun_log_forward_decl.stan similarity index 100% rename from test/integration/good/fun_log_forward_decl.stan rename to test/integration/good/warning/fun_log_forward_decl.stan diff --git a/test/integration/good/functions-fwd-ref.stan b/test/integration/good/warning/functions-fwd-ref.stan similarity index 100% rename from test/integration/good/functions-fwd-ref.stan rename to test/integration/good/warning/functions-fwd-ref.stan diff --git a/test/integration/good/overloading/forward_decl.stan b/test/integration/good/warning/overloaded_forward_decl.stan similarity index 100% rename from test/integration/good/overloading/forward_decl.stan rename to test/integration/good/warning/overloaded_forward_decl.stan diff --git a/test/integration/good/warning/pretty.expected b/test/integration/good/warning/pretty.expected index 6e53112fb0..59718e55e3 100644 --- a/test/integration/good/warning/pretty.expected +++ b/test/integration/good/warning/pretty.expected @@ -1672,6 +1672,48 @@ Warning in 'duplicate-warns.stan', line 11, column 8: normal_ccdf_log is Warning: Empty file 'empty.stan' detected; this is a valid stan model but likely unintended! + $ ../../../../../install/default/bin/stanc --auto-format fun_log_forward_decl.stan +/** + * this one's for issue #1768, where there was a duplicate fun decl + * because of the instantiation of propto + */ +functions { + real n_lpdf(real y); + + real n_lpdf(real y) { + return -0.5 * square(y); + } +} +parameters { + real mu; +} +model { + mu ~ n(); + target += n_lpdf(mu /*check*/// both instantiations + ); +} + +Warning in 'fun_log_forward_decl.stan', line 6, column 7: Forward + declarations are deprecated and not needed for recursion. + $ ../../../../../install/default/bin/stanc --auto-format functions-fwd-ref.stan +functions { + int foo(int n); + + int foo(int n) { + if (n == 0) + return 1; + return n * foo(n - 1); + } +} +parameters { + real y; +} +model { + y ~ normal(0, 1); +} + +Warning in 'functions-fwd-ref.stan', line 3, column 6: Forward declarations + are deprecated and not needed for recursion. $ ../../../../../install/default/bin/stanc --auto-format get-lp-deprecate.stan parameters { real y; @@ -2573,6 +2615,29 @@ Warning in 'old-log-funs.stan', line 3, column 6: multiply_log is deprecated Warning in 'old-log-funs.stan', line 4, column 6: binomial_coefficient_log is deprecated and will be removed in Stan 2.32.0. Use lchoose instead. This can be automatically changed using the canonicalize flag for stanc + $ ../../../../../install/default/bin/stanc --auto-format overloaded_forward_decl.stan +functions { + int is_real(int x); + int is_real(real x); + + int is_real(real x) { + return 1; + } + + int is_real(int x) { + return 0; + } +} +transformed data { + if (is_real(1.5)) { + print(is_real(0)); + } +} + +Warning in 'overloaded_forward_decl.stan', line 2, column 6: Forward + declarations are deprecated and not needed for recursion. +Warning in 'overloaded_forward_decl.stan', line 3, column 6: Forward + declarations are deprecated and not needed for recursion. $ ../../../../../install/default/bin/stanc --auto-format pound-comment-deprecated.stan data { // hey, this is the old way to do things, should raise warning From 003ae57e3f63b9f32c54e07625908b58b690b0a4 Mon Sep 17 00:00:00 2001 From: Niko Huurre Date: Tue, 10 Jan 2023 14:16:34 +0200 Subject: [PATCH 07/13] refactor --- src/stan_math_backend/Lower_functions.ml | 37 +++++++------ src/stan_math_backend/Transform_Mir.ml | 66 ++++++++++++++---------- 2 files changed, 58 insertions(+), 45 deletions(-) diff --git a/src/stan_math_backend/Lower_functions.ml b/src/stan_math_backend/Lower_functions.ml index 0bd43f9935..ee1c9128bb 100644 --- a/src/stan_math_backend/Lower_functions.ml +++ b/src/stan_math_backend/Lower_functions.ml @@ -268,28 +268,31 @@ let collect_functors_functions (p : Program.Numbered.t) : defn list = | {fdname; fdbody= Some _; _} -> Some fdname | _ -> None ) |> String.Set.of_list in + (* overloaded functions generate only one functor struct per name *) let structs = String.Table.create () in + let is_overload (d : _ Program.fun_def) arg_types = + List.equal UnsizedType.equal + (List.map ~f:(fun (_, _, t) -> t) d.fdargs) + arg_types in + let declare_and_define (d : _ Program.fun_def) = + let functors = + Map.find_multi functor_required d.fdname + |> List.stable_dedup + |> List.filter_map ~f:(fun (hof, ts) -> + if is_overload d ts then Some hof else None ) in + let fn, st = lower_fun_def functors d in + List.iter st ~f:(fun s -> + (* Side effecting, collates functor structs *) + Hashtbl.update structs s.struct_name ~f:(function + | Some x -> {x with body= x.body @ s.body} + | None -> s ) ) ; + let decl, defn = Cpp.split_fun_decl_defn fn in + (FunDef decl, FunDef defn) in let fun_decls, fun_defns = p.functions_block |> List.filter_map ~f:(fun d -> if Set.mem fun_has_def d.fdname && Option.is_none d.fdbody then None - else - let functors = - Map.find_multi functor_required d.fdname - |> List.stable_dedup - |> List.filter_map ~f:(fun (x, ts) -> - if - List.equal UnsizedType.equal ts - (List.map ~f:(fun (_, _, t) -> t) d.fdargs) - then Some x - else None ) in - let fn, st = lower_fun_def functors d in - List.iter st ~f:(fun s -> - Hashtbl.update structs s.struct_name ~f:(function - | Some x -> {x with body= x.body @ s.body} - | None -> s ) ) ; - let decl, defn = Cpp.split_fun_decl_defn fn in - Some (FunDef decl, FunDef defn) ) + else Some (declare_and_define d) ) |> List.unzip in let structs = Hashtbl.data structs |> List.map ~f:(fun s -> Struct s) in fun_decls @ structs @ fun_defns diff --git a/src/stan_math_backend/Transform_Mir.ml b/src/stan_math_backend/Transform_Mir.ml index 4dee9ca371..889236355a 100644 --- a/src/stan_math_backend/Transform_Mir.ml +++ b/src/stan_math_backend/Transform_Mir.ml @@ -466,35 +466,48 @@ let trans_prog (p : Program.Typed.t) = |> map Fn.id change_kwrds_stmts) in (* Eval indexed eigen types in UDF calls to prevent infinite template expansion if the call is recursive + + All relevant function calls are recorded transitively in `callgraph`, + meaning if `A` calls `B` and `B` calls `C` then `callgraph[A] = {B,C}`. *) - let callmap = Hashtbl.create (module String) in + let callgraph = String.Table.create () in let eval_eigen_cycles fun_args calls (f : _ Program.fun_def) = - let check_recursive name = - name = f.fdname - || Hashtbl.find callmap name - |> Option.value_map ~default:false ~f:(fun x -> Set.mem x f.fdname) - in let open Expr.Fixed in - let rec eigen_expr = function + let rec is_potentially_recursive = function | {pattern= Var name; _} -> Set.mem fun_args name - | {pattern= Pattern.Indexed (e, _); _} -> eigen_expr e + | {pattern= Indexed (e, _); _} -> is_potentially_recursive e | {pattern= FunApp (StanLib (fname, _, _), e :: _); _} -> - Set.mem eigen_block_expr_fns fname && eigen_expr e + Set.mem eigen_block_expr_fns fname && is_potentially_recursive e | _ -> false in let rec map_args name args = - let is_rec = check_recursive name in - List.map args ~f:(fun e -> - let e = rewrite_expr e in - if not (eigen_expr e) then e - else if is_rec then - {e with pattern= FunApp (StanLib ("eval", FnPlain, AoS), [e])} - else (Hash_set.add calls name ; e) ) + let args = List.map ~f:rewrite_expr args in + let can_recurse, eval_args = + List.fold_map ~init:false + ~f:(fun is_rec e -> + if is_potentially_recursive e then + ( true + , {e with pattern= FunApp (StanLib ("eval", FnPlain, AoS), [e])} + ) + else (is_rec, e) ) + args in + if not can_recurse then args + else if name = f.fdname then eval_args + else + match Hashtbl.find callgraph name with + | Some nested when Hash_set.mem nested f.fdname -> eval_args + | Some nested -> + (* `calls` records all functions reachable from the current function *) + Hash_set.add calls name ; + Hash_set.iter nested ~f:(Hash_set.add calls) ; + args + | None -> Hash_set.add calls name ; args and rewrite_expr = function | {pattern= FunApp ((UserDefined (name, _) as kind), args); _} as e -> {e with pattern= FunApp (kind, map_args name args)} | e -> {e with pattern= Pattern.map rewrite_expr e.pattern} in - let open Stmt.Fixed in - let rec rewrite_stmt = function + let rec rewrite_stmt s = + let open Stmt.Fixed in + match s with | {pattern= Pattern.NRFunApp ((UserDefined (name, _) as kind), args); _} as s -> {s with pattern= NRFunApp (kind, map_args name args)} @@ -503,21 +516,18 @@ let trans_prog (p : Program.Typed.t) = Program.map_fun_def rewrite_stmt f in let break_cycles (Program.{fdname; fdargs; _} as fd) = let fun_args = - List.filter_map - ~f:(fun (_, n, t) -> + List.filter_map fdargs ~f:(fun (_, n, t) -> if UnsizedType.is_eigen_type t then Some n else None ) - fdargs |> String.Set.of_list in if Set.is_empty fun_args then fd else - let calls = Hash_set.create (module String) in + let calls = + Hashtbl.find_or_add callgraph fdname ~default:String.Hash_set.create + in let fndef = eval_eigen_cycles fun_args calls fd in - if not (Hash_set.is_empty calls) then ( - let calls = Hash_set.to_list calls |> String.Set.of_list in - Hashtbl.map_inplace callmap ~f:(fun x -> - if Set.mem x fdname then Set.union calls x else x ) ; - Hashtbl.update callmap fdname - ~f:(Option.value_map ~f:(Set.union calls) ~default:calls) ) ; + (* update `callgraph` with the call paths going through the current function *) + Hashtbl.map_inplace callgraph ~f:(fun x -> + if Hash_set.mem x fdname then Hash_set.union calls x else x ) ; fndef in let p = {p with functions_block= List.map ~f:break_cycles p.functions_block} in let init_pos = From 66e1543a4859a62a8a79f39a4fc3cd1ed296694f Mon Sep 17 00:00:00 2001 From: Niko Huurre Date: Tue, 10 Jan 2023 14:35:04 +0200 Subject: [PATCH 08/13] reword --- src/frontend/Deprecation_analysis.ml | 5 +- .../downstream/rstanarm/inlined.expected | 65 +++++++++++-------- .../downstream/rstanarm/pretty.expected | 65 +++++++++++-------- test/integration/good/warning/pretty.expected | 20 +++--- 4 files changed, 93 insertions(+), 62 deletions(-) diff --git a/src/frontend/Deprecation_analysis.ml b/src/frontend/Deprecation_analysis.ml index 038a29d561..0f58e7ca77 100644 --- a/src/frontend/Deprecation_analysis.ml +++ b/src/frontend/Deprecation_analysis.ml @@ -178,8 +178,9 @@ let rec collect_deprecated_stmt fundefs (acc : (Location_span.t * string) list) when is_redundant_forwarddecl fundefs funname arguments -> acc @ [ ( funname.id_loc - , "Forward declarations are deprecated and not needed for recursion." - ) ] + , "Functions do not need to be declared before definition; all user \ + defined function names are always in scope regardless of \ + defintion order." ) ] | FunDef { body ; funname= {name; id_loc} diff --git a/test/integration/downstream/rstanarm/inlined.expected b/test/integration/downstream/rstanarm/inlined.expected index 803b5bd0e9..decb40c729 100644 --- a/test/integration/downstream/rstanarm/inlined.expected +++ b/test/integration/downstream/rstanarm/inlined.expected @@ -947,8 +947,9 @@ generated quantities { } Warning in './/functions/bernoulli_likelihoods.stan', line 84, column 7, included from -'bernoulli.stan', line 7, column 2: Forward - declarations are deprecated and not needed for recursion. +'bernoulli.stan', line 7, column 2: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. $ ../../../../../install/default/bin/stanc --include-paths="." --auto-format --canonicalize=includes --allow-undefined binomial.stan // This file is part of rstanarm. // Copyright (C) 2015, 2016 2017 Trustees of Columbia University @@ -3302,35 +3303,45 @@ generated quantities { } Warning in './/functions/SSfunctions.stan', line 1, column 7, included from -'continuous.stan', line 9, column 2: Forward - declarations are deprecated and not needed for recursion. +'continuous.stan', line 9, column 2: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. Warning in './/functions/SSfunctions.stan', line 2, column 7, included from -'continuous.stan', line 9, column 2: Forward - declarations are deprecated and not needed for recursion. +'continuous.stan', line 9, column 2: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. Warning in './/functions/SSfunctions.stan', line 3, column 7, included from -'continuous.stan', line 9, column 2: Forward - declarations are deprecated and not needed for recursion. +'continuous.stan', line 9, column 2: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. Warning in './/functions/SSfunctions.stan', line 4, column 7, included from -'continuous.stan', line 9, column 2: Forward - declarations are deprecated and not needed for recursion. +'continuous.stan', line 9, column 2: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. Warning in './/functions/SSfunctions.stan', line 5, column 7, included from -'continuous.stan', line 9, column 2: Forward - declarations are deprecated and not needed for recursion. +'continuous.stan', line 9, column 2: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. Warning in './/functions/SSfunctions.stan', line 6, column 7, included from -'continuous.stan', line 9, column 2: Forward - declarations are deprecated and not needed for recursion. +'continuous.stan', line 9, column 2: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. Warning in './/functions/SSfunctions.stan', line 7, column 7, included from -'continuous.stan', line 9, column 2: Forward - declarations are deprecated and not needed for recursion. +'continuous.stan', line 9, column 2: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. Warning in './/functions/SSfunctions.stan', line 8, column 7, included from -'continuous.stan', line 9, column 2: Forward - declarations are deprecated and not needed for recursion. +'continuous.stan', line 9, column 2: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. Warning in './/functions/SSfunctions.stan', line 9, column 7, included from -'continuous.stan', line 9, column 2: Forward - declarations are deprecated and not needed for recursion. +'continuous.stan', line 9, column 2: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. Warning in './/functions/SSfunctions.stan', line 10, column 7, included from -'continuous.stan', line 9, column 2: Forward - declarations are deprecated and not needed for recursion. +'continuous.stan', line 9, column 2: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. $ ../../../../../install/default/bin/stanc --include-paths="." --auto-format --canonicalize=includes --allow-undefined count.stan // This file is part of rstanarm. // Copyright (C) 2015, 2016 2017 Trustees of Columbia University @@ -7245,8 +7256,9 @@ generated quantities { } Warning in './/functions/bernoulli_likelihoods.stan', line 84, column 7, included from -'jm.stan', line 8, column 0: Forward - declarations are deprecated and not needed for recursion. +'jm.stan', line 8, column 0: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. $ ../../../../../install/default/bin/stanc --include-paths="." --auto-format --canonicalize=includes --allow-undefined lm.stan // This file is part of rstanarm. // Copyright (C) 2015, 2016 2017 Trustees of Columbia University @@ -9307,8 +9319,9 @@ generated quantities { } Warning in './/functions/bernoulli_likelihoods.stan', line 84, column 7, included from -'mvmer.stan', line 8, column 0: Forward - declarations are deprecated and not needed for recursion. +'mvmer.stan', line 8, column 0: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. $ ../../../../../install/default/bin/stanc --include-paths="." --auto-format --canonicalize=includes --allow-undefined polr.stan // This file is part of rstanarm. // Copyright (C) 2015, 2016 2017 Trustees of Columbia University diff --git a/test/integration/downstream/rstanarm/pretty.expected b/test/integration/downstream/rstanarm/pretty.expected index c0ac345cf6..7a587228c8 100644 --- a/test/integration/downstream/rstanarm/pretty.expected +++ b/test/integration/downstream/rstanarm/pretty.expected @@ -201,8 +201,9 @@ generated quantities { } Warning in './/functions/bernoulli_likelihoods.stan', line 84, column 7, included from -'bernoulli.stan', line 7, column 2: Forward - declarations are deprecated and not needed for recursion. +'bernoulli.stan', line 7, column 2: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. $ ../../../../../install/default/bin/stanc --include-paths="." --auto-format --allow-undefined binomial.stan #include /pre/Columbia_copyright.stan #include /pre/license.stan @@ -715,35 +716,45 @@ generated quantities { } Warning in './/functions/SSfunctions.stan', line 1, column 7, included from -'continuous.stan', line 9, column 2: Forward - declarations are deprecated and not needed for recursion. +'continuous.stan', line 9, column 2: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. Warning in './/functions/SSfunctions.stan', line 2, column 7, included from -'continuous.stan', line 9, column 2: Forward - declarations are deprecated and not needed for recursion. +'continuous.stan', line 9, column 2: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. Warning in './/functions/SSfunctions.stan', line 3, column 7, included from -'continuous.stan', line 9, column 2: Forward - declarations are deprecated and not needed for recursion. +'continuous.stan', line 9, column 2: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. Warning in './/functions/SSfunctions.stan', line 4, column 7, included from -'continuous.stan', line 9, column 2: Forward - declarations are deprecated and not needed for recursion. +'continuous.stan', line 9, column 2: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. Warning in './/functions/SSfunctions.stan', line 5, column 7, included from -'continuous.stan', line 9, column 2: Forward - declarations are deprecated and not needed for recursion. +'continuous.stan', line 9, column 2: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. Warning in './/functions/SSfunctions.stan', line 6, column 7, included from -'continuous.stan', line 9, column 2: Forward - declarations are deprecated and not needed for recursion. +'continuous.stan', line 9, column 2: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. Warning in './/functions/SSfunctions.stan', line 7, column 7, included from -'continuous.stan', line 9, column 2: Forward - declarations are deprecated and not needed for recursion. +'continuous.stan', line 9, column 2: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. Warning in './/functions/SSfunctions.stan', line 8, column 7, included from -'continuous.stan', line 9, column 2: Forward - declarations are deprecated and not needed for recursion. +'continuous.stan', line 9, column 2: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. Warning in './/functions/SSfunctions.stan', line 9, column 7, included from -'continuous.stan', line 9, column 2: Forward - declarations are deprecated and not needed for recursion. +'continuous.stan', line 9, column 2: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. Warning in './/functions/SSfunctions.stan', line 10, column 7, included from -'continuous.stan', line 9, column 2: Forward - declarations are deprecated and not needed for recursion. +'continuous.stan', line 9, column 2: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. $ ../../../../../install/default/bin/stanc --include-paths="." --auto-format --allow-undefined count.stan #include /pre/Columbia_copyright.stan #include /pre/license.stan @@ -1114,8 +1125,9 @@ generated quantities { } Warning in './/functions/bernoulli_likelihoods.stan', line 84, column 7, included from -'jm.stan', line 8, column 0: Forward - declarations are deprecated and not needed for recursion. +'jm.stan', line 8, column 0: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. $ ../../../../../install/default/bin/stanc --include-paths="." --auto-format --allow-undefined lm.stan #include /pre/Columbia_copyright.stan #include /pre/license.stan @@ -1313,8 +1325,9 @@ generated quantities { } Warning in './/functions/bernoulli_likelihoods.stan', line 84, column 7, included from -'mvmer.stan', line 8, column 0: Forward - declarations are deprecated and not needed for recursion. +'mvmer.stan', line 8, column 0: Functions + do not need to be declared before definition; all user defined function + names are always in scope regardless of defintion order. $ ../../../../../install/default/bin/stanc --include-paths="." --auto-format --allow-undefined polr.stan #include /pre/Columbia_copyright.stan #include /pre/license.stan diff --git a/test/integration/good/warning/pretty.expected b/test/integration/good/warning/pretty.expected index 59718e55e3..b684a8dfa9 100644 --- a/test/integration/good/warning/pretty.expected +++ b/test/integration/good/warning/pretty.expected @@ -1693,8 +1693,9 @@ model { ); } -Warning in 'fun_log_forward_decl.stan', line 6, column 7: Forward - declarations are deprecated and not needed for recursion. +Warning in 'fun_log_forward_decl.stan', line 6, column 7: Functions do not + need to be declared before definition; all user defined function names + are always in scope regardless of defintion order. $ ../../../../../install/default/bin/stanc --auto-format functions-fwd-ref.stan functions { int foo(int n); @@ -1712,8 +1713,9 @@ model { y ~ normal(0, 1); } -Warning in 'functions-fwd-ref.stan', line 3, column 6: Forward declarations - are deprecated and not needed for recursion. +Warning in 'functions-fwd-ref.stan', line 3, column 6: Functions do not need + to be declared before definition; all user defined function names are + always in scope regardless of defintion order. $ ../../../../../install/default/bin/stanc --auto-format get-lp-deprecate.stan parameters { real y; @@ -2634,10 +2636,12 @@ transformed data { } } -Warning in 'overloaded_forward_decl.stan', line 2, column 6: Forward - declarations are deprecated and not needed for recursion. -Warning in 'overloaded_forward_decl.stan', line 3, column 6: Forward - declarations are deprecated and not needed for recursion. +Warning in 'overloaded_forward_decl.stan', line 2, column 6: Functions do not + need to be declared before definition; all user defined function names + are always in scope regardless of defintion order. +Warning in 'overloaded_forward_decl.stan', line 3, column 6: Functions do not + need to be declared before definition; all user defined function names + are always in scope regardless of defintion order. $ ../../../../../install/default/bin/stanc --auto-format pound-comment-deprecated.stan data { // hey, this is the old way to do things, should raise warning From eb6e4540e73d9488f2ecaa1f781bbb6051b05ec4 Mon Sep 17 00:00:00 2001 From: Niko Huurre Date: Tue, 10 Jan 2023 20:10:01 +0200 Subject: [PATCH 09/13] fix --- src/stan_math_backend/Lower_functions.ml | 16 +- src/stan_math_backend/Transform_Mir.ml | 17 +- test/integration/good/code-gen/cpp.expected | 207 +++++++++++++----- .../good/code-gen/recursive-slicing.stan | 10 +- 4 files changed, 175 insertions(+), 75 deletions(-) diff --git a/src/stan_math_backend/Lower_functions.ml b/src/stan_math_backend/Lower_functions.ml index ee1c9128bb..7abf7f4b0c 100644 --- a/src/stan_math_backend/Lower_functions.ml +++ b/src/stan_math_backend/Lower_functions.ml @@ -263,23 +263,18 @@ let get_functor_requirements (p : Program.Numbered.t) = let collect_functors_functions (p : Program.Numbered.t) : defn list = let functor_required = get_functor_requirements p in - let fun_has_def = - List.filter_map p.functions_block ~f:(function - | {fdname; fdbody= Some _; _} -> Some fdname - | _ -> None ) - |> String.Set.of_list in (* overloaded functions generate only one functor struct per name *) let structs = String.Table.create () in - let is_overload (d : _ Program.fun_def) arg_types = + let matching_argtypes Program.{fdargs; _} arg_types = List.equal UnsizedType.equal - (List.map ~f:(fun (_, _, t) -> t) d.fdargs) + (List.map ~f:(fun (_, _, t) -> t) fdargs) arg_types in let declare_and_define (d : _ Program.fun_def) = let functors = Map.find_multi functor_required d.fdname |> List.stable_dedup |> List.filter_map ~f:(fun (hof, ts) -> - if is_overload d ts then Some hof else None ) in + if matching_argtypes d ts then Some hof else None ) in let fn, st = lower_fun_def functors d in List.iter st ~f:(fun s -> (* Side effecting, collates functor structs *) @@ -291,8 +286,9 @@ let collect_functors_functions (p : Program.Numbered.t) : defn list = let fun_decls, fun_defns = p.functions_block |> List.filter_map ~f:(fun d -> - if Set.mem fun_has_def d.fdname && Option.is_none d.fdbody then None - else Some (declare_and_define d) ) + (* FIXME: external functions don't need decls + but they do need structs (when used in HOF) *) + if Option.is_none d.fdbody then None else Some (declare_and_define d) ) |> List.unzip in let structs = Hashtbl.data structs |> List.map ~f:(fun s -> Struct s) in fun_decls @ structs @ fun_defns diff --git a/src/stan_math_backend/Transform_Mir.ml b/src/stan_math_backend/Transform_Mir.ml index 889236355a..af50e62dc5 100644 --- a/src/stan_math_backend/Transform_Mir.ml +++ b/src/stan_math_backend/Transform_Mir.ml @@ -467,8 +467,16 @@ let trans_prog (p : Program.Typed.t) = (* Eval indexed eigen types in UDF calls to prevent infinite template expansion if the call is recursive + Infinite expansion can happen only when the call graph is cyclic. + The strategy here is to build the call graph one edge at the time + and check if adding that edge creates a cycle. If it does, insert + an `eval()` to stop template expansion. + All relevant function calls are recorded transitively in `callgraph`, meaning if `A` calls `B` and `B` calls `C` then `callgraph[A] = {B,C}`. + In the worst case every function calls every other, `callgraph` has + size O(n²) and this algorithm is O(n³) so it's important to include + only the function calls that really can propagate eigen templates. *) let callgraph = String.Table.create () in let eval_eigen_cycles fun_args calls (f : _ Program.fun_def) = @@ -501,9 +509,16 @@ let trans_prog (p : Program.Typed.t) = Hash_set.iter nested ~f:(Hash_set.add calls) ; args | None -> Hash_set.add calls name ; args - and rewrite_expr = function + and rewrite_expr : Expr.Typed.t -> Expr.Typed.t = function | {pattern= FunApp ((UserDefined (name, _) as kind), args); _} as e -> {e with pattern= FunApp (kind, map_args name args)} + | { pattern= + FunApp + ( (StanLib (_, _, _) as kind) + , ({pattern= Var name; meta= {type_= UFun _; _}} as f) :: args ) + ; _ } as e -> + (* higher-order function -- just pretend it's a direct call *) + {e with pattern= FunApp (kind, f :: map_args name args)} | e -> {e with pattern= Pattern.map rewrite_expr e.pattern} in let rec rewrite_stmt s = let open Stmt.Fixed in diff --git a/test/integration/good/code-gen/cpp.expected b/test/integration/good/code-gen/cpp.expected index d1b0adad95..48c14332f2 100644 --- a/test/integration/good/code-gen/cpp.expected +++ b/test/integration/good/code-gen/cpp.expected @@ -20566,14 +20566,15 @@ namespace recursive_slicing_model_namespace { using stan::model::model_base_crtp; using namespace stan::math; stan::math::profile_map profiles__; -static constexpr std::array locations_array__ = +static constexpr std::array locations_array__ = {" (found before start of program)", - " (in 'recursive-slicing.stan', line 72, column 2 to column 22)", - " (in 'recursive-slicing.stan', line 75, column 2 to column 33)", - " (in 'recursive-slicing.stan', line 68, column 2 to column 8)", - " (in 'recursive-slicing.stan', line 69, column 2 to column 12)", - " (in 'recursive-slicing.stan', line 72, column 9 to column 14)", - " (in 'recursive-slicing.stan', line 75, column 9 to column 10)", + " (in 'recursive-slicing.stan', line 73, column 2 to column 22)", + " (in 'recursive-slicing.stan', line 76, column 2 to column 33)", + " (in 'recursive-slicing.stan', line 77, column 2 to column 52)", + " (in 'recursive-slicing.stan', line 69, column 2 to column 8)", + " (in 'recursive-slicing.stan', line 70, column 2 to column 12)", + " (in 'recursive-slicing.stan', line 73, column 9 to column 14)", + " (in 'recursive-slicing.stan', line 76, column 9 to column 10)", " (in 'recursive-slicing.stan', line 4, column 3 to column 31)", " (in 'recursive-slicing.stan', line 9, column 6 to column 35)", " (in 'recursive-slicing.stan', line 7, column 6 to column 30)", @@ -20590,23 +20591,25 @@ static constexpr std::array locations_array__ = " (in 'recursive-slicing.stan', line 26, column 2 to column 40)", " (in 'recursive-slicing.stan', line 27, column 2 to column 23)", " (in 'recursive-slicing.stan', line 25, column 16 to line 28, column 1)", - " (in 'recursive-slicing.stan', line 36, column 3 to column 31)", - " (in 'recursive-slicing.stan', line 41, column 6 to column 35)", - " (in 'recursive-slicing.stan', line 39, column 6 to column 30)", - " (in 'recursive-slicing.stan', line 38, column 3 to line 41, column 35)", - " (in 'recursive-slicing.stan', line 35, column 27 to line 42, column 3)", - " (in 'recursive-slicing.stan', line 44, column 2 to column 22)", - " (in 'recursive-slicing.stan', line 43, column 27 to line 45, column 1)", - " (in 'recursive-slicing.stan', line 49, column 3 to column 31)", - " (in 'recursive-slicing.stan', line 54, column 6 to column 28)", - " (in 'recursive-slicing.stan', line 52, column 6 to column 22)", - " (in 'recursive-slicing.stan', line 51, column 3 to line 54, column 28)", - " (in 'recursive-slicing.stan', line 48, column 24 to line 55, column 1)", - " (in 'recursive-slicing.stan', line 58, column 3 to column 31)", - " (in 'recursive-slicing.stan', line 63, column 6 to column 38)", - " (in 'recursive-slicing.stan', line 61, column 6 to column 30)", - " (in 'recursive-slicing.stan', line 60, column 3 to line 63, column 38)", - " (in 'recursive-slicing.stan', line 57, column 28 to line 64, column 3)"}; + " (in 'recursive-slicing.stan', line 32, column 3 to column 31)", + " (in 'recursive-slicing.stan', line 37, column 6 to column 35)", + " (in 'recursive-slicing.stan', line 35, column 6 to column 30)", + " (in 'recursive-slicing.stan', line 34, column 3 to line 37, column 35)", + " (in 'recursive-slicing.stan', line 31, column 27 to line 38, column 3)", + " (in 'recursive-slicing.stan', line 40, column 2 to column 22)", + " (in 'recursive-slicing.stan', line 39, column 27 to line 41, column 1)", + " (in 'recursive-slicing.stan', line 45, column 3 to column 31)", + " (in 'recursive-slicing.stan', line 50, column 6 to column 28)", + " (in 'recursive-slicing.stan', line 48, column 6 to column 22)", + " (in 'recursive-slicing.stan', line 47, column 3 to line 50, column 28)", + " (in 'recursive-slicing.stan', line 44, column 24 to line 51, column 1)", + " (in 'recursive-slicing.stan', line 54, column 3 to column 31)", + " (in 'recursive-slicing.stan', line 59, column 6 to column 38)", + " (in 'recursive-slicing.stan', line 57, column 6 to column 30)", + " (in 'recursive-slicing.stan', line 56, column 3 to line 59, column 38)", + " (in 'recursive-slicing.stan', line 53, column 28 to line 60, column 3)", + " (in 'recursive-slicing.stan', line 64, column 4 to column 53)", + " (in 'recursive-slicing.stan', line 63, column 41 to line 65, column 3)"}; template , stan::is_vt_not_complex>* = nullptr> @@ -20644,6 +20647,30 @@ template >* = nullptr> Eigen::Matrix>,-1,1> test7(const T0__& gamma_arg__, std::ostream* pstream__); +template , + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,1> +foo(const T0__& x, const T1__& s_arg__, const T2__& y_arg__, std::ostream* + pstream__); +struct foo_variadic2_functor__ { + template , + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> + Eigen::Matrix, + stan::base_type_t>,-1,1> + operator()(const T0__& x, const T1__& s, std::ostream* pstream__, + const T2__& y) const { + return foo(x, s, y, pstream__); + } +}; template , stan::is_vt_not_complex>*> @@ -20660,14 +20687,14 @@ test2(const T0__& gamma_arg__, std::ostream* pstream__) { (void) DUMMY_VAR__; try { int D = std::numeric_limits::min(); - current_statement__ = 7; + current_statement__ = 8; D = stan::math::num_elements(gamma); - current_statement__ = 10; + current_statement__ = 11; if (stan::math::logical_eq(D, 1)) { - current_statement__ = 9; + current_statement__ = 10; return stan::math::rep_vector(D, 0); } else { - current_statement__ = 8; + current_statement__ = 9; return test2( stan::math::eval( stan::model::rvalue(gamma, "gamma", @@ -20692,13 +20719,13 @@ matrix_pow(const T0__& a_arg__, const int& n, std::ostream* pstream__) { // suppress unused var warning (void) DUMMY_VAR__; try { - current_statement__ = 16; + current_statement__ = 17; if (stan::math::logical_eq(n, 0)) { - current_statement__ = 14; + current_statement__ = 15; return stan::math::diag_matrix( stan::math::rep_vector(1, stan::math::rows(a))); } else { - current_statement__ = 12; + current_statement__ = 13; return stan::math::multiply(a, matrix_pow( stan::math::eval( @@ -20726,7 +20753,7 @@ foo(const T0__& a_arg__, std::ostream* pstream__) { // suppress unused var warning (void) DUMMY_VAR__; try { - current_statement__ = 18; + current_statement__ = 19; return 1; } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); @@ -20745,10 +20772,10 @@ stan::promote_args_t foo(const T0__& b, std::ostream* pstream__) { try { Eigen::Matrix B = Eigen::Matrix::Constant(10, 10, DUMMY_VAR__); - current_statement__ = 20; + current_statement__ = 21; stan::model::assign(B, stan::math::rep_matrix(b, 10, 10), "assigning variable B"); - current_statement__ = 21; + current_statement__ = 22; return foo( stan::model::rvalue(B, "B", stan::model::index_omni(), stan::model::index_min_max(2, 4)), pstream__); @@ -20772,14 +20799,14 @@ test4(const T0__& gamma_arg__, std::ostream* pstream__) { (void) DUMMY_VAR__; try { int D = std::numeric_limits::min(); - current_statement__ = 23; + current_statement__ = 24; D = stan::math::num_elements(gamma); - current_statement__ = 26; + current_statement__ = 27; if (stan::math::logical_eq(D, 1)) { - current_statement__ = 25; + current_statement__ = 26; return stan::math::rep_vector(D, 0); } else { - current_statement__ = 24; + current_statement__ = 25; return test3( stan::model::rvalue(gamma, "gamma", stan::model::index_min_max(1, (D - 1))), pstream__); @@ -20803,7 +20830,7 @@ test3(const T0__& gamma_arg__, std::ostream* pstream__) { // suppress unused var warning (void) DUMMY_VAR__; try { - current_statement__ = 28; + current_statement__ = 29; return test4(stan::math::eval(gamma), pstream__); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); @@ -20824,18 +20851,18 @@ void test6(const T0__& alpha_arg__, std::ostream* pstream__) { (void) DUMMY_VAR__; try { int D = std::numeric_limits::min(); - current_statement__ = 30; + current_statement__ = 31; D = stan::math::num_elements(alpha); - current_statement__ = 33; + current_statement__ = 34; if (stan::math::logical_eq(D, 1)) { - current_statement__ = 32; + current_statement__ = 33; if (pstream__) { stan::math::stan_print(pstream__, stan::model::rvalue(alpha, "alpha", stan::model::index_uni(1))); stan::math::stan_print(pstream__, "\n"); } } else { - current_statement__ = 31; + current_statement__ = 32; test6( stan::math::eval( stan::model::rvalue(alpha, "alpha", @@ -20861,14 +20888,14 @@ test7(const T0__& gamma_arg__, std::ostream* pstream__) { (void) DUMMY_VAR__; try { int D = std::numeric_limits::min(); - current_statement__ = 35; + current_statement__ = 36; D = stan::math::num_elements(gamma); - current_statement__ = 38; + current_statement__ = 39; if (stan::math::logical_eq(D, 1)) { - current_statement__ = 37; + current_statement__ = 38; return stan::math::rep_vector(D, 0); } else { - current_statement__ = 36; + current_statement__ = 37; return test7(stan::math::eval(stan::math::head(gamma, (D - 1))), pstream__); } @@ -20876,6 +20903,42 @@ test7(const T0__& gamma_arg__, std::ostream* pstream__) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } +template , + stan::is_col_vector, + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>*> +Eigen::Matrix, + stan::base_type_t>,-1,1> +foo(const T0__& x, const T1__& s_arg__, const T2__& y_arg__, std::ostream* + pstream__) { + using local_scalar_t__ = stan::promote_args_t, + stan::base_type_t>; + int current_statement__ = 0; + const auto& s = stan::math::to_ref(s_arg__); + const auto& y = stan::math::to_ref(y_arg__); + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 41; + return stan::model::rvalue( + stan::math::ode_rk45(foo_variadic2_functor__(), + (Eigen::Matrix(1) << 1).finished(), 0.0, + std::vector{1.0}, pstream__, + stan::math::eval( + stan::model::rvalue(y, "y", stan::model::index_min(2)))), + "ode_rk45(foo, Transpose__(FnMakeRowVec__(promote(1, real))), 0.0,\nFnMakeArray__(1.0),\neval(y[2:]))", + stan::model::index_uni(1)); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} class recursive_slicing_model final : public model_base_crtp { private: int N; @@ -20901,21 +20964,21 @@ class recursive_slicing_model final : public model_base_crtp::min(); pos__ = 1; - current_statement__ = 3; + current_statement__ = 4; context__.validate_dims("data initialization", "N", "int", std::vector{}); N = std::numeric_limits::min(); - current_statement__ = 3; - N = context__.vals_i("N")[(1 - 1)]; current_statement__ = 4; + N = context__.vals_i("N")[(1 - 1)]; + current_statement__ = 5; context__.validate_dims("data initialization", "times", "int", std::vector{}); times = std::numeric_limits::min(); - current_statement__ = 4; - times = context__.vals_i("times")[(1 - 1)]; current_statement__ = 5; - stan::math::validate_non_negative_index("gamma", "times", times); + times = context__.vals_i("times")[(1 - 1)]; current_statement__ = 6; + stan::math::validate_non_negative_index("gamma", "times", times); + current_statement__ = 7; stan::math::validate_non_negative_index("z_hat", "N", N); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); @@ -20958,6 +21021,12 @@ class recursive_slicing_model final : public model_base_crtp z = + Eigen::Matrix::Constant(3, DUMMY_VAR__); + current_statement__ = 3; + stan::model::assign(z, + foo(1.0, gamma, stan::math::diag_matrix(gamma), pstream__), + "assigning variable z"); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } @@ -21003,6 +21072,9 @@ class recursive_slicing_model final : public model_base_crtp z_hat = Eigen::Matrix::Constant(N, std::numeric_limits::quiet_NaN()); + Eigen::Matrix z = + Eigen::Matrix::Constant(3, + std::numeric_limits::quiet_NaN()); out__.write(gamma); if (stan::math::logical_negation( (stan::math::primitive_value(emit_transformed_parameters__) || @@ -21012,8 +21084,13 @@ class recursive_slicing_model final : public model_base_crtp& names__) const { - names__ = std::vector{"gamma", "z_hat"}; + names__ = std::vector{"gamma", "z_hat", "z"}; } inline void get_dims(std::vector>& dimss__) const { dimss__ = std::vector>{std::vector{static_cast< size_t>( times)}, - std::vector{static_cast(N)}}; + std::vector{static_cast(N)}, + std::vector{static_cast(3)}}; } inline void constrained_param_names(std::vector& param_names__, bool @@ -21071,6 +21149,10 @@ class recursive_slicing_model final : public model_base_crtp inline void @@ -21104,7 +21190,7 @@ class recursive_slicing_model final : public model_base_crtp& y_slice, const int& start, const int& end, try { current_statement__ = 221; return stan::math::reduce_sum(y_slice, 1, pstream__, a, b, - c, d, e, f, g, h, i, j, k, l, m, n, o, p, q); + stan::math::eval(c), stan::math::eval(d), stan::math::eval(e), + f, g, h, i, j, k, l, m, n, o, p, q); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } diff --git a/test/integration/good/code-gen/recursive-slicing.stan b/test/integration/good/code-gen/recursive-slicing.stan index 55971a35e2..0f066c6250 100644 --- a/test/integration/good/code-gen/recursive-slicing.stan +++ b/test/integration/good/code-gen/recursive-slicing.stan @@ -27,11 +27,7 @@ real foo(real b){ return foo(B[:,2:4]); } - // mutual recursion - - - vector test4(vector gamma) { int D = num_elements(gamma); @@ -63,6 +59,11 @@ void test6(vector alpha){ return test7(head(gamma,D - 1)); } + // recursion through higher-order function + vector foo(real x, vector s, matrix y) { + return ode_rk45(foo, [1]', 0.0, {1.0}, y[2:])[1]; + } + } data { int N; @@ -73,4 +74,5 @@ parameters { } transformed parameters { vector[N] z_hat = test2(gamma); + vector[3] z = foo(1.0, gamma, diag_matrix(gamma)); } From c6e3b0a27698fcca48f77f700e74224507a07b63 Mon Sep 17 00:00:00 2001 From: Niko Huurre Date: Tue, 10 Jan 2023 21:32:47 +0200 Subject: [PATCH 10/13] fix function inlining --- src/analysis_and_optimization/Optimize.ml | 69 +++++++++++------------ 1 file changed, 32 insertions(+), 37 deletions(-) diff --git a/src/analysis_and_optimization/Optimize.ml b/src/analysis_and_optimization/Optimize.ml index e4371dc196..6e9c9184e0 100644 --- a/src/analysis_and_optimization/Optimize.ml +++ b/src/analysis_and_optimization/Optimize.ml @@ -448,47 +448,42 @@ let rec inline_function_statement propto adt fim Stmt.Fixed.{pattern; meta} = ; meta } let create_function_inline_map adt l = - (* We only add the first definition for each function to the inline map. - This will make sure we do not inline recursive functions. - We also don't want to add any function declaration (as opposed to - definitions), because that would replace the function call with a Skip. - *) - let f (accum, visited) Program.{fdname; fdargs; fdbody; fdrt; _} = - (* If we see a function more than once, - remove it to prevent inlining of overloaded functions - *) - if Set.mem visited fdname then (Map.remove accum fdname, visited) - else - let accum' = - match fdbody with - | None -> accum - | Some fdbody -> ( - let create_data propto = - ( Option.map ~f:(fun x -> Type.Unsized x) fdrt - , List.map ~f:(fun (_, name, _) -> name) fdargs - , inline_function_statement propto adt accum fdbody ) in - match Middle.Utils.with_unnormalized_suffix fdname with - | None -> ( - let data = create_data true in - match Map.add accum ~key:fdname ~data with - | `Ok m -> m - | `Duplicate -> accum ) - | Some fdname' -> - let data = create_data false in - let data' = create_data true in - let m = - Map.Poly.of_alist_exn [(fdname, data); (fdname', data')] in - Map.merge_skewed accum m ~combine:(fun ~key:_ f _ -> f) ) in - let visited' = Set.add visited fdname in - (accum', visited') in - let accum, _ = List.fold l ~init:(Map.Poly.empty, Set.Poly.empty) ~f in - accum + let f accum Program.{fdname; fdargs; fdbody; fdrt; _} = + match fdbody with + | None -> accum + | Some fdbody -> ( + let create_data propto = + ( Option.map ~f:(fun x -> Type.Unsized x) fdrt + , List.map ~f:(fun (_, name, _) -> name) fdargs + , inline_function_statement propto adt accum fdbody ) in + match Middle.Utils.with_unnormalized_suffix fdname with + | None -> ( + let data = create_data true in + match Map.add accum ~key:fdname ~data with + | `Ok m -> m + | `Duplicate -> accum ) + | Some fdname' -> + let data = create_data false in + let data' = create_data true in + let m = Map.Poly.of_alist_exn [(fdname, data); (fdname', data')] in + Map.merge_skewed accum m ~combine:(fun ~key:_ f _ -> f) ) in + List.fold l ~init:Map.Poly.empty ~f let function_inlining (mir : Program.Typed.t) = + (* We add only the functions with a single definition to the inline map. + Overloaded functions cannot be inlined. *) + let can_inline = + List.fold mir.functions_block ~init:String.Map.empty + ~f:(fun accum Program.{fdname; _} -> + Map.update accum fdname + ~f:(Option.value_map ~default:true ~f:(fun _ -> false)) ) in + let inlineable_functions = + List.filter mir.functions_block ~f:(fun Program.{fdname; _} -> + Map.find_exn can_inline fdname ) in let dataonly_inline_map = - create_function_inline_map UnsizedType.DataOnly mir.functions_block in + create_function_inline_map UnsizedType.DataOnly inlineable_functions in let autodiff_inline_map = - create_function_inline_map UnsizedType.AutoDiffable mir.functions_block + create_function_inline_map UnsizedType.AutoDiffable inlineable_functions in let dataonly_inline_function_statements = List.map From 1a9811931319c5e66750a7d1b5399916af6d739f Mon Sep 17 00:00:00 2001 From: Niko Huurre Date: Wed, 11 Jan 2023 14:24:41 +0200 Subject: [PATCH 11/13] add tests --- src/stan_math_backend/Transform_Mir.ml | 15 +- .../compiler-optimizations/cppO0.expected | 326 ++++++++++++++++++ .../overloaded-fn2.stan | 15 + test/integration/good/pretty.expected | 17 + .../integration/good/recursive-functions.stan | 15 + 5 files changed, 381 insertions(+), 7 deletions(-) create mode 100644 test/integration/good/compiler-optimizations/overloaded-fn2.stan create mode 100644 test/integration/good/recursive-functions.stan diff --git a/src/stan_math_backend/Transform_Mir.ml b/src/stan_math_backend/Transform_Mir.ml index af50e62dc5..71466cdc02 100644 --- a/src/stan_math_backend/Transform_Mir.ml +++ b/src/stan_math_backend/Transform_Mir.ml @@ -475,7 +475,7 @@ let trans_prog (p : Program.Typed.t) = All relevant function calls are recorded transitively in `callgraph`, meaning if `A` calls `B` and `B` calls `C` then `callgraph[A] = {B,C}`. In the worst case every function calls every other, `callgraph` has - size O(n²) and this algorithm is O(n³) so it's important to include + size O(n^2) and this algorithm is O(n^3) so it's important to track only the function calls that really can propagate eigen templates. *) let callgraph = String.Table.create () in @@ -536,13 +536,14 @@ let trans_prog (p : Program.Typed.t) = |> String.Set.of_list in if Set.is_empty fun_args then fd else - let calls = - Hashtbl.find_or_add callgraph fdname ~default:String.Hash_set.create - in + let calls = String.Hash_set.create () in let fndef = eval_eigen_cycles fun_args calls fd in - (* update `callgraph` with the call paths going through the current function *) - Hashtbl.map_inplace callgraph ~f:(fun x -> - if Hash_set.mem x fdname then Hash_set.union calls x else x ) ; + if not (Hash_set.is_empty calls) then ( + (* update `callgraph` with the call paths going through the current function *) + Hashtbl.map_inplace callgraph ~f:(fun x -> + if Hash_set.mem x fdname then Hash_set.union calls x else x ) ; + Hashtbl.update callgraph fdname + ~f:(Option.value_map ~f:(Hash_set.union calls) ~default:calls) ) ; fndef in let p = {p with functions_block= List.map ~f:break_cycles p.functions_block} in let init_pos = diff --git a/test/integration/good/compiler-optimizations/cppO0.expected b/test/integration/good/compiler-optimizations/cppO0.expected index 10359afcd6..7489517773 100644 --- a/test/integration/good/compiler-optimizations/cppO0.expected +++ b/test/integration/good/compiler-optimizations/cppO0.expected @@ -17994,6 +17994,332 @@ new_model(stan::io::var_context& data_context, unsigned int seed, stan::math::profile_map& get_stan_profile_data() { return overloaded_fn_model_namespace::profiles__; } +#endif + $ ../../../../../install/default/bin/stanc --print-cpp --O0 overloaded-fn2.stan +// Code generated by %%NAME%% %%VERSION%% +#include +namespace overloaded_fn2_model_namespace { +using stan::model::model_base_crtp; +using namespace stan::math; +stan::math::profile_map profiles__; +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'overloaded-fn2.stan', line 14, column 2 to column 11)", + " (in 'overloaded-fn2.stan', line 3, column 4 to column 18)", + " (in 'overloaded-fn2.stan', line 2, column 21 to line 4, column 3)", + " (in 'overloaded-fn2.stan', line 7, column 4 to column 26)", + " (in 'overloaded-fn2.stan', line 5, column 16 to line 8, column 3)", + " (in 'overloaded-fn2.stan', line 10, column 4 to column 16)", + " (in 'overloaded-fn2.stan', line 9, column 21 to line 11, column 3)"}; +template , + stan::is_vt_not_complex>* = nullptr> +stan::promote_args_t> +foo(const T0__& x_arg__, std::ostream* pstream__); +template void +bar_lp(T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__); +template >* = nullptr> +Eigen::Matrix,-1,1> +foo(const T0__& x, std::ostream* pstream__); +template , + stan::is_vt_not_complex>*> +stan::promote_args_t> +foo(const T0__& x_arg__, std::ostream* pstream__) { + using local_scalar_t__ = stan::promote_args_t>; + int current_statement__ = 0; + const auto& x = stan::math::to_ref(x_arg__); + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 2; + return stan::math::sum(x); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +template void +bar_lp(T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) { + using local_scalar_t__ = double; + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 4; + lp_accum__.add(stan::model::rvalue(foo(1.0, pstream__), "foo(1.0)", + stan::model::index_uni(1))); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +template >*> +Eigen::Matrix,-1,1> +foo(const T0__& x, std::ostream* pstream__) { + using local_scalar_t__ = stan::promote_args_t; + int current_statement__ = 0; + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 6; + return (Eigen::Matrix(1) << x).finished(); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +class overloaded_fn2_model final : public model_base_crtp { + private: + + public: + ~overloaded_fn2_model() {} + overloaded_fn2_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__ = + "overloaded_fn2_model_namespace::overloaded_fn2_model"; + // suppress unused var warning + (void) function__; + 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; + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + num_params_r__ = 0U; + } + inline std::string model_name() const final { + return "overloaded_fn2_model"; + } + inline std::vector model_compile_info() const noexcept { + return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", + "stancflags = --print-cpp --O0"}; + } + 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__; + stan::io::deserializer in__(params_r__, params_i__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + static constexpr const char* function__ = + "overloaded_fn2_model_namespace::log_prob"; + // suppress unused var warning + (void) function__; + try { + current_statement__ = 1; + bar_lp(lp__, lp_accum__, pstream__); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + lp_accum__.add(lp__); + return lp_accum__.sum(); + } + 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; + 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; + // 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()); + // suppress unused var warning + (void) DUMMY_VAR__; + constexpr bool jacobian__ = false; + static constexpr const char* function__ = + "overloaded_fn2_model_namespace::write_array"; + // suppress unused var warning + (void) function__; + try { + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { + return ; + } + if (stan::math::logical_negation(emit_generated_quantities__)) { + return ; + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline void + transform_inits_impl(VecVar& params_r__, 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; + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + inline void get_param_names(std::vector& names__) const { + names__ = std::vector{}; + } + inline void get_dims(std::vector>& dimss__) const { + dimss__ = std::vector>{}; + } + inline void + constrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { + if (emit_transformed_parameters__) {} + 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 { + if (emit_transformed_parameters__) {} + if (emit_generated_quantities__) {} + } + inline std::string get_constrained_sizedtypes() const { + return std::string("[]"); + } + inline std::string get_unconstrained_sizedtypes() const { + return std::string("[]"); + } + // 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__ = 0; + const size_t num_transformed = emit_transformed_parameters * (0); + 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__ = 0; + const size_t num_transformed = emit_transformed_parameters * (0); + 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 { + constexpr std::array names__{}; + const std::array constrain_param_sizes__{}; + const auto num_constrained_params__ = + std::accumulate(constrain_param_sizes__.begin(), + constrain_param_sizes__.end(), 0); + std::vector params_r_flat__(num_constrained_params__); + Eigen::Index size_iter__ = 0; + Eigen::Index flat_iter__ = 0; + for (auto&& param_name__: names__) { + const auto param_vec__ = context.vals_r(param_name__); + for (Eigen::Index i = 0; i < constrain_param_sizes__[size_iter__]; ++i) { + params_r_flat__[flat_iter__] = param_vec__[i]; + ++flat_iter__; + } + ++size_iter__; + } + vars.resize(num_params_r__); + transform_inits_impl(params_r_flat__, params_i, vars, pstream__); + } +}; +} +using stan_model = overloaded_fn2_model_namespace::overloaded_fn2_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* m = new stan_model(data_context, seed, msg_stream); + return *m; +} +stan::math::profile_map& get_stan_profile_data() { + return overloaded_fn2_model_namespace::profiles__; +} #endif $ ../../../../../install/default/bin/stanc --print-cpp --O0 partial-eval.stan // Code generated by %%NAME%% %%VERSION%% diff --git a/test/integration/good/compiler-optimizations/overloaded-fn2.stan b/test/integration/good/compiler-optimizations/overloaded-fn2.stan new file mode 100644 index 0000000000..ebfb984bff --- /dev/null +++ b/test/integration/good/compiler-optimizations/overloaded-fn2.stan @@ -0,0 +1,15 @@ +functions { + real foo(vector x) { + return sum(x); + } + void bar_lp() { + // this `foo` is the one below, not above + target += foo(1.0)[1]; + } + vector foo(real x) { + return [x]'; + } +} +model { + bar_lp(); +} \ No newline at end of file diff --git a/test/integration/good/pretty.expected b/test/integration/good/pretty.expected index d08f39b3fe..3d070b4a85 100644 --- a/test/integration/good/pretty.expected +++ b/test/integration/good/pretty.expected @@ -4464,6 +4464,23 @@ model { $ ../../../../install/default/bin/stanc --auto-format propto-good.stan model { target += normal_lupdf(1 | 0, 1); +} + + $ ../../../../install/default/bin/stanc --auto-format recursive-functions.stan +functions { + // no forward declarations + real foo(real baz) { + return bar(baz); + } + real bar(real bar) { + return foo(bar); + } + real baz(real foo) { + return baz(foo); + } +} +model { + } $ ../../../../install/default/bin/stanc --auto-format rng_loc.stan diff --git a/test/integration/good/recursive-functions.stan b/test/integration/good/recursive-functions.stan new file mode 100644 index 0000000000..8932b52f0c --- /dev/null +++ b/test/integration/good/recursive-functions.stan @@ -0,0 +1,15 @@ +functions { + // no forward declarations + real foo(real baz) { + return bar(baz); + } + real bar(real bar) { + return foo(bar); + } + real baz(real foo) { + return baz(foo); + } +} +model { + +} \ No newline at end of file From 3610da4399b9f942c467781713d5510e4e92a762 Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Wed, 11 Jan 2023 09:45:01 -0500 Subject: [PATCH 12/13] Add new test to list of files --- .../good/compiler-optimizations/cpp.expected | 341 ++++++++++ .../compiler-optimizations/cppO1.expected | 623 ++++++++++++++++++ .../good/compiler-optimizations/dune | 3 + 3 files changed, 967 insertions(+) diff --git a/test/integration/good/compiler-optimizations/cpp.expected b/test/integration/good/compiler-optimizations/cpp.expected index dc9fc5c6e8..22545b31f3 100644 --- a/test/integration/good/compiler-optimizations/cpp.expected +++ b/test/integration/good/compiler-optimizations/cpp.expected @@ -26334,6 +26334,347 @@ new_model(stan::io::var_context& data_context, unsigned int seed, stan::math::profile_map& get_stan_profile_data() { return overloaded_fn_model_namespace::profiles__; } +#endif + $ ../../../../../install/default/bin/stanc --O --print-cpp overloaded-fn2.stan +// Code generated by %%NAME%% %%VERSION%% +#include +namespace overloaded_fn2_model_namespace { +using stan::model::model_base_crtp; +using namespace stan::math; +stan::math::profile_map profiles__; +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'overloaded-fn2.stan', line 7, column 4 to column 26)", + " (in 'overloaded-fn2.stan', line 14, column 2 to column 11)", + " (in 'overloaded-fn2.stan', line 3, column 4 to column 18)", + " (in 'overloaded-fn2.stan', line 2, column 21 to line 4, column 3)", + " (in 'overloaded-fn2.stan', line 5, column 16 to line 8, column 3)", + " (in 'overloaded-fn2.stan', line 10, column 4 to column 16)", + " (in 'overloaded-fn2.stan', line 9, column 21 to line 11, column 3)"}; +template , + stan::is_vt_not_complex>* = nullptr> +stan::promote_args_t> +foo(const T0__& x_arg__, std::ostream* pstream__); +template void +bar_lp(T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__); +template >* = nullptr> +Eigen::Matrix,-1,1> +foo(const T0__& x, std::ostream* pstream__); +template , + stan::is_vt_not_complex>*> +stan::promote_args_t> +foo(const T0__& x_arg__, std::ostream* pstream__) { + using local_scalar_t__ = stan::promote_args_t>; + int current_statement__ = 0; + const auto& x = stan::math::to_ref(x_arg__); + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + double lcm_sym2__; + { + current_statement__ = 3; + return stan::math::sum(x); + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +template void +bar_lp(T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) { + using local_scalar_t__ = double; + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + double lcm_sym3__; + { + current_statement__ = 1; + lp_accum__.add(stan::model::rvalue(foo(1.0, pstream__), "foo(1.0)", + stan::model::index_uni(1))); + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +template >*> +Eigen::Matrix,-1,1> +foo(const T0__& x, std::ostream* pstream__) { + using local_scalar_t__ = stan::promote_args_t; + int current_statement__ = 0; + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + Eigen::Matrix lcm_sym4__; + { + current_statement__ = 6; + return (Eigen::Matrix(1) << x).finished(); + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +class overloaded_fn2_model final : public model_base_crtp { + private: + + public: + ~overloaded_fn2_model() {} + overloaded_fn2_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__ = + "overloaded_fn2_model_namespace::overloaded_fn2_model"; + // suppress unused var warning + (void) function__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + int pos__; + pos__ = 1; + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + num_params_r__ = 0U; + } + inline std::string model_name() const final { + return "overloaded_fn2_model"; + } + inline std::vector model_compile_info() const noexcept { + return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", + "stancflags = --O --print-cpp"}; + } + 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__; + stan::io::deserializer in__(params_r__, params_i__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + static constexpr const char* function__ = + "overloaded_fn2_model_namespace::log_prob"; + // suppress unused var warning + (void) function__; + try { + double lcm_sym7__; + { + current_statement__ = 1; + lp_accum__.add(stan::model::rvalue(foo(1.0, pstream__), "foo(1.0)", + stan::model::index_uni(1))); + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + lp_accum__.add(lp__); + return lp_accum__.sum(); + } + 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; + 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; + // 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()); + // suppress unused var warning + (void) DUMMY_VAR__; + constexpr bool jacobian__ = false; + static constexpr const char* function__ = + "overloaded_fn2_model_namespace::write_array"; + // suppress unused var warning + (void) function__; + try { + int lcm_sym6__; + int lcm_sym5__; + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { + return ; + } + if (stan::math::logical_negation(emit_generated_quantities__)) { + return ; + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline void + transform_inits_impl(VecVar& params_r__, 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__; + pos__ = 1; + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + inline void get_param_names(std::vector& names__) const { + names__ = std::vector{}; + } + inline void get_dims(std::vector>& dimss__) const { + dimss__ = std::vector>{}; + } + inline void + constrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { + if (emit_transformed_parameters__) {} + 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 { + if (emit_transformed_parameters__) {} + if (emit_generated_quantities__) {} + } + inline std::string get_constrained_sizedtypes() const { + return std::string("[]"); + } + inline std::string get_unconstrained_sizedtypes() const { + return std::string("[]"); + } + // 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__ = 0; + const size_t num_transformed = emit_transformed_parameters * (0); + 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__ = 0; + const size_t num_transformed = emit_transformed_parameters * (0); + 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 { + constexpr std::array names__{}; + const std::array constrain_param_sizes__{}; + const auto num_constrained_params__ = + std::accumulate(constrain_param_sizes__.begin(), + constrain_param_sizes__.end(), 0); + std::vector params_r_flat__(num_constrained_params__); + Eigen::Index size_iter__ = 0; + Eigen::Index flat_iter__ = 0; + for (auto&& param_name__: names__) { + const auto param_vec__ = context.vals_r(param_name__); + for (Eigen::Index i = 0; i < constrain_param_sizes__[size_iter__]; ++i) { + params_r_flat__[flat_iter__] = param_vec__[i]; + ++flat_iter__; + } + ++size_iter__; + } + vars.resize(num_params_r__); + transform_inits_impl(params_r_flat__, params_i, vars, pstream__); + } +}; +} +using stan_model = overloaded_fn2_model_namespace::overloaded_fn2_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* m = new stan_model(data_context, seed, msg_stream); + return *m; +} +stan::math::profile_map& get_stan_profile_data() { + return overloaded_fn2_model_namespace::profiles__; +} #endif $ ../../../../../install/default/bin/stanc --O --print-cpp partial-eval.stan // Code generated by %%NAME%% %%VERSION%% diff --git a/test/integration/good/compiler-optimizations/cppO1.expected b/test/integration/good/compiler-optimizations/cppO1.expected index 623f7a0add..e1c04384de 100644 --- a/test/integration/good/compiler-optimizations/cppO1.expected +++ b/test/integration/good/compiler-optimizations/cppO1.expected @@ -18330,6 +18330,629 @@ new_model(stan::io::var_context& data_context, unsigned int seed, stan::math::profile_map& get_stan_profile_data() { return optimizations_model_namespace::profiles__; } +#endif + $ ../../../../../install/default/bin/stanc --O1 --print-cpp overloaded-fn.stan +// Code generated by %%NAME%% %%VERSION%% +#include +namespace overloaded_fn_model_namespace { +using stan::model::model_base_crtp; +using namespace stan::math; +stan::math::profile_map profiles__; +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'overloaded-fn.stan', line 13, column 2 to column 22)", + " (in 'overloaded-fn.stan', line 3, column 5 to column 20)", + " (in 'overloaded-fn.stan', line 2, column 20 to line 4, column 4)", + " (in 'overloaded-fn.stan', line 7, column 5 to column 20)", + " (in 'overloaded-fn.stan', line 6, column 19 to line 8, column 4)"}; +template >* = nullptr> +stan::promote_args_t dumb(const T0__& x, std::ostream* pstream__); +double dumb(const int& x, std::ostream* pstream__); +template >*> +stan::promote_args_t dumb(const T0__& x, std::ostream* pstream__) { + using local_scalar_t__ = stan::promote_args_t; + int current_statement__ = 0; + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 2; + return (x + 0.5); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +double dumb(const int& x, std::ostream* pstream__) { + using local_scalar_t__ = double; + int current_statement__ = 0; + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 4; + return (x - 0.5); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +class overloaded_fn_model final : public model_base_crtp { + private: + + public: + ~overloaded_fn_model() {} + overloaded_fn_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__ = + "overloaded_fn_model_namespace::overloaded_fn_model"; + // suppress unused var warning + (void) function__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + int pos__; + pos__ = 1; + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + num_params_r__ = 0U; + } + inline std::string model_name() const final { + return "overloaded_fn_model"; + } + inline std::vector model_compile_info() const noexcept { + return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", + "stancflags = --O1 --print-cpp"}; + } + 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__; + stan::io::deserializer in__(params_r__, params_i__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + static constexpr const char* function__ = + "overloaded_fn_model_namespace::log_prob"; + // suppress unused var warning + (void) function__; + try { + current_statement__ = 1; + lp_accum__.add(dumb(1.0, pstream__)); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + lp_accum__.add(lp__); + return lp_accum__.sum(); + } + 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; + 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; + // 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()); + // suppress unused var warning + (void) DUMMY_VAR__; + constexpr bool jacobian__ = false; + static constexpr const char* function__ = + "overloaded_fn_model_namespace::write_array"; + // suppress unused var warning + (void) function__; + try { + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { + return ; + } + if (stan::math::logical_negation(emit_generated_quantities__)) { + return ; + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline void + transform_inits_impl(VecVar& params_r__, 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__; + pos__ = 1; + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + inline void get_param_names(std::vector& names__) const { + names__ = std::vector{}; + } + inline void get_dims(std::vector>& dimss__) const { + dimss__ = std::vector>{}; + } + inline void + constrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { + if (emit_transformed_parameters__) {} + 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 { + if (emit_transformed_parameters__) {} + if (emit_generated_quantities__) {} + } + inline std::string get_constrained_sizedtypes() const { + return std::string("[]"); + } + inline std::string get_unconstrained_sizedtypes() const { + return std::string("[]"); + } + // 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__ = 0; + const size_t num_transformed = emit_transformed_parameters * (0); + 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__ = 0; + const size_t num_transformed = emit_transformed_parameters * (0); + 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 { + constexpr std::array names__{}; + const std::array constrain_param_sizes__{}; + const auto num_constrained_params__ = + std::accumulate(constrain_param_sizes__.begin(), + constrain_param_sizes__.end(), 0); + std::vector params_r_flat__(num_constrained_params__); + Eigen::Index size_iter__ = 0; + Eigen::Index flat_iter__ = 0; + for (auto&& param_name__: names__) { + const auto param_vec__ = context.vals_r(param_name__); + for (Eigen::Index i = 0; i < constrain_param_sizes__[size_iter__]; ++i) { + params_r_flat__[flat_iter__] = param_vec__[i]; + ++flat_iter__; + } + ++size_iter__; + } + vars.resize(num_params_r__); + transform_inits_impl(params_r_flat__, params_i, vars, pstream__); + } +}; +} +using stan_model = overloaded_fn_model_namespace::overloaded_fn_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* m = new stan_model(data_context, seed, msg_stream); + return *m; +} +stan::math::profile_map& get_stan_profile_data() { + return overloaded_fn_model_namespace::profiles__; +} +#endif + $ ../../../../../install/default/bin/stanc --O1 --print-cpp overloaded-fn2.stan +// Code generated by %%NAME%% %%VERSION%% +#include +namespace overloaded_fn2_model_namespace { +using stan::model::model_base_crtp; +using namespace stan::math; +stan::math::profile_map profiles__; +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'overloaded-fn2.stan', line 7, column 4 to column 26)", + " (in 'overloaded-fn2.stan', line 14, column 2 to column 11)", + " (in 'overloaded-fn2.stan', line 3, column 4 to column 18)", + " (in 'overloaded-fn2.stan', line 2, column 21 to line 4, column 3)", + " (in 'overloaded-fn2.stan', line 5, column 16 to line 8, column 3)", + " (in 'overloaded-fn2.stan', line 10, column 4 to column 16)", + " (in 'overloaded-fn2.stan', line 9, column 21 to line 11, column 3)"}; +template , + stan::is_vt_not_complex>* = nullptr> +stan::promote_args_t> +foo(const T0__& x_arg__, std::ostream* pstream__); +template void +bar_lp(T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__); +template >* = nullptr> +Eigen::Matrix,-1,1> +foo(const T0__& x, std::ostream* pstream__); +template , + stan::is_vt_not_complex>*> +stan::promote_args_t> +foo(const T0__& x_arg__, std::ostream* pstream__) { + using local_scalar_t__ = stan::promote_args_t>; + int current_statement__ = 0; + const auto& x = stan::math::to_ref(x_arg__); + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 3; + return stan::math::sum(x); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +template void +bar_lp(T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) { + using local_scalar_t__ = double; + 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; + lp_accum__.add(stan::model::rvalue(foo(1.0, pstream__), "foo(1.0)", + stan::model::index_uni(1))); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +template >*> +Eigen::Matrix,-1,1> +foo(const T0__& x, std::ostream* pstream__) { + using local_scalar_t__ = stan::promote_args_t; + int current_statement__ = 0; + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 6; + return (Eigen::Matrix(1) << x).finished(); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +class overloaded_fn2_model final : public model_base_crtp { + private: + + public: + ~overloaded_fn2_model() {} + overloaded_fn2_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__ = + "overloaded_fn2_model_namespace::overloaded_fn2_model"; + // suppress unused var warning + (void) function__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + int pos__; + pos__ = 1; + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + num_params_r__ = 0U; + } + inline std::string model_name() const final { + return "overloaded_fn2_model"; + } + inline std::vector model_compile_info() const noexcept { + return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", + "stancflags = --O1 --print-cpp"}; + } + 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__; + stan::io::deserializer in__(params_r__, params_i__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + static constexpr const char* function__ = + "overloaded_fn2_model_namespace::log_prob"; + // suppress unused var warning + (void) function__; + try { + current_statement__ = 1; + lp_accum__.add(stan::model::rvalue(foo(1.0, pstream__), "foo(1.0)", + stan::model::index_uni(1))); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + lp_accum__.add(lp__); + return lp_accum__.sum(); + } + 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; + 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; + // 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()); + // suppress unused var warning + (void) DUMMY_VAR__; + constexpr bool jacobian__ = false; + static constexpr const char* function__ = + "overloaded_fn2_model_namespace::write_array"; + // suppress unused var warning + (void) function__; + try { + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { + return ; + } + if (stan::math::logical_negation(emit_generated_quantities__)) { + return ; + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline void + transform_inits_impl(VecVar& params_r__, 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__; + pos__ = 1; + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + inline void get_param_names(std::vector& names__) const { + names__ = std::vector{}; + } + inline void get_dims(std::vector>& dimss__) const { + dimss__ = std::vector>{}; + } + inline void + constrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { + if (emit_transformed_parameters__) {} + 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 { + if (emit_transformed_parameters__) {} + if (emit_generated_quantities__) {} + } + inline std::string get_constrained_sizedtypes() const { + return std::string("[]"); + } + inline std::string get_unconstrained_sizedtypes() const { + return std::string("[]"); + } + // 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__ = 0; + const size_t num_transformed = emit_transformed_parameters * (0); + 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__ = 0; + const size_t num_transformed = emit_transformed_parameters * (0); + 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 { + constexpr std::array names__{}; + const std::array constrain_param_sizes__{}; + const auto num_constrained_params__ = + std::accumulate(constrain_param_sizes__.begin(), + constrain_param_sizes__.end(), 0); + std::vector params_r_flat__(num_constrained_params__); + Eigen::Index size_iter__ = 0; + Eigen::Index flat_iter__ = 0; + for (auto&& param_name__: names__) { + const auto param_vec__ = context.vals_r(param_name__); + for (Eigen::Index i = 0; i < constrain_param_sizes__[size_iter__]; ++i) { + params_r_flat__[flat_iter__] = param_vec__[i]; + ++flat_iter__; + } + ++size_iter__; + } + vars.resize(num_params_r__); + transform_inits_impl(params_r_flat__, params_i, vars, pstream__); + } +}; +} +using stan_model = overloaded_fn2_model_namespace::overloaded_fn2_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* m = new stan_model(data_context, seed, msg_stream); + return *m; +} +stan::math::profile_map& get_stan_profile_data() { + return overloaded_fn2_model_namespace::profiles__; +} #endif $ ../../../../../install/default/bin/stanc --O1 --print-cpp partial-eval.stan // Code generated by %%NAME%% %%VERSION%% diff --git a/test/integration/good/compiler-optimizations/dune b/test/integration/good/compiler-optimizations/dune index ec5a634824..bc10287705 100644 --- a/test/integration/good/compiler-optimizations/dune +++ b/test/integration/good/compiler-optimizations/dune @@ -30,6 +30,7 @@ ad-level-failing.stan ad-level-deep-dependence.stan overloaded-fn.stan + overloaded-fn2.stan lupdf-inlining.stan unenforce-initialize.stan partial_eval_multiply.stan @@ -74,6 +75,8 @@ fails-test.stan off-small.stan off-dce.stan + overloaded-fn.stan + overloaded-fn2.stan stalled1-failure.stan expr-prop-fail.stan ad-level-failing.stan From a9955a78bf8f0762eb83edaa4a41869113cacc44 Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Wed, 11 Jan 2023 10:43:03 -0500 Subject: [PATCH 13/13] Glob in optimization testing --- .../good/compiler-optimizations/cpp.expected | 15712 +++++++++------- .../compiler-optimizations/cppO1.expected | 13072 +++++++------ .../good/compiler-optimizations/dune | 73 +- 3 files changed, 16071 insertions(+), 12786 deletions(-) diff --git a/test/integration/good/compiler-optimizations/cpp.expected b/test/integration/good/compiler-optimizations/cpp.expected index 22545b31f3..4b23b26e92 100644 --- a/test/integration/good/compiler-optimizations/cpp.expected +++ b/test/integration/good/compiler-optimizations/cpp.expected @@ -2485,1002 +2485,861 @@ Warning in 'ad-level-failing.stan', line 46, column 8: integrate_ode_rk45 is deprecated and will be removed in Stan 3.0. Use ode_rk45 instead. The new interface is slightly different, see: https://mc-stan.org/users/documentation/case-studies/convert_odes.html - $ ../../../../../install/default/bin/stanc --O --print-cpp copy_fail.stan + $ ../../../../../install/default/bin/stanc --O --print-cpp ad-levels-deep.stan // Code generated by %%NAME%% %%VERSION%% #include -namespace copy_fail_model_namespace { +namespace ad_levels_deep_model_namespace { using stan::model::model_base_crtp; using namespace stan::math; stan::math::profile_map profiles__; -static constexpr std::array locations_array__ = +static constexpr std::array locations_array__ = {" (found before start of program)", - " (in 'copy_fail.stan', line 68, column 2 to column 32)", - " (in 'copy_fail.stan', line 69, column 2 to column 41)", - " (in 'copy_fail.stan', line 72, column 2 to column 52)", - " (in 'copy_fail.stan', line 73, column 2 to column 50)", - " (in 'copy_fail.stan', line 74, column 2 to column 50)", - " (in 'copy_fail.stan', line 80, column 6 to column 18)", - " (in 'copy_fail.stan', line 79, column 6 to column 20)", - " (in 'copy_fail.stan', line 78, column 34 to line 81, column 5)", - " (in 'copy_fail.stan', line 83, column 6 to column 32)", - " (in 'copy_fail.stan', line 84, column 6 to column 23)", - " (in 'copy_fail.stan', line 82, column 40 to line 85, column 5)", - " (in 'copy_fail.stan', line 82, column 4 to line 85, column 5)", - " (in 'copy_fail.stan', line 77, column 22 to line 86, column 3)", - " (in 'copy_fail.stan', line 25, column 11 to column 15)", - " (in 'copy_fail.stan', line 25, column 17 to column 28)", - " (in 'copy_fail.stan', line 25, column 4 to column 34)", - " (in 'copy_fail.stan', line 28, column 6 to column 32)", - " (in 'copy_fail.stan', line 31, column 8 to column 37)", - " (in 'copy_fail.stan', line 32, column 8 to column 32)", - " (in 'copy_fail.stan', line 40, column 8 to line 42, column 44)", - " (in 'copy_fail.stan', line 29, column 39 to line 43, column 7)", - " (in 'copy_fail.stan', line 29, column 6 to line 43, column 7)", - " (in 'copy_fail.stan', line 27, column 24 to line 44, column 5)", - " (in 'copy_fail.stan', line 27, column 4 to line 44, column 5)", - " (in 'copy_fail.stan', line 45, column 4 to column 15)", - " (in 'copy_fail.stan', line 100, column 8 to column 37)", - " (in 'copy_fail.stan', line 101, column 8 to column 41)", - " (in 'copy_fail.stan', line 99, column 42 to line 102, column 7)", - " (in 'copy_fail.stan', line 103, column 6 to column 37)", - " (in 'copy_fail.stan', line 98, column 22 to line 104, column 5)", - " (in 'copy_fail.stan', line 97, column 22 to line 105, column 3)", - " (in 'copy_fail.stan', line 97, column 2 to line 105, column 3)", - " (in 'copy_fail.stan', line 49, column 2 to column 20)", - " (in 'copy_fail.stan', line 50, column 2 to column 27)", - " (in 'copy_fail.stan', line 51, column 8 to column 12)", - " (in 'copy_fail.stan', line 51, column 14 to column 25)", - " (in 'copy_fail.stan', line 51, column 2 to column 51)", - " (in 'copy_fail.stan', line 52, column 2 to column 23)", - " (in 'copy_fail.stan', line 53, column 8 to column 12)", - " (in 'copy_fail.stan', line 53, column 2 to column 61)", - " (in 'copy_fail.stan', line 56, column 2 to column 38)", - " (in 'copy_fail.stan', line 58, column 8 to column 12)", - " (in 'copy_fail.stan', line 58, column 2 to column 52)", - " (in 'copy_fail.stan', line 59, column 8 to column 12)", - " (in 'copy_fail.stan', line 59, column 2 to column 51)", - " (in 'copy_fail.stan', line 63, column 4 to column 35)", - " (in 'copy_fail.stan', line 62, column 2 to line 63, column 35)", - " (in 'copy_fail.stan', line 65, column 4 to column 33)", - " (in 'copy_fail.stan', line 64, column 2 to line 65, column 33)", - " (in 'copy_fail.stan', line 69, column 27 to column 34)", - " (in 'copy_fail.stan', line 72, column 27 to column 31)", - " (in 'copy_fail.stan', line 72, column 33 to column 46)", - " (in 'copy_fail.stan', line 73, column 27 to column 31)", - " (in 'copy_fail.stan', line 73, column 33 to column 46)", - " (in 'copy_fail.stan', line 74, column 27 to column 31)", - " (in 'copy_fail.stan', line 74, column 33 to column 44)", - " (in 'copy_fail.stan', line 8, column 8 to column 17)", - " (in 'copy_fail.stan', line 7, column 6 to line 8, column 17)", - " (in 'copy_fail.stan', line 9, column 4 to column 13)", - " (in 'copy_fail.stan', line 5, column 37 to line 10, column 3)", - " (in 'copy_fail.stan', line 15, column 6 to column 32)", - " (in 'copy_fail.stan', line 19, column 8 to column 17)", - " (in 'copy_fail.stan', line 18, column 6 to line 19, column 17)", - " (in 'copy_fail.stan', line 13, column 39 to line 20, column 5)", - " (in 'copy_fail.stan', line 21, column 4 to column 13)", - " (in 'copy_fail.stan', line 12, column 36 to line 22, column 3)", - " (in 'copy_fail.stan', line 24, column 74 to line 46, column 3)"}; -int first_capture(const std::vector& y_i, std::ostream* pstream__); -int last_capture(const std::vector& y_i, std::ostream* pstream__); -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, - const T3__& phi_arg__, std::ostream* pstream__); -int first_capture(const std::vector& y_i, std::ostream* pstream__) { - using local_scalar_t__ = double; - int current_statement__ = 0; - static constexpr bool propto__ = true; - // suppress unused var warning - (void) propto__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - int lcm_sym18__; - int lcm_sym17__; - int lcm_sym16__; - int lcm_sym15__; - { - lcm_sym16__ = stan::math::size(y_i); - if (stan::math::logical_gte(lcm_sym16__, 1)) { - current_statement__ = 58; - if (stan::model::rvalue(y_i, "y_i", stan::model::index_uni(1))) { - current_statement__ = 57; - return 1; - } - for (int k = 2; k <= lcm_sym16__; ++k) { - current_statement__ = 58; - if (stan::model::rvalue(y_i, "y_i", stan::model::index_uni(k))) { - current_statement__ = 57; - return k; - } - } - } - current_statement__ = 59; - return 0; - } - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } -} -int last_capture(const std::vector& y_i, std::ostream* pstream__) { - using local_scalar_t__ = double; - int current_statement__ = 0; - static constexpr bool propto__ = true; - // suppress unused var warning - (void) propto__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - int lcm_sym24__; - int lcm_sym23__; - int lcm_sym22__; - int lcm_sym21__; - int lcm_sym20__; - int lcm_sym19__; - { - lcm_sym22__ = (stan::math::size(y_i) - 1); - if (stan::math::logical_gte(lcm_sym22__, 0)) { - int k = std::numeric_limits::min(); - lcm_sym21__ = (stan::math::size(y_i) - 0); - current_statement__ = 63; - if (y_i[(lcm_sym21__ - 1)]) { - current_statement__ = 62; - return lcm_sym21__; - } - for (int k_rev = 1; k_rev <= lcm_sym22__; ++k_rev) { - int k = std::numeric_limits::min(); - lcm_sym20__ = (stan::math::size(y_i) - k_rev); - current_statement__ = 63; - if (y_i[(lcm_sym20__ - 1)]) { - current_statement__ = 62; - return lcm_sym20__; + " (in 'ad-levels-deep.stan', line 6, column 4 to column 23)", + " (in 'ad-levels-deep.stan', line 10, column 4 to column 39)", + " (in 'ad-levels-deep.stan', line 11, column 4 to column 38)", + " (in 'ad-levels-deep.stan', line 12, column 4 to column 16)", + " (in 'ad-levels-deep.stan', line 2, column 4 to column 26)"}; +class ad_levels_deep_model final : public model_base_crtp { + private: + double lcm_sym9__; + double lcm_sym8__; + int lcm_sym7__; + Eigen::Matrix X_data_data__; + Eigen::Map> X_data{nullptr, 0, 0}; + public: + ~ad_levels_deep_model() {} + ad_levels_deep_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__ = + "ad_levels_deep_model_namespace::ad_levels_deep_model"; + // suppress unused var warning + (void) function__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + int pos__; + pos__ = 1; + current_statement__ = 5; + context__.validate_dims("data initialization", "X_data", "double", + std::vector{static_cast(10), static_cast(10)}); + X_data_data__ = Eigen::Matrix::Constant(10, 10, + std::numeric_limits::quiet_NaN()); + new (&X_data) + Eigen::Map>(X_data_data__.data(), 10, 10); + { + std::vector X_data_flat__; + current_statement__ = 5; + X_data_flat__ = context__.vals_r("X_data"); + current_statement__ = 5; + pos__ = 1; + { + { + current_statement__ = 5; + stan::model::assign(X_data, + stan::model::rvalue(X_data_flat__, "X_data_flat__", + stan::model::index_uni(1)), "assigning variable X_data", + stan::model::index_uni(1), stan::model::index_uni(1)); + current_statement__ = 5; + pos__ = 2; + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(2), + stan::model::index_uni(1)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(3), + stan::model::index_uni(1)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(4), + stan::model::index_uni(1)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(5), + stan::model::index_uni(1)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(6), + stan::model::index_uni(1)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(7), + stan::model::index_uni(1)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(8), + stan::model::index_uni(1)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(9), + stan::model::index_uni(1)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(10), + stan::model::index_uni(1)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } } - } - } - current_statement__ = 65; - return 0; - } - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } -} -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, - const T3__& phi_arg__, std::ostream* pstream__) { - using local_scalar_t__ = stan::promote_args_t, - stan::base_type_t>; - int current_statement__ = 0; - const auto& p = stan::math::to_ref(p_arg__); - const auto& phi = stan::math::to_ref(phi_arg__); - static constexpr bool propto__ = true; - // suppress unused var warning - (void) propto__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - double lcm_sym34__; - double lcm_sym33__; - double lcm_sym32__; - double lcm_sym31__; - int lcm_sym30__; - int lcm_sym29__; - int lcm_sym28__; - int lcm_sym27__; - int lcm_sym26__; - int lcm_sym25__; - { - current_statement__ = 14; - stan::math::validate_non_negative_index("chi", "nind", nind); - current_statement__ = 15; - stan::math::validate_non_negative_index("chi", "n_occasions", - n_occasions); - Eigen::Matrix chi = - Eigen::Matrix::Constant(nind, n_occasions, - DUMMY_VAR__); - current_statement__ = 24; - if (stan::math::logical_gte(nind, 1)) { - current_statement__ = 17; - stan::model::assign(chi, 1.0, "assigning variable chi", - stan::model::index_uni(1), stan::model::index_uni(n_occasions)); - lcm_sym28__ = (n_occasions - 1); - lcm_sym26__ = stan::math::logical_gte(lcm_sym28__, 1); - if (lcm_sym26__) { - int t_curr = std::numeric_limits::min(); - int t_next = std::numeric_limits::min(); - lcm_sym30__ = (lcm_sym28__ + 1); - current_statement__ = 20; - stan::model::assign(chi, - stan::math::fma( - (stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym28__)) * (1 - - stan::model::rvalue(p, "p", stan::model::index_uni(1), - stan::model::index_uni((lcm_sym30__ - 1))))), - stan::model::rvalue(chi, "chi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym30__)), (1 - - stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym28__)))), - "assigning variable chi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym28__)); - for (int t = 2; t <= lcm_sym28__; ++t) { - int t_curr = std::numeric_limits::min(); - lcm_sym27__ = (n_occasions - t); - int t_next = std::numeric_limits::min(); - lcm_sym29__ = (lcm_sym27__ + 1); - current_statement__ = 20; - stan::model::assign(chi, - stan::math::fma( - (stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym27__)) * (1 - - stan::model::rvalue(p, "p", stan::model::index_uni(1), - stan::model::index_uni((lcm_sym29__ - 1))))), - stan::model::rvalue(chi, "chi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym29__)), (1 - - stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym27__)))), - "assigning variable chi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym27__)); - } - } - for (int i = 2; i <= nind; ++i) { - current_statement__ = 17; - stan::model::assign(chi, 1.0, "assigning variable chi", - stan::model::index_uni(i), stan::model::index_uni(n_occasions)); - current_statement__ = 22; - if (lcm_sym26__) { - int t_curr = std::numeric_limits::min(); - int t_next = std::numeric_limits::min(); - lcm_sym30__ = (lcm_sym28__ + 1); - current_statement__ = 20; - stan::model::assign(chi, - stan::math::fma( - (stan::model::rvalue(phi, "phi", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym28__)) * (1 - - stan::model::rvalue(p, "p", stan::model::index_uni(i), - stan::model::index_uni((lcm_sym30__ - 1))))), - stan::model::rvalue(chi, "chi", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym30__)), (1 - - stan::model::rvalue(phi, "phi", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym28__)))), - "assigning variable chi", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym28__)); - for (int t = 2; t <= lcm_sym28__; ++t) { - int t_curr = std::numeric_limits::min(); - lcm_sym27__ = (n_occasions - t); - int t_next = std::numeric_limits::min(); - lcm_sym29__ = (lcm_sym27__ + 1); - current_statement__ = 20; - stan::model::assign(chi, - stan::math::fma( - (stan::model::rvalue(phi, "phi", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym27__)) * (1 - - stan::model::rvalue(p, "p", stan::model::index_uni(i), - stan::model::index_uni((lcm_sym29__ - 1))))), - stan::model::rvalue(chi, "chi", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym29__)), (1 - - stan::model::rvalue(phi, "phi", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym27__)))), - "assigning variable chi", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym27__)); + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(1), + stan::model::index_uni(2)); + current_statement__ = 5; + pos__ = (pos__ + 1); + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(2), + stan::model::index_uni(2)); + current_statement__ = 5; + pos__ = (pos__ + 1); } - } - } - } - current_statement__ = 25; - return chi; - } - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } -} -class copy_fail_model final : public model_base_crtp { - private: - int lcm_sym118__; - int lcm_sym117__; - int lcm_sym116__; - int lcm_sym115__; - int lcm_sym114__; - int lcm_sym113__; - int lcm_sym112__; - int lcm_sym111__; - int lcm_sym110__; - int lcm_sym109__; - int lcm_sym108__; - int lcm_sym107__; - int lcm_sym106__; - int nind; - int n_occasions; - std::vector> y; - int max_age; - std::vector> x; - int n_occ_minus_1; - std::vector first; - std::vector last; - public: - ~copy_fail_model() {} - copy_fail_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__ = - "copy_fail_model_namespace::copy_fail_model"; - // suppress unused var warning - (void) function__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - int pos__; - pos__ = 1; - current_statement__ = 33; - context__.validate_dims("data initialization", "nind", "int", - std::vector{}); - nind = std::numeric_limits::min(); - current_statement__ = 33; - nind = context__.vals_i("nind")[(1 - 1)]; - current_statement__ = 33; - stan::math::check_greater_or_equal(function__, "nind", nind, 0); - current_statement__ = 34; - context__.validate_dims("data initialization", "n_occasions", "int", - std::vector{}); - n_occasions = std::numeric_limits::min(); - current_statement__ = 34; - n_occasions = context__.vals_i("n_occasions")[(1 - 1)]; - current_statement__ = 34; - stan::math::check_greater_or_equal(function__, "n_occasions", - n_occasions, 2); - current_statement__ = 35; - stan::math::validate_non_negative_index("y", "nind", nind); - current_statement__ = 36; - stan::math::validate_non_negative_index("y", "n_occasions", n_occasions); - current_statement__ = 37; - context__.validate_dims("data initialization", "y", "int", - std::vector{static_cast(nind), - static_cast(n_occasions)}); - y = std::vector>(nind, - std::vector(n_occasions, std::numeric_limits::min())); - { - std::vector y_flat__; - current_statement__ = 37; - y_flat__ = context__.vals_i("y"); - current_statement__ = 37; - pos__ = 1; - current_statement__ = 37; - if (stan::math::logical_gte(n_occasions, 1)) { - lcm_sym107__ = stan::math::logical_gte(nind, 1); - if (lcm_sym107__) { - current_statement__ = 37; - stan::model::assign(y, - stan::model::rvalue(y_flat__, "y_flat__", - stan::model::index_uni(1)), "assigning variable y", - stan::model::index_uni(1), stan::model::index_uni(1)); - current_statement__ = 37; - pos__ = 2; - for (int sym2__ = 2; sym2__ <= nind; ++sym2__) { - current_statement__ = 37; - stan::model::assign(y, y_flat__[(pos__ - 1)], - "assigning variable y", stan::model::index_uni(sym2__), - stan::model::index_uni(1)); - current_statement__ = 37; + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(3), + stan::model::index_uni(2)); + current_statement__ = 5; pos__ = (pos__ + 1); } - } - for (int sym1__ = 2; sym1__ <= n_occasions; ++sym1__) { - current_statement__ = 37; - if (lcm_sym107__) { - current_statement__ = 37; - stan::model::assign(y, y_flat__[(pos__ - 1)], - "assigning variable y", stan::model::index_uni(1), - stan::model::index_uni(sym1__)); - current_statement__ = 37; + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(4), + stan::model::index_uni(2)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(5), + stan::model::index_uni(2)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(6), + stan::model::index_uni(2)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(7), + stan::model::index_uni(2)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(8), + stan::model::index_uni(2)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(9), + stan::model::index_uni(2)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(10), + stan::model::index_uni(2)); + current_statement__ = 5; pos__ = (pos__ + 1); - for (int sym2__ = 2; sym2__ <= nind; ++sym2__) { - current_statement__ = 37; - stan::model::assign(y, y_flat__[(pos__ - 1)], - "assigning variable y", stan::model::index_uni(sym2__), - stan::model::index_uni(sym1__)); - current_statement__ = 37; - pos__ = (pos__ + 1); - } } } - } else { - lcm_sym107__ = stan::math::logical_gte(nind, 1); - } - } - current_statement__ = 37; - stan::math::check_greater_or_equal(function__, "y", y, 0); - current_statement__ = 37; - stan::math::check_less_or_equal(function__, "y", y, 1); - current_statement__ = 38; - context__.validate_dims("data initialization", "max_age", "int", - std::vector{}); - max_age = std::numeric_limits::min(); - current_statement__ = 38; - max_age = context__.vals_i("max_age")[(1 - 1)]; - current_statement__ = 38; - stan::math::check_greater_or_equal(function__, "max_age", max_age, 1); - current_statement__ = 39; - stan::math::validate_non_negative_index("x", "nind", nind); - lcm_sym109__ = (n_occasions - 1); - stan::math::validate_non_negative_index("x", "n_occasions - 1", - lcm_sym109__); - current_statement__ = 40; - context__.validate_dims("data initialization", "x", "int", - std::vector{static_cast(nind), - static_cast(lcm_sym109__)}); - x = std::vector>(nind, - std::vector(lcm_sym109__, std::numeric_limits::min())); - { - std::vector x_flat__; - current_statement__ = 40; - x_flat__ = context__.vals_i("x"); - current_statement__ = 40; - pos__ = 1; - current_statement__ = 40; - if (stan::math::logical_gte(lcm_sym109__, 1)) { - current_statement__ = 40; - if (lcm_sym107__) { - current_statement__ = 40; - stan::model::assign(x, - stan::model::rvalue(x_flat__, "x_flat__", - stan::model::index_uni(1)), "assigning variable x", - stan::model::index_uni(1), stan::model::index_uni(1)); - current_statement__ = 40; - pos__ = 2; - for (int sym2__ = 2; sym2__ <= nind; ++sym2__) { - current_statement__ = 40; - stan::model::assign(x, x_flat__[(pos__ - 1)], - "assigning variable x", stan::model::index_uni(sym2__), - stan::model::index_uni(1)); - current_statement__ = 40; + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(1), + stan::model::index_uni(3)); + current_statement__ = 5; + pos__ = (pos__ + 1); + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(2), + stan::model::index_uni(3)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(3), + stan::model::index_uni(3)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(4), + stan::model::index_uni(3)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(5), + stan::model::index_uni(3)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(6), + stan::model::index_uni(3)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(7), + stan::model::index_uni(3)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(8), + stan::model::index_uni(3)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(9), + stan::model::index_uni(3)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(10), + stan::model::index_uni(3)); + current_statement__ = 5; pos__ = (pos__ + 1); } } - for (int sym1__ = 2; sym1__ <= lcm_sym109__; ++sym1__) { - current_statement__ = 40; - if (lcm_sym107__) { - current_statement__ = 40; - stan::model::assign(x, x_flat__[(pos__ - 1)], - "assigning variable x", stan::model::index_uni(1), - stan::model::index_uni(sym1__)); - current_statement__ = 40; + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(1), + stan::model::index_uni(4)); + current_statement__ = 5; + pos__ = (pos__ + 1); + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(2), + stan::model::index_uni(4)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(3), + stan::model::index_uni(4)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(4), + stan::model::index_uni(4)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(5), + stan::model::index_uni(4)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(6), + stan::model::index_uni(4)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(7), + stan::model::index_uni(4)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(8), + stan::model::index_uni(4)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(9), + stan::model::index_uni(4)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(10), + stan::model::index_uni(4)); + current_statement__ = 5; pos__ = (pos__ + 1); - for (int sym2__ = 2; sym2__ <= nind; ++sym2__) { - current_statement__ = 40; - stan::model::assign(x, x_flat__[(pos__ - 1)], - "assigning variable x", stan::model::index_uni(sym2__), - stan::model::index_uni(sym1__)); - current_statement__ = 40; - pos__ = (pos__ + 1); - } } } - } - } - current_statement__ = 40; - stan::math::check_greater_or_equal(function__, "x", x, 0); - current_statement__ = 40; - stan::math::check_less_or_equal(function__, "x", x, max_age); - current_statement__ = 41; - n_occ_minus_1 = std::numeric_limits::min(); - current_statement__ = 41; - n_occ_minus_1 = lcm_sym109__; - current_statement__ = 42; - stan::math::validate_non_negative_index("first", "nind", nind); - current_statement__ = 43; - first = std::vector(nind, std::numeric_limits::min()); - current_statement__ = 44; - stan::math::validate_non_negative_index("last", "nind", nind); - current_statement__ = 45; - last = std::vector(nind, std::numeric_limits::min()); - current_statement__ = 47; - if (lcm_sym107__) { - current_statement__ = 46; - stan::model::assign(first, - first_capture( - stan::model::rvalue(y, "y", stan::model::index_uni(1)), pstream__), - "assigning variable first", stan::model::index_uni(1)); - for (int i = 2; i <= nind; ++i) { - current_statement__ = 46; - stan::model::assign(first, - first_capture( - stan::model::rvalue(y, "y", stan::model::index_uni(i)), - pstream__), "assigning variable first", - stan::model::index_uni(i)); - } - } - current_statement__ = 49; - if (lcm_sym107__) { - current_statement__ = 48; - stan::model::assign(last, - last_capture( - stan::model::rvalue(y, "y", stan::model::index_uni(1)), pstream__), - "assigning variable last", stan::model::index_uni(1)); - for (int i = 2; i <= nind; ++i) { - current_statement__ = 48; - stan::model::assign(last, - last_capture( - stan::model::rvalue(y, "y", stan::model::index_uni(i)), - pstream__), "assigning variable last", - stan::model::index_uni(i)); - } - } - current_statement__ = 43; - stan::math::check_greater_or_equal(function__, "first", first, 0); - current_statement__ = 43; - stan::math::check_less_or_equal(function__, "first", first, n_occasions); - current_statement__ = 45; - stan::math::check_greater_or_equal(function__, "last", last, 0); - current_statement__ = 45; - stan::math::check_less_or_equal(function__, "last", last, n_occasions); - current_statement__ = 50; - stan::math::validate_non_negative_index("beta", "max_age", max_age); - current_statement__ = 51; - stan::math::validate_non_negative_index("phi", "nind", nind); - current_statement__ = 52; - stan::math::validate_non_negative_index("phi", "n_occ_minus_1", - lcm_sym109__); - current_statement__ = 53; - stan::math::validate_non_negative_index("p", "nind", nind); - current_statement__ = 54; - stan::math::validate_non_negative_index("p", "n_occ_minus_1", - lcm_sym109__); - current_statement__ = 55; - stan::math::validate_non_negative_index("chi", "nind", nind); - current_statement__ = 56; - stan::math::validate_non_negative_index("chi", "n_occasions", - n_occasions); - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } - num_params_r__ = 1 + max_age; - } - inline std::string model_name() const final { - return "copy_fail_model"; - } - inline std::vector model_compile_info() const noexcept { - return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", - "stancflags = --O --print-cpp"}; - } - 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__; - stan::io::deserializer in__(params_r__, params_i__); - int current_statement__ = 0; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - static constexpr const char* function__ = - "copy_fail_model_namespace::log_prob"; - // suppress unused var warning - (void) function__; - try { - double lcm_sym105__; - int lcm_sym104__; - int lcm_sym103__; - int lcm_sym102__; - int lcm_sym101__; - double lcm_sym100__; - double lcm_sym99__; - double lcm_sym98__; - double lcm_sym97__; - double lcm_sym96__; - double lcm_sym95__; - double lcm_sym94__; - double lcm_sym93__; - double lcm_sym92__; - double lcm_sym91__; - double lcm_sym90__; - double lcm_sym89__; - double lcm_sym88__; - double lcm_sym87__; - double lcm_sym86__; - double lcm_sym85__; - double lcm_sym84__; - double lcm_sym83__; - int lcm_sym82__; - int lcm_sym81__; - int lcm_sym80__; - int lcm_sym79__; - int lcm_sym78__; - int lcm_sym77__; - int lcm_sym76__; - int lcm_sym75__; - int lcm_sym74__; - int lcm_sym73__; - int lcm_sym72__; - int lcm_sym71__; - int lcm_sym70__; - int lcm_sym69__; - int lcm_sym68__; - int lcm_sym67__; - int lcm_sym66__; - int lcm_sym65__; - int lcm_sym64__; - int lcm_sym63__; - local_scalar_t__ mean_p; - current_statement__ = 1; - mean_p = in__.template read_constrain_lub(0, 1, lp__); - Eigen::Matrix beta; - current_statement__ = 2; - beta = in__.template read_constrain_lub< - Eigen::Matrix, jacobian__>(0, 1, lp__, - max_age); - Eigen::Matrix phi = - Eigen::Matrix::Constant(nind, (n_occasions - - 1), DUMMY_VAR__); - Eigen::Matrix p = - Eigen::Matrix::Constant(nind, (n_occasions - - 1), DUMMY_VAR__); - Eigen::Matrix chi = - Eigen::Matrix::Constant(nind, n_occasions, - DUMMY_VAR__); - lcm_sym63__ = stan::math::logical_gte(nind, 1); - if (lcm_sym63__) { - lcm_sym102__ = stan::model::rvalue(first, "first", - stan::model::index_uni(1)); - lcm_sym76__ = (lcm_sym102__ - 1); - if (stan::math::logical_gte(lcm_sym76__, 1)) { - stan::model::assign(phi, 0, "assigning variable phi", - stan::model::index_uni(1), stan::model::index_uni(1)); - current_statement__ = 6; - stan::model::assign(p, 0, "assigning variable p", - stan::model::index_uni(1), stan::model::index_uni(1)); - for (int t = 2; t <= lcm_sym76__; ++t) { - current_statement__ = 7; - stan::model::assign(phi, 0, "assigning variable phi", - stan::model::index_uni(1), stan::model::index_uni(t)); - current_statement__ = 6; - stan::model::assign(p, 0, "assigning variable p", - stan::model::index_uni(1), stan::model::index_uni(t)); - } - } - lcm_sym74__ = (n_occasions - 1); - if (stan::math::logical_gte(lcm_sym74__, lcm_sym102__)) { - current_statement__ = 9; - stan::model::assign(phi, - stan::model::rvalue(beta, "beta", - stan::model::index_uni( - stan::model::rvalue(x, "x", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym102__)))), - "assigning variable phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym102__)); - lcm_sym82__ = (lcm_sym102__ + 1); - stan::model::assign(p, mean_p, "assigning variable p", - stan::model::index_uni(1), stan::model::index_uni(lcm_sym102__)); - for (int t = lcm_sym82__; t <= lcm_sym74__; ++t) { - current_statement__ = 9; - stan::model::assign(phi, - stan::model::rvalue(beta, "beta", - stan::model::index_uni( - stan::model::rvalue(x, "x", stan::model::index_uni(1), - stan::model::index_uni(t)))), "assigning variable phi", - stan::model::index_uni(1), stan::model::index_uni(t)); - current_statement__ = 10; - stan::model::assign(p, mean_p, "assigning variable p", - stan::model::index_uni(1), stan::model::index_uni(t)); + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(1), + stan::model::index_uni(5)); + current_statement__ = 5; + pos__ = (pos__ + 1); + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(2), + stan::model::index_uni(5)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(3), + stan::model::index_uni(5)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(4), + stan::model::index_uni(5)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(5), + stan::model::index_uni(5)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(6), + stan::model::index_uni(5)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(7), + stan::model::index_uni(5)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(8), + stan::model::index_uni(5)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(9), + stan::model::index_uni(5)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(10), + stan::model::index_uni(5)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } } - } - for (int i = 2; i <= nind; ++i) { - lcm_sym101__ = stan::model::rvalue(first, "first", - stan::model::index_uni(i)); - lcm_sym75__ = (lcm_sym101__ - 1); - if (stan::math::logical_gte(lcm_sym75__, 1)) { - stan::model::assign(phi, 0, "assigning variable phi", - stan::model::index_uni(i), stan::model::index_uni(1)); - current_statement__ = 6; - stan::model::assign(p, 0, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(1)); - for (int t = 2; t <= lcm_sym75__; ++t) { - current_statement__ = 7; - stan::model::assign(phi, 0, "assigning variable phi", - stan::model::index_uni(i), stan::model::index_uni(t)); - current_statement__ = 6; - stan::model::assign(p, 0, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(t)); + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(1), + stan::model::index_uni(6)); + current_statement__ = 5; + pos__ = (pos__ + 1); + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(2), + stan::model::index_uni(6)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(3), + stan::model::index_uni(6)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(4), + stan::model::index_uni(6)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(5), + stan::model::index_uni(6)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(6), + stan::model::index_uni(6)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(7), + stan::model::index_uni(6)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(8), + stan::model::index_uni(6)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(9), + stan::model::index_uni(6)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(10), + stan::model::index_uni(6)); + current_statement__ = 5; + pos__ = (pos__ + 1); } } - current_statement__ = 12; - if (stan::math::logical_gte(lcm_sym74__, lcm_sym101__)) { - current_statement__ = 9; - stan::model::assign(phi, - stan::model::rvalue(beta, "beta", - stan::model::index_uni( - stan::model::rvalue(x, "x", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym101__)))), - "assigning variable phi", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym101__)); - lcm_sym81__ = (lcm_sym101__ + 1); - stan::model::assign(p, mean_p, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(lcm_sym101__)); - for (int t = lcm_sym81__; t <= lcm_sym74__; ++t) { - current_statement__ = 9; - stan::model::assign(phi, - stan::model::rvalue(beta, "beta", - stan::model::index_uni( - stan::model::rvalue(x, "x", stan::model::index_uni(i), - stan::model::index_uni(t)))), "assigning variable phi", - stan::model::index_uni(i), stan::model::index_uni(t)); - current_statement__ = 10; - stan::model::assign(p, mean_p, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(t)); + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(1), + stan::model::index_uni(7)); + current_statement__ = 5; + pos__ = (pos__ + 1); + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(2), + stan::model::index_uni(7)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(3), + stan::model::index_uni(7)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(4), + stan::model::index_uni(7)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(5), + stan::model::index_uni(7)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(6), + stan::model::index_uni(7)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(7), + stan::model::index_uni(7)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(8), + stan::model::index_uni(7)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(9), + stan::model::index_uni(7)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(10), + stan::model::index_uni(7)); + current_statement__ = 5; + pos__ = (pos__ + 1); } } - } - } - Eigen::Matrix - inline_prob_uncaptured_return_sym8__; - { - current_statement__ = 14; - stan::math::validate_non_negative_index("chi", "nind", nind); - current_statement__ = 15; - stan::math::validate_non_negative_index("chi", "n_occasions", - n_occasions); - Eigen::Matrix - inline_prob_uncaptured_chi_sym9__ = - Eigen::Matrix::Constant(nind, n_occasions, - DUMMY_VAR__); - current_statement__ = 24; - if (lcm_sym63__) { - current_statement__ = 17; - stan::model::assign(inline_prob_uncaptured_chi_sym9__, 1.0, - "assigning variable inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(1), stan::model::index_uni(n_occasions)); - lcm_sym74__ = (n_occasions - 1); - lcm_sym64__ = stan::math::logical_gte(lcm_sym74__, 1); - if (lcm_sym64__) { - int inline_prob_uncaptured_t_curr_sym10__ = - std::numeric_limits::min(); - int inline_prob_uncaptured_t_next_sym11__ = - std::numeric_limits::min(); - lcm_sym78__ = (lcm_sym74__ + 1); - current_statement__ = 20; - stan::model::assign(inline_prob_uncaptured_chi_sym9__, - stan::math::fma( - (stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym74__)) * (1 - - stan::model::rvalue(p, "p", stan::model::index_uni(1), - stan::model::index_uni((lcm_sym78__ - 1))))), - stan::model::rvalue(inline_prob_uncaptured_chi_sym9__, - "inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(1), - stan::model::index_uni(lcm_sym78__)), (1 - - stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym74__)))), - "assigning variable inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(1), stan::model::index_uni(lcm_sym74__)); - for (int inline_prob_uncaptured_t_sym12__ = 2; inline_prob_uncaptured_t_sym12__ - <= lcm_sym74__; ++inline_prob_uncaptured_t_sym12__) { - int inline_prob_uncaptured_t_curr_sym10__ = - std::numeric_limits::min(); - lcm_sym73__ = (n_occasions - inline_prob_uncaptured_t_sym12__); - int inline_prob_uncaptured_t_next_sym11__ = - std::numeric_limits::min(); - lcm_sym77__ = (lcm_sym73__ + 1); - current_statement__ = 20; - stan::model::assign(inline_prob_uncaptured_chi_sym9__, - stan::math::fma( - (stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym73__)) * (1 - - stan::model::rvalue(p, "p", stan::model::index_uni(1), - stan::model::index_uni((lcm_sym77__ - 1))))), - stan::model::rvalue(inline_prob_uncaptured_chi_sym9__, - "inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(1), - stan::model::index_uni(lcm_sym77__)), (1 - - stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym73__)))), - "assigning variable inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(1), - stan::model::index_uni(lcm_sym73__)); + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(1), + stan::model::index_uni(8)); + current_statement__ = 5; + pos__ = (pos__ + 1); + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(2), + stan::model::index_uni(8)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(3), + stan::model::index_uni(8)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(4), + stan::model::index_uni(8)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(5), + stan::model::index_uni(8)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(6), + stan::model::index_uni(8)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(7), + stan::model::index_uni(8)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(8), + stan::model::index_uni(8)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(9), + stan::model::index_uni(8)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(10), + stan::model::index_uni(8)); + current_statement__ = 5; + pos__ = (pos__ + 1); } } - for (int inline_prob_uncaptured_i_sym13__ = 2; inline_prob_uncaptured_i_sym13__ - <= nind; ++inline_prob_uncaptured_i_sym13__) { - current_statement__ = 17; - stan::model::assign(inline_prob_uncaptured_chi_sym9__, 1.0, - "assigning variable inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni(n_occasions)); - current_statement__ = 22; - if (lcm_sym64__) { - int inline_prob_uncaptured_t_curr_sym10__ = - std::numeric_limits::min(); - int inline_prob_uncaptured_t_next_sym11__ = - std::numeric_limits::min(); - lcm_sym78__ = (lcm_sym74__ + 1); - current_statement__ = 20; - stan::model::assign(inline_prob_uncaptured_chi_sym9__, - stan::math::fma( - (stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni(lcm_sym74__)) * (1 - - stan::model::rvalue(p, "p", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni((lcm_sym78__ - 1))))), - stan::model::rvalue(inline_prob_uncaptured_chi_sym9__, - "inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni(lcm_sym78__)), (1 - - stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni(lcm_sym74__)))), - "assigning variable inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni(lcm_sym74__)); - for (int inline_prob_uncaptured_t_sym12__ = 2; inline_prob_uncaptured_t_sym12__ - <= lcm_sym74__; ++inline_prob_uncaptured_t_sym12__) { - int inline_prob_uncaptured_t_curr_sym10__ = - std::numeric_limits::min(); - lcm_sym73__ = (n_occasions - - inline_prob_uncaptured_t_sym12__); - int inline_prob_uncaptured_t_next_sym11__ = - std::numeric_limits::min(); - lcm_sym77__ = (lcm_sym73__ + 1); - current_statement__ = 20; - stan::model::assign(inline_prob_uncaptured_chi_sym9__, - stan::math::fma( - (stan::model::rvalue(phi, "phi", - stan::model::index_uni( - inline_prob_uncaptured_i_sym13__), - stan::model::index_uni(lcm_sym73__)) * (1 - - stan::model::rvalue(p, "p", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni((lcm_sym77__ - 1))))), - stan::model::rvalue(inline_prob_uncaptured_chi_sym9__, - "inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni(lcm_sym77__)), (1 - - stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni(lcm_sym73__)))), - "assigning variable inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni(lcm_sym73__)); - } - } - } - } - current_statement__ = 25; - stan::model::assign(inline_prob_uncaptured_return_sym8__, - inline_prob_uncaptured_chi_sym9__, - "assigning variable inline_prob_uncaptured_return_sym8__"); - } - stan::model::assign(chi, inline_prob_uncaptured_return_sym8__, - "assigning variable chi"); - current_statement__ = 3; - stan::math::check_greater_or_equal(function__, "phi", phi, 0); - current_statement__ = 3; - stan::math::check_less_or_equal(function__, "phi", phi, 1); - current_statement__ = 4; - stan::math::check_greater_or_equal(function__, "p", p, 0); - current_statement__ = 4; - stan::math::check_less_or_equal(function__, "p", p, 1); - current_statement__ = 5; - stan::math::check_greater_or_equal(function__, "chi", - inline_prob_uncaptured_return_sym8__, 0); - current_statement__ = 5; - stan::math::check_less_or_equal(function__, "chi", - inline_prob_uncaptured_return_sym8__, 1); - { - current_statement__ = 32; - if (lcm_sym63__) { - lcm_sym102__ = stan::model::rvalue(first, "first", - stan::model::index_uni(1)); - if (stan::math::logical_gt(lcm_sym102__, 0)) { - lcm_sym104__ = stan::model::rvalue(last, "last", - stan::model::index_uni(1)); - lcm_sym82__ = (lcm_sym102__ + 1); - if (stan::math::logical_gte(lcm_sym104__, lcm_sym82__)) { - current_statement__ = 26; - lp_accum__.add(stan::math::bernoulli_lpmf(1, - stan::model::rvalue(phi, "phi", - stan::model::index_uni(1), - stan::model::index_uni((lcm_sym82__ - 1))))); - lcm_sym80__ = (lcm_sym82__ + 1); - lp_accum__.add(stan::math::bernoulli_lpmf( - stan::model::rvalue(y, "y", - stan::model::index_uni(1), - stan::model::index_uni(lcm_sym82__)), - stan::model::rvalue(p, "p", - stan::model::index_uni(1), - stan::model::index_uni((lcm_sym82__ - 1))))); - for (int t = lcm_sym80__; t <= lcm_sym104__; ++t) { - current_statement__ = 26; - lp_accum__.add(stan::math::bernoulli_lpmf(1, - stan::model::rvalue(phi, "phi", - stan::model::index_uni(1), - stan::model::index_uni((t - 1))))); - current_statement__ = 27; - lp_accum__.add(stan::math::bernoulli_lpmf( - stan::model::rvalue(y, "y", - stan::model::index_uni(1), - stan::model::index_uni(t)), - stan::model::rvalue(p, "p", - stan::model::index_uni(1), - stan::model::index_uni((t - 1))))); - } - } - current_statement__ = 29; - lp_accum__.add(stan::math::bernoulli_lpmf(1, - stan::model::rvalue( - inline_prob_uncaptured_return_sym8__, - "inline_prob_uncaptured_return_sym8__", - stan::model::index_uni(1), - stan::model::index_uni(lcm_sym104__)))); - } - for (int i = 2; i <= nind; ++i) { - lcm_sym101__ = stan::model::rvalue(first, "first", - stan::model::index_uni(i)); - if (stan::math::logical_gt(lcm_sym101__, 0)) { - lcm_sym103__ = stan::model::rvalue(last, "last", - stan::model::index_uni(i)); - lcm_sym81__ = (lcm_sym101__ + 1); - if (stan::math::logical_gte(lcm_sym103__, lcm_sym81__)) { - current_statement__ = 26; - lp_accum__.add(stan::math::bernoulli_lpmf(1, - stan::model::rvalue(phi, "phi", - stan::model::index_uni(i), - stan::model::index_uni((lcm_sym81__ - 1))))); - lcm_sym79__ = (lcm_sym81__ + 1); - lp_accum__.add(stan::math::bernoulli_lpmf( - stan::model::rvalue(y, "y", - stan::model::index_uni(i), - stan::model::index_uni(lcm_sym81__)), - stan::model::rvalue(p, "p", - stan::model::index_uni(i), - stan::model::index_uni((lcm_sym81__ - 1))))); - for (int t = lcm_sym79__; t <= lcm_sym103__; ++t) { - current_statement__ = 26; - lp_accum__.add(stan::math::bernoulli_lpmf(1, - stan::model::rvalue(phi, "phi", - stan::model::index_uni(i), - stan::model::index_uni((t - 1))))); - current_statement__ = 27; - lp_accum__.add(stan::math::bernoulli_lpmf( - stan::model::rvalue(y, "y", - stan::model::index_uni(i), - stan::model::index_uni(t)), - stan::model::rvalue(p, "p", - stan::model::index_uni(i), - stan::model::index_uni((t - 1))))); - } - } - current_statement__ = 29; - lp_accum__.add(stan::math::bernoulli_lpmf(1, - stan::model::rvalue( - inline_prob_uncaptured_return_sym8__, - "inline_prob_uncaptured_return_sym8__", - stan::model::index_uni(i), - stan::model::index_uni(lcm_sym103__)))); + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(1), + stan::model::index_uni(9)); + current_statement__ = 5; + pos__ = (pos__ + 1); + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(2), + stan::model::index_uni(9)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(3), + stan::model::index_uni(9)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(4), + stan::model::index_uni(9)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(5), + stan::model::index_uni(9)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(6), + stan::model::index_uni(9)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(7), + stan::model::index_uni(9)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(8), + stan::model::index_uni(9)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(9), + stan::model::index_uni(9)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(10), + stan::model::index_uni(9)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(1), + stan::model::index_uni(10)); + current_statement__ = 5; + pos__ = (pos__ + 1); + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(2), + stan::model::index_uni(10)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(3), + stan::model::index_uni(10)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(4), + stan::model::index_uni(10)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(5), + stan::model::index_uni(10)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(6), + stan::model::index_uni(10)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(7), + stan::model::index_uni(10)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(8), + stan::model::index_uni(10)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(9), + stan::model::index_uni(10)); + current_statement__ = 5; + pos__ = (pos__ + 1); + } + { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(10), + stan::model::index_uni(10)); + current_statement__ = 5; + pos__ = (pos__ + 1); } } } @@ -3488,6 +3347,62 @@ class copy_fail_model final : public model_base_crtp { } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } + num_params_r__ = (10 * 10); + } + inline std::string model_name() const final { + return "ad_levels_deep_model"; + } + inline std::vector model_compile_info() const noexcept { + return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", + "stancflags = --O --print-cpp"}; + } + 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__; + stan::io::deserializer in__(params_r__, params_i__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + static constexpr const char* function__ = + "ad_levels_deep_model_namespace::log_prob"; + // suppress unused var warning + (void) function__; + try { + Eigen::Matrix lcm_sym6__; + Eigen::Matrix lcm_sym5__; + stan::conditional_var_value_t> X_p; + current_statement__ = 1; + X_p = in__.template read< + stan::conditional_var_value_t>>(10, 10); + stan::conditional_var_value_t> X_tp1 = + stan::conditional_var_value_t>(Eigen::Matrix::Constant(10, + 10, + std::numeric_limits::quiet_NaN( + ))); + stan::model::assign(lcm_sym5__, stan::math::exp(X_data), + "assigning variable lcm_sym5__"); + stan::model::assign(X_tp1, lcm_sym5__, "assigning variable X_tp1"); + Eigen::Matrix X_tp2; + current_statement__ = 3; + stan::model::assign(X_tp2, stan::math::exp(lcm_sym5__), + "assigning variable X_tp2"); + current_statement__ = 4; + stan::model::assign(X_tp1, X_p, "assigning variable X_tp1"); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } lp_accum__.add(lp__); return lp_accum__.sum(); } @@ -3518,311 +3433,40 @@ class copy_fail_model final : public model_base_crtp { (void) DUMMY_VAR__; constexpr bool jacobian__ = false; static constexpr const char* function__ = - "copy_fail_model_namespace::write_array"; + "ad_levels_deep_model_namespace::write_array"; // suppress unused var warning (void) function__; try { - double lcm_sym62__; - int lcm_sym61__; - int lcm_sym60__; - double lcm_sym59__; - double lcm_sym58__; - double lcm_sym57__; - double lcm_sym56__; - double lcm_sym55__; - double lcm_sym54__; - double lcm_sym53__; - double lcm_sym52__; - int lcm_sym51__; - int lcm_sym50__; - int lcm_sym49__; - int lcm_sym48__; - int lcm_sym47__; - int lcm_sym46__; - int lcm_sym45__; - int lcm_sym44__; - int lcm_sym43__; - int lcm_sym42__; - int lcm_sym41__; - int lcm_sym40__; - int lcm_sym39__; - int lcm_sym38__; - int lcm_sym37__; - int lcm_sym36__; - double mean_p; + Eigen::Matrix lcm_sym4__; + Eigen::Matrix lcm_sym3__; + int lcm_sym2__; + int lcm_sym1__; + Eigen::Matrix X_p; current_statement__ = 1; - mean_p = in__.template read_constrain_lub(0, 1, lp__); - Eigen::Matrix beta; - current_statement__ = 2; - beta = in__.template read_constrain_lub< - Eigen::Matrix, jacobian__>(0, 1, lp__, - max_age); - Eigen::Matrix phi = - Eigen::Matrix::Constant(nind, (n_occasions - 1), - std::numeric_limits::quiet_NaN()); - Eigen::Matrix p = - Eigen::Matrix::Constant(nind, (n_occasions - 1), + X_p = in__.template read>(10, 10); + Eigen::Matrix X_tp1 = + Eigen::Matrix::Constant(10, 10, std::numeric_limits::quiet_NaN()); - Eigen::Matrix chi = - Eigen::Matrix::Constant(nind, n_occasions, + Eigen::Matrix X_tp2 = + Eigen::Matrix::Constant(10, 10, std::numeric_limits::quiet_NaN()); - out__.write(mean_p); - out__.write(beta); + out__.write(X_p); if (stan::math::logical_negation( (stan::math::primitive_value(emit_transformed_parameters__) || stan::math::primitive_value(emit_generated_quantities__)))) { return ; } - lcm_sym36__ = stan::math::logical_gte(nind, 1); - if (lcm_sym36__) { - lcm_sym61__ = stan::model::rvalue(first, "first", - stan::model::index_uni(1)); - lcm_sym45__ = (lcm_sym61__ - 1); - if (stan::math::logical_gte(lcm_sym45__, 1)) { - stan::model::assign(phi, 0, "assigning variable phi", - stan::model::index_uni(1), stan::model::index_uni(1)); - current_statement__ = 6; - stan::model::assign(p, 0, "assigning variable p", - stan::model::index_uni(1), stan::model::index_uni(1)); - for (int t = 2; t <= lcm_sym45__; ++t) { - current_statement__ = 7; - stan::model::assign(phi, 0, "assigning variable phi", - stan::model::index_uni(1), stan::model::index_uni(t)); - current_statement__ = 6; - stan::model::assign(p, 0, "assigning variable p", - stan::model::index_uni(1), stan::model::index_uni(t)); - } - } - lcm_sym43__ = (n_occasions - 1); - if (stan::math::logical_gte(lcm_sym43__, lcm_sym61__)) { - current_statement__ = 9; - stan::model::assign(phi, - stan::model::rvalue(beta, "beta", - stan::model::index_uni( - stan::model::rvalue(x, "x", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym61__)))), - "assigning variable phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym61__)); - lcm_sym51__ = (lcm_sym61__ + 1); - stan::model::assign(p, mean_p, "assigning variable p", - stan::model::index_uni(1), stan::model::index_uni(lcm_sym61__)); - for (int t = lcm_sym51__; t <= lcm_sym43__; ++t) { - current_statement__ = 9; - stan::model::assign(phi, - stan::model::rvalue(beta, "beta", - stan::model::index_uni( - stan::model::rvalue(x, "x", stan::model::index_uni(1), - stan::model::index_uni(t)))), "assigning variable phi", - stan::model::index_uni(1), stan::model::index_uni(t)); - current_statement__ = 10; - stan::model::assign(p, mean_p, "assigning variable p", - stan::model::index_uni(1), stan::model::index_uni(t)); - } - } - for (int i = 2; i <= nind; ++i) { - lcm_sym60__ = stan::model::rvalue(first, "first", - stan::model::index_uni(i)); - lcm_sym44__ = (lcm_sym60__ - 1); - if (stan::math::logical_gte(lcm_sym44__, 1)) { - stan::model::assign(phi, 0, "assigning variable phi", - stan::model::index_uni(i), stan::model::index_uni(1)); - current_statement__ = 6; - stan::model::assign(p, 0, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(1)); - for (int t = 2; t <= lcm_sym44__; ++t) { - current_statement__ = 7; - stan::model::assign(phi, 0, "assigning variable phi", - stan::model::index_uni(i), stan::model::index_uni(t)); - current_statement__ = 6; - stan::model::assign(p, 0, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(t)); - } - } - current_statement__ = 12; - if (stan::math::logical_gte(lcm_sym43__, lcm_sym60__)) { - current_statement__ = 9; - stan::model::assign(phi, - stan::model::rvalue(beta, "beta", - stan::model::index_uni( - stan::model::rvalue(x, "x", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym60__)))), - "assigning variable phi", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym60__)); - lcm_sym50__ = (lcm_sym60__ + 1); - stan::model::assign(p, mean_p, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(lcm_sym60__)); - for (int t = lcm_sym50__; t <= lcm_sym43__; ++t) { - current_statement__ = 9; - stan::model::assign(phi, - stan::model::rvalue(beta, "beta", - stan::model::index_uni( - stan::model::rvalue(x, "x", stan::model::index_uni(i), - stan::model::index_uni(t)))), "assigning variable phi", - stan::model::index_uni(i), stan::model::index_uni(t)); - current_statement__ = 10; - stan::model::assign(p, mean_p, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(t)); - } - } - } - } - Eigen::Matrix inline_prob_uncaptured_return_sym1__; - { - current_statement__ = 14; - stan::math::validate_non_negative_index("chi", "nind", nind); - current_statement__ = 15; - stan::math::validate_non_negative_index("chi", "n_occasions", - n_occasions); - Eigen::Matrix - inline_prob_uncaptured_chi_sym2__ = - Eigen::Matrix::Constant(nind, n_occasions, - DUMMY_VAR__); - current_statement__ = 24; - if (lcm_sym36__) { - current_statement__ = 17; - stan::model::assign(inline_prob_uncaptured_chi_sym2__, 1.0, - "assigning variable inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(1), stan::model::index_uni(n_occasions)); - lcm_sym43__ = (n_occasions - 1); - lcm_sym37__ = stan::math::logical_gte(lcm_sym43__, 1); - if (lcm_sym37__) { - int inline_prob_uncaptured_t_curr_sym3__ = - std::numeric_limits::min(); - int inline_prob_uncaptured_t_next_sym4__ = - std::numeric_limits::min(); - lcm_sym49__ = (lcm_sym43__ + 1); - current_statement__ = 20; - stan::model::assign(inline_prob_uncaptured_chi_sym2__, - stan::math::fma( - (stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym43__)) * (1 - - stan::model::rvalue(p, "p", stan::model::index_uni(1), - stan::model::index_uni((lcm_sym49__ - 1))))), - stan::model::rvalue(inline_prob_uncaptured_chi_sym2__, - "inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(1), - stan::model::index_uni(lcm_sym49__)), (1 - - stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym43__)))), - "assigning variable inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(1), stan::model::index_uni(lcm_sym43__)); - for (int inline_prob_uncaptured_t_sym5__ = 2; inline_prob_uncaptured_t_sym5__ - <= lcm_sym43__; ++inline_prob_uncaptured_t_sym5__) { - int inline_prob_uncaptured_t_curr_sym3__ = - std::numeric_limits::min(); - lcm_sym42__ = (n_occasions - inline_prob_uncaptured_t_sym5__); - int inline_prob_uncaptured_t_next_sym4__ = - std::numeric_limits::min(); - lcm_sym48__ = (lcm_sym42__ + 1); - current_statement__ = 20; - stan::model::assign(inline_prob_uncaptured_chi_sym2__, - stan::math::fma( - (stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym42__)) * (1 - - stan::model::rvalue(p, "p", stan::model::index_uni(1), - stan::model::index_uni((lcm_sym48__ - 1))))), - stan::model::rvalue(inline_prob_uncaptured_chi_sym2__, - "inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(1), - stan::model::index_uni(lcm_sym48__)), (1 - - stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym42__)))), - "assigning variable inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(1), - stan::model::index_uni(lcm_sym42__)); - } - } - for (int inline_prob_uncaptured_i_sym6__ = 2; inline_prob_uncaptured_i_sym6__ - <= nind; ++inline_prob_uncaptured_i_sym6__) { - current_statement__ = 17; - stan::model::assign(inline_prob_uncaptured_chi_sym2__, 1.0, - "assigning variable inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(n_occasions)); - current_statement__ = 22; - if (lcm_sym37__) { - int inline_prob_uncaptured_t_curr_sym3__ = - std::numeric_limits::min(); - int inline_prob_uncaptured_t_next_sym4__ = - std::numeric_limits::min(); - lcm_sym49__ = (lcm_sym43__ + 1); - current_statement__ = 20; - stan::model::assign(inline_prob_uncaptured_chi_sym2__, - stan::math::fma( - (stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(lcm_sym43__)) * (1 - - stan::model::rvalue(p, "p", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni((lcm_sym49__ - 1))))), - stan::model::rvalue(inline_prob_uncaptured_chi_sym2__, - "inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(lcm_sym49__)), (1 - - stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(lcm_sym43__)))), - "assigning variable inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(lcm_sym43__)); - for (int inline_prob_uncaptured_t_sym5__ = 2; inline_prob_uncaptured_t_sym5__ - <= lcm_sym43__; ++inline_prob_uncaptured_t_sym5__) { - int inline_prob_uncaptured_t_curr_sym3__ = - std::numeric_limits::min(); - lcm_sym42__ = (n_occasions - - inline_prob_uncaptured_t_sym5__); - int inline_prob_uncaptured_t_next_sym4__ = - std::numeric_limits::min(); - lcm_sym48__ = (lcm_sym42__ + 1); - current_statement__ = 20; - stan::model::assign(inline_prob_uncaptured_chi_sym2__, - stan::math::fma( - (stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(lcm_sym42__)) * (1 - - stan::model::rvalue(p, "p", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni((lcm_sym48__ - 1))))), - stan::model::rvalue(inline_prob_uncaptured_chi_sym2__, - "inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(lcm_sym48__)), (1 - - stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(lcm_sym42__)))), - "assigning variable inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(lcm_sym42__)); - } - } - } - } - current_statement__ = 25; - stan::model::assign(inline_prob_uncaptured_return_sym1__, - inline_prob_uncaptured_chi_sym2__, - "assigning variable inline_prob_uncaptured_return_sym1__"); - } - stan::model::assign(chi, inline_prob_uncaptured_return_sym1__, - "assigning variable chi"); - current_statement__ = 3; - stan::math::check_greater_or_equal(function__, "phi", phi, 0); - current_statement__ = 3; - stan::math::check_less_or_equal(function__, "phi", phi, 1); - current_statement__ = 4; - stan::math::check_greater_or_equal(function__, "p", p, 0); + stan::model::assign(lcm_sym3__, stan::math::exp(X_data), + "assigning variable lcm_sym3__"); + stan::model::assign(X_tp1, lcm_sym3__, "assigning variable X_tp1"); + stan::model::assign(lcm_sym4__, stan::math::exp(lcm_sym3__), + "assigning variable lcm_sym4__"); + stan::model::assign(X_tp2, lcm_sym4__, "assigning variable X_tp2"); current_statement__ = 4; - stan::math::check_less_or_equal(function__, "p", p, 1); - current_statement__ = 5; - stan::math::check_greater_or_equal(function__, "chi", - inline_prob_uncaptured_return_sym1__, 0); - current_statement__ = 5; - stan::math::check_less_or_equal(function__, "chi", - inline_prob_uncaptured_return_sym1__, 1); + stan::model::assign(X_tp1, X_p, "assigning variable X_tp1"); if (emit_transformed_parameters__) { - out__.write(phi); - out__.write(p); - out__.write(inline_prob_uncaptured_return_sym1__); + out__.write(X_p); + out__.write(lcm_sym4__); } if (stan::math::logical_negation(emit_generated_quantities__)) { return ; @@ -3845,178 +3489,2214 @@ class copy_fail_model final : public model_base_crtp { // suppress unused var warning (void) DUMMY_VAR__; try { - int lcm_sym35__; int pos__; pos__ = 1; - local_scalar_t__ mean_p; - mean_p = in__.read(); - out__.write_free_lub(0, 1, mean_p); - Eigen::Matrix beta = - Eigen::Matrix::Constant(max_age, DUMMY_VAR__); - if (stan::math::logical_gte(max_age, 1)) { - stan::model::assign(beta, in__.read(), - "assigning variable beta", stan::model::index_uni(1)); - for (int sym1__ = 2; sym1__ <= max_age; ++sym1__) { - stan::model::assign(beta, in__.read(), - "assigning variable beta", stan::model::index_uni(sym1__)); - } - } - out__.write_free_lub(0, 1, beta); - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } - } - inline void get_param_names(std::vector& names__) const { - names__ = std::vector{"mean_p", "beta", "phi", "p", "chi"}; - } - inline void get_dims(std::vector>& dimss__) const { - dimss__ = std::vector>{std::vector{}, - std::vector{static_cast(max_age)}, - std::vector{static_cast(nind), - static_cast(n_occ_minus_1)}, - std::vector{static_cast(nind), - static_cast(n_occ_minus_1)}, - std::vector{static_cast(nind), - static_cast(n_occasions)}}; - } - inline void - constrained_param_names(std::vector& param_names__, bool - emit_transformed_parameters__ = true, bool - emit_generated_quantities__ = true) const final { - param_names__.emplace_back(std::string() + "mean_p"); - for (int sym119__ = 1; sym119__ <= max_age; ++sym119__) { - param_names__.emplace_back(std::string() + "beta" + '.' + - std::to_string(sym119__)); - } - if (emit_transformed_parameters__) { - for (int sym119__ = 1; sym119__ <= n_occ_minus_1; ++sym119__) { - for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { - param_names__.emplace_back(std::string() + "phi" + '.' + - std::to_string(sym120__) + '.' + std::to_string(sym119__)); - } - } - for (int sym119__ = 1; sym119__ <= n_occ_minus_1; ++sym119__) { - for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { - param_names__.emplace_back(std::string() + "p" + '.' + - std::to_string(sym120__) + '.' + std::to_string(sym119__)); - } - } - for (int sym119__ = 1; sym119__ <= n_occasions; ++sym119__) { - for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { - param_names__.emplace_back(std::string() + "chi" + '.' + - std::to_string(sym120__) + '.' + std::to_string(sym119__)); - } - } - } - 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 { - param_names__.emplace_back(std::string() + "mean_p"); - for (int sym119__ = 1; sym119__ <= max_age; ++sym119__) { - param_names__.emplace_back(std::string() + "beta" + '.' + - std::to_string(sym119__)); - } - if (emit_transformed_parameters__) { - for (int sym119__ = 1; sym119__ <= n_occ_minus_1; ++sym119__) { - for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { - param_names__.emplace_back(std::string() + "phi" + '.' + - std::to_string(sym120__) + '.' + std::to_string(sym119__)); + Eigen::Matrix X_p = + Eigen::Matrix::Constant(10, 10, DUMMY_VAR__); + { + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(1), + stan::model::index_uni(1)); + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(2), + stan::model::index_uni(1)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(3), + stan::model::index_uni(1)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(4), + stan::model::index_uni(1)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(5), + stan::model::index_uni(1)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(6), + stan::model::index_uni(1)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(7), + stan::model::index_uni(1)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(8), + stan::model::index_uni(1)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(9), + stan::model::index_uni(1)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(10), + stan::model::index_uni(1)); + } } - } - for (int sym119__ = 1; sym119__ <= n_occ_minus_1; ++sym119__) { - for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { - param_names__.emplace_back(std::string() + "p" + '.' + - std::to_string(sym120__) + '.' + std::to_string(sym119__)); + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(1), + stan::model::index_uni(2)); + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(2), + stan::model::index_uni(2)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(3), + stan::model::index_uni(2)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(4), + stan::model::index_uni(2)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(5), + stan::model::index_uni(2)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(6), + stan::model::index_uni(2)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(7), + stan::model::index_uni(2)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(8), + stan::model::index_uni(2)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(9), + stan::model::index_uni(2)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(10), + stan::model::index_uni(2)); + } } - } - for (int sym119__ = 1; sym119__ <= n_occasions; ++sym119__) { - for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { - param_names__.emplace_back(std::string() + "chi" + '.' + - std::to_string(sym120__) + '.' + std::to_string(sym119__)); + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(1), + stan::model::index_uni(3)); + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(2), + stan::model::index_uni(3)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(3), + stan::model::index_uni(3)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(4), + stan::model::index_uni(3)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(5), + stan::model::index_uni(3)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(6), + stan::model::index_uni(3)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(7), + stan::model::index_uni(3)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(8), + stan::model::index_uni(3)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(9), + stan::model::index_uni(3)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(10), + stan::model::index_uni(3)); + } } - } - } - if (emit_generated_quantities__) {} - } - inline std::string get_constrained_sizedtypes() const { - return std::string("[{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(max_age) + "},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"}]"); - } - inline std::string get_unconstrained_sizedtypes() const { - return std::string("[{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(max_age) + "},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occasions) + "},\"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__ = (1 + max_age); - const size_t num_transformed = emit_transformed_parameters * ((((nind * - n_occ_minus_1) + (nind * n_occ_minus_1)) + (nind * n_occasions))); - 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__ = (1 + max_age); - const size_t num_transformed = emit_transformed_parameters * ((((nind * - n_occ_minus_1) + (nind * n_occ_minus_1)) + (nind * n_occasions))); - 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 { - constexpr std::array names__{"mean_p", "beta"}; - const std::array constrain_param_sizes__{1, max_age}; - const auto num_constrained_params__ = - std::accumulate(constrain_param_sizes__.begin(), - constrain_param_sizes__.end(), 0); - std::vector params_r_flat__(num_constrained_params__); - Eigen::Index size_iter__ = 0; - Eigen::Index flat_iter__ = 0; - for (auto&& param_name__: names__) { - const auto param_vec__ = context.vals_r(param_name__); + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(1), + stan::model::index_uni(4)); + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(2), + stan::model::index_uni(4)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(3), + stan::model::index_uni(4)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(4), + stan::model::index_uni(4)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(5), + stan::model::index_uni(4)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(6), + stan::model::index_uni(4)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(7), + stan::model::index_uni(4)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(8), + stan::model::index_uni(4)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(9), + stan::model::index_uni(4)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(10), + stan::model::index_uni(4)); + } + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(1), + stan::model::index_uni(5)); + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(2), + stan::model::index_uni(5)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(3), + stan::model::index_uni(5)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(4), + stan::model::index_uni(5)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(5), + stan::model::index_uni(5)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(6), + stan::model::index_uni(5)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(7), + stan::model::index_uni(5)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(8), + stan::model::index_uni(5)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(9), + stan::model::index_uni(5)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(10), + stan::model::index_uni(5)); + } + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(1), + stan::model::index_uni(6)); + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(2), + stan::model::index_uni(6)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(3), + stan::model::index_uni(6)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(4), + stan::model::index_uni(6)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(5), + stan::model::index_uni(6)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(6), + stan::model::index_uni(6)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(7), + stan::model::index_uni(6)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(8), + stan::model::index_uni(6)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(9), + stan::model::index_uni(6)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(10), + stan::model::index_uni(6)); + } + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(1), + stan::model::index_uni(7)); + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(2), + stan::model::index_uni(7)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(3), + stan::model::index_uni(7)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(4), + stan::model::index_uni(7)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(5), + stan::model::index_uni(7)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(6), + stan::model::index_uni(7)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(7), + stan::model::index_uni(7)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(8), + stan::model::index_uni(7)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(9), + stan::model::index_uni(7)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(10), + stan::model::index_uni(7)); + } + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(1), + stan::model::index_uni(8)); + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(2), + stan::model::index_uni(8)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(3), + stan::model::index_uni(8)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(4), + stan::model::index_uni(8)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(5), + stan::model::index_uni(8)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(6), + stan::model::index_uni(8)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(7), + stan::model::index_uni(8)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(8), + stan::model::index_uni(8)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(9), + stan::model::index_uni(8)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(10), + stan::model::index_uni(8)); + } + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(1), + stan::model::index_uni(9)); + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(2), + stan::model::index_uni(9)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(3), + stan::model::index_uni(9)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(4), + stan::model::index_uni(9)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(5), + stan::model::index_uni(9)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(6), + stan::model::index_uni(9)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(7), + stan::model::index_uni(9)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(8), + stan::model::index_uni(9)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(9), + stan::model::index_uni(9)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(10), + stan::model::index_uni(9)); + } + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(1), + stan::model::index_uni(10)); + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(2), + stan::model::index_uni(10)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(3), + stan::model::index_uni(10)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(4), + stan::model::index_uni(10)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(5), + stan::model::index_uni(10)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(6), + stan::model::index_uni(10)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(7), + stan::model::index_uni(10)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(8), + stan::model::index_uni(10)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(9), + stan::model::index_uni(10)); + } + { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(10), + stan::model::index_uni(10)); + } + } + } + out__.write(X_p); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + inline void get_param_names(std::vector& names__) const { + names__ = std::vector{"X_p", "X_tp1", "X_tp2"}; + } + inline void get_dims(std::vector>& dimss__) const { + dimss__ = std::vector>{std::vector{static_cast< + size_t>( + 10), + static_cast(10)}, + std::vector{static_cast(10), + static_cast(10)}, + std::vector{static_cast(10), + static_cast(10)}}; + } + inline void + constrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { + for (int sym10__ = 1; sym10__ <= 10; ++sym10__) { + for (int sym11__ = 1; sym11__ <= 10; ++sym11__) { + param_names__.emplace_back(std::string() + "X_p" + '.' + + std::to_string(sym11__) + '.' + std::to_string(sym10__)); + } + } + if (emit_transformed_parameters__) { + for (int sym10__ = 1; sym10__ <= 10; ++sym10__) { + for (int sym11__ = 1; sym11__ <= 10; ++sym11__) { + param_names__.emplace_back(std::string() + "X_tp1" + '.' + + std::to_string(sym11__) + '.' + std::to_string(sym10__)); + } + } + for (int sym10__ = 1; sym10__ <= 10; ++sym10__) { + for (int sym11__ = 1; sym11__ <= 10; ++sym11__) { + param_names__.emplace_back(std::string() + "X_tp2" + '.' + + std::to_string(sym11__) + '.' + std::to_string(sym10__)); + } + } + } + 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 sym10__ = 1; sym10__ <= 10; ++sym10__) { + for (int sym11__ = 1; sym11__ <= 10; ++sym11__) { + param_names__.emplace_back(std::string() + "X_p" + '.' + + std::to_string(sym11__) + '.' + std::to_string(sym10__)); + } + } + if (emit_transformed_parameters__) { + for (int sym10__ = 1; sym10__ <= 10; ++sym10__) { + for (int sym11__ = 1; sym11__ <= 10; ++sym11__) { + param_names__.emplace_back(std::string() + "X_tp1" + '.' + + std::to_string(sym11__) + '.' + std::to_string(sym10__)); + } + } + for (int sym10__ = 1; sym10__ <= 10; ++sym10__) { + for (int sym11__ = 1; sym11__ <= 10; ++sym11__) { + param_names__.emplace_back(std::string() + "X_tp2" + '.' + + std::to_string(sym11__) + '.' + std::to_string(sym10__)); + } + } + } + if (emit_generated_quantities__) {} + } + inline std::string get_constrained_sizedtypes() const { + return std::string("[{\"name\":\"X_p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(10) + ",\"cols\":" + std::to_string(10) + "},\"block\":\"parameters\"},{\"name\":\"X_tp1\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(10) + ",\"cols\":" + std::to_string(10) + "},\"block\":\"transformed_parameters\"},{\"name\":\"X_tp2\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(10) + ",\"cols\":" + std::to_string(10) + "},\"block\":\"transformed_parameters\"}]"); + } + inline std::string get_unconstrained_sizedtypes() const { + return std::string("[{\"name\":\"X_p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(10) + ",\"cols\":" + std::to_string(10) + "},\"block\":\"parameters\"},{\"name\":\"X_tp1\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(10) + ",\"cols\":" + std::to_string(10) + "},\"block\":\"transformed_parameters\"},{\"name\":\"X_tp2\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(10) + ",\"cols\":" + std::to_string(10) + "},\"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__ = (10 * 10); + const size_t num_transformed = emit_transformed_parameters * (((10 * 10) + + (10 * 10))); + 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__ = (10 * 10); + const size_t num_transformed = emit_transformed_parameters * (((10 * 10) + + (10 * 10))); + 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 { + constexpr std::array names__{"X_p"}; + const std::array constrain_param_sizes__{(10 * 10)}; + const auto num_constrained_params__ = + std::accumulate(constrain_param_sizes__.begin(), + constrain_param_sizes__.end(), 0); + std::vector params_r_flat__(num_constrained_params__); + Eigen::Index size_iter__ = 0; + Eigen::Index flat_iter__ = 0; + for (auto&& param_name__: names__) { + const auto param_vec__ = context.vals_r(param_name__); + for (Eigen::Index i = 0; i < constrain_param_sizes__[size_iter__]; ++i) { + params_r_flat__[flat_iter__] = param_vec__[i]; + ++flat_iter__; + } + ++size_iter__; + } + vars.resize(num_params_r__); + transform_inits_impl(params_r_flat__, params_i, vars, pstream__); + } +}; +} +using stan_model = ad_levels_deep_model_namespace::ad_levels_deep_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* m = new stan_model(data_context, seed, msg_stream); + return *m; +} +stan::math::profile_map& get_stan_profile_data() { + return ad_levels_deep_model_namespace::profiles__; +} +#endif + $ ../../../../../install/default/bin/stanc --O --print-cpp copy_fail.stan +// Code generated by %%NAME%% %%VERSION%% +#include +namespace copy_fail_model_namespace { +using stan::model::model_base_crtp; +using namespace stan::math; +stan::math::profile_map profiles__; +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'copy_fail.stan', line 68, column 2 to column 32)", + " (in 'copy_fail.stan', line 69, column 2 to column 41)", + " (in 'copy_fail.stan', line 72, column 2 to column 52)", + " (in 'copy_fail.stan', line 73, column 2 to column 50)", + " (in 'copy_fail.stan', line 74, column 2 to column 50)", + " (in 'copy_fail.stan', line 80, column 6 to column 18)", + " (in 'copy_fail.stan', line 79, column 6 to column 20)", + " (in 'copy_fail.stan', line 78, column 34 to line 81, column 5)", + " (in 'copy_fail.stan', line 83, column 6 to column 32)", + " (in 'copy_fail.stan', line 84, column 6 to column 23)", + " (in 'copy_fail.stan', line 82, column 40 to line 85, column 5)", + " (in 'copy_fail.stan', line 82, column 4 to line 85, column 5)", + " (in 'copy_fail.stan', line 77, column 22 to line 86, column 3)", + " (in 'copy_fail.stan', line 25, column 11 to column 15)", + " (in 'copy_fail.stan', line 25, column 17 to column 28)", + " (in 'copy_fail.stan', line 25, column 4 to column 34)", + " (in 'copy_fail.stan', line 28, column 6 to column 32)", + " (in 'copy_fail.stan', line 31, column 8 to column 37)", + " (in 'copy_fail.stan', line 32, column 8 to column 32)", + " (in 'copy_fail.stan', line 40, column 8 to line 42, column 44)", + " (in 'copy_fail.stan', line 29, column 39 to line 43, column 7)", + " (in 'copy_fail.stan', line 29, column 6 to line 43, column 7)", + " (in 'copy_fail.stan', line 27, column 24 to line 44, column 5)", + " (in 'copy_fail.stan', line 27, column 4 to line 44, column 5)", + " (in 'copy_fail.stan', line 45, column 4 to column 15)", + " (in 'copy_fail.stan', line 100, column 8 to column 37)", + " (in 'copy_fail.stan', line 101, column 8 to column 41)", + " (in 'copy_fail.stan', line 99, column 42 to line 102, column 7)", + " (in 'copy_fail.stan', line 103, column 6 to column 37)", + " (in 'copy_fail.stan', line 98, column 22 to line 104, column 5)", + " (in 'copy_fail.stan', line 97, column 22 to line 105, column 3)", + " (in 'copy_fail.stan', line 97, column 2 to line 105, column 3)", + " (in 'copy_fail.stan', line 49, column 2 to column 20)", + " (in 'copy_fail.stan', line 50, column 2 to column 27)", + " (in 'copy_fail.stan', line 51, column 8 to column 12)", + " (in 'copy_fail.stan', line 51, column 14 to column 25)", + " (in 'copy_fail.stan', line 51, column 2 to column 51)", + " (in 'copy_fail.stan', line 52, column 2 to column 23)", + " (in 'copy_fail.stan', line 53, column 8 to column 12)", + " (in 'copy_fail.stan', line 53, column 2 to column 61)", + " (in 'copy_fail.stan', line 56, column 2 to column 38)", + " (in 'copy_fail.stan', line 58, column 8 to column 12)", + " (in 'copy_fail.stan', line 58, column 2 to column 52)", + " (in 'copy_fail.stan', line 59, column 8 to column 12)", + " (in 'copy_fail.stan', line 59, column 2 to column 51)", + " (in 'copy_fail.stan', line 63, column 4 to column 35)", + " (in 'copy_fail.stan', line 62, column 2 to line 63, column 35)", + " (in 'copy_fail.stan', line 65, column 4 to column 33)", + " (in 'copy_fail.stan', line 64, column 2 to line 65, column 33)", + " (in 'copy_fail.stan', line 69, column 27 to column 34)", + " (in 'copy_fail.stan', line 72, column 27 to column 31)", + " (in 'copy_fail.stan', line 72, column 33 to column 46)", + " (in 'copy_fail.stan', line 73, column 27 to column 31)", + " (in 'copy_fail.stan', line 73, column 33 to column 46)", + " (in 'copy_fail.stan', line 74, column 27 to column 31)", + " (in 'copy_fail.stan', line 74, column 33 to column 44)", + " (in 'copy_fail.stan', line 8, column 8 to column 17)", + " (in 'copy_fail.stan', line 7, column 6 to line 8, column 17)", + " (in 'copy_fail.stan', line 9, column 4 to column 13)", + " (in 'copy_fail.stan', line 5, column 37 to line 10, column 3)", + " (in 'copy_fail.stan', line 15, column 6 to column 32)", + " (in 'copy_fail.stan', line 19, column 8 to column 17)", + " (in 'copy_fail.stan', line 18, column 6 to line 19, column 17)", + " (in 'copy_fail.stan', line 13, column 39 to line 20, column 5)", + " (in 'copy_fail.stan', line 21, column 4 to column 13)", + " (in 'copy_fail.stan', line 12, column 36 to line 22, column 3)", + " (in 'copy_fail.stan', line 24, column 74 to line 46, column 3)"}; +int first_capture(const std::vector& y_i, std::ostream* pstream__); +int last_capture(const std::vector& y_i, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, + const T3__& phi_arg__, std::ostream* pstream__); +int first_capture(const std::vector& y_i, std::ostream* pstream__) { + using local_scalar_t__ = double; + int current_statement__ = 0; + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + int lcm_sym18__; + int lcm_sym17__; + int lcm_sym16__; + int lcm_sym15__; + { + lcm_sym16__ = stan::math::size(y_i); + if (stan::math::logical_gte(lcm_sym16__, 1)) { + current_statement__ = 58; + if (stan::model::rvalue(y_i, "y_i", stan::model::index_uni(1))) { + current_statement__ = 57; + return 1; + } + for (int k = 2; k <= lcm_sym16__; ++k) { + current_statement__ = 58; + if (stan::model::rvalue(y_i, "y_i", stan::model::index_uni(k))) { + current_statement__ = 57; + return k; + } + } + } + current_statement__ = 59; + return 0; + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +int last_capture(const std::vector& y_i, std::ostream* pstream__) { + using local_scalar_t__ = double; + int current_statement__ = 0; + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + int lcm_sym24__; + int lcm_sym23__; + int lcm_sym22__; + int lcm_sym21__; + int lcm_sym20__; + int lcm_sym19__; + { + lcm_sym22__ = (stan::math::size(y_i) - 1); + if (stan::math::logical_gte(lcm_sym22__, 0)) { + int k = std::numeric_limits::min(); + lcm_sym21__ = (stan::math::size(y_i) - 0); + current_statement__ = 63; + if (y_i[(lcm_sym21__ - 1)]) { + current_statement__ = 62; + return lcm_sym21__; + } + for (int k_rev = 1; k_rev <= lcm_sym22__; ++k_rev) { + int k = std::numeric_limits::min(); + lcm_sym20__ = (stan::math::size(y_i) - k_rev); + current_statement__ = 63; + if (y_i[(lcm_sym20__ - 1)]) { + current_statement__ = 62; + return lcm_sym20__; + } + } + } + current_statement__ = 65; + return 0; + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>*> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, + const T3__& phi_arg__, std::ostream* pstream__) { + using local_scalar_t__ = stan::promote_args_t, + stan::base_type_t>; + int current_statement__ = 0; + const auto& p = stan::math::to_ref(p_arg__); + const auto& phi = stan::math::to_ref(phi_arg__); + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + double lcm_sym34__; + double lcm_sym33__; + double lcm_sym32__; + double lcm_sym31__; + int lcm_sym30__; + int lcm_sym29__; + int lcm_sym28__; + int lcm_sym27__; + int lcm_sym26__; + int lcm_sym25__; + { + current_statement__ = 14; + stan::math::validate_non_negative_index("chi", "nind", nind); + current_statement__ = 15; + stan::math::validate_non_negative_index("chi", "n_occasions", + n_occasions); + Eigen::Matrix chi = + Eigen::Matrix::Constant(nind, n_occasions, + DUMMY_VAR__); + current_statement__ = 24; + if (stan::math::logical_gte(nind, 1)) { + current_statement__ = 17; + stan::model::assign(chi, 1.0, "assigning variable chi", + stan::model::index_uni(1), stan::model::index_uni(n_occasions)); + lcm_sym28__ = (n_occasions - 1); + lcm_sym26__ = stan::math::logical_gte(lcm_sym28__, 1); + if (lcm_sym26__) { + int t_curr = std::numeric_limits::min(); + int t_next = std::numeric_limits::min(); + lcm_sym30__ = (lcm_sym28__ + 1); + current_statement__ = 20; + stan::model::assign(chi, + stan::math::fma( + (stan::model::rvalue(phi, "phi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym28__)) * (1 - + stan::model::rvalue(p, "p", stan::model::index_uni(1), + stan::model::index_uni((lcm_sym30__ - 1))))), + stan::model::rvalue(chi, "chi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym30__)), (1 - + stan::model::rvalue(phi, "phi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym28__)))), + "assigning variable chi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym28__)); + for (int t = 2; t <= lcm_sym28__; ++t) { + int t_curr = std::numeric_limits::min(); + lcm_sym27__ = (n_occasions - t); + int t_next = std::numeric_limits::min(); + lcm_sym29__ = (lcm_sym27__ + 1); + current_statement__ = 20; + stan::model::assign(chi, + stan::math::fma( + (stan::model::rvalue(phi, "phi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym27__)) * (1 - + stan::model::rvalue(p, "p", stan::model::index_uni(1), + stan::model::index_uni((lcm_sym29__ - 1))))), + stan::model::rvalue(chi, "chi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym29__)), (1 - + stan::model::rvalue(phi, "phi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym27__)))), + "assigning variable chi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym27__)); + } + } + for (int i = 2; i <= nind; ++i) { + current_statement__ = 17; + stan::model::assign(chi, 1.0, "assigning variable chi", + stan::model::index_uni(i), stan::model::index_uni(n_occasions)); + current_statement__ = 22; + if (lcm_sym26__) { + int t_curr = std::numeric_limits::min(); + int t_next = std::numeric_limits::min(); + lcm_sym30__ = (lcm_sym28__ + 1); + current_statement__ = 20; + stan::model::assign(chi, + stan::math::fma( + (stan::model::rvalue(phi, "phi", stan::model::index_uni(i), + stan::model::index_uni(lcm_sym28__)) * (1 - + stan::model::rvalue(p, "p", stan::model::index_uni(i), + stan::model::index_uni((lcm_sym30__ - 1))))), + stan::model::rvalue(chi, "chi", stan::model::index_uni(i), + stan::model::index_uni(lcm_sym30__)), (1 - + stan::model::rvalue(phi, "phi", stan::model::index_uni(i), + stan::model::index_uni(lcm_sym28__)))), + "assigning variable chi", stan::model::index_uni(i), + stan::model::index_uni(lcm_sym28__)); + for (int t = 2; t <= lcm_sym28__; ++t) { + int t_curr = std::numeric_limits::min(); + lcm_sym27__ = (n_occasions - t); + int t_next = std::numeric_limits::min(); + lcm_sym29__ = (lcm_sym27__ + 1); + current_statement__ = 20; + stan::model::assign(chi, + stan::math::fma( + (stan::model::rvalue(phi, "phi", stan::model::index_uni(i), + stan::model::index_uni(lcm_sym27__)) * (1 - + stan::model::rvalue(p, "p", stan::model::index_uni(i), + stan::model::index_uni((lcm_sym29__ - 1))))), + stan::model::rvalue(chi, "chi", stan::model::index_uni(i), + stan::model::index_uni(lcm_sym29__)), (1 - + stan::model::rvalue(phi, "phi", stan::model::index_uni(i), + stan::model::index_uni(lcm_sym27__)))), + "assigning variable chi", stan::model::index_uni(i), + stan::model::index_uni(lcm_sym27__)); + } + } + } + } + current_statement__ = 25; + return chi; + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +class copy_fail_model final : public model_base_crtp { + private: + int lcm_sym118__; + int lcm_sym117__; + int lcm_sym116__; + int lcm_sym115__; + int lcm_sym114__; + int lcm_sym113__; + int lcm_sym112__; + int lcm_sym111__; + int lcm_sym110__; + int lcm_sym109__; + int lcm_sym108__; + int lcm_sym107__; + int lcm_sym106__; + int nind; + int n_occasions; + std::vector> y; + int max_age; + std::vector> x; + int n_occ_minus_1; + std::vector first; + std::vector last; + public: + ~copy_fail_model() {} + copy_fail_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__ = + "copy_fail_model_namespace::copy_fail_model"; + // suppress unused var warning + (void) function__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + int pos__; + pos__ = 1; + current_statement__ = 33; + context__.validate_dims("data initialization", "nind", "int", + std::vector{}); + nind = std::numeric_limits::min(); + current_statement__ = 33; + nind = context__.vals_i("nind")[(1 - 1)]; + current_statement__ = 33; + stan::math::check_greater_or_equal(function__, "nind", nind, 0); + current_statement__ = 34; + context__.validate_dims("data initialization", "n_occasions", "int", + std::vector{}); + n_occasions = std::numeric_limits::min(); + current_statement__ = 34; + n_occasions = context__.vals_i("n_occasions")[(1 - 1)]; + current_statement__ = 34; + stan::math::check_greater_or_equal(function__, "n_occasions", + n_occasions, 2); + current_statement__ = 35; + stan::math::validate_non_negative_index("y", "nind", nind); + current_statement__ = 36; + stan::math::validate_non_negative_index("y", "n_occasions", n_occasions); + current_statement__ = 37; + context__.validate_dims("data initialization", "y", "int", + std::vector{static_cast(nind), + static_cast(n_occasions)}); + y = std::vector>(nind, + std::vector(n_occasions, std::numeric_limits::min())); + { + std::vector y_flat__; + current_statement__ = 37; + y_flat__ = context__.vals_i("y"); + current_statement__ = 37; + pos__ = 1; + current_statement__ = 37; + if (stan::math::logical_gte(n_occasions, 1)) { + lcm_sym107__ = stan::math::logical_gte(nind, 1); + if (lcm_sym107__) { + current_statement__ = 37; + stan::model::assign(y, + stan::model::rvalue(y_flat__, "y_flat__", + stan::model::index_uni(1)), "assigning variable y", + stan::model::index_uni(1), stan::model::index_uni(1)); + current_statement__ = 37; + pos__ = 2; + for (int sym2__ = 2; sym2__ <= nind; ++sym2__) { + current_statement__ = 37; + stan::model::assign(y, y_flat__[(pos__ - 1)], + "assigning variable y", stan::model::index_uni(sym2__), + stan::model::index_uni(1)); + current_statement__ = 37; + pos__ = (pos__ + 1); + } + } + for (int sym1__ = 2; sym1__ <= n_occasions; ++sym1__) { + current_statement__ = 37; + if (lcm_sym107__) { + current_statement__ = 37; + stan::model::assign(y, y_flat__[(pos__ - 1)], + "assigning variable y", stan::model::index_uni(1), + stan::model::index_uni(sym1__)); + current_statement__ = 37; + pos__ = (pos__ + 1); + for (int sym2__ = 2; sym2__ <= nind; ++sym2__) { + current_statement__ = 37; + stan::model::assign(y, y_flat__[(pos__ - 1)], + "assigning variable y", stan::model::index_uni(sym2__), + stan::model::index_uni(sym1__)); + current_statement__ = 37; + pos__ = (pos__ + 1); + } + } + } + } else { + lcm_sym107__ = stan::math::logical_gte(nind, 1); + } + } + current_statement__ = 37; + stan::math::check_greater_or_equal(function__, "y", y, 0); + current_statement__ = 37; + stan::math::check_less_or_equal(function__, "y", y, 1); + current_statement__ = 38; + context__.validate_dims("data initialization", "max_age", "int", + std::vector{}); + max_age = std::numeric_limits::min(); + current_statement__ = 38; + max_age = context__.vals_i("max_age")[(1 - 1)]; + current_statement__ = 38; + stan::math::check_greater_or_equal(function__, "max_age", max_age, 1); + current_statement__ = 39; + stan::math::validate_non_negative_index("x", "nind", nind); + lcm_sym109__ = (n_occasions - 1); + stan::math::validate_non_negative_index("x", "n_occasions - 1", + lcm_sym109__); + current_statement__ = 40; + context__.validate_dims("data initialization", "x", "int", + std::vector{static_cast(nind), + static_cast(lcm_sym109__)}); + x = std::vector>(nind, + std::vector(lcm_sym109__, std::numeric_limits::min())); + { + std::vector x_flat__; + current_statement__ = 40; + x_flat__ = context__.vals_i("x"); + current_statement__ = 40; + pos__ = 1; + current_statement__ = 40; + if (stan::math::logical_gte(lcm_sym109__, 1)) { + current_statement__ = 40; + if (lcm_sym107__) { + current_statement__ = 40; + stan::model::assign(x, + stan::model::rvalue(x_flat__, "x_flat__", + stan::model::index_uni(1)), "assigning variable x", + stan::model::index_uni(1), stan::model::index_uni(1)); + current_statement__ = 40; + pos__ = 2; + for (int sym2__ = 2; sym2__ <= nind; ++sym2__) { + current_statement__ = 40; + stan::model::assign(x, x_flat__[(pos__ - 1)], + "assigning variable x", stan::model::index_uni(sym2__), + stan::model::index_uni(1)); + current_statement__ = 40; + pos__ = (pos__ + 1); + } + } + for (int sym1__ = 2; sym1__ <= lcm_sym109__; ++sym1__) { + current_statement__ = 40; + if (lcm_sym107__) { + current_statement__ = 40; + stan::model::assign(x, x_flat__[(pos__ - 1)], + "assigning variable x", stan::model::index_uni(1), + stan::model::index_uni(sym1__)); + current_statement__ = 40; + pos__ = (pos__ + 1); + for (int sym2__ = 2; sym2__ <= nind; ++sym2__) { + current_statement__ = 40; + stan::model::assign(x, x_flat__[(pos__ - 1)], + "assigning variable x", stan::model::index_uni(sym2__), + stan::model::index_uni(sym1__)); + current_statement__ = 40; + pos__ = (pos__ + 1); + } + } + } + } + } + current_statement__ = 40; + stan::math::check_greater_or_equal(function__, "x", x, 0); + current_statement__ = 40; + stan::math::check_less_or_equal(function__, "x", x, max_age); + current_statement__ = 41; + n_occ_minus_1 = std::numeric_limits::min(); + current_statement__ = 41; + n_occ_minus_1 = lcm_sym109__; + current_statement__ = 42; + stan::math::validate_non_negative_index("first", "nind", nind); + current_statement__ = 43; + first = std::vector(nind, std::numeric_limits::min()); + current_statement__ = 44; + stan::math::validate_non_negative_index("last", "nind", nind); + current_statement__ = 45; + last = std::vector(nind, std::numeric_limits::min()); + current_statement__ = 47; + if (lcm_sym107__) { + current_statement__ = 46; + stan::model::assign(first, + first_capture( + stan::model::rvalue(y, "y", stan::model::index_uni(1)), pstream__), + "assigning variable first", stan::model::index_uni(1)); + for (int i = 2; i <= nind; ++i) { + current_statement__ = 46; + stan::model::assign(first, + first_capture( + stan::model::rvalue(y, "y", stan::model::index_uni(i)), + pstream__), "assigning variable first", + stan::model::index_uni(i)); + } + } + current_statement__ = 49; + if (lcm_sym107__) { + current_statement__ = 48; + stan::model::assign(last, + last_capture( + stan::model::rvalue(y, "y", stan::model::index_uni(1)), pstream__), + "assigning variable last", stan::model::index_uni(1)); + for (int i = 2; i <= nind; ++i) { + current_statement__ = 48; + stan::model::assign(last, + last_capture( + stan::model::rvalue(y, "y", stan::model::index_uni(i)), + pstream__), "assigning variable last", + stan::model::index_uni(i)); + } + } + current_statement__ = 43; + stan::math::check_greater_or_equal(function__, "first", first, 0); + current_statement__ = 43; + stan::math::check_less_or_equal(function__, "first", first, n_occasions); + current_statement__ = 45; + stan::math::check_greater_or_equal(function__, "last", last, 0); + current_statement__ = 45; + stan::math::check_less_or_equal(function__, "last", last, n_occasions); + current_statement__ = 50; + stan::math::validate_non_negative_index("beta", "max_age", max_age); + current_statement__ = 51; + stan::math::validate_non_negative_index("phi", "nind", nind); + current_statement__ = 52; + stan::math::validate_non_negative_index("phi", "n_occ_minus_1", + lcm_sym109__); + current_statement__ = 53; + stan::math::validate_non_negative_index("p", "nind", nind); + current_statement__ = 54; + stan::math::validate_non_negative_index("p", "n_occ_minus_1", + lcm_sym109__); + current_statement__ = 55; + stan::math::validate_non_negative_index("chi", "nind", nind); + current_statement__ = 56; + stan::math::validate_non_negative_index("chi", "n_occasions", + n_occasions); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + num_params_r__ = 1 + max_age; + } + inline std::string model_name() const final { + return "copy_fail_model"; + } + inline std::vector model_compile_info() const noexcept { + return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", + "stancflags = --O --print-cpp"}; + } + 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__; + stan::io::deserializer in__(params_r__, params_i__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + static constexpr const char* function__ = + "copy_fail_model_namespace::log_prob"; + // suppress unused var warning + (void) function__; + try { + double lcm_sym105__; + int lcm_sym104__; + int lcm_sym103__; + int lcm_sym102__; + int lcm_sym101__; + double lcm_sym100__; + double lcm_sym99__; + double lcm_sym98__; + double lcm_sym97__; + double lcm_sym96__; + double lcm_sym95__; + double lcm_sym94__; + double lcm_sym93__; + double lcm_sym92__; + double lcm_sym91__; + double lcm_sym90__; + double lcm_sym89__; + double lcm_sym88__; + double lcm_sym87__; + double lcm_sym86__; + double lcm_sym85__; + double lcm_sym84__; + double lcm_sym83__; + int lcm_sym82__; + int lcm_sym81__; + int lcm_sym80__; + int lcm_sym79__; + int lcm_sym78__; + int lcm_sym77__; + int lcm_sym76__; + int lcm_sym75__; + int lcm_sym74__; + int lcm_sym73__; + int lcm_sym72__; + int lcm_sym71__; + int lcm_sym70__; + int lcm_sym69__; + int lcm_sym68__; + int lcm_sym67__; + int lcm_sym66__; + int lcm_sym65__; + int lcm_sym64__; + int lcm_sym63__; + local_scalar_t__ mean_p; + current_statement__ = 1; + mean_p = in__.template read_constrain_lub(0, 1, lp__); + Eigen::Matrix beta; + current_statement__ = 2; + beta = in__.template read_constrain_lub< + Eigen::Matrix, jacobian__>(0, 1, lp__, + max_age); + Eigen::Matrix phi = + Eigen::Matrix::Constant(nind, (n_occasions - + 1), DUMMY_VAR__); + Eigen::Matrix p = + Eigen::Matrix::Constant(nind, (n_occasions - + 1), DUMMY_VAR__); + Eigen::Matrix chi = + Eigen::Matrix::Constant(nind, n_occasions, + DUMMY_VAR__); + lcm_sym63__ = stan::math::logical_gte(nind, 1); + if (lcm_sym63__) { + lcm_sym102__ = stan::model::rvalue(first, "first", + stan::model::index_uni(1)); + lcm_sym76__ = (lcm_sym102__ - 1); + if (stan::math::logical_gte(lcm_sym76__, 1)) { + stan::model::assign(phi, 0, "assigning variable phi", + stan::model::index_uni(1), stan::model::index_uni(1)); + current_statement__ = 6; + stan::model::assign(p, 0, "assigning variable p", + stan::model::index_uni(1), stan::model::index_uni(1)); + for (int t = 2; t <= lcm_sym76__; ++t) { + current_statement__ = 7; + stan::model::assign(phi, 0, "assigning variable phi", + stan::model::index_uni(1), stan::model::index_uni(t)); + current_statement__ = 6; + stan::model::assign(p, 0, "assigning variable p", + stan::model::index_uni(1), stan::model::index_uni(t)); + } + } + lcm_sym74__ = (n_occasions - 1); + if (stan::math::logical_gte(lcm_sym74__, lcm_sym102__)) { + current_statement__ = 9; + stan::model::assign(phi, + stan::model::rvalue(beta, "beta", + stan::model::index_uni( + stan::model::rvalue(x, "x", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym102__)))), + "assigning variable phi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym102__)); + lcm_sym82__ = (lcm_sym102__ + 1); + stan::model::assign(p, mean_p, "assigning variable p", + stan::model::index_uni(1), stan::model::index_uni(lcm_sym102__)); + for (int t = lcm_sym82__; t <= lcm_sym74__; ++t) { + current_statement__ = 9; + stan::model::assign(phi, + stan::model::rvalue(beta, "beta", + stan::model::index_uni( + stan::model::rvalue(x, "x", stan::model::index_uni(1), + stan::model::index_uni(t)))), "assigning variable phi", + stan::model::index_uni(1), stan::model::index_uni(t)); + current_statement__ = 10; + stan::model::assign(p, mean_p, "assigning variable p", + stan::model::index_uni(1), stan::model::index_uni(t)); + } + } + for (int i = 2; i <= nind; ++i) { + lcm_sym101__ = stan::model::rvalue(first, "first", + stan::model::index_uni(i)); + lcm_sym75__ = (lcm_sym101__ - 1); + if (stan::math::logical_gte(lcm_sym75__, 1)) { + stan::model::assign(phi, 0, "assigning variable phi", + stan::model::index_uni(i), stan::model::index_uni(1)); + current_statement__ = 6; + stan::model::assign(p, 0, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(1)); + for (int t = 2; t <= lcm_sym75__; ++t) { + current_statement__ = 7; + stan::model::assign(phi, 0, "assigning variable phi", + stan::model::index_uni(i), stan::model::index_uni(t)); + current_statement__ = 6; + stan::model::assign(p, 0, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(t)); + } + } + current_statement__ = 12; + if (stan::math::logical_gte(lcm_sym74__, lcm_sym101__)) { + current_statement__ = 9; + stan::model::assign(phi, + stan::model::rvalue(beta, "beta", + stan::model::index_uni( + stan::model::rvalue(x, "x", stan::model::index_uni(i), + stan::model::index_uni(lcm_sym101__)))), + "assigning variable phi", stan::model::index_uni(i), + stan::model::index_uni(lcm_sym101__)); + lcm_sym81__ = (lcm_sym101__ + 1); + stan::model::assign(p, mean_p, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(lcm_sym101__)); + for (int t = lcm_sym81__; t <= lcm_sym74__; ++t) { + current_statement__ = 9; + stan::model::assign(phi, + stan::model::rvalue(beta, "beta", + stan::model::index_uni( + stan::model::rvalue(x, "x", stan::model::index_uni(i), + stan::model::index_uni(t)))), "assigning variable phi", + stan::model::index_uni(i), stan::model::index_uni(t)); + current_statement__ = 10; + stan::model::assign(p, mean_p, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(t)); + } + } + } + } + Eigen::Matrix + inline_prob_uncaptured_return_sym8__; + { + current_statement__ = 14; + stan::math::validate_non_negative_index("chi", "nind", nind); + current_statement__ = 15; + stan::math::validate_non_negative_index("chi", "n_occasions", + n_occasions); + Eigen::Matrix + inline_prob_uncaptured_chi_sym9__ = + Eigen::Matrix::Constant(nind, n_occasions, + DUMMY_VAR__); + current_statement__ = 24; + if (lcm_sym63__) { + current_statement__ = 17; + stan::model::assign(inline_prob_uncaptured_chi_sym9__, 1.0, + "assigning variable inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(1), stan::model::index_uni(n_occasions)); + lcm_sym74__ = (n_occasions - 1); + lcm_sym64__ = stan::math::logical_gte(lcm_sym74__, 1); + if (lcm_sym64__) { + int inline_prob_uncaptured_t_curr_sym10__ = + std::numeric_limits::min(); + int inline_prob_uncaptured_t_next_sym11__ = + std::numeric_limits::min(); + lcm_sym78__ = (lcm_sym74__ + 1); + current_statement__ = 20; + stan::model::assign(inline_prob_uncaptured_chi_sym9__, + stan::math::fma( + (stan::model::rvalue(phi, "phi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym74__)) * (1 - + stan::model::rvalue(p, "p", stan::model::index_uni(1), + stan::model::index_uni((lcm_sym78__ - 1))))), + stan::model::rvalue(inline_prob_uncaptured_chi_sym9__, + "inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(1), + stan::model::index_uni(lcm_sym78__)), (1 - + stan::model::rvalue(phi, "phi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym74__)))), + "assigning variable inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(1), stan::model::index_uni(lcm_sym74__)); + for (int inline_prob_uncaptured_t_sym12__ = 2; inline_prob_uncaptured_t_sym12__ + <= lcm_sym74__; ++inline_prob_uncaptured_t_sym12__) { + int inline_prob_uncaptured_t_curr_sym10__ = + std::numeric_limits::min(); + lcm_sym73__ = (n_occasions - inline_prob_uncaptured_t_sym12__); + int inline_prob_uncaptured_t_next_sym11__ = + std::numeric_limits::min(); + lcm_sym77__ = (lcm_sym73__ + 1); + current_statement__ = 20; + stan::model::assign(inline_prob_uncaptured_chi_sym9__, + stan::math::fma( + (stan::model::rvalue(phi, "phi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym73__)) * (1 - + stan::model::rvalue(p, "p", stan::model::index_uni(1), + stan::model::index_uni((lcm_sym77__ - 1))))), + stan::model::rvalue(inline_prob_uncaptured_chi_sym9__, + "inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(1), + stan::model::index_uni(lcm_sym77__)), (1 - + stan::model::rvalue(phi, "phi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym73__)))), + "assigning variable inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(1), + stan::model::index_uni(lcm_sym73__)); + } + } + for (int inline_prob_uncaptured_i_sym13__ = 2; inline_prob_uncaptured_i_sym13__ + <= nind; ++inline_prob_uncaptured_i_sym13__) { + current_statement__ = 17; + stan::model::assign(inline_prob_uncaptured_chi_sym9__, 1.0, + "assigning variable inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(n_occasions)); + current_statement__ = 22; + if (lcm_sym64__) { + int inline_prob_uncaptured_t_curr_sym10__ = + std::numeric_limits::min(); + int inline_prob_uncaptured_t_next_sym11__ = + std::numeric_limits::min(); + lcm_sym78__ = (lcm_sym74__ + 1); + current_statement__ = 20; + stan::model::assign(inline_prob_uncaptured_chi_sym9__, + stan::math::fma( + (stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(lcm_sym74__)) * (1 - + stan::model::rvalue(p, "p", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni((lcm_sym78__ - 1))))), + stan::model::rvalue(inline_prob_uncaptured_chi_sym9__, + "inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(lcm_sym78__)), (1 - + stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(lcm_sym74__)))), + "assigning variable inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(lcm_sym74__)); + for (int inline_prob_uncaptured_t_sym12__ = 2; inline_prob_uncaptured_t_sym12__ + <= lcm_sym74__; ++inline_prob_uncaptured_t_sym12__) { + int inline_prob_uncaptured_t_curr_sym10__ = + std::numeric_limits::min(); + lcm_sym73__ = (n_occasions - + inline_prob_uncaptured_t_sym12__); + int inline_prob_uncaptured_t_next_sym11__ = + std::numeric_limits::min(); + lcm_sym77__ = (lcm_sym73__ + 1); + current_statement__ = 20; + stan::model::assign(inline_prob_uncaptured_chi_sym9__, + stan::math::fma( + (stan::model::rvalue(phi, "phi", + stan::model::index_uni( + inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(lcm_sym73__)) * (1 - + stan::model::rvalue(p, "p", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni((lcm_sym77__ - 1))))), + stan::model::rvalue(inline_prob_uncaptured_chi_sym9__, + "inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(lcm_sym77__)), (1 - + stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(lcm_sym73__)))), + "assigning variable inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(lcm_sym73__)); + } + } + } + } + current_statement__ = 25; + stan::model::assign(inline_prob_uncaptured_return_sym8__, + inline_prob_uncaptured_chi_sym9__, + "assigning variable inline_prob_uncaptured_return_sym8__"); + } + stan::model::assign(chi, inline_prob_uncaptured_return_sym8__, + "assigning variable chi"); + current_statement__ = 3; + stan::math::check_greater_or_equal(function__, "phi", phi, 0); + current_statement__ = 3; + stan::math::check_less_or_equal(function__, "phi", phi, 1); + current_statement__ = 4; + stan::math::check_greater_or_equal(function__, "p", p, 0); + current_statement__ = 4; + stan::math::check_less_or_equal(function__, "p", p, 1); + current_statement__ = 5; + stan::math::check_greater_or_equal(function__, "chi", + inline_prob_uncaptured_return_sym8__, 0); + current_statement__ = 5; + stan::math::check_less_or_equal(function__, "chi", + inline_prob_uncaptured_return_sym8__, 1); + { + current_statement__ = 32; + if (lcm_sym63__) { + lcm_sym102__ = stan::model::rvalue(first, "first", + stan::model::index_uni(1)); + if (stan::math::logical_gt(lcm_sym102__, 0)) { + lcm_sym104__ = stan::model::rvalue(last, "last", + stan::model::index_uni(1)); + lcm_sym82__ = (lcm_sym102__ + 1); + if (stan::math::logical_gte(lcm_sym104__, lcm_sym82__)) { + current_statement__ = 26; + lp_accum__.add(stan::math::bernoulli_lpmf(1, + stan::model::rvalue(phi, "phi", + stan::model::index_uni(1), + stan::model::index_uni((lcm_sym82__ - 1))))); + lcm_sym80__ = (lcm_sym82__ + 1); + lp_accum__.add(stan::math::bernoulli_lpmf( + stan::model::rvalue(y, "y", + stan::model::index_uni(1), + stan::model::index_uni(lcm_sym82__)), + stan::model::rvalue(p, "p", + stan::model::index_uni(1), + stan::model::index_uni((lcm_sym82__ - 1))))); + for (int t = lcm_sym80__; t <= lcm_sym104__; ++t) { + current_statement__ = 26; + lp_accum__.add(stan::math::bernoulli_lpmf(1, + stan::model::rvalue(phi, "phi", + stan::model::index_uni(1), + stan::model::index_uni((t - 1))))); + current_statement__ = 27; + lp_accum__.add(stan::math::bernoulli_lpmf( + stan::model::rvalue(y, "y", + stan::model::index_uni(1), + stan::model::index_uni(t)), + stan::model::rvalue(p, "p", + stan::model::index_uni(1), + stan::model::index_uni((t - 1))))); + } + } + current_statement__ = 29; + lp_accum__.add(stan::math::bernoulli_lpmf(1, + stan::model::rvalue( + inline_prob_uncaptured_return_sym8__, + "inline_prob_uncaptured_return_sym8__", + stan::model::index_uni(1), + stan::model::index_uni(lcm_sym104__)))); + } + for (int i = 2; i <= nind; ++i) { + lcm_sym101__ = stan::model::rvalue(first, "first", + stan::model::index_uni(i)); + if (stan::math::logical_gt(lcm_sym101__, 0)) { + lcm_sym103__ = stan::model::rvalue(last, "last", + stan::model::index_uni(i)); + lcm_sym81__ = (lcm_sym101__ + 1); + if (stan::math::logical_gte(lcm_sym103__, lcm_sym81__)) { + current_statement__ = 26; + lp_accum__.add(stan::math::bernoulli_lpmf(1, + stan::model::rvalue(phi, "phi", + stan::model::index_uni(i), + stan::model::index_uni((lcm_sym81__ - 1))))); + lcm_sym79__ = (lcm_sym81__ + 1); + lp_accum__.add(stan::math::bernoulli_lpmf( + stan::model::rvalue(y, "y", + stan::model::index_uni(i), + stan::model::index_uni(lcm_sym81__)), + stan::model::rvalue(p, "p", + stan::model::index_uni(i), + stan::model::index_uni((lcm_sym81__ - 1))))); + for (int t = lcm_sym79__; t <= lcm_sym103__; ++t) { + current_statement__ = 26; + lp_accum__.add(stan::math::bernoulli_lpmf(1, + stan::model::rvalue(phi, "phi", + stan::model::index_uni(i), + stan::model::index_uni((t - 1))))); + current_statement__ = 27; + lp_accum__.add(stan::math::bernoulli_lpmf( + stan::model::rvalue(y, "y", + stan::model::index_uni(i), + stan::model::index_uni(t)), + stan::model::rvalue(p, "p", + stan::model::index_uni(i), + stan::model::index_uni((t - 1))))); + } + } + current_statement__ = 29; + lp_accum__.add(stan::math::bernoulli_lpmf(1, + stan::model::rvalue( + inline_prob_uncaptured_return_sym8__, + "inline_prob_uncaptured_return_sym8__", + stan::model::index_uni(i), + stan::model::index_uni(lcm_sym103__)))); + } + } + } + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + lp_accum__.add(lp__); + return lp_accum__.sum(); + } + 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; + 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; + // 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()); + // suppress unused var warning + (void) DUMMY_VAR__; + constexpr bool jacobian__ = false; + static constexpr const char* function__ = + "copy_fail_model_namespace::write_array"; + // suppress unused var warning + (void) function__; + try { + double lcm_sym62__; + int lcm_sym61__; + int lcm_sym60__; + double lcm_sym59__; + double lcm_sym58__; + double lcm_sym57__; + double lcm_sym56__; + double lcm_sym55__; + double lcm_sym54__; + double lcm_sym53__; + double lcm_sym52__; + int lcm_sym51__; + int lcm_sym50__; + int lcm_sym49__; + int lcm_sym48__; + int lcm_sym47__; + int lcm_sym46__; + int lcm_sym45__; + int lcm_sym44__; + int lcm_sym43__; + int lcm_sym42__; + int lcm_sym41__; + int lcm_sym40__; + int lcm_sym39__; + int lcm_sym38__; + int lcm_sym37__; + int lcm_sym36__; + double mean_p; + current_statement__ = 1; + mean_p = in__.template read_constrain_lub(0, 1, lp__); + Eigen::Matrix beta; + current_statement__ = 2; + beta = in__.template read_constrain_lub< + Eigen::Matrix, jacobian__>(0, 1, lp__, + max_age); + Eigen::Matrix phi = + Eigen::Matrix::Constant(nind, (n_occasions - 1), + std::numeric_limits::quiet_NaN()); + Eigen::Matrix p = + Eigen::Matrix::Constant(nind, (n_occasions - 1), + std::numeric_limits::quiet_NaN()); + Eigen::Matrix chi = + Eigen::Matrix::Constant(nind, n_occasions, + std::numeric_limits::quiet_NaN()); + out__.write(mean_p); + out__.write(beta); + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { + return ; + } + lcm_sym36__ = stan::math::logical_gte(nind, 1); + if (lcm_sym36__) { + lcm_sym61__ = stan::model::rvalue(first, "first", + stan::model::index_uni(1)); + lcm_sym45__ = (lcm_sym61__ - 1); + if (stan::math::logical_gte(lcm_sym45__, 1)) { + stan::model::assign(phi, 0, "assigning variable phi", + stan::model::index_uni(1), stan::model::index_uni(1)); + current_statement__ = 6; + stan::model::assign(p, 0, "assigning variable p", + stan::model::index_uni(1), stan::model::index_uni(1)); + for (int t = 2; t <= lcm_sym45__; ++t) { + current_statement__ = 7; + stan::model::assign(phi, 0, "assigning variable phi", + stan::model::index_uni(1), stan::model::index_uni(t)); + current_statement__ = 6; + stan::model::assign(p, 0, "assigning variable p", + stan::model::index_uni(1), stan::model::index_uni(t)); + } + } + lcm_sym43__ = (n_occasions - 1); + if (stan::math::logical_gte(lcm_sym43__, lcm_sym61__)) { + current_statement__ = 9; + stan::model::assign(phi, + stan::model::rvalue(beta, "beta", + stan::model::index_uni( + stan::model::rvalue(x, "x", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym61__)))), + "assigning variable phi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym61__)); + lcm_sym51__ = (lcm_sym61__ + 1); + stan::model::assign(p, mean_p, "assigning variable p", + stan::model::index_uni(1), stan::model::index_uni(lcm_sym61__)); + for (int t = lcm_sym51__; t <= lcm_sym43__; ++t) { + current_statement__ = 9; + stan::model::assign(phi, + stan::model::rvalue(beta, "beta", + stan::model::index_uni( + stan::model::rvalue(x, "x", stan::model::index_uni(1), + stan::model::index_uni(t)))), "assigning variable phi", + stan::model::index_uni(1), stan::model::index_uni(t)); + current_statement__ = 10; + stan::model::assign(p, mean_p, "assigning variable p", + stan::model::index_uni(1), stan::model::index_uni(t)); + } + } + for (int i = 2; i <= nind; ++i) { + lcm_sym60__ = stan::model::rvalue(first, "first", + stan::model::index_uni(i)); + lcm_sym44__ = (lcm_sym60__ - 1); + if (stan::math::logical_gte(lcm_sym44__, 1)) { + stan::model::assign(phi, 0, "assigning variable phi", + stan::model::index_uni(i), stan::model::index_uni(1)); + current_statement__ = 6; + stan::model::assign(p, 0, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(1)); + for (int t = 2; t <= lcm_sym44__; ++t) { + current_statement__ = 7; + stan::model::assign(phi, 0, "assigning variable phi", + stan::model::index_uni(i), stan::model::index_uni(t)); + current_statement__ = 6; + stan::model::assign(p, 0, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(t)); + } + } + current_statement__ = 12; + if (stan::math::logical_gte(lcm_sym43__, lcm_sym60__)) { + current_statement__ = 9; + stan::model::assign(phi, + stan::model::rvalue(beta, "beta", + stan::model::index_uni( + stan::model::rvalue(x, "x", stan::model::index_uni(i), + stan::model::index_uni(lcm_sym60__)))), + "assigning variable phi", stan::model::index_uni(i), + stan::model::index_uni(lcm_sym60__)); + lcm_sym50__ = (lcm_sym60__ + 1); + stan::model::assign(p, mean_p, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(lcm_sym60__)); + for (int t = lcm_sym50__; t <= lcm_sym43__; ++t) { + current_statement__ = 9; + stan::model::assign(phi, + stan::model::rvalue(beta, "beta", + stan::model::index_uni( + stan::model::rvalue(x, "x", stan::model::index_uni(i), + stan::model::index_uni(t)))), "assigning variable phi", + stan::model::index_uni(i), stan::model::index_uni(t)); + current_statement__ = 10; + stan::model::assign(p, mean_p, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(t)); + } + } + } + } + Eigen::Matrix inline_prob_uncaptured_return_sym1__; + { + current_statement__ = 14; + stan::math::validate_non_negative_index("chi", "nind", nind); + current_statement__ = 15; + stan::math::validate_non_negative_index("chi", "n_occasions", + n_occasions); + Eigen::Matrix + inline_prob_uncaptured_chi_sym2__ = + Eigen::Matrix::Constant(nind, n_occasions, + DUMMY_VAR__); + current_statement__ = 24; + if (lcm_sym36__) { + current_statement__ = 17; + stan::model::assign(inline_prob_uncaptured_chi_sym2__, 1.0, + "assigning variable inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(1), stan::model::index_uni(n_occasions)); + lcm_sym43__ = (n_occasions - 1); + lcm_sym37__ = stan::math::logical_gte(lcm_sym43__, 1); + if (lcm_sym37__) { + int inline_prob_uncaptured_t_curr_sym3__ = + std::numeric_limits::min(); + int inline_prob_uncaptured_t_next_sym4__ = + std::numeric_limits::min(); + lcm_sym49__ = (lcm_sym43__ + 1); + current_statement__ = 20; + stan::model::assign(inline_prob_uncaptured_chi_sym2__, + stan::math::fma( + (stan::model::rvalue(phi, "phi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym43__)) * (1 - + stan::model::rvalue(p, "p", stan::model::index_uni(1), + stan::model::index_uni((lcm_sym49__ - 1))))), + stan::model::rvalue(inline_prob_uncaptured_chi_sym2__, + "inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(1), + stan::model::index_uni(lcm_sym49__)), (1 - + stan::model::rvalue(phi, "phi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym43__)))), + "assigning variable inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(1), stan::model::index_uni(lcm_sym43__)); + for (int inline_prob_uncaptured_t_sym5__ = 2; inline_prob_uncaptured_t_sym5__ + <= lcm_sym43__; ++inline_prob_uncaptured_t_sym5__) { + int inline_prob_uncaptured_t_curr_sym3__ = + std::numeric_limits::min(); + lcm_sym42__ = (n_occasions - inline_prob_uncaptured_t_sym5__); + int inline_prob_uncaptured_t_next_sym4__ = + std::numeric_limits::min(); + lcm_sym48__ = (lcm_sym42__ + 1); + current_statement__ = 20; + stan::model::assign(inline_prob_uncaptured_chi_sym2__, + stan::math::fma( + (stan::model::rvalue(phi, "phi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym42__)) * (1 - + stan::model::rvalue(p, "p", stan::model::index_uni(1), + stan::model::index_uni((lcm_sym48__ - 1))))), + stan::model::rvalue(inline_prob_uncaptured_chi_sym2__, + "inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(1), + stan::model::index_uni(lcm_sym48__)), (1 - + stan::model::rvalue(phi, "phi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym42__)))), + "assigning variable inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(1), + stan::model::index_uni(lcm_sym42__)); + } + } + for (int inline_prob_uncaptured_i_sym6__ = 2; inline_prob_uncaptured_i_sym6__ + <= nind; ++inline_prob_uncaptured_i_sym6__) { + current_statement__ = 17; + stan::model::assign(inline_prob_uncaptured_chi_sym2__, 1.0, + "assigning variable inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(n_occasions)); + current_statement__ = 22; + if (lcm_sym37__) { + int inline_prob_uncaptured_t_curr_sym3__ = + std::numeric_limits::min(); + int inline_prob_uncaptured_t_next_sym4__ = + std::numeric_limits::min(); + lcm_sym49__ = (lcm_sym43__ + 1); + current_statement__ = 20; + stan::model::assign(inline_prob_uncaptured_chi_sym2__, + stan::math::fma( + (stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(lcm_sym43__)) * (1 - + stan::model::rvalue(p, "p", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni((lcm_sym49__ - 1))))), + stan::model::rvalue(inline_prob_uncaptured_chi_sym2__, + "inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(lcm_sym49__)), (1 - + stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(lcm_sym43__)))), + "assigning variable inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(lcm_sym43__)); + for (int inline_prob_uncaptured_t_sym5__ = 2; inline_prob_uncaptured_t_sym5__ + <= lcm_sym43__; ++inline_prob_uncaptured_t_sym5__) { + int inline_prob_uncaptured_t_curr_sym3__ = + std::numeric_limits::min(); + lcm_sym42__ = (n_occasions - + inline_prob_uncaptured_t_sym5__); + int inline_prob_uncaptured_t_next_sym4__ = + std::numeric_limits::min(); + lcm_sym48__ = (lcm_sym42__ + 1); + current_statement__ = 20; + stan::model::assign(inline_prob_uncaptured_chi_sym2__, + stan::math::fma( + (stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(lcm_sym42__)) * (1 - + stan::model::rvalue(p, "p", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni((lcm_sym48__ - 1))))), + stan::model::rvalue(inline_prob_uncaptured_chi_sym2__, + "inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(lcm_sym48__)), (1 - + stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(lcm_sym42__)))), + "assigning variable inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(lcm_sym42__)); + } + } + } + } + current_statement__ = 25; + stan::model::assign(inline_prob_uncaptured_return_sym1__, + inline_prob_uncaptured_chi_sym2__, + "assigning variable inline_prob_uncaptured_return_sym1__"); + } + stan::model::assign(chi, inline_prob_uncaptured_return_sym1__, + "assigning variable chi"); + current_statement__ = 3; + stan::math::check_greater_or_equal(function__, "phi", phi, 0); + current_statement__ = 3; + stan::math::check_less_or_equal(function__, "phi", phi, 1); + current_statement__ = 4; + stan::math::check_greater_or_equal(function__, "p", p, 0); + current_statement__ = 4; + stan::math::check_less_or_equal(function__, "p", p, 1); + current_statement__ = 5; + stan::math::check_greater_or_equal(function__, "chi", + inline_prob_uncaptured_return_sym1__, 0); + current_statement__ = 5; + stan::math::check_less_or_equal(function__, "chi", + inline_prob_uncaptured_return_sym1__, 1); + if (emit_transformed_parameters__) { + out__.write(phi); + out__.write(p); + out__.write(inline_prob_uncaptured_return_sym1__); + } + if (stan::math::logical_negation(emit_generated_quantities__)) { + return ; + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline void + transform_inits_impl(VecVar& params_r__, 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 lcm_sym35__; + int pos__; + pos__ = 1; + local_scalar_t__ mean_p; + mean_p = in__.read(); + out__.write_free_lub(0, 1, mean_p); + Eigen::Matrix beta = + Eigen::Matrix::Constant(max_age, DUMMY_VAR__); + if (stan::math::logical_gte(max_age, 1)) { + stan::model::assign(beta, in__.read(), + "assigning variable beta", stan::model::index_uni(1)); + for (int sym1__ = 2; sym1__ <= max_age; ++sym1__) { + stan::model::assign(beta, in__.read(), + "assigning variable beta", stan::model::index_uni(sym1__)); + } + } + out__.write_free_lub(0, 1, beta); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + inline void get_param_names(std::vector& names__) const { + names__ = std::vector{"mean_p", "beta", "phi", "p", "chi"}; + } + inline void get_dims(std::vector>& dimss__) const { + dimss__ = std::vector>{std::vector{}, + std::vector{static_cast(max_age)}, + std::vector{static_cast(nind), + static_cast(n_occ_minus_1)}, + std::vector{static_cast(nind), + static_cast(n_occ_minus_1)}, + std::vector{static_cast(nind), + static_cast(n_occasions)}}; + } + inline void + constrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { + param_names__.emplace_back(std::string() + "mean_p"); + for (int sym119__ = 1; sym119__ <= max_age; ++sym119__) { + param_names__.emplace_back(std::string() + "beta" + '.' + + std::to_string(sym119__)); + } + if (emit_transformed_parameters__) { + for (int sym119__ = 1; sym119__ <= n_occ_minus_1; ++sym119__) { + for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { + param_names__.emplace_back(std::string() + "phi" + '.' + + std::to_string(sym120__) + '.' + std::to_string(sym119__)); + } + } + for (int sym119__ = 1; sym119__ <= n_occ_minus_1; ++sym119__) { + for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { + param_names__.emplace_back(std::string() + "p" + '.' + + std::to_string(sym120__) + '.' + std::to_string(sym119__)); + } + } + for (int sym119__ = 1; sym119__ <= n_occasions; ++sym119__) { + for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { + param_names__.emplace_back(std::string() + "chi" + '.' + + std::to_string(sym120__) + '.' + std::to_string(sym119__)); + } + } + } + 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 { + param_names__.emplace_back(std::string() + "mean_p"); + for (int sym119__ = 1; sym119__ <= max_age; ++sym119__) { + param_names__.emplace_back(std::string() + "beta" + '.' + + std::to_string(sym119__)); + } + if (emit_transformed_parameters__) { + for (int sym119__ = 1; sym119__ <= n_occ_minus_1; ++sym119__) { + for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { + param_names__.emplace_back(std::string() + "phi" + '.' + + std::to_string(sym120__) + '.' + std::to_string(sym119__)); + } + } + for (int sym119__ = 1; sym119__ <= n_occ_minus_1; ++sym119__) { + for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { + param_names__.emplace_back(std::string() + "p" + '.' + + std::to_string(sym120__) + '.' + std::to_string(sym119__)); + } + } + for (int sym119__ = 1; sym119__ <= n_occasions; ++sym119__) { + for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { + param_names__.emplace_back(std::string() + "chi" + '.' + + std::to_string(sym120__) + '.' + std::to_string(sym119__)); + } + } + } + if (emit_generated_quantities__) {} + } + inline std::string get_constrained_sizedtypes() const { + return std::string("[{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(max_age) + "},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"}]"); + } + inline std::string get_unconstrained_sizedtypes() const { + return std::string("[{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(max_age) + "},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occasions) + "},\"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__ = (1 + max_age); + const size_t num_transformed = emit_transformed_parameters * ((((nind * + n_occ_minus_1) + (nind * n_occ_minus_1)) + (nind * n_occasions))); + 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__ = (1 + max_age); + const size_t num_transformed = emit_transformed_parameters * ((((nind * + n_occ_minus_1) + (nind * n_occ_minus_1)) + (nind * n_occasions))); + 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 { + constexpr std::array names__{"mean_p", "beta"}; + const std::array constrain_param_sizes__{1, max_age}; + const auto num_constrained_params__ = + std::accumulate(constrain_param_sizes__.begin(), + constrain_param_sizes__.end(), 0); + std::vector params_r_flat__(num_constrained_params__); + Eigen::Index size_iter__ = 0; + Eigen::Index flat_iter__ = 0; + for (auto&& param_name__: names__) { + const auto param_vec__ = context.vals_r(param_name__); for (Eigen::Index i = 0; i < constrain_param_sizes__[size_iter__]; ++i) { params_r_flat__[flat_iter__] = param_vec__[i]; ++flat_iter__; @@ -14470,559 +16150,990 @@ int first_capture(const std::vector& y_i, std::ostream* pstream__) { } } } - current_statement__ = 59; - return 0; + current_statement__ = 59; + return 0; + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +int last_capture(const std::vector& y_i, std::ostream* pstream__) { + using local_scalar_t__ = double; + int current_statement__ = 0; + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + int lcm_sym24__; + int lcm_sym23__; + int lcm_sym22__; + int lcm_sym21__; + int lcm_sym20__; + int lcm_sym19__; + { + lcm_sym22__ = (stan::math::size(y_i) - 1); + if (stan::math::logical_gte(lcm_sym22__, 0)) { + int k = std::numeric_limits::min(); + lcm_sym21__ = (stan::math::size(y_i) - 0); + current_statement__ = 63; + if (y_i[(lcm_sym21__ - 1)]) { + current_statement__ = 62; + return lcm_sym21__; + } + for (int k_rev = 1; k_rev <= lcm_sym22__; ++k_rev) { + int k = std::numeric_limits::min(); + lcm_sym20__ = (stan::math::size(y_i) - k_rev); + current_statement__ = 63; + if (y_i[(lcm_sym20__ - 1)]) { + current_statement__ = 62; + return lcm_sym20__; + } + } + } + current_statement__ = 65; + return 0; + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>*> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, + const T3__& phi_arg__, std::ostream* pstream__) { + using local_scalar_t__ = stan::promote_args_t, + stan::base_type_t>; + int current_statement__ = 0; + const auto& p = stan::math::to_ref(p_arg__); + const auto& phi = stan::math::to_ref(phi_arg__); + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + double lcm_sym34__; + double lcm_sym33__; + double lcm_sym32__; + double lcm_sym31__; + int lcm_sym30__; + int lcm_sym29__; + int lcm_sym28__; + int lcm_sym27__; + int lcm_sym26__; + int lcm_sym25__; + { + current_statement__ = 14; + stan::math::validate_non_negative_index("chi", "nind", nind); + current_statement__ = 15; + stan::math::validate_non_negative_index("chi", "n_occasions", + n_occasions); + Eigen::Matrix chi = + Eigen::Matrix::Constant(nind, n_occasions, + DUMMY_VAR__); + current_statement__ = 24; + if (stan::math::logical_gte(nind, 1)) { + current_statement__ = 17; + stan::model::assign(chi, 1.0, "assigning variable chi", + stan::model::index_uni(1), stan::model::index_uni(n_occasions)); + lcm_sym28__ = (n_occasions - 1); + lcm_sym26__ = stan::math::logical_gte(lcm_sym28__, 1); + if (lcm_sym26__) { + int t_curr = std::numeric_limits::min(); + int t_next = std::numeric_limits::min(); + lcm_sym30__ = (lcm_sym28__ + 1); + current_statement__ = 20; + stan::model::assign(chi, + stan::math::fma( + (stan::model::rvalue(phi, "phi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym28__)) * (1 - + stan::model::rvalue(p, "p", stan::model::index_uni(1), + stan::model::index_uni((lcm_sym30__ - 1))))), + stan::model::rvalue(chi, "chi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym30__)), (1 - + stan::model::rvalue(phi, "phi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym28__)))), + "assigning variable chi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym28__)); + for (int t = 2; t <= lcm_sym28__; ++t) { + int t_curr = std::numeric_limits::min(); + lcm_sym27__ = (n_occasions - t); + int t_next = std::numeric_limits::min(); + lcm_sym29__ = (lcm_sym27__ + 1); + current_statement__ = 20; + stan::model::assign(chi, + stan::math::fma( + (stan::model::rvalue(phi, "phi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym27__)) * (1 - + stan::model::rvalue(p, "p", stan::model::index_uni(1), + stan::model::index_uni((lcm_sym29__ - 1))))), + stan::model::rvalue(chi, "chi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym29__)), (1 - + stan::model::rvalue(phi, "phi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym27__)))), + "assigning variable chi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym27__)); + } + } + for (int i = 2; i <= nind; ++i) { + current_statement__ = 17; + stan::model::assign(chi, 1.0, "assigning variable chi", + stan::model::index_uni(i), stan::model::index_uni(n_occasions)); + current_statement__ = 22; + if (lcm_sym26__) { + int t_curr = std::numeric_limits::min(); + int t_next = std::numeric_limits::min(); + lcm_sym30__ = (lcm_sym28__ + 1); + current_statement__ = 20; + stan::model::assign(chi, + stan::math::fma( + (stan::model::rvalue(phi, "phi", stan::model::index_uni(i), + stan::model::index_uni(lcm_sym28__)) * (1 - + stan::model::rvalue(p, "p", stan::model::index_uni(i), + stan::model::index_uni((lcm_sym30__ - 1))))), + stan::model::rvalue(chi, "chi", stan::model::index_uni(i), + stan::model::index_uni(lcm_sym30__)), (1 - + stan::model::rvalue(phi, "phi", stan::model::index_uni(i), + stan::model::index_uni(lcm_sym28__)))), + "assigning variable chi", stan::model::index_uni(i), + stan::model::index_uni(lcm_sym28__)); + for (int t = 2; t <= lcm_sym28__; ++t) { + int t_curr = std::numeric_limits::min(); + lcm_sym27__ = (n_occasions - t); + int t_next = std::numeric_limits::min(); + lcm_sym29__ = (lcm_sym27__ + 1); + current_statement__ = 20; + stan::model::assign(chi, + stan::math::fma( + (stan::model::rvalue(phi, "phi", stan::model::index_uni(i), + stan::model::index_uni(lcm_sym27__)) * (1 - + stan::model::rvalue(p, "p", stan::model::index_uni(i), + stan::model::index_uni((lcm_sym29__ - 1))))), + stan::model::rvalue(chi, "chi", stan::model::index_uni(i), + stan::model::index_uni(lcm_sym29__)), (1 - + stan::model::rvalue(phi, "phi", stan::model::index_uni(i), + stan::model::index_uni(lcm_sym27__)))), + "assigning variable chi", stan::model::index_uni(i), + stan::model::index_uni(lcm_sym27__)); + } + } + } + } + current_statement__ = 25; + return chi; } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -int last_capture(const std::vector& y_i, std::ostream* pstream__) { - using local_scalar_t__ = double; - int current_statement__ = 0; - static constexpr bool propto__ = true; - // suppress unused var warning - (void) propto__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - int lcm_sym24__; - int lcm_sym23__; - int lcm_sym22__; - int lcm_sym21__; - int lcm_sym20__; - int lcm_sym19__; - { - lcm_sym22__ = (stan::math::size(y_i) - 1); - if (stan::math::logical_gte(lcm_sym22__, 0)) { - int k = std::numeric_limits::min(); - lcm_sym21__ = (stan::math::size(y_i) - 0); - current_statement__ = 63; - if (y_i[(lcm_sym21__ - 1)]) { - current_statement__ = 62; - return lcm_sym21__; +class fails_test_model final : public model_base_crtp { + private: + int lcm_sym118__; + int lcm_sym117__; + int lcm_sym116__; + int lcm_sym115__; + int lcm_sym114__; + int lcm_sym113__; + int lcm_sym112__; + int lcm_sym111__; + int lcm_sym110__; + int lcm_sym109__; + int lcm_sym108__; + int lcm_sym107__; + int lcm_sym106__; + int nind; + int n_occasions; + std::vector> y; + int max_age; + std::vector> x; + int n_occ_minus_1; + std::vector first; + std::vector last; + public: + ~fails_test_model() {} + fails_test_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__ = + "fails_test_model_namespace::fails_test_model"; + // suppress unused var warning + (void) function__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + int pos__; + pos__ = 1; + current_statement__ = 33; + context__.validate_dims("data initialization", "nind", "int", + std::vector{}); + nind = std::numeric_limits::min(); + current_statement__ = 33; + nind = context__.vals_i("nind")[(1 - 1)]; + current_statement__ = 33; + stan::math::check_greater_or_equal(function__, "nind", nind, 0); + current_statement__ = 34; + context__.validate_dims("data initialization", "n_occasions", "int", + std::vector{}); + n_occasions = std::numeric_limits::min(); + current_statement__ = 34; + n_occasions = context__.vals_i("n_occasions")[(1 - 1)]; + current_statement__ = 34; + stan::math::check_greater_or_equal(function__, "n_occasions", + n_occasions, 2); + current_statement__ = 35; + stan::math::validate_non_negative_index("y", "nind", nind); + current_statement__ = 36; + stan::math::validate_non_negative_index("y", "n_occasions", n_occasions); + current_statement__ = 37; + context__.validate_dims("data initialization", "y", "int", + std::vector{static_cast(nind), + static_cast(n_occasions)}); + y = std::vector>(nind, + std::vector(n_occasions, std::numeric_limits::min())); + { + std::vector y_flat__; + current_statement__ = 37; + y_flat__ = context__.vals_i("y"); + current_statement__ = 37; + pos__ = 1; + current_statement__ = 37; + if (stan::math::logical_gte(n_occasions, 1)) { + lcm_sym107__ = stan::math::logical_gte(nind, 1); + if (lcm_sym107__) { + current_statement__ = 37; + stan::model::assign(y, + stan::model::rvalue(y_flat__, "y_flat__", + stan::model::index_uni(1)), "assigning variable y", + stan::model::index_uni(1), stan::model::index_uni(1)); + current_statement__ = 37; + pos__ = 2; + for (int sym2__ = 2; sym2__ <= nind; ++sym2__) { + current_statement__ = 37; + stan::model::assign(y, y_flat__[(pos__ - 1)], + "assigning variable y", stan::model::index_uni(sym2__), + stan::model::index_uni(1)); + current_statement__ = 37; + pos__ = (pos__ + 1); + } + } + for (int sym1__ = 2; sym1__ <= n_occasions; ++sym1__) { + current_statement__ = 37; + if (lcm_sym107__) { + current_statement__ = 37; + stan::model::assign(y, y_flat__[(pos__ - 1)], + "assigning variable y", stan::model::index_uni(1), + stan::model::index_uni(sym1__)); + current_statement__ = 37; + pos__ = (pos__ + 1); + for (int sym2__ = 2; sym2__ <= nind; ++sym2__) { + current_statement__ = 37; + stan::model::assign(y, y_flat__[(pos__ - 1)], + "assigning variable y", stan::model::index_uni(sym2__), + stan::model::index_uni(sym1__)); + current_statement__ = 37; + pos__ = (pos__ + 1); + } + } + } + } else { + lcm_sym107__ = stan::math::logical_gte(nind, 1); + } + } + current_statement__ = 37; + stan::math::check_greater_or_equal(function__, "y", y, 0); + current_statement__ = 37; + stan::math::check_less_or_equal(function__, "y", y, 1); + current_statement__ = 38; + context__.validate_dims("data initialization", "max_age", "int", + std::vector{}); + max_age = std::numeric_limits::min(); + current_statement__ = 38; + max_age = context__.vals_i("max_age")[(1 - 1)]; + current_statement__ = 38; + stan::math::check_greater_or_equal(function__, "max_age", max_age, 1); + current_statement__ = 39; + stan::math::validate_non_negative_index("x", "nind", nind); + lcm_sym109__ = (n_occasions - 1); + stan::math::validate_non_negative_index("x", "n_occasions - 1", + lcm_sym109__); + current_statement__ = 40; + context__.validate_dims("data initialization", "x", "int", + std::vector{static_cast(nind), + static_cast(lcm_sym109__)}); + x = std::vector>(nind, + std::vector(lcm_sym109__, std::numeric_limits::min())); + { + std::vector x_flat__; + current_statement__ = 40; + x_flat__ = context__.vals_i("x"); + current_statement__ = 40; + pos__ = 1; + current_statement__ = 40; + if (stan::math::logical_gte(lcm_sym109__, 1)) { + current_statement__ = 40; + if (lcm_sym107__) { + current_statement__ = 40; + stan::model::assign(x, + stan::model::rvalue(x_flat__, "x_flat__", + stan::model::index_uni(1)), "assigning variable x", + stan::model::index_uni(1), stan::model::index_uni(1)); + current_statement__ = 40; + pos__ = 2; + for (int sym2__ = 2; sym2__ <= nind; ++sym2__) { + current_statement__ = 40; + stan::model::assign(x, x_flat__[(pos__ - 1)], + "assigning variable x", stan::model::index_uni(sym2__), + stan::model::index_uni(1)); + current_statement__ = 40; + pos__ = (pos__ + 1); + } + } + for (int sym1__ = 2; sym1__ <= lcm_sym109__; ++sym1__) { + current_statement__ = 40; + if (lcm_sym107__) { + current_statement__ = 40; + stan::model::assign(x, x_flat__[(pos__ - 1)], + "assigning variable x", stan::model::index_uni(1), + stan::model::index_uni(sym1__)); + current_statement__ = 40; + pos__ = (pos__ + 1); + for (int sym2__ = 2; sym2__ <= nind; ++sym2__) { + current_statement__ = 40; + stan::model::assign(x, x_flat__[(pos__ - 1)], + "assigning variable x", stan::model::index_uni(sym2__), + stan::model::index_uni(sym1__)); + current_statement__ = 40; + pos__ = (pos__ + 1); + } + } + } + } + } + current_statement__ = 40; + stan::math::check_greater_or_equal(function__, "x", x, 0); + current_statement__ = 40; + stan::math::check_less_or_equal(function__, "x", x, max_age); + current_statement__ = 41; + n_occ_minus_1 = std::numeric_limits::min(); + current_statement__ = 41; + n_occ_minus_1 = lcm_sym109__; + current_statement__ = 42; + stan::math::validate_non_negative_index("first", "nind", nind); + current_statement__ = 43; + first = std::vector(nind, std::numeric_limits::min()); + current_statement__ = 44; + stan::math::validate_non_negative_index("last", "nind", nind); + current_statement__ = 45; + last = std::vector(nind, std::numeric_limits::min()); + current_statement__ = 47; + if (lcm_sym107__) { + current_statement__ = 46; + stan::model::assign(first, + first_capture( + stan::model::rvalue(y, "y", stan::model::index_uni(1)), pstream__), + "assigning variable first", stan::model::index_uni(1)); + for (int i = 2; i <= nind; ++i) { + current_statement__ = 46; + stan::model::assign(first, + first_capture( + stan::model::rvalue(y, "y", stan::model::index_uni(i)), + pstream__), "assigning variable first", + stan::model::index_uni(i)); } - for (int k_rev = 1; k_rev <= lcm_sym22__; ++k_rev) { - int k = std::numeric_limits::min(); - lcm_sym20__ = (stan::math::size(y_i) - k_rev); - current_statement__ = 63; - if (y_i[(lcm_sym20__ - 1)]) { - current_statement__ = 62; - return lcm_sym20__; - } + } + current_statement__ = 49; + if (lcm_sym107__) { + current_statement__ = 48; + stan::model::assign(last, + last_capture( + stan::model::rvalue(y, "y", stan::model::index_uni(1)), pstream__), + "assigning variable last", stan::model::index_uni(1)); + for (int i = 2; i <= nind; ++i) { + current_statement__ = 48; + stan::model::assign(last, + last_capture( + stan::model::rvalue(y, "y", stan::model::index_uni(i)), + pstream__), "assigning variable last", + stan::model::index_uni(i)); } } - current_statement__ = 65; - return 0; - } - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } -} -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, - const T3__& phi_arg__, std::ostream* pstream__) { - using local_scalar_t__ = stan::promote_args_t, - stan::base_type_t>; - int current_statement__ = 0; - const auto& p = stan::math::to_ref(p_arg__); - const auto& phi = stan::math::to_ref(phi_arg__); - static constexpr bool propto__ = true; - // suppress unused var warning - (void) propto__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - double lcm_sym34__; - double lcm_sym33__; - double lcm_sym32__; - double lcm_sym31__; - int lcm_sym30__; - int lcm_sym29__; - int lcm_sym28__; - int lcm_sym27__; - int lcm_sym26__; - int lcm_sym25__; - { - current_statement__ = 14; + current_statement__ = 43; + stan::math::check_greater_or_equal(function__, "first", first, 0); + current_statement__ = 43; + stan::math::check_less_or_equal(function__, "first", first, n_occasions); + current_statement__ = 45; + stan::math::check_greater_or_equal(function__, "last", last, 0); + current_statement__ = 45; + stan::math::check_less_or_equal(function__, "last", last, n_occasions); + current_statement__ = 50; + stan::math::validate_non_negative_index("beta", "max_age", max_age); + current_statement__ = 51; + stan::math::validate_non_negative_index("phi", "nind", nind); + current_statement__ = 52; + stan::math::validate_non_negative_index("phi", "n_occ_minus_1", + lcm_sym109__); + current_statement__ = 53; + stan::math::validate_non_negative_index("p", "nind", nind); + current_statement__ = 54; + stan::math::validate_non_negative_index("p", "n_occ_minus_1", + lcm_sym109__); + current_statement__ = 55; stan::math::validate_non_negative_index("chi", "nind", nind); - current_statement__ = 15; + current_statement__ = 56; stan::math::validate_non_negative_index("chi", "n_occasions", n_occasions); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + num_params_r__ = 1 + max_age; + } + inline std::string model_name() const final { + return "fails_test_model"; + } + inline std::vector model_compile_info() const noexcept { + return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", + "stancflags = --O --print-cpp"}; + } + 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__; + stan::io::deserializer in__(params_r__, params_i__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + static constexpr const char* function__ = + "fails_test_model_namespace::log_prob"; + // suppress unused var warning + (void) function__; + try { + double lcm_sym105__; + int lcm_sym104__; + int lcm_sym103__; + int lcm_sym102__; + int lcm_sym101__; + double lcm_sym100__; + double lcm_sym99__; + double lcm_sym98__; + double lcm_sym97__; + double lcm_sym96__; + double lcm_sym95__; + double lcm_sym94__; + double lcm_sym93__; + double lcm_sym92__; + double lcm_sym91__; + double lcm_sym90__; + double lcm_sym89__; + double lcm_sym88__; + double lcm_sym87__; + double lcm_sym86__; + double lcm_sym85__; + double lcm_sym84__; + double lcm_sym83__; + int lcm_sym82__; + int lcm_sym81__; + int lcm_sym80__; + int lcm_sym79__; + int lcm_sym78__; + int lcm_sym77__; + int lcm_sym76__; + int lcm_sym75__; + int lcm_sym74__; + int lcm_sym73__; + int lcm_sym72__; + int lcm_sym71__; + int lcm_sym70__; + int lcm_sym69__; + int lcm_sym68__; + int lcm_sym67__; + int lcm_sym66__; + int lcm_sym65__; + int lcm_sym64__; + int lcm_sym63__; + local_scalar_t__ mean_p; + current_statement__ = 1; + mean_p = in__.template read_constrain_lub(0, 1, lp__); + Eigen::Matrix beta; + current_statement__ = 2; + beta = in__.template read_constrain_lub< + Eigen::Matrix, jacobian__>(0, 1, lp__, + max_age); + Eigen::Matrix phi = + Eigen::Matrix::Constant(nind, (n_occasions - + 1), DUMMY_VAR__); + Eigen::Matrix p = + Eigen::Matrix::Constant(nind, (n_occasions - + 1), DUMMY_VAR__); Eigen::Matrix chi = Eigen::Matrix::Constant(nind, n_occasions, DUMMY_VAR__); - current_statement__ = 24; - if (stan::math::logical_gte(nind, 1)) { - current_statement__ = 17; - stan::model::assign(chi, 1.0, "assigning variable chi", - stan::model::index_uni(1), stan::model::index_uni(n_occasions)); - lcm_sym28__ = (n_occasions - 1); - lcm_sym26__ = stan::math::logical_gte(lcm_sym28__, 1); - if (lcm_sym26__) { - int t_curr = std::numeric_limits::min(); - int t_next = std::numeric_limits::min(); - lcm_sym30__ = (lcm_sym28__ + 1); - current_statement__ = 20; - stan::model::assign(chi, - stan::math::fma( - (stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym28__)) * (1 - - stan::model::rvalue(p, "p", stan::model::index_uni(1), - stan::model::index_uni((lcm_sym30__ - 1))))), - stan::model::rvalue(chi, "chi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym30__)), (1 - - stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym28__)))), - "assigning variable chi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym28__)); - for (int t = 2; t <= lcm_sym28__; ++t) { - int t_curr = std::numeric_limits::min(); - lcm_sym27__ = (n_occasions - t); - int t_next = std::numeric_limits::min(); - lcm_sym29__ = (lcm_sym27__ + 1); - current_statement__ = 20; - stan::model::assign(chi, - stan::math::fma( - (stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym27__)) * (1 - - stan::model::rvalue(p, "p", stan::model::index_uni(1), - stan::model::index_uni((lcm_sym29__ - 1))))), - stan::model::rvalue(chi, "chi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym29__)), (1 - - stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym27__)))), - "assigning variable chi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym27__)); + lcm_sym63__ = stan::math::logical_gte(nind, 1); + if (lcm_sym63__) { + lcm_sym102__ = stan::model::rvalue(first, "first", + stan::model::index_uni(1)); + lcm_sym76__ = (lcm_sym102__ - 1); + if (stan::math::logical_gte(lcm_sym76__, 1)) { + stan::model::assign(phi, 0, "assigning variable phi", + stan::model::index_uni(1), stan::model::index_uni(1)); + current_statement__ = 6; + stan::model::assign(p, 0, "assigning variable p", + stan::model::index_uni(1), stan::model::index_uni(1)); + for (int t = 2; t <= lcm_sym76__; ++t) { + current_statement__ = 7; + stan::model::assign(phi, 0, "assigning variable phi", + stan::model::index_uni(1), stan::model::index_uni(t)); + current_statement__ = 6; + stan::model::assign(p, 0, "assigning variable p", + stan::model::index_uni(1), stan::model::index_uni(t)); + } + } + lcm_sym74__ = (n_occasions - 1); + if (stan::math::logical_gte(lcm_sym74__, lcm_sym102__)) { + current_statement__ = 9; + stan::model::assign(phi, + stan::model::rvalue(beta, "beta", + stan::model::index_uni( + stan::model::rvalue(x, "x", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym102__)))), + "assigning variable phi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym102__)); + lcm_sym82__ = (lcm_sym102__ + 1); + stan::model::assign(p, mean_p, "assigning variable p", + stan::model::index_uni(1), stan::model::index_uni(lcm_sym102__)); + for (int t = lcm_sym82__; t <= lcm_sym74__; ++t) { + current_statement__ = 9; + stan::model::assign(phi, + stan::model::rvalue(beta, "beta", + stan::model::index_uni( + stan::model::rvalue(x, "x", stan::model::index_uni(1), + stan::model::index_uni(t)))), "assigning variable phi", + stan::model::index_uni(1), stan::model::index_uni(t)); + current_statement__ = 10; + stan::model::assign(p, mean_p, "assigning variable p", + stan::model::index_uni(1), stan::model::index_uni(t)); } } for (int i = 2; i <= nind; ++i) { - current_statement__ = 17; - stan::model::assign(chi, 1.0, "assigning variable chi", - stan::model::index_uni(i), stan::model::index_uni(n_occasions)); - current_statement__ = 22; - if (lcm_sym26__) { - int t_curr = std::numeric_limits::min(); - int t_next = std::numeric_limits::min(); - lcm_sym30__ = (lcm_sym28__ + 1); - current_statement__ = 20; - stan::model::assign(chi, - stan::math::fma( - (stan::model::rvalue(phi, "phi", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym28__)) * (1 - - stan::model::rvalue(p, "p", stan::model::index_uni(i), - stan::model::index_uni((lcm_sym30__ - 1))))), - stan::model::rvalue(chi, "chi", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym30__)), (1 - - stan::model::rvalue(phi, "phi", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym28__)))), - "assigning variable chi", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym28__)); - for (int t = 2; t <= lcm_sym28__; ++t) { - int t_curr = std::numeric_limits::min(); - lcm_sym27__ = (n_occasions - t); - int t_next = std::numeric_limits::min(); - lcm_sym29__ = (lcm_sym27__ + 1); - current_statement__ = 20; - stan::model::assign(chi, - stan::math::fma( - (stan::model::rvalue(phi, "phi", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym27__)) * (1 - - stan::model::rvalue(p, "p", stan::model::index_uni(i), - stan::model::index_uni((lcm_sym29__ - 1))))), - stan::model::rvalue(chi, "chi", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym29__)), (1 - - stan::model::rvalue(phi, "phi", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym27__)))), - "assigning variable chi", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym27__)); + lcm_sym101__ = stan::model::rvalue(first, "first", + stan::model::index_uni(i)); + lcm_sym75__ = (lcm_sym101__ - 1); + if (stan::math::logical_gte(lcm_sym75__, 1)) { + stan::model::assign(phi, 0, "assigning variable phi", + stan::model::index_uni(i), stan::model::index_uni(1)); + current_statement__ = 6; + stan::model::assign(p, 0, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(1)); + for (int t = 2; t <= lcm_sym75__; ++t) { + current_statement__ = 7; + stan::model::assign(phi, 0, "assigning variable phi", + stan::model::index_uni(i), stan::model::index_uni(t)); + current_statement__ = 6; + stan::model::assign(p, 0, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(t)); + } + } + current_statement__ = 12; + if (stan::math::logical_gte(lcm_sym74__, lcm_sym101__)) { + current_statement__ = 9; + stan::model::assign(phi, + stan::model::rvalue(beta, "beta", + stan::model::index_uni( + stan::model::rvalue(x, "x", stan::model::index_uni(i), + stan::model::index_uni(lcm_sym101__)))), + "assigning variable phi", stan::model::index_uni(i), + stan::model::index_uni(lcm_sym101__)); + lcm_sym81__ = (lcm_sym101__ + 1); + stan::model::assign(p, mean_p, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(lcm_sym101__)); + for (int t = lcm_sym81__; t <= lcm_sym74__; ++t) { + current_statement__ = 9; + stan::model::assign(phi, + stan::model::rvalue(beta, "beta", + stan::model::index_uni( + stan::model::rvalue(x, "x", stan::model::index_uni(i), + stan::model::index_uni(t)))), "assigning variable phi", + stan::model::index_uni(i), stan::model::index_uni(t)); + current_statement__ = 10; + stan::model::assign(p, mean_p, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(t)); } } } } - current_statement__ = 25; - return chi; - } - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } -} -class fails_test_model final : public model_base_crtp { - private: - int lcm_sym118__; - int lcm_sym117__; - int lcm_sym116__; - int lcm_sym115__; - int lcm_sym114__; - int lcm_sym113__; - int lcm_sym112__; - int lcm_sym111__; - int lcm_sym110__; - int lcm_sym109__; - int lcm_sym108__; - int lcm_sym107__; - int lcm_sym106__; - int nind; - int n_occasions; - std::vector> y; - int max_age; - std::vector> x; - int n_occ_minus_1; - std::vector first; - std::vector last; - public: - ~fails_test_model() {} - fails_test_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__ = - "fails_test_model_namespace::fails_test_model"; - // suppress unused var warning - (void) function__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - int pos__; - pos__ = 1; - current_statement__ = 33; - context__.validate_dims("data initialization", "nind", "int", - std::vector{}); - nind = std::numeric_limits::min(); - current_statement__ = 33; - nind = context__.vals_i("nind")[(1 - 1)]; - current_statement__ = 33; - stan::math::check_greater_or_equal(function__, "nind", nind, 0); - current_statement__ = 34; - context__.validate_dims("data initialization", "n_occasions", "int", - std::vector{}); - n_occasions = std::numeric_limits::min(); - current_statement__ = 34; - n_occasions = context__.vals_i("n_occasions")[(1 - 1)]; - current_statement__ = 34; - stan::math::check_greater_or_equal(function__, "n_occasions", - n_occasions, 2); - current_statement__ = 35; - stan::math::validate_non_negative_index("y", "nind", nind); - current_statement__ = 36; - stan::math::validate_non_negative_index("y", "n_occasions", n_occasions); - current_statement__ = 37; - context__.validate_dims("data initialization", "y", "int", - std::vector{static_cast(nind), - static_cast(n_occasions)}); - y = std::vector>(nind, - std::vector(n_occasions, std::numeric_limits::min())); + Eigen::Matrix + inline_prob_uncaptured_return_sym8__; { - std::vector y_flat__; - current_statement__ = 37; - y_flat__ = context__.vals_i("y"); - current_statement__ = 37; - pos__ = 1; - current_statement__ = 37; - if (stan::math::logical_gte(n_occasions, 1)) { - lcm_sym107__ = stan::math::logical_gte(nind, 1); - if (lcm_sym107__) { - current_statement__ = 37; - stan::model::assign(y, - stan::model::rvalue(y_flat__, "y_flat__", - stan::model::index_uni(1)), "assigning variable y", - stan::model::index_uni(1), stan::model::index_uni(1)); - current_statement__ = 37; - pos__ = 2; - for (int sym2__ = 2; sym2__ <= nind; ++sym2__) { - current_statement__ = 37; - stan::model::assign(y, y_flat__[(pos__ - 1)], - "assigning variable y", stan::model::index_uni(sym2__), - stan::model::index_uni(1)); - current_statement__ = 37; - pos__ = (pos__ + 1); + current_statement__ = 14; + stan::math::validate_non_negative_index("chi", "nind", nind); + current_statement__ = 15; + stan::math::validate_non_negative_index("chi", "n_occasions", + n_occasions); + Eigen::Matrix + inline_prob_uncaptured_chi_sym9__ = + Eigen::Matrix::Constant(nind, n_occasions, + DUMMY_VAR__); + current_statement__ = 24; + if (lcm_sym63__) { + current_statement__ = 17; + stan::model::assign(inline_prob_uncaptured_chi_sym9__, 1.0, + "assigning variable inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(1), stan::model::index_uni(n_occasions)); + lcm_sym74__ = (n_occasions - 1); + lcm_sym64__ = stan::math::logical_gte(lcm_sym74__, 1); + if (lcm_sym64__) { + int inline_prob_uncaptured_t_curr_sym10__ = + std::numeric_limits::min(); + int inline_prob_uncaptured_t_next_sym11__ = + std::numeric_limits::min(); + lcm_sym78__ = (lcm_sym74__ + 1); + current_statement__ = 20; + stan::model::assign(inline_prob_uncaptured_chi_sym9__, + stan::math::fma( + (stan::model::rvalue(phi, "phi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym74__)) * (1 - + stan::model::rvalue(p, "p", stan::model::index_uni(1), + stan::model::index_uni((lcm_sym78__ - 1))))), + stan::model::rvalue(inline_prob_uncaptured_chi_sym9__, + "inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(1), + stan::model::index_uni(lcm_sym78__)), (1 - + stan::model::rvalue(phi, "phi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym74__)))), + "assigning variable inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(1), stan::model::index_uni(lcm_sym74__)); + for (int inline_prob_uncaptured_t_sym12__ = 2; inline_prob_uncaptured_t_sym12__ + <= lcm_sym74__; ++inline_prob_uncaptured_t_sym12__) { + int inline_prob_uncaptured_t_curr_sym10__ = + std::numeric_limits::min(); + lcm_sym73__ = (n_occasions - inline_prob_uncaptured_t_sym12__); + int inline_prob_uncaptured_t_next_sym11__ = + std::numeric_limits::min(); + lcm_sym77__ = (lcm_sym73__ + 1); + current_statement__ = 20; + stan::model::assign(inline_prob_uncaptured_chi_sym9__, + stan::math::fma( + (stan::model::rvalue(phi, "phi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym73__)) * (1 - + stan::model::rvalue(p, "p", stan::model::index_uni(1), + stan::model::index_uni((lcm_sym77__ - 1))))), + stan::model::rvalue(inline_prob_uncaptured_chi_sym9__, + "inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(1), + stan::model::index_uni(lcm_sym77__)), (1 - + stan::model::rvalue(phi, "phi", stan::model::index_uni(1), + stan::model::index_uni(lcm_sym73__)))), + "assigning variable inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(1), + stan::model::index_uni(lcm_sym73__)); } } - for (int sym1__ = 2; sym1__ <= n_occasions; ++sym1__) { - current_statement__ = 37; - if (lcm_sym107__) { - current_statement__ = 37; - stan::model::assign(y, y_flat__[(pos__ - 1)], - "assigning variable y", stan::model::index_uni(1), - stan::model::index_uni(sym1__)); - current_statement__ = 37; - pos__ = (pos__ + 1); - for (int sym2__ = 2; sym2__ <= nind; ++sym2__) { - current_statement__ = 37; - stan::model::assign(y, y_flat__[(pos__ - 1)], - "assigning variable y", stan::model::index_uni(sym2__), - stan::model::index_uni(sym1__)); - current_statement__ = 37; - pos__ = (pos__ + 1); + for (int inline_prob_uncaptured_i_sym13__ = 2; inline_prob_uncaptured_i_sym13__ + <= nind; ++inline_prob_uncaptured_i_sym13__) { + current_statement__ = 17; + stan::model::assign(inline_prob_uncaptured_chi_sym9__, 1.0, + "assigning variable inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(n_occasions)); + current_statement__ = 22; + if (lcm_sym64__) { + int inline_prob_uncaptured_t_curr_sym10__ = + std::numeric_limits::min(); + int inline_prob_uncaptured_t_next_sym11__ = + std::numeric_limits::min(); + lcm_sym78__ = (lcm_sym74__ + 1); + current_statement__ = 20; + stan::model::assign(inline_prob_uncaptured_chi_sym9__, + stan::math::fma( + (stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(lcm_sym74__)) * (1 - + stan::model::rvalue(p, "p", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni((lcm_sym78__ - 1))))), + stan::model::rvalue(inline_prob_uncaptured_chi_sym9__, + "inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(lcm_sym78__)), (1 - + stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(lcm_sym74__)))), + "assigning variable inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(lcm_sym74__)); + for (int inline_prob_uncaptured_t_sym12__ = 2; inline_prob_uncaptured_t_sym12__ + <= lcm_sym74__; ++inline_prob_uncaptured_t_sym12__) { + int inline_prob_uncaptured_t_curr_sym10__ = + std::numeric_limits::min(); + lcm_sym73__ = (n_occasions - + inline_prob_uncaptured_t_sym12__); + int inline_prob_uncaptured_t_next_sym11__ = + std::numeric_limits::min(); + lcm_sym77__ = (lcm_sym73__ + 1); + current_statement__ = 20; + stan::model::assign(inline_prob_uncaptured_chi_sym9__, + stan::math::fma( + (stan::model::rvalue(phi, "phi", + stan::model::index_uni( + inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(lcm_sym73__)) * (1 - + stan::model::rvalue(p, "p", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni((lcm_sym77__ - 1))))), + stan::model::rvalue(inline_prob_uncaptured_chi_sym9__, + "inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(lcm_sym77__)), (1 - + stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(lcm_sym73__)))), + "assigning variable inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(lcm_sym73__)); } } } - } else { - lcm_sym107__ = stan::math::logical_gte(nind, 1); } + current_statement__ = 25; + stan::model::assign(inline_prob_uncaptured_return_sym8__, + inline_prob_uncaptured_chi_sym9__, + "assigning variable inline_prob_uncaptured_return_sym8__"); } - current_statement__ = 37; - stan::math::check_greater_or_equal(function__, "y", y, 0); - current_statement__ = 37; - stan::math::check_less_or_equal(function__, "y", y, 1); - current_statement__ = 38; - context__.validate_dims("data initialization", "max_age", "int", - std::vector{}); - max_age = std::numeric_limits::min(); - current_statement__ = 38; - max_age = context__.vals_i("max_age")[(1 - 1)]; - current_statement__ = 38; - stan::math::check_greater_or_equal(function__, "max_age", max_age, 1); - current_statement__ = 39; - stan::math::validate_non_negative_index("x", "nind", nind); - lcm_sym109__ = (n_occasions - 1); - stan::math::validate_non_negative_index("x", "n_occasions - 1", - lcm_sym109__); - current_statement__ = 40; - context__.validate_dims("data initialization", "x", "int", - std::vector{static_cast(nind), - static_cast(lcm_sym109__)}); - x = std::vector>(nind, - std::vector(lcm_sym109__, std::numeric_limits::min())); + stan::model::assign(chi, inline_prob_uncaptured_return_sym8__, + "assigning variable chi"); + current_statement__ = 3; + stan::math::check_greater_or_equal(function__, "phi", phi, 0); + current_statement__ = 3; + stan::math::check_less_or_equal(function__, "phi", phi, 1); + current_statement__ = 4; + stan::math::check_greater_or_equal(function__, "p", p, 0); + current_statement__ = 4; + stan::math::check_less_or_equal(function__, "p", p, 1); + current_statement__ = 5; + stan::math::check_greater_or_equal(function__, "chi", + inline_prob_uncaptured_return_sym8__, 0); + current_statement__ = 5; + stan::math::check_less_or_equal(function__, "chi", + inline_prob_uncaptured_return_sym8__, 1); { - std::vector x_flat__; - current_statement__ = 40; - x_flat__ = context__.vals_i("x"); - current_statement__ = 40; - pos__ = 1; - current_statement__ = 40; - if (stan::math::logical_gte(lcm_sym109__, 1)) { - current_statement__ = 40; - if (lcm_sym107__) { - current_statement__ = 40; - stan::model::assign(x, - stan::model::rvalue(x_flat__, "x_flat__", - stan::model::index_uni(1)), "assigning variable x", - stan::model::index_uni(1), stan::model::index_uni(1)); - current_statement__ = 40; - pos__ = 2; - for (int sym2__ = 2; sym2__ <= nind; ++sym2__) { - current_statement__ = 40; - stan::model::assign(x, x_flat__[(pos__ - 1)], - "assigning variable x", stan::model::index_uni(sym2__), - stan::model::index_uni(1)); - current_statement__ = 40; - pos__ = (pos__ + 1); + current_statement__ = 32; + if (lcm_sym63__) { + lcm_sym102__ = stan::model::rvalue(first, "first", + stan::model::index_uni(1)); + if (stan::math::logical_gt(lcm_sym102__, 0)) { + lcm_sym104__ = stan::model::rvalue(last, "last", + stan::model::index_uni(1)); + lcm_sym82__ = (lcm_sym102__ + 1); + if (stan::math::logical_gte(lcm_sym104__, lcm_sym82__)) { + current_statement__ = 26; + lp_accum__.add(stan::math::bernoulli_lpmf(1, + stan::model::rvalue(phi, "phi", + stan::model::index_uni(1), + stan::model::index_uni((lcm_sym82__ - 1))))); + lcm_sym80__ = (lcm_sym82__ + 1); + lp_accum__.add(stan::math::bernoulli_lpmf( + stan::model::rvalue(y, "y", + stan::model::index_uni(1), + stan::model::index_uni(lcm_sym82__)), + stan::model::rvalue(p, "p", + stan::model::index_uni(1), + stan::model::index_uni((lcm_sym82__ - 1))))); + for (int t = lcm_sym80__; t <= lcm_sym104__; ++t) { + current_statement__ = 26; + lp_accum__.add(stan::math::bernoulli_lpmf(1, + stan::model::rvalue(phi, "phi", + stan::model::index_uni(1), + stan::model::index_uni((t - 1))))); + current_statement__ = 27; + lp_accum__.add(stan::math::bernoulli_lpmf( + stan::model::rvalue(y, "y", + stan::model::index_uni(1), + stan::model::index_uni(t)), + stan::model::rvalue(p, "p", + stan::model::index_uni(1), + stan::model::index_uni((t - 1))))); + } } + current_statement__ = 29; + lp_accum__.add(stan::math::bernoulli_lpmf(1, + stan::model::rvalue( + inline_prob_uncaptured_return_sym8__, + "inline_prob_uncaptured_return_sym8__", + stan::model::index_uni(1), + stan::model::index_uni(lcm_sym104__)))); } - for (int sym1__ = 2; sym1__ <= lcm_sym109__; ++sym1__) { - current_statement__ = 40; - if (lcm_sym107__) { - current_statement__ = 40; - stan::model::assign(x, x_flat__[(pos__ - 1)], - "assigning variable x", stan::model::index_uni(1), - stan::model::index_uni(sym1__)); - current_statement__ = 40; - pos__ = (pos__ + 1); - for (int sym2__ = 2; sym2__ <= nind; ++sym2__) { - current_statement__ = 40; - stan::model::assign(x, x_flat__[(pos__ - 1)], - "assigning variable x", stan::model::index_uni(sym2__), - stan::model::index_uni(sym1__)); - current_statement__ = 40; - pos__ = (pos__ + 1); + for (int i = 2; i <= nind; ++i) { + lcm_sym101__ = stan::model::rvalue(first, "first", + stan::model::index_uni(i)); + if (stan::math::logical_gt(lcm_sym101__, 0)) { + lcm_sym103__ = stan::model::rvalue(last, "last", + stan::model::index_uni(i)); + lcm_sym81__ = (lcm_sym101__ + 1); + if (stan::math::logical_gte(lcm_sym103__, lcm_sym81__)) { + current_statement__ = 26; + lp_accum__.add(stan::math::bernoulli_lpmf(1, + stan::model::rvalue(phi, "phi", + stan::model::index_uni(i), + stan::model::index_uni((lcm_sym81__ - 1))))); + lcm_sym79__ = (lcm_sym81__ + 1); + lp_accum__.add(stan::math::bernoulli_lpmf( + stan::model::rvalue(y, "y", + stan::model::index_uni(i), + stan::model::index_uni(lcm_sym81__)), + stan::model::rvalue(p, "p", + stan::model::index_uni(i), + stan::model::index_uni((lcm_sym81__ - 1))))); + for (int t = lcm_sym79__; t <= lcm_sym103__; ++t) { + current_statement__ = 26; + lp_accum__.add(stan::math::bernoulli_lpmf(1, + stan::model::rvalue(phi, "phi", + stan::model::index_uni(i), + stan::model::index_uni((t - 1))))); + current_statement__ = 27; + lp_accum__.add(stan::math::bernoulli_lpmf( + stan::model::rvalue(y, "y", + stan::model::index_uni(i), + stan::model::index_uni(t)), + stan::model::rvalue(p, "p", + stan::model::index_uni(i), + stan::model::index_uni((t - 1))))); + } } + current_statement__ = 29; + lp_accum__.add(stan::math::bernoulli_lpmf(1, + stan::model::rvalue( + inline_prob_uncaptured_return_sym8__, + "inline_prob_uncaptured_return_sym8__", + stan::model::index_uni(i), + stan::model::index_uni(lcm_sym103__)))); } } } } - current_statement__ = 40; - stan::math::check_greater_or_equal(function__, "x", x, 0); - current_statement__ = 40; - stan::math::check_less_or_equal(function__, "x", x, max_age); - current_statement__ = 41; - n_occ_minus_1 = std::numeric_limits::min(); - current_statement__ = 41; - n_occ_minus_1 = lcm_sym109__; - current_statement__ = 42; - stan::math::validate_non_negative_index("first", "nind", nind); - current_statement__ = 43; - first = std::vector(nind, std::numeric_limits::min()); - current_statement__ = 44; - stan::math::validate_non_negative_index("last", "nind", nind); - current_statement__ = 45; - last = std::vector(nind, std::numeric_limits::min()); - current_statement__ = 47; - if (lcm_sym107__) { - current_statement__ = 46; - stan::model::assign(first, - first_capture( - stan::model::rvalue(y, "y", stan::model::index_uni(1)), pstream__), - "assigning variable first", stan::model::index_uni(1)); - for (int i = 2; i <= nind; ++i) { - current_statement__ = 46; - stan::model::assign(first, - first_capture( - stan::model::rvalue(y, "y", stan::model::index_uni(i)), - pstream__), "assigning variable first", - stan::model::index_uni(i)); - } - } - current_statement__ = 49; - if (lcm_sym107__) { - current_statement__ = 48; - stan::model::assign(last, - last_capture( - stan::model::rvalue(y, "y", stan::model::index_uni(1)), pstream__), - "assigning variable last", stan::model::index_uni(1)); - for (int i = 2; i <= nind; ++i) { - current_statement__ = 48; - stan::model::assign(last, - last_capture( - stan::model::rvalue(y, "y", stan::model::index_uni(i)), - pstream__), "assigning variable last", - stan::model::index_uni(i)); - } - } - current_statement__ = 43; - stan::math::check_greater_or_equal(function__, "first", first, 0); - current_statement__ = 43; - stan::math::check_less_or_equal(function__, "first", first, n_occasions); - current_statement__ = 45; - stan::math::check_greater_or_equal(function__, "last", last, 0); - current_statement__ = 45; - stan::math::check_less_or_equal(function__, "last", last, n_occasions); - current_statement__ = 50; - stan::math::validate_non_negative_index("beta", "max_age", max_age); - current_statement__ = 51; - stan::math::validate_non_negative_index("phi", "nind", nind); - current_statement__ = 52; - stan::math::validate_non_negative_index("phi", "n_occ_minus_1", - lcm_sym109__); - current_statement__ = 53; - stan::math::validate_non_negative_index("p", "nind", nind); - current_statement__ = 54; - stan::math::validate_non_negative_index("p", "n_occ_minus_1", - lcm_sym109__); - current_statement__ = 55; - stan::math::validate_non_negative_index("chi", "nind", nind); - current_statement__ = 56; - stan::math::validate_non_negative_index("chi", "n_occasions", - n_occasions); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } - num_params_r__ = 1 + max_age; - } - inline std::string model_name() const final { - return "fails_test_model"; - } - inline std::vector model_compile_info() const noexcept { - return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", - "stancflags = --O --print-cpp"}; + lp_accum__.add(lp__); + return lp_accum__.sum(); } - 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__; + 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; 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; + // 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()); // suppress unused var warning (void) DUMMY_VAR__; + constexpr bool jacobian__ = false; static constexpr const char* function__ = - "fails_test_model_namespace::log_prob"; + "fails_test_model_namespace::write_array"; // suppress unused var warning (void) function__; try { - double lcm_sym105__; - int lcm_sym104__; - int lcm_sym103__; - int lcm_sym102__; - int lcm_sym101__; - double lcm_sym100__; - double lcm_sym99__; - double lcm_sym98__; - double lcm_sym97__; - double lcm_sym96__; - double lcm_sym95__; - double lcm_sym94__; - double lcm_sym93__; - double lcm_sym92__; - double lcm_sym91__; - double lcm_sym90__; - double lcm_sym89__; - double lcm_sym88__; - double lcm_sym87__; - double lcm_sym86__; - double lcm_sym85__; - double lcm_sym84__; - double lcm_sym83__; - int lcm_sym82__; - int lcm_sym81__; - int lcm_sym80__; - int lcm_sym79__; - int lcm_sym78__; - int lcm_sym77__; - int lcm_sym76__; - int lcm_sym75__; - int lcm_sym74__; - int lcm_sym73__; - int lcm_sym72__; - int lcm_sym71__; - int lcm_sym70__; - int lcm_sym69__; - int lcm_sym68__; - int lcm_sym67__; - int lcm_sym66__; - int lcm_sym65__; - int lcm_sym64__; - int lcm_sym63__; - local_scalar_t__ mean_p; + double lcm_sym62__; + int lcm_sym61__; + int lcm_sym60__; + double lcm_sym59__; + double lcm_sym58__; + double lcm_sym57__; + double lcm_sym56__; + double lcm_sym55__; + double lcm_sym54__; + double lcm_sym53__; + double lcm_sym52__; + int lcm_sym51__; + int lcm_sym50__; + int lcm_sym49__; + int lcm_sym48__; + int lcm_sym47__; + int lcm_sym46__; + int lcm_sym45__; + int lcm_sym44__; + int lcm_sym43__; + int lcm_sym42__; + int lcm_sym41__; + int lcm_sym40__; + int lcm_sym39__; + int lcm_sym38__; + int lcm_sym37__; + int lcm_sym36__; + double mean_p; current_statement__ = 1; mean_p = in__.template read_constrain_lub(0, 1, lp__); - Eigen::Matrix beta; + Eigen::Matrix beta; current_statement__ = 2; beta = in__.template read_constrain_lub< Eigen::Matrix, jacobian__>(0, 1, lp__, max_age); - Eigen::Matrix phi = - Eigen::Matrix::Constant(nind, (n_occasions - - 1), DUMMY_VAR__); - Eigen::Matrix p = - Eigen::Matrix::Constant(nind, (n_occasions - - 1), DUMMY_VAR__); - Eigen::Matrix chi = - Eigen::Matrix::Constant(nind, n_occasions, - DUMMY_VAR__); - lcm_sym63__ = stan::math::logical_gte(nind, 1); - if (lcm_sym63__) { - lcm_sym102__ = stan::model::rvalue(first, "first", - stan::model::index_uni(1)); - lcm_sym76__ = (lcm_sym102__ - 1); - if (stan::math::logical_gte(lcm_sym76__, 1)) { + Eigen::Matrix phi = + Eigen::Matrix::Constant(nind, (n_occasions - 1), + std::numeric_limits::quiet_NaN()); + Eigen::Matrix p = + Eigen::Matrix::Constant(nind, (n_occasions - 1), + std::numeric_limits::quiet_NaN()); + Eigen::Matrix chi = + Eigen::Matrix::Constant(nind, n_occasions, + std::numeric_limits::quiet_NaN()); + out__.write(mean_p); + out__.write(beta); + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { + return ; + } + lcm_sym36__ = stan::math::logical_gte(nind, 1); + if (lcm_sym36__) { + lcm_sym61__ = stan::model::rvalue(first, "first", + stan::model::index_uni(1)); + lcm_sym45__ = (lcm_sym61__ - 1); + if (stan::math::logical_gte(lcm_sym45__, 1)) { stan::model::assign(phi, 0, "assigning variable phi", stan::model::index_uni(1), stan::model::index_uni(1)); current_statement__ = 6; stan::model::assign(p, 0, "assigning variable p", stan::model::index_uni(1), stan::model::index_uni(1)); - for (int t = 2; t <= lcm_sym76__; ++t) { + for (int t = 2; t <= lcm_sym45__; ++t) { current_statement__ = 7; stan::model::assign(phi, 0, "assigning variable phi", stan::model::index_uni(1), stan::model::index_uni(t)); @@ -15031,20 +17142,20 @@ class fails_test_model final : public model_base_crtp { stan::model::index_uni(1), stan::model::index_uni(t)); } } - lcm_sym74__ = (n_occasions - 1); - if (stan::math::logical_gte(lcm_sym74__, lcm_sym102__)) { + lcm_sym43__ = (n_occasions - 1); + if (stan::math::logical_gte(lcm_sym43__, lcm_sym61__)) { current_statement__ = 9; stan::model::assign(phi, stan::model::rvalue(beta, "beta", stan::model::index_uni( stan::model::rvalue(x, "x", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym102__)))), + stan::model::index_uni(lcm_sym61__)))), "assigning variable phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym102__)); - lcm_sym82__ = (lcm_sym102__ + 1); + stan::model::index_uni(lcm_sym61__)); + lcm_sym51__ = (lcm_sym61__ + 1); stan::model::assign(p, mean_p, "assigning variable p", - stan::model::index_uni(1), stan::model::index_uni(lcm_sym102__)); - for (int t = lcm_sym82__; t <= lcm_sym74__; ++t) { + stan::model::index_uni(1), stan::model::index_uni(lcm_sym61__)); + for (int t = lcm_sym51__; t <= lcm_sym43__; ++t) { current_statement__ = 9; stan::model::assign(phi, stan::model::rvalue(beta, "beta", @@ -15058,16 +17169,16 @@ class fails_test_model final : public model_base_crtp { } } for (int i = 2; i <= nind; ++i) { - lcm_sym101__ = stan::model::rvalue(first, "first", - stan::model::index_uni(i)); - lcm_sym75__ = (lcm_sym101__ - 1); - if (stan::math::logical_gte(lcm_sym75__, 1)) { + lcm_sym60__ = stan::model::rvalue(first, "first", + stan::model::index_uni(i)); + lcm_sym44__ = (lcm_sym60__ - 1); + if (stan::math::logical_gte(lcm_sym44__, 1)) { stan::model::assign(phi, 0, "assigning variable phi", stan::model::index_uni(i), stan::model::index_uni(1)); current_statement__ = 6; stan::model::assign(p, 0, "assigning variable p", stan::model::index_uni(i), stan::model::index_uni(1)); - for (int t = 2; t <= lcm_sym75__; ++t) { + for (int t = 2; t <= lcm_sym44__; ++t) { current_statement__ = 7; stan::model::assign(phi, 0, "assigning variable phi", stan::model::index_uni(i), stan::model::index_uni(t)); @@ -15077,19 +17188,19 @@ class fails_test_model final : public model_base_crtp { } } current_statement__ = 12; - if (stan::math::logical_gte(lcm_sym74__, lcm_sym101__)) { + if (stan::math::logical_gte(lcm_sym43__, lcm_sym60__)) { current_statement__ = 9; stan::model::assign(phi, stan::model::rvalue(beta, "beta", stan::model::index_uni( stan::model::rvalue(x, "x", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym101__)))), + stan::model::index_uni(lcm_sym60__)))), "assigning variable phi", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym101__)); - lcm_sym81__ = (lcm_sym101__ + 1); + stan::model::index_uni(lcm_sym60__)); + lcm_sym50__ = (lcm_sym60__ + 1); stan::model::assign(p, mean_p, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(lcm_sym101__)); - for (int t = lcm_sym81__; t <= lcm_sym74__; ++t) { + stan::model::index_uni(i), stan::model::index_uni(lcm_sym60__)); + for (int t = lcm_sym50__; t <= lcm_sym43__; ++t) { current_statement__ = 9; stan::model::assign(phi, stan::model::rvalue(beta, "beta", @@ -15104,8 +17215,7 @@ class fails_test_model final : public model_base_crtp { } } } - Eigen::Matrix - inline_prob_uncaptured_return_sym8__; + Eigen::Matrix inline_prob_uncaptured_return_sym1__; { current_statement__ = 14; stan::math::validate_non_negative_index("chi", "nind", nind); @@ -15113,584 +17223,643 @@ class fails_test_model final : public model_base_crtp { stan::math::validate_non_negative_index("chi", "n_occasions", n_occasions); Eigen::Matrix - inline_prob_uncaptured_chi_sym9__ = + inline_prob_uncaptured_chi_sym2__ = Eigen::Matrix::Constant(nind, n_occasions, DUMMY_VAR__); current_statement__ = 24; - if (lcm_sym63__) { + if (lcm_sym36__) { current_statement__ = 17; - stan::model::assign(inline_prob_uncaptured_chi_sym9__, 1.0, - "assigning variable inline_prob_uncaptured_chi_sym9__", + stan::model::assign(inline_prob_uncaptured_chi_sym2__, 1.0, + "assigning variable inline_prob_uncaptured_chi_sym2__", stan::model::index_uni(1), stan::model::index_uni(n_occasions)); - lcm_sym74__ = (n_occasions - 1); - lcm_sym64__ = stan::math::logical_gte(lcm_sym74__, 1); - if (lcm_sym64__) { - int inline_prob_uncaptured_t_curr_sym10__ = + lcm_sym43__ = (n_occasions - 1); + lcm_sym37__ = stan::math::logical_gte(lcm_sym43__, 1); + if (lcm_sym37__) { + int inline_prob_uncaptured_t_curr_sym3__ = std::numeric_limits::min(); - int inline_prob_uncaptured_t_next_sym11__ = + int inline_prob_uncaptured_t_next_sym4__ = std::numeric_limits::min(); - lcm_sym78__ = (lcm_sym74__ + 1); + lcm_sym49__ = (lcm_sym43__ + 1); current_statement__ = 20; - stan::model::assign(inline_prob_uncaptured_chi_sym9__, + stan::model::assign(inline_prob_uncaptured_chi_sym2__, stan::math::fma( (stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym74__)) * (1 - + stan::model::index_uni(lcm_sym43__)) * (1 - stan::model::rvalue(p, "p", stan::model::index_uni(1), - stan::model::index_uni((lcm_sym78__ - 1))))), - stan::model::rvalue(inline_prob_uncaptured_chi_sym9__, - "inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni((lcm_sym49__ - 1))))), + stan::model::rvalue(inline_prob_uncaptured_chi_sym2__, + "inline_prob_uncaptured_chi_sym2__", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym78__)), (1 - + stan::model::index_uni(lcm_sym49__)), (1 - stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym74__)))), - "assigning variable inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(1), stan::model::index_uni(lcm_sym74__)); - for (int inline_prob_uncaptured_t_sym12__ = 2; inline_prob_uncaptured_t_sym12__ - <= lcm_sym74__; ++inline_prob_uncaptured_t_sym12__) { - int inline_prob_uncaptured_t_curr_sym10__ = + stan::model::index_uni(lcm_sym43__)))), + "assigning variable inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(1), stan::model::index_uni(lcm_sym43__)); + for (int inline_prob_uncaptured_t_sym5__ = 2; inline_prob_uncaptured_t_sym5__ + <= lcm_sym43__; ++inline_prob_uncaptured_t_sym5__) { + int inline_prob_uncaptured_t_curr_sym3__ = std::numeric_limits::min(); - lcm_sym73__ = (n_occasions - inline_prob_uncaptured_t_sym12__); - int inline_prob_uncaptured_t_next_sym11__ = + lcm_sym42__ = (n_occasions - inline_prob_uncaptured_t_sym5__); + int inline_prob_uncaptured_t_next_sym4__ = std::numeric_limits::min(); - lcm_sym77__ = (lcm_sym73__ + 1); + lcm_sym48__ = (lcm_sym42__ + 1); current_statement__ = 20; - stan::model::assign(inline_prob_uncaptured_chi_sym9__, + stan::model::assign(inline_prob_uncaptured_chi_sym2__, stan::math::fma( (stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym73__)) * (1 - + stan::model::index_uni(lcm_sym42__)) * (1 - stan::model::rvalue(p, "p", stan::model::index_uni(1), - stan::model::index_uni((lcm_sym77__ - 1))))), - stan::model::rvalue(inline_prob_uncaptured_chi_sym9__, - "inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni((lcm_sym48__ - 1))))), + stan::model::rvalue(inline_prob_uncaptured_chi_sym2__, + "inline_prob_uncaptured_chi_sym2__", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym77__)), (1 - + stan::model::index_uni(lcm_sym48__)), (1 - stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym73__)))), - "assigning variable inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(lcm_sym42__)))), + "assigning variable inline_prob_uncaptured_chi_sym2__", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym73__)); + stan::model::index_uni(lcm_sym42__)); } } - for (int inline_prob_uncaptured_i_sym13__ = 2; inline_prob_uncaptured_i_sym13__ - <= nind; ++inline_prob_uncaptured_i_sym13__) { + for (int inline_prob_uncaptured_i_sym6__ = 2; inline_prob_uncaptured_i_sym6__ + <= nind; ++inline_prob_uncaptured_i_sym6__) { current_statement__ = 17; - stan::model::assign(inline_prob_uncaptured_chi_sym9__, 1.0, - "assigning variable inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::assign(inline_prob_uncaptured_chi_sym2__, 1.0, + "assigning variable inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), stan::model::index_uni(n_occasions)); current_statement__ = 22; - if (lcm_sym64__) { - int inline_prob_uncaptured_t_curr_sym10__ = + if (lcm_sym37__) { + int inline_prob_uncaptured_t_curr_sym3__ = std::numeric_limits::min(); - int inline_prob_uncaptured_t_next_sym11__ = + int inline_prob_uncaptured_t_next_sym4__ = std::numeric_limits::min(); - lcm_sym78__ = (lcm_sym74__ + 1); + lcm_sym49__ = (lcm_sym43__ + 1); current_statement__ = 20; - stan::model::assign(inline_prob_uncaptured_chi_sym9__, + stan::model::assign(inline_prob_uncaptured_chi_sym2__, stan::math::fma( (stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni(lcm_sym74__)) * (1 - + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(lcm_sym43__)) * (1 - stan::model::rvalue(p, "p", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni((lcm_sym78__ - 1))))), - stan::model::rvalue(inline_prob_uncaptured_chi_sym9__, - "inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni(lcm_sym78__)), (1 - - stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni(lcm_sym74__)))), - "assigning variable inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni(lcm_sym74__)); - for (int inline_prob_uncaptured_t_sym12__ = 2; inline_prob_uncaptured_t_sym12__ - <= lcm_sym74__; ++inline_prob_uncaptured_t_sym12__) { - int inline_prob_uncaptured_t_curr_sym10__ = - std::numeric_limits::min(); - lcm_sym73__ = (n_occasions - - inline_prob_uncaptured_t_sym12__); - int inline_prob_uncaptured_t_next_sym11__ = - std::numeric_limits::min(); - lcm_sym77__ = (lcm_sym73__ + 1); - current_statement__ = 20; - stan::model::assign(inline_prob_uncaptured_chi_sym9__, - stan::math::fma( - (stan::model::rvalue(phi, "phi", - stan::model::index_uni( - inline_prob_uncaptured_i_sym13__), - stan::model::index_uni(lcm_sym73__)) * (1 - - stan::model::rvalue(p, "p", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni((lcm_sym77__ - 1))))), - stan::model::rvalue(inline_prob_uncaptured_chi_sym9__, - "inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni(lcm_sym77__)), (1 - - stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni(lcm_sym73__)))), - "assigning variable inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni(lcm_sym73__)); - } - } - } - } - current_statement__ = 25; - stan::model::assign(inline_prob_uncaptured_return_sym8__, - inline_prob_uncaptured_chi_sym9__, - "assigning variable inline_prob_uncaptured_return_sym8__"); - } - stan::model::assign(chi, inline_prob_uncaptured_return_sym8__, - "assigning variable chi"); - current_statement__ = 3; - stan::math::check_greater_or_equal(function__, "phi", phi, 0); - current_statement__ = 3; - stan::math::check_less_or_equal(function__, "phi", phi, 1); - current_statement__ = 4; - stan::math::check_greater_or_equal(function__, "p", p, 0); - current_statement__ = 4; - stan::math::check_less_or_equal(function__, "p", p, 1); - current_statement__ = 5; - stan::math::check_greater_or_equal(function__, "chi", - inline_prob_uncaptured_return_sym8__, 0); - current_statement__ = 5; - stan::math::check_less_or_equal(function__, "chi", - inline_prob_uncaptured_return_sym8__, 1); - { - current_statement__ = 32; - if (lcm_sym63__) { - lcm_sym102__ = stan::model::rvalue(first, "first", - stan::model::index_uni(1)); - if (stan::math::logical_gt(lcm_sym102__, 0)) { - lcm_sym104__ = stan::model::rvalue(last, "last", - stan::model::index_uni(1)); - lcm_sym82__ = (lcm_sym102__ + 1); - if (stan::math::logical_gte(lcm_sym104__, lcm_sym82__)) { - current_statement__ = 26; - lp_accum__.add(stan::math::bernoulli_lpmf(1, - stan::model::rvalue(phi, "phi", - stan::model::index_uni(1), - stan::model::index_uni((lcm_sym82__ - 1))))); - lcm_sym80__ = (lcm_sym82__ + 1); - lp_accum__.add(stan::math::bernoulli_lpmf( - stan::model::rvalue(y, "y", - stan::model::index_uni(1), - stan::model::index_uni(lcm_sym82__)), - stan::model::rvalue(p, "p", - stan::model::index_uni(1), - stan::model::index_uni((lcm_sym82__ - 1))))); - for (int t = lcm_sym80__; t <= lcm_sym104__; ++t) { - current_statement__ = 26; - lp_accum__.add(stan::math::bernoulli_lpmf(1, - stan::model::rvalue(phi, "phi", - stan::model::index_uni(1), - stan::model::index_uni((t - 1))))); - current_statement__ = 27; - lp_accum__.add(stan::math::bernoulli_lpmf( - stan::model::rvalue(y, "y", - stan::model::index_uni(1), - stan::model::index_uni(t)), - stan::model::rvalue(p, "p", - stan::model::index_uni(1), - stan::model::index_uni((t - 1))))); - } - } - current_statement__ = 29; - lp_accum__.add(stan::math::bernoulli_lpmf(1, - stan::model::rvalue( - inline_prob_uncaptured_return_sym8__, - "inline_prob_uncaptured_return_sym8__", - stan::model::index_uni(1), - stan::model::index_uni(lcm_sym104__)))); - } - for (int i = 2; i <= nind; ++i) { - lcm_sym101__ = stan::model::rvalue(first, "first", - stan::model::index_uni(i)); - if (stan::math::logical_gt(lcm_sym101__, 0)) { - lcm_sym103__ = stan::model::rvalue(last, "last", - stan::model::index_uni(i)); - lcm_sym81__ = (lcm_sym101__ + 1); - if (stan::math::logical_gte(lcm_sym103__, lcm_sym81__)) { - current_statement__ = 26; - lp_accum__.add(stan::math::bernoulli_lpmf(1, - stan::model::rvalue(phi, "phi", - stan::model::index_uni(i), - stan::model::index_uni((lcm_sym81__ - 1))))); - lcm_sym79__ = (lcm_sym81__ + 1); - lp_accum__.add(stan::math::bernoulli_lpmf( - stan::model::rvalue(y, "y", - stan::model::index_uni(i), - stan::model::index_uni(lcm_sym81__)), - stan::model::rvalue(p, "p", - stan::model::index_uni(i), - stan::model::index_uni((lcm_sym81__ - 1))))); - for (int t = lcm_sym79__; t <= lcm_sym103__; ++t) { - current_statement__ = 26; - lp_accum__.add(stan::math::bernoulli_lpmf(1, - stan::model::rvalue(phi, "phi", - stan::model::index_uni(i), - stan::model::index_uni((t - 1))))); - current_statement__ = 27; - lp_accum__.add(stan::math::bernoulli_lpmf( - stan::model::rvalue(y, "y", - stan::model::index_uni(i), - stan::model::index_uni(t)), - stan::model::rvalue(p, "p", - stan::model::index_uni(i), - stan::model::index_uni((t - 1))))); - } + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni((lcm_sym49__ - 1))))), + stan::model::rvalue(inline_prob_uncaptured_chi_sym2__, + "inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(lcm_sym49__)), (1 - + stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(lcm_sym43__)))), + "assigning variable inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(lcm_sym43__)); + for (int inline_prob_uncaptured_t_sym5__ = 2; inline_prob_uncaptured_t_sym5__ + <= lcm_sym43__; ++inline_prob_uncaptured_t_sym5__) { + int inline_prob_uncaptured_t_curr_sym3__ = + std::numeric_limits::min(); + lcm_sym42__ = (n_occasions - + inline_prob_uncaptured_t_sym5__); + int inline_prob_uncaptured_t_next_sym4__ = + std::numeric_limits::min(); + lcm_sym48__ = (lcm_sym42__ + 1); + current_statement__ = 20; + stan::model::assign(inline_prob_uncaptured_chi_sym2__, + stan::math::fma( + (stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(lcm_sym42__)) * (1 - + stan::model::rvalue(p, "p", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni((lcm_sym48__ - 1))))), + stan::model::rvalue(inline_prob_uncaptured_chi_sym2__, + "inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(lcm_sym48__)), (1 - + stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(lcm_sym42__)))), + "assigning variable inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(lcm_sym42__)); } - current_statement__ = 29; - lp_accum__.add(stan::math::bernoulli_lpmf(1, - stan::model::rvalue( - inline_prob_uncaptured_return_sym8__, - "inline_prob_uncaptured_return_sym8__", - stan::model::index_uni(i), - stan::model::index_uni(lcm_sym103__)))); } } } + current_statement__ = 25; + stan::model::assign(inline_prob_uncaptured_return_sym1__, + inline_prob_uncaptured_chi_sym2__, + "assigning variable inline_prob_uncaptured_return_sym1__"); + } + stan::model::assign(chi, inline_prob_uncaptured_return_sym1__, + "assigning variable chi"); + current_statement__ = 3; + stan::math::check_greater_or_equal(function__, "phi", phi, 0); + current_statement__ = 3; + stan::math::check_less_or_equal(function__, "phi", phi, 1); + current_statement__ = 4; + stan::math::check_greater_or_equal(function__, "p", p, 0); + current_statement__ = 4; + stan::math::check_less_or_equal(function__, "p", p, 1); + current_statement__ = 5; + stan::math::check_greater_or_equal(function__, "chi", + inline_prob_uncaptured_return_sym1__, 0); + current_statement__ = 5; + stan::math::check_less_or_equal(function__, "chi", + inline_prob_uncaptured_return_sym1__, 1); + if (emit_transformed_parameters__) { + out__.write(phi); + out__.write(p); + out__.write(inline_prob_uncaptured_return_sym1__); + } + if (stan::math::logical_negation(emit_generated_quantities__)) { + return ; + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline void + transform_inits_impl(VecVar& params_r__, 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 lcm_sym35__; + int pos__; + pos__ = 1; + local_scalar_t__ mean_p; + mean_p = in__.read(); + out__.write_free_lub(0, 1, mean_p); + Eigen::Matrix beta = + Eigen::Matrix::Constant(max_age, DUMMY_VAR__); + if (stan::math::logical_gte(max_age, 1)) { + stan::model::assign(beta, in__.read(), + "assigning variable beta", stan::model::index_uni(1)); + for (int sym1__ = 2; sym1__ <= max_age; ++sym1__) { + stan::model::assign(beta, in__.read(), + "assigning variable beta", stan::model::index_uni(sym1__)); + } + } + out__.write_free_lub(0, 1, beta); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + inline void get_param_names(std::vector& names__) const { + names__ = std::vector{"mean_p", "beta", "phi", "p", "chi"}; + } + inline void get_dims(std::vector>& dimss__) const { + dimss__ = std::vector>{std::vector{}, + std::vector{static_cast(max_age)}, + std::vector{static_cast(nind), + static_cast(n_occ_minus_1)}, + std::vector{static_cast(nind), + static_cast(n_occ_minus_1)}, + std::vector{static_cast(nind), + static_cast(n_occasions)}}; + } + inline void + constrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { + param_names__.emplace_back(std::string() + "mean_p"); + for (int sym119__ = 1; sym119__ <= max_age; ++sym119__) { + param_names__.emplace_back(std::string() + "beta" + '.' + + std::to_string(sym119__)); + } + if (emit_transformed_parameters__) { + for (int sym119__ = 1; sym119__ <= n_occ_minus_1; ++sym119__) { + for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { + param_names__.emplace_back(std::string() + "phi" + '.' + + std::to_string(sym120__) + '.' + std::to_string(sym119__)); + } + } + for (int sym119__ = 1; sym119__ <= n_occ_minus_1; ++sym119__) { + for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { + param_names__.emplace_back(std::string() + "p" + '.' + + std::to_string(sym120__) + '.' + std::to_string(sym119__)); + } + } + for (int sym119__ = 1; sym119__ <= n_occasions; ++sym119__) { + for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { + param_names__.emplace_back(std::string() + "chi" + '.' + + std::to_string(sym120__) + '.' + std::to_string(sym119__)); + } + } + } + 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 { + param_names__.emplace_back(std::string() + "mean_p"); + for (int sym119__ = 1; sym119__ <= max_age; ++sym119__) { + param_names__.emplace_back(std::string() + "beta" + '.' + + std::to_string(sym119__)); + } + if (emit_transformed_parameters__) { + for (int sym119__ = 1; sym119__ <= n_occ_minus_1; ++sym119__) { + for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { + param_names__.emplace_back(std::string() + "phi" + '.' + + std::to_string(sym120__) + '.' + std::to_string(sym119__)); + } + } + for (int sym119__ = 1; sym119__ <= n_occ_minus_1; ++sym119__) { + for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { + param_names__.emplace_back(std::string() + "p" + '.' + + std::to_string(sym120__) + '.' + std::to_string(sym119__)); + } + } + for (int sym119__ = 1; sym119__ <= n_occasions; ++sym119__) { + for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { + param_names__.emplace_back(std::string() + "chi" + '.' + + std::to_string(sym120__) + '.' + std::to_string(sym119__)); + } + } + } + if (emit_generated_quantities__) {} + } + inline std::string get_constrained_sizedtypes() const { + return std::string("[{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(max_age) + "},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"}]"); + } + inline std::string get_unconstrained_sizedtypes() const { + return std::string("[{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(max_age) + "},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occasions) + "},\"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__ = (1 + max_age); + const size_t num_transformed = emit_transformed_parameters * ((((nind * + n_occ_minus_1) + (nind * n_occ_minus_1)) + (nind * n_occasions))); + 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__ = (1 + max_age); + const size_t num_transformed = emit_transformed_parameters * ((((nind * + n_occ_minus_1) + (nind * n_occ_minus_1)) + (nind * n_occasions))); + 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 { + constexpr std::array names__{"mean_p", "beta"}; + const std::array constrain_param_sizes__{1, max_age}; + const auto num_constrained_params__ = + std::accumulate(constrain_param_sizes__.begin(), + constrain_param_sizes__.end(), 0); + std::vector params_r_flat__(num_constrained_params__); + Eigen::Index size_iter__ = 0; + Eigen::Index flat_iter__ = 0; + for (auto&& param_name__: names__) { + const auto param_vec__ = context.vals_r(param_name__); + for (Eigen::Index i = 0; i < constrain_param_sizes__[size_iter__]; ++i) { + params_r_flat__[flat_iter__] = param_vec__[i]; + ++flat_iter__; } - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); + ++size_iter__; } - lp_accum__.add(lp__); - return lp_accum__.sum(); + vars.resize(num_params_r__); + transform_inits_impl(params_r_flat__, params_i, vars, pstream__); } - 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 stan_model = fails_test_model_namespace::fails_test_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* m = new stan_model(data_context, seed, msg_stream); + return *m; +} +stan::math::profile_map& get_stan_profile_data() { + return fails_test_model_namespace::profiles__; +} +#endif + $ ../../../../../install/default/bin/stanc --O --print-cpp function-in-function-inline.stan +// Code generated by %%NAME%% %%VERSION%% +#include +namespace function_in_function_inline_model_namespace { +using stan::model::model_base_crtp; +using namespace stan::math; +stan::math::profile_map profiles__; +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'function-in-function-inline.stan', line 14, column 2 to column 29)", + " (in 'function-in-function-inline.stan', line 15, column 2 to column 16)", + " (in 'function-in-function-inline.stan', line 11, column 2 to column 17)", + " (in 'function-in-function-inline.stan', line 3, column 4 to column 20)", + " (in 'function-in-function-inline.stan', line 2, column 30 to line 4, column 3)", + " (in 'function-in-function-inline.stan', line 7, column 4 to column 27)", + " (in 'function-in-function-inline.stan', line 6, column 30 to line 8, column 3)"}; +template , + stan::is_vt_not_complex>* = nullptr> +stan::promote_args_t> +inner_lpdf(const T0__& phi_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +stan::promote_args_t> +outer_lpdf(const T0__& phi_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>*> +stan::promote_args_t> +inner_lpdf(const T0__& phi_arg__, std::ostream* pstream__) { + using local_scalar_t__ = stan::promote_args_t>; + int current_statement__ = 0; + const auto& phi = stan::math::to_ref(phi_arg__); + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + double lcm_sym12__; + { + current_statement__ = 4; + return stan::math::sum(phi); + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +template , + stan::is_vt_not_complex>*> +stan::promote_args_t> +outer_lpdf(const T0__& phi_arg__, std::ostream* pstream__) { + using local_scalar_t__ = stan::promote_args_t>; + int current_statement__ = 0; + const auto& phi = stan::math::to_ref(phi_arg__); + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + double lcm_sym13__; + { + current_statement__ = 6; + return inner_lpdf(phi, pstream__); + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +class function_in_function_inline_model final : public model_base_crtp { + private: + double lcm_sym19__; + double lcm_sym18__; + int lcm_sym17__; + Eigen::Matrix phi_data__; + Eigen::Map> phi{nullptr, 0}; + public: + ~function_in_function_inline_model() {} + function_in_function_inline_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; - stan::io::deserializer in__(params_r__, params_i__); - stan::io::serializer out__(vars__); - static constexpr bool propto__ = true; + boost::ecuyer1988 base_rng__ = + stan::services::util::create_rng(random_seed__, 0); // suppress unused var warning - (void) propto__; - double lp__ = 0.0; + (void) base_rng__; + static constexpr const char* function__ = + "function_in_function_inline_model_namespace::function_in_function_inline_model"; // suppress unused var warning - (void) lp__; - int current_statement__ = 0; - stan::math::accumulator lp_accum__; + (void) function__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); // suppress unused var warning (void) DUMMY_VAR__; - constexpr bool jacobian__ = false; - static constexpr const char* function__ = - "fails_test_model_namespace::write_array"; - // suppress unused var warning - (void) function__; try { - double lcm_sym62__; - int lcm_sym61__; - int lcm_sym60__; - double lcm_sym59__; - double lcm_sym58__; - double lcm_sym57__; - double lcm_sym56__; - double lcm_sym55__; - double lcm_sym54__; - double lcm_sym53__; - double lcm_sym52__; - int lcm_sym51__; - int lcm_sym50__; - int lcm_sym49__; - int lcm_sym48__; - int lcm_sym47__; - int lcm_sym46__; - int lcm_sym45__; - int lcm_sym44__; - int lcm_sym43__; - int lcm_sym42__; - int lcm_sym41__; - int lcm_sym40__; - int lcm_sym39__; - int lcm_sym38__; - int lcm_sym37__; - int lcm_sym36__; - double mean_p; - current_statement__ = 1; - mean_p = in__.template read_constrain_lub(0, 1, lp__); - Eigen::Matrix beta; - current_statement__ = 2; - beta = in__.template read_constrain_lub< - Eigen::Matrix, jacobian__>(0, 1, lp__, - max_age); - Eigen::Matrix phi = - Eigen::Matrix::Constant(nind, (n_occasions - 1), - std::numeric_limits::quiet_NaN()); - Eigen::Matrix p = - Eigen::Matrix::Constant(nind, (n_occasions - 1), - std::numeric_limits::quiet_NaN()); - Eigen::Matrix chi = - Eigen::Matrix::Constant(nind, n_occasions, - std::numeric_limits::quiet_NaN()); - out__.write(mean_p); - out__.write(beta); - if (stan::math::logical_negation( - (stan::math::primitive_value(emit_transformed_parameters__) || - stan::math::primitive_value(emit_generated_quantities__)))) { - return ; - } - lcm_sym36__ = stan::math::logical_gte(nind, 1); - if (lcm_sym36__) { - lcm_sym61__ = stan::model::rvalue(first, "first", - stan::model::index_uni(1)); - lcm_sym45__ = (lcm_sym61__ - 1); - if (stan::math::logical_gte(lcm_sym45__, 1)) { - stan::model::assign(phi, 0, "assigning variable phi", - stan::model::index_uni(1), stan::model::index_uni(1)); - current_statement__ = 6; - stan::model::assign(p, 0, "assigning variable p", - stan::model::index_uni(1), stan::model::index_uni(1)); - for (int t = 2; t <= lcm_sym45__; ++t) { - current_statement__ = 7; - stan::model::assign(phi, 0, "assigning variable phi", - stan::model::index_uni(1), stan::model::index_uni(t)); - current_statement__ = 6; - stan::model::assign(p, 0, "assigning variable p", - stan::model::index_uni(1), stan::model::index_uni(t)); - } - } - lcm_sym43__ = (n_occasions - 1); - if (stan::math::logical_gte(lcm_sym43__, lcm_sym61__)) { - current_statement__ = 9; + int pos__; + pos__ = 1; + current_statement__ = 3; + context__.validate_dims("data initialization", "phi", "double", + std::vector{static_cast(10)}); + phi_data__ = Eigen::Matrix::Constant(10, + std::numeric_limits::quiet_NaN()); + new (&phi) Eigen::Map>(phi_data__.data(), + 10); + { + std::vector phi_flat__; + current_statement__ = 3; + phi_flat__ = context__.vals_r("phi"); + current_statement__ = 3; + pos__ = 1; + { + current_statement__ = 3; stan::model::assign(phi, - stan::model::rvalue(beta, "beta", - stan::model::index_uni( - stan::model::rvalue(x, "x", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym61__)))), - "assigning variable phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym61__)); - lcm_sym51__ = (lcm_sym61__ + 1); - stan::model::assign(p, mean_p, "assigning variable p", - stan::model::index_uni(1), stan::model::index_uni(lcm_sym61__)); - for (int t = lcm_sym51__; t <= lcm_sym43__; ++t) { - current_statement__ = 9; - stan::model::assign(phi, - stan::model::rvalue(beta, "beta", - stan::model::index_uni( - stan::model::rvalue(x, "x", stan::model::index_uni(1), - stan::model::index_uni(t)))), "assigning variable phi", - stan::model::index_uni(1), stan::model::index_uni(t)); - current_statement__ = 10; - stan::model::assign(p, mean_p, "assigning variable p", - stan::model::index_uni(1), stan::model::index_uni(t)); + stan::model::rvalue(phi_flat__, "phi_flat__", + stan::model::index_uni(1)), "assigning variable phi", + stan::model::index_uni(1)); + current_statement__ = 3; + pos__ = 2; + { + current_statement__ = 3; + stan::model::assign(phi, phi_flat__[(pos__ - 1)], + "assigning variable phi", stan::model::index_uni(2)); + current_statement__ = 3; + pos__ = (pos__ + 1); } - } - for (int i = 2; i <= nind; ++i) { - lcm_sym60__ = stan::model::rvalue(first, "first", - stan::model::index_uni(i)); - lcm_sym44__ = (lcm_sym60__ - 1); - if (stan::math::logical_gte(lcm_sym44__, 1)) { - stan::model::assign(phi, 0, "assigning variable phi", - stan::model::index_uni(i), stan::model::index_uni(1)); - current_statement__ = 6; - stan::model::assign(p, 0, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(1)); - for (int t = 2; t <= lcm_sym44__; ++t) { - current_statement__ = 7; - stan::model::assign(phi, 0, "assigning variable phi", - stan::model::index_uni(i), stan::model::index_uni(t)); - current_statement__ = 6; - stan::model::assign(p, 0, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(t)); - } + { + current_statement__ = 3; + stan::model::assign(phi, phi_flat__[(pos__ - 1)], + "assigning variable phi", stan::model::index_uni(3)); + current_statement__ = 3; + pos__ = (pos__ + 1); + } + { + current_statement__ = 3; + stan::model::assign(phi, phi_flat__[(pos__ - 1)], + "assigning variable phi", stan::model::index_uni(4)); + current_statement__ = 3; + pos__ = (pos__ + 1); + } + { + current_statement__ = 3; + stan::model::assign(phi, phi_flat__[(pos__ - 1)], + "assigning variable phi", stan::model::index_uni(5)); + current_statement__ = 3; + pos__ = (pos__ + 1); + } + { + current_statement__ = 3; + stan::model::assign(phi, phi_flat__[(pos__ - 1)], + "assigning variable phi", stan::model::index_uni(6)); + current_statement__ = 3; + pos__ = (pos__ + 1); } - current_statement__ = 12; - if (stan::math::logical_gte(lcm_sym43__, lcm_sym60__)) { - current_statement__ = 9; - stan::model::assign(phi, - stan::model::rvalue(beta, "beta", - stan::model::index_uni( - stan::model::rvalue(x, "x", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym60__)))), - "assigning variable phi", stan::model::index_uni(i), - stan::model::index_uni(lcm_sym60__)); - lcm_sym50__ = (lcm_sym60__ + 1); - stan::model::assign(p, mean_p, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(lcm_sym60__)); - for (int t = lcm_sym50__; t <= lcm_sym43__; ++t) { - current_statement__ = 9; - stan::model::assign(phi, - stan::model::rvalue(beta, "beta", - stan::model::index_uni( - stan::model::rvalue(x, "x", stan::model::index_uni(i), - stan::model::index_uni(t)))), "assigning variable phi", - stan::model::index_uni(i), stan::model::index_uni(t)); - current_statement__ = 10; - stan::model::assign(p, mean_p, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(t)); - } + { + current_statement__ = 3; + stan::model::assign(phi, phi_flat__[(pos__ - 1)], + "assigning variable phi", stan::model::index_uni(7)); + current_statement__ = 3; + pos__ = (pos__ + 1); + } + { + current_statement__ = 3; + stan::model::assign(phi, phi_flat__[(pos__ - 1)], + "assigning variable phi", stan::model::index_uni(8)); + current_statement__ = 3; + pos__ = (pos__ + 1); + } + { + current_statement__ = 3; + stan::model::assign(phi, phi_flat__[(pos__ - 1)], + "assigning variable phi", stan::model::index_uni(9)); + current_statement__ = 3; + pos__ = (pos__ + 1); + } + { + current_statement__ = 3; + stan::model::assign(phi, phi_flat__[(pos__ - 1)], + "assigning variable phi", stan::model::index_uni(10)); + current_statement__ = 3; + pos__ = (pos__ + 1); } } } - Eigen::Matrix inline_prob_uncaptured_return_sym1__; + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + num_params_r__ = 0U; + } + inline std::string model_name() const final { + return "function_in_function_inline_model"; + } + inline std::vector model_compile_info() const noexcept { + return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", + "stancflags = --O --print-cpp"}; + } + 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__; + stan::io::deserializer in__(params_r__, params_i__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + static constexpr const char* function__ = + "function_in_function_inline_model_namespace::log_prob"; + // suppress unused var warning + (void) function__; + try { + double lcm_sym16__; { - current_statement__ = 14; - stan::math::validate_non_negative_index("chi", "nind", nind); - current_statement__ = 15; - stan::math::validate_non_negative_index("chi", "n_occasions", - n_occasions); - Eigen::Matrix - inline_prob_uncaptured_chi_sym2__ = - Eigen::Matrix::Constant(nind, n_occasions, - DUMMY_VAR__); - current_statement__ = 24; - if (lcm_sym36__) { - current_statement__ = 17; - stan::model::assign(inline_prob_uncaptured_chi_sym2__, 1.0, - "assigning variable inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(1), stan::model::index_uni(n_occasions)); - lcm_sym43__ = (n_occasions - 1); - lcm_sym37__ = stan::math::logical_gte(lcm_sym43__, 1); - if (lcm_sym37__) { - int inline_prob_uncaptured_t_curr_sym3__ = - std::numeric_limits::min(); - int inline_prob_uncaptured_t_next_sym4__ = - std::numeric_limits::min(); - lcm_sym49__ = (lcm_sym43__ + 1); - current_statement__ = 20; - stan::model::assign(inline_prob_uncaptured_chi_sym2__, - stan::math::fma( - (stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym43__)) * (1 - - stan::model::rvalue(p, "p", stan::model::index_uni(1), - stan::model::index_uni((lcm_sym49__ - 1))))), - stan::model::rvalue(inline_prob_uncaptured_chi_sym2__, - "inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(1), - stan::model::index_uni(lcm_sym49__)), (1 - - stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym43__)))), - "assigning variable inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(1), stan::model::index_uni(lcm_sym43__)); - for (int inline_prob_uncaptured_t_sym5__ = 2; inline_prob_uncaptured_t_sym5__ - <= lcm_sym43__; ++inline_prob_uncaptured_t_sym5__) { - int inline_prob_uncaptured_t_curr_sym3__ = - std::numeric_limits::min(); - lcm_sym42__ = (n_occasions - inline_prob_uncaptured_t_sym5__); - int inline_prob_uncaptured_t_next_sym4__ = - std::numeric_limits::min(); - lcm_sym48__ = (lcm_sym42__ + 1); - current_statement__ = 20; - stan::model::assign(inline_prob_uncaptured_chi_sym2__, - stan::math::fma( - (stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym42__)) * (1 - - stan::model::rvalue(p, "p", stan::model::index_uni(1), - stan::model::index_uni((lcm_sym48__ - 1))))), - stan::model::rvalue(inline_prob_uncaptured_chi_sym2__, - "inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(1), - stan::model::index_uni(lcm_sym48__)), (1 - - stan::model::rvalue(phi, "phi", stan::model::index_uni(1), - stan::model::index_uni(lcm_sym42__)))), - "assigning variable inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(1), - stan::model::index_uni(lcm_sym42__)); - } - } - for (int inline_prob_uncaptured_i_sym6__ = 2; inline_prob_uncaptured_i_sym6__ - <= nind; ++inline_prob_uncaptured_i_sym6__) { - current_statement__ = 17; - stan::model::assign(inline_prob_uncaptured_chi_sym2__, 1.0, - "assigning variable inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(n_occasions)); - current_statement__ = 22; - if (lcm_sym37__) { - int inline_prob_uncaptured_t_curr_sym3__ = - std::numeric_limits::min(); - int inline_prob_uncaptured_t_next_sym4__ = - std::numeric_limits::min(); - lcm_sym49__ = (lcm_sym43__ + 1); - current_statement__ = 20; - stan::model::assign(inline_prob_uncaptured_chi_sym2__, - stan::math::fma( - (stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(lcm_sym43__)) * (1 - - stan::model::rvalue(p, "p", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni((lcm_sym49__ - 1))))), - stan::model::rvalue(inline_prob_uncaptured_chi_sym2__, - "inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(lcm_sym49__)), (1 - - stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(lcm_sym43__)))), - "assigning variable inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(lcm_sym43__)); - for (int inline_prob_uncaptured_t_sym5__ = 2; inline_prob_uncaptured_t_sym5__ - <= lcm_sym43__; ++inline_prob_uncaptured_t_sym5__) { - int inline_prob_uncaptured_t_curr_sym3__ = - std::numeric_limits::min(); - lcm_sym42__ = (n_occasions - - inline_prob_uncaptured_t_sym5__); - int inline_prob_uncaptured_t_next_sym4__ = - std::numeric_limits::min(); - lcm_sym48__ = (lcm_sym42__ + 1); - current_statement__ = 20; - stan::model::assign(inline_prob_uncaptured_chi_sym2__, - stan::math::fma( - (stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(lcm_sym42__)) * (1 - - stan::model::rvalue(p, "p", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni((lcm_sym48__ - 1))))), - stan::model::rvalue(inline_prob_uncaptured_chi_sym2__, - "inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(lcm_sym48__)), (1 - - stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(lcm_sym42__)))), - "assigning variable inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(lcm_sym42__)); - } - } + double ret = std::numeric_limits::quiet_NaN(); + double inline_outer_lpdf_return_sym9__; + { + double inline_outer_lpdf_inline_inner_lpdf_return_sym5___sym10__; + { + lcm_sym16__ = stan::math::sum(phi); } } - current_statement__ = 25; - stan::model::assign(inline_prob_uncaptured_return_sym1__, - inline_prob_uncaptured_chi_sym2__, - "assigning variable inline_prob_uncaptured_return_sym1__"); + current_statement__ = 2; + lp_accum__.add(lcm_sym16__); } - stan::model::assign(chi, inline_prob_uncaptured_return_sym1__, - "assigning variable chi"); - current_statement__ = 3; - stan::math::check_greater_or_equal(function__, "phi", phi, 0); - current_statement__ = 3; - stan::math::check_less_or_equal(function__, "phi", phi, 1); - current_statement__ = 4; - stan::math::check_greater_or_equal(function__, "p", p, 0); - current_statement__ = 4; - stan::math::check_less_or_equal(function__, "p", p, 1); - current_statement__ = 5; - stan::math::check_greater_or_equal(function__, "chi", - inline_prob_uncaptured_return_sym1__, 0); - current_statement__ = 5; - stan::math::check_less_or_equal(function__, "chi", - inline_prob_uncaptured_return_sym1__, 1); - if (emit_transformed_parameters__) { - out__.write(phi); - out__.write(p); - out__.write(inline_prob_uncaptured_return_sym1__); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + lp_accum__.add(lp__); + return lp_accum__.sum(); + } + 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; + 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; + // 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()); + // suppress unused var warning + (void) DUMMY_VAR__; + constexpr bool jacobian__ = false; + static constexpr const char* function__ = + "function_in_function_inline_model_namespace::write_array"; + // suppress unused var warning + (void) function__; + try { + int lcm_sym15__; + int lcm_sym14__; + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { + return ; } if (stan::math::logical_negation(emit_generated_quantities__)) { return ; @@ -15713,107 +17882,37 @@ class fails_test_model final : public model_base_crtp { // suppress unused var warning (void) DUMMY_VAR__; try { - int lcm_sym35__; int pos__; pos__ = 1; - local_scalar_t__ mean_p; - mean_p = in__.read(); - out__.write_free_lub(0, 1, mean_p); - Eigen::Matrix beta = - Eigen::Matrix::Constant(max_age, DUMMY_VAR__); - if (stan::math::logical_gte(max_age, 1)) { - stan::model::assign(beta, in__.read(), - "assigning variable beta", stan::model::index_uni(1)); - for (int sym1__ = 2; sym1__ <= max_age; ++sym1__) { - stan::model::assign(beta, in__.read(), - "assigning variable beta", stan::model::index_uni(sym1__)); - } - } - out__.write_free_lub(0, 1, beta); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } inline void get_param_names(std::vector& names__) const { - names__ = std::vector{"mean_p", "beta", "phi", "p", "chi"}; + names__ = std::vector{}; } inline void get_dims(std::vector>& dimss__) const { - dimss__ = std::vector>{std::vector{}, - std::vector{static_cast(max_age)}, - std::vector{static_cast(nind), - static_cast(n_occ_minus_1)}, - std::vector{static_cast(nind), - static_cast(n_occ_minus_1)}, - std::vector{static_cast(nind), - static_cast(n_occasions)}}; + dimss__ = std::vector>{}; } inline void constrained_param_names(std::vector& param_names__, bool emit_transformed_parameters__ = true, bool emit_generated_quantities__ = true) const final { - param_names__.emplace_back(std::string() + "mean_p"); - for (int sym119__ = 1; sym119__ <= max_age; ++sym119__) { - param_names__.emplace_back(std::string() + "beta" + '.' + - std::to_string(sym119__)); - } - if (emit_transformed_parameters__) { - for (int sym119__ = 1; sym119__ <= n_occ_minus_1; ++sym119__) { - for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { - param_names__.emplace_back(std::string() + "phi" + '.' + - std::to_string(sym120__) + '.' + std::to_string(sym119__)); - } - } - for (int sym119__ = 1; sym119__ <= n_occ_minus_1; ++sym119__) { - for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { - param_names__.emplace_back(std::string() + "p" + '.' + - std::to_string(sym120__) + '.' + std::to_string(sym119__)); - } - } - for (int sym119__ = 1; sym119__ <= n_occasions; ++sym119__) { - for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { - param_names__.emplace_back(std::string() + "chi" + '.' + - std::to_string(sym120__) + '.' + std::to_string(sym119__)); - } - } - } + if (emit_transformed_parameters__) {} 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 { - param_names__.emplace_back(std::string() + "mean_p"); - for (int sym119__ = 1; sym119__ <= max_age; ++sym119__) { - param_names__.emplace_back(std::string() + "beta" + '.' + - std::to_string(sym119__)); - } - if (emit_transformed_parameters__) { - for (int sym119__ = 1; sym119__ <= n_occ_minus_1; ++sym119__) { - for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { - param_names__.emplace_back(std::string() + "phi" + '.' + - std::to_string(sym120__) + '.' + std::to_string(sym119__)); - } - } - for (int sym119__ = 1; sym119__ <= n_occ_minus_1; ++sym119__) { - for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { - param_names__.emplace_back(std::string() + "p" + '.' + - std::to_string(sym120__) + '.' + std::to_string(sym119__)); - } - } - for (int sym119__ = 1; sym119__ <= n_occasions; ++sym119__) { - for (int sym120__ = 1; sym120__ <= nind; ++sym120__) { - param_names__.emplace_back(std::string() + "chi" + '.' + - std::to_string(sym120__) + '.' + std::to_string(sym119__)); - } - } - } + if (emit_transformed_parameters__) {} if (emit_generated_quantities__) {} } inline std::string get_constrained_sizedtypes() const { - return std::string("[{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(max_age) + "},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"}]"); + return std::string("[]"); } inline std::string get_unconstrained_sizedtypes() const { - return std::string("[{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(max_age) + "},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"}]"); + return std::string("[]"); } // Begin method overload boilerplate template inline void @@ -15822,9 +17921,8 @@ class fails_test_model final : public model_base_crtp { emit_transformed_parameters = true, const bool emit_generated_quantities = true, std::ostream* pstream = nullptr) const { - const size_t num_params__ = (1 + max_age); - const size_t num_transformed = emit_transformed_parameters * ((((nind * - n_occ_minus_1) + (nind * n_occ_minus_1)) + (nind * n_occasions))); + const size_t num_params__ = 0; + const size_t num_transformed = emit_transformed_parameters * (0); const size_t num_gen_quantities = emit_generated_quantities * (0); const size_t num_to_write = num_params__ + num_transformed + num_gen_quantities; @@ -15840,9 +17938,8 @@ class fails_test_model final : public model_base_crtp { emit_transformed_parameters = true, bool emit_generated_quantities = true, std::ostream* pstream = nullptr) const { - const size_t num_params__ = (1 + max_age); - const size_t num_transformed = emit_transformed_parameters * ((((nind * - n_occ_minus_1) + (nind * n_occ_minus_1)) + (nind * n_occasions))); + const size_t num_params__ = 0; + const size_t num_transformed = emit_transformed_parameters * (0); const size_t num_gen_quantities = emit_generated_quantities * (0); const size_t num_to_write = num_params__ + num_transformed + num_gen_quantities; @@ -15875,8 +17972,8 @@ class fails_test_model final : public model_base_crtp { transform_inits(const stan::io::var_context& context, std::vector& params_i, std::vector& vars, std::ostream* pstream__ = nullptr) const { - constexpr std::array names__{"mean_p", "beta"}; - const std::array constrain_param_sizes__{1, max_age}; + constexpr std::array names__{}; + const std::array constrain_param_sizes__{}; const auto num_constrained_params__ = std::accumulate(constrain_param_sizes__.begin(), constrain_param_sizes__.end(), 0); @@ -15896,7 +17993,7 @@ class fails_test_model final : public model_base_crtp { } }; } -using stan_model = fails_test_model_namespace::fails_test_model; +using stan_model = function_in_function_inline_model_namespace::function_in_function_inline_model; #ifndef USING_R // Boilerplate stan::model::model_base& @@ -15906,7 +18003,7 @@ new_model(stan::io::var_context& data_context, unsigned int seed, return *m; } stan::math::profile_map& get_stan_profile_data() { - return fails_test_model_namespace::profiles__; + return function_in_function_inline_model_namespace::profiles__; } #endif $ ../../../../../install/default/bin/stanc --O --print-cpp function-in-function-loops.stan @@ -25656,46 +27753,495 @@ class optimizations_model final : public model_base_crtp { lp_accum__.add(2); } { - current_statement__ = 67; - lp_accum__.add(1); - current_statement__ = 68; - lp_accum__.add(24); + current_statement__ = 67; + lp_accum__.add(1); + current_statement__ = 68; + lp_accum__.add(24); + } + { + current_statement__ = 70; + lp_accum__.add(1); + } + double temp = std::numeric_limits::quiet_NaN(); + { + current_statement__ = 74; + if (pstream__) { + stan::math::stan_print(pstream__, "hello"); + stan::math::stan_print(pstream__, "\n"); + } + } + double temp2 = std::numeric_limits::quiet_NaN(); + { + lp_accum__.add(4); + lp_accum__.add(6); + { + current_statement__ = 77; + lp_accum__.add(4); + current_statement__ = 78; + lp_accum__.add(6); + } + } + double dataonlyvar; + current_statement__ = 80; + dataonlyvar = 3; + current_statement__ = 81; + lp_accum__.add(dataonlyvar); + local_scalar_t__ paramvar = DUMMY_VAR__; + { + current_statement__ = 83; + paramvar = (theta * 34); + } + current_statement__ = 85; + lp_accum__.add(paramvar); + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + lp_accum__.add(lp__); + return lp_accum__.sum(); + } + 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; + 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; + // 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()); + // suppress unused var warning + (void) DUMMY_VAR__; + constexpr bool jacobian__ = false; + static constexpr const char* function__ = + "optimizations_model_namespace::write_array"; + // suppress unused var warning + (void) function__; + try { + int lcm_sym33__; + int lcm_sym32__; + double theta; + current_statement__ = 1; + theta = in__.template read(); + double phi; + current_statement__ = 2; + phi = in__.template read(); + Eigen::Matrix x_matrix; + current_statement__ = 3; + x_matrix = in__.template read>(3, + 2); + Eigen::Matrix x_vector; + current_statement__ = 4; + x_vector = in__.template read>(2); + Eigen::Matrix x_cov; + current_statement__ = 5; + x_cov = in__.template read_constrain_cov_matrix< + Eigen::Matrix, jacobian__>(lp__, 2); + out__.write(theta); + out__.write(phi); + out__.write(x_matrix); + out__.write(x_vector); + out__.write(x_cov); + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { + return ; + } + if (stan::math::logical_negation(emit_generated_quantities__)) { + return ; + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline void + transform_inits_impl(VecVar& params_r__, 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__; + pos__ = 1; + local_scalar_t__ theta; + theta = in__.read(); + out__.write(theta); + local_scalar_t__ phi; + phi = in__.read(); + out__.write(phi); + Eigen::Matrix x_matrix = + Eigen::Matrix::Constant(3, 2, DUMMY_VAR__); + { + { + stan::model::assign(x_matrix, in__.read(), + "assigning variable x_matrix", stan::model::index_uni(1), + stan::model::index_uni(1)); + { + stan::model::assign(x_matrix, in__.read(), + "assigning variable x_matrix", stan::model::index_uni(2), + stan::model::index_uni(1)); + } + { + stan::model::assign(x_matrix, in__.read(), + "assigning variable x_matrix", stan::model::index_uni(3), + stan::model::index_uni(1)); + } + } + { + stan::model::assign(x_matrix, in__.read(), + "assigning variable x_matrix", stan::model::index_uni(1), + stan::model::index_uni(2)); + { + stan::model::assign(x_matrix, in__.read(), + "assigning variable x_matrix", stan::model::index_uni(2), + stan::model::index_uni(2)); + } + { + stan::model::assign(x_matrix, in__.read(), + "assigning variable x_matrix", stan::model::index_uni(3), + stan::model::index_uni(2)); + } } + } + out__.write(x_matrix); + Eigen::Matrix x_vector = + Eigen::Matrix::Constant(2, DUMMY_VAR__); + { + stan::model::assign(x_vector, in__.read(), + "assigning variable x_vector", stan::model::index_uni(1)); { - current_statement__ = 70; - lp_accum__.add(1); + stan::model::assign(x_vector, in__.read(), + "assigning variable x_vector", stan::model::index_uni(2)); } - double temp = std::numeric_limits::quiet_NaN(); + } + out__.write(x_vector); + Eigen::Matrix x_cov = + Eigen::Matrix::Constant(2, 2, DUMMY_VAR__); + { { - current_statement__ = 74; - if (pstream__) { - stan::math::stan_print(pstream__, "hello"); - stan::math::stan_print(pstream__, "\n"); + stan::model::assign(x_cov, in__.read(), + "assigning variable x_cov", stan::model::index_uni(1), + stan::model::index_uni(1)); + { + stan::model::assign(x_cov, in__.read(), + "assigning variable x_cov", stan::model::index_uni(2), + stan::model::index_uni(1)); } } - double temp2 = std::numeric_limits::quiet_NaN(); { - lp_accum__.add(4); - lp_accum__.add(6); + stan::model::assign(x_cov, in__.read(), + "assigning variable x_cov", stan::model::index_uni(1), + stan::model::index_uni(2)); { - current_statement__ = 77; - lp_accum__.add(4); - current_statement__ = 78; - lp_accum__.add(6); + stan::model::assign(x_cov, in__.read(), + "assigning variable x_cov", stan::model::index_uni(2), + stan::model::index_uni(2)); } } - double dataonlyvar; - current_statement__ = 80; - dataonlyvar = 3; - current_statement__ = 81; - lp_accum__.add(dataonlyvar); - local_scalar_t__ paramvar = DUMMY_VAR__; - { - current_statement__ = 83; - paramvar = (theta * 34); - } - current_statement__ = 85; - lp_accum__.add(paramvar); + } + out__.write_free_cov_matrix(x_cov); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + inline void get_param_names(std::vector& names__) const { + names__ = std::vector{"theta", "phi", "x_matrix", + "x_vector", "x_cov"}; + } + inline void get_dims(std::vector>& dimss__) const { + dimss__ = std::vector>{std::vector{}, + std::vector{}, + std::vector{static_cast(3), + static_cast(2)}, + std::vector{static_cast(2)}, + std::vector{static_cast(2), + static_cast(2)}}; + } + inline void + constrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { + param_names__.emplace_back(std::string() + "theta"); + param_names__.emplace_back(std::string() + "phi"); + for (int sym58__ = 1; sym58__ <= 2; ++sym58__) { + for (int sym59__ = 1; sym59__ <= 3; ++sym59__) { + param_names__.emplace_back(std::string() + "x_matrix" + '.' + + std::to_string(sym59__) + '.' + std::to_string(sym58__)); + } + } + for (int sym58__ = 1; sym58__ <= 2; ++sym58__) { + param_names__.emplace_back(std::string() + "x_vector" + '.' + + std::to_string(sym58__)); + } + for (int sym58__ = 1; sym58__ <= 2; ++sym58__) { + for (int sym59__ = 1; sym59__ <= 2; ++sym59__) { + param_names__.emplace_back(std::string() + "x_cov" + '.' + + std::to_string(sym59__) + '.' + std::to_string(sym58__)); + } + } + if (emit_transformed_parameters__) {} + 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 { + param_names__.emplace_back(std::string() + "theta"); + param_names__.emplace_back(std::string() + "phi"); + for (int sym58__ = 1; sym58__ <= 2; ++sym58__) { + for (int sym59__ = 1; sym59__ <= 3; ++sym59__) { + param_names__.emplace_back(std::string() + "x_matrix" + '.' + + std::to_string(sym59__) + '.' + std::to_string(sym58__)); + } + } + for (int sym58__ = 1; sym58__ <= 2; ++sym58__) { + param_names__.emplace_back(std::string() + "x_vector" + '.' + + std::to_string(sym58__)); + } + for (int sym58__ = 1; sym58__ <= 3; ++sym58__) { + param_names__.emplace_back(std::string() + "x_cov" + '.' + + std::to_string(sym58__)); + } + if (emit_transformed_parameters__) {} + if (emit_generated_quantities__) {} + } + inline std::string get_constrained_sizedtypes() const { + return std::string("[{\"name\":\"theta\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"x_matrix\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(3) + ",\"cols\":" + std::to_string(2) + "},\"block\":\"parameters\"},{\"name\":\"x_vector\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(2) + "},\"block\":\"parameters\"},{\"name\":\"x_cov\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(2) + ",\"cols\":" + std::to_string(2) + "},\"block\":\"parameters\"}]"); + } + inline std::string get_unconstrained_sizedtypes() const { + return std::string("[{\"name\":\"theta\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"x_matrix\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(3) + ",\"cols\":" + std::to_string(2) + "},\"block\":\"parameters\"},{\"name\":\"x_vector\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(2) + "},\"block\":\"parameters\"},{\"name\":\"x_cov\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(3) + "},\"block\":\"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__ = ((((1 + 1) + (3 * 2)) + 2) + (2 * 2)); + const size_t num_transformed = emit_transformed_parameters * (0); + 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__ = ((((1 + 1) + (3 * 2)) + 2) + (2 * 2)); + const size_t num_transformed = emit_transformed_parameters * (0); + 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 { + constexpr std::array + names__{"theta", "phi", "x_matrix", "x_vector", "x_cov"}; + const std::array + constrain_param_sizes__{1, 1, (3 * 2), 2, (2 * 2)}; + const auto num_constrained_params__ = + std::accumulate(constrain_param_sizes__.begin(), + constrain_param_sizes__.end(), 0); + std::vector params_r_flat__(num_constrained_params__); + Eigen::Index size_iter__ = 0; + Eigen::Index flat_iter__ = 0; + for (auto&& param_name__: names__) { + const auto param_vec__ = context.vals_r(param_name__); + for (Eigen::Index i = 0; i < constrain_param_sizes__[size_iter__]; ++i) { + params_r_flat__[flat_iter__] = param_vec__[i]; + ++flat_iter__; + } + ++size_iter__; + } + vars.resize(num_params_r__); + transform_inits_impl(params_r_flat__, params_i, vars, pstream__); + } +}; +} +using stan_model = optimizations_model_namespace::optimizations_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* m = new stan_model(data_context, seed, msg_stream); + return *m; +} +stan::math::profile_map& get_stan_profile_data() { + return optimizations_model_namespace::profiles__; +} +#endif + $ ../../../../../install/default/bin/stanc --O --print-cpp overloaded-fn.stan +// Code generated by %%NAME%% %%VERSION%% +#include +namespace overloaded_fn_model_namespace { +using stan::model::model_base_crtp; +using namespace stan::math; +stan::math::profile_map profiles__; +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'overloaded-fn.stan', line 13, column 2 to column 22)", + " (in 'overloaded-fn.stan', line 3, column 5 to column 20)", + " (in 'overloaded-fn.stan', line 2, column 20 to line 4, column 4)", + " (in 'overloaded-fn.stan', line 7, column 5 to column 20)", + " (in 'overloaded-fn.stan', line 6, column 19 to line 8, column 4)"}; +template >* = nullptr> +stan::promote_args_t dumb(const T0__& x, std::ostream* pstream__); +double dumb(const int& x, std::ostream* pstream__); +template >*> +stan::promote_args_t dumb(const T0__& x, std::ostream* pstream__) { + using local_scalar_t__ = stan::promote_args_t; + int current_statement__ = 0; + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + double lcm_sym1__; + { + current_statement__ = 2; + return (x + 0.5); + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +double dumb(const int& x, std::ostream* pstream__) { + using local_scalar_t__ = double; + int current_statement__ = 0; + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + double lcm_sym2__; + { + current_statement__ = 4; + return (x - 0.5); + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +class overloaded_fn_model final : public model_base_crtp { + private: + + public: + ~overloaded_fn_model() {} + overloaded_fn_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__ = + "overloaded_fn_model_namespace::overloaded_fn_model"; + // suppress unused var warning + (void) function__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + int pos__; + pos__ = 1; + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + num_params_r__ = 0U; + } + inline std::string model_name() const final { + return "overloaded_fn_model"; + } + inline std::vector model_compile_info() const noexcept { + return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", + "stancflags = --O --print-cpp"}; + } + 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__; + stan::io::deserializer in__(params_r__, params_i__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + static constexpr const char* function__ = + "overloaded_fn_model_namespace::log_prob"; + // suppress unused var warning + (void) function__; + try { + double lcm_sym5__; + { + current_statement__ = 1; + lp_accum__.add(dumb(1.0, pstream__)); } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); @@ -25730,34 +28276,12 @@ class optimizations_model final : public model_base_crtp { (void) DUMMY_VAR__; constexpr bool jacobian__ = false; static constexpr const char* function__ = - "optimizations_model_namespace::write_array"; + "overloaded_fn_model_namespace::write_array"; // suppress unused var warning (void) function__; try { - int lcm_sym33__; - int lcm_sym32__; - double theta; - current_statement__ = 1; - theta = in__.template read(); - double phi; - current_statement__ = 2; - phi = in__.template read(); - Eigen::Matrix x_matrix; - current_statement__ = 3; - x_matrix = in__.template read>(3, - 2); - Eigen::Matrix x_vector; - current_statement__ = 4; - x_vector = in__.template read>(2); - Eigen::Matrix x_cov; - current_statement__ = 5; - x_cov = in__.template read_constrain_cov_matrix< - Eigen::Matrix, jacobian__>(lp__, 2); - out__.write(theta); - out__.write(phi); - out__.write(x_matrix); - out__.write(x_vector); - out__.write(x_cov); + int lcm_sym4__; + int lcm_sym3__; if (stan::math::logical_negation( (stan::math::primitive_value(emit_transformed_parameters__) || stan::math::primitive_value(emit_generated_quantities__)))) { @@ -25786,122 +28310,20 @@ class optimizations_model final : public model_base_crtp { try { int pos__; pos__ = 1; - local_scalar_t__ theta; - theta = in__.read(); - out__.write(theta); - local_scalar_t__ phi; - phi = in__.read(); - out__.write(phi); - Eigen::Matrix x_matrix = - Eigen::Matrix::Constant(3, 2, DUMMY_VAR__); - { - { - stan::model::assign(x_matrix, in__.read(), - "assigning variable x_matrix", stan::model::index_uni(1), - stan::model::index_uni(1)); - { - stan::model::assign(x_matrix, in__.read(), - "assigning variable x_matrix", stan::model::index_uni(2), - stan::model::index_uni(1)); - } - { - stan::model::assign(x_matrix, in__.read(), - "assigning variable x_matrix", stan::model::index_uni(3), - stan::model::index_uni(1)); - } - } - { - stan::model::assign(x_matrix, in__.read(), - "assigning variable x_matrix", stan::model::index_uni(1), - stan::model::index_uni(2)); - { - stan::model::assign(x_matrix, in__.read(), - "assigning variable x_matrix", stan::model::index_uni(2), - stan::model::index_uni(2)); - } - { - stan::model::assign(x_matrix, in__.read(), - "assigning variable x_matrix", stan::model::index_uni(3), - stan::model::index_uni(2)); - } - } - } - out__.write(x_matrix); - Eigen::Matrix x_vector = - Eigen::Matrix::Constant(2, DUMMY_VAR__); - { - stan::model::assign(x_vector, in__.read(), - "assigning variable x_vector", stan::model::index_uni(1)); - { - stan::model::assign(x_vector, in__.read(), - "assigning variable x_vector", stan::model::index_uni(2)); - } - } - out__.write(x_vector); - Eigen::Matrix x_cov = - Eigen::Matrix::Constant(2, 2, DUMMY_VAR__); - { - { - stan::model::assign(x_cov, in__.read(), - "assigning variable x_cov", stan::model::index_uni(1), - stan::model::index_uni(1)); - { - stan::model::assign(x_cov, in__.read(), - "assigning variable x_cov", stan::model::index_uni(2), - stan::model::index_uni(1)); - } - } - { - stan::model::assign(x_cov, in__.read(), - "assigning variable x_cov", stan::model::index_uni(1), - stan::model::index_uni(2)); - { - stan::model::assign(x_cov, in__.read(), - "assigning variable x_cov", stan::model::index_uni(2), - stan::model::index_uni(2)); - } - } - } - out__.write_free_cov_matrix(x_cov); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } inline void get_param_names(std::vector& names__) const { - names__ = std::vector{"theta", "phi", "x_matrix", - "x_vector", "x_cov"}; + names__ = std::vector{}; } inline void get_dims(std::vector>& dimss__) const { - dimss__ = std::vector>{std::vector{}, - std::vector{}, - std::vector{static_cast(3), - static_cast(2)}, - std::vector{static_cast(2)}, - std::vector{static_cast(2), - static_cast(2)}}; + dimss__ = std::vector>{}; } inline void constrained_param_names(std::vector& param_names__, bool emit_transformed_parameters__ = true, bool emit_generated_quantities__ = true) const final { - param_names__.emplace_back(std::string() + "theta"); - param_names__.emplace_back(std::string() + "phi"); - for (int sym58__ = 1; sym58__ <= 2; ++sym58__) { - for (int sym59__ = 1; sym59__ <= 3; ++sym59__) { - param_names__.emplace_back(std::string() + "x_matrix" + '.' + - std::to_string(sym59__) + '.' + std::to_string(sym58__)); - } - } - for (int sym58__ = 1; sym58__ <= 2; ++sym58__) { - param_names__.emplace_back(std::string() + "x_vector" + '.' + - std::to_string(sym58__)); - } - for (int sym58__ = 1; sym58__ <= 2; ++sym58__) { - for (int sym59__ = 1; sym59__ <= 2; ++sym59__) { - param_names__.emplace_back(std::string() + "x_cov" + '.' + - std::to_string(sym59__) + '.' + std::to_string(sym58__)); - } - } if (emit_transformed_parameters__) {} if (emit_generated_quantities__) {} } @@ -25909,30 +28331,14 @@ class optimizations_model final : public model_base_crtp { unconstrained_param_names(std::vector& param_names__, bool emit_transformed_parameters__ = true, bool emit_generated_quantities__ = true) const final { - param_names__.emplace_back(std::string() + "theta"); - param_names__.emplace_back(std::string() + "phi"); - for (int sym58__ = 1; sym58__ <= 2; ++sym58__) { - for (int sym59__ = 1; sym59__ <= 3; ++sym59__) { - param_names__.emplace_back(std::string() + "x_matrix" + '.' + - std::to_string(sym59__) + '.' + std::to_string(sym58__)); - } - } - for (int sym58__ = 1; sym58__ <= 2; ++sym58__) { - param_names__.emplace_back(std::string() + "x_vector" + '.' + - std::to_string(sym58__)); - } - for (int sym58__ = 1; sym58__ <= 3; ++sym58__) { - param_names__.emplace_back(std::string() + "x_cov" + '.' + - std::to_string(sym58__)); - } if (emit_transformed_parameters__) {} if (emit_generated_quantities__) {} } inline std::string get_constrained_sizedtypes() const { - return std::string("[{\"name\":\"theta\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"x_matrix\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(3) + ",\"cols\":" + std::to_string(2) + "},\"block\":\"parameters\"},{\"name\":\"x_vector\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(2) + "},\"block\":\"parameters\"},{\"name\":\"x_cov\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(2) + ",\"cols\":" + std::to_string(2) + "},\"block\":\"parameters\"}]"); + return std::string("[]"); } inline std::string get_unconstrained_sizedtypes() const { - return std::string("[{\"name\":\"theta\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"x_matrix\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(3) + ",\"cols\":" + std::to_string(2) + "},\"block\":\"parameters\"},{\"name\":\"x_vector\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(2) + "},\"block\":\"parameters\"},{\"name\":\"x_cov\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(3) + "},\"block\":\"parameters\"}]"); + return std::string("[]"); } // Begin method overload boilerplate template inline void @@ -25941,7 +28347,7 @@ class optimizations_model final : public model_base_crtp { emit_transformed_parameters = true, const bool emit_generated_quantities = true, std::ostream* pstream = nullptr) const { - const size_t num_params__ = ((((1 + 1) + (3 * 2)) + 2) + (2 * 2)); + const size_t num_params__ = 0; const size_t num_transformed = emit_transformed_parameters * (0); const size_t num_gen_quantities = emit_generated_quantities * (0); const size_t num_to_write = num_params__ + num_transformed + @@ -25958,7 +28364,7 @@ class optimizations_model final : public model_base_crtp { emit_transformed_parameters = true, bool emit_generated_quantities = true, std::ostream* pstream = nullptr) const { - const size_t num_params__ = ((((1 + 1) + (3 * 2)) + 2) + (2 * 2)); + const size_t num_params__ = 0; const size_t num_transformed = emit_transformed_parameters * (0); const size_t num_gen_quantities = emit_generated_quantities * (0); const size_t num_to_write = num_params__ + num_transformed + @@ -25992,10 +28398,8 @@ class optimizations_model final : public model_base_crtp { transform_inits(const stan::io::var_context& context, std::vector& params_i, std::vector& vars, std::ostream* pstream__ = nullptr) const { - constexpr std::array - names__{"theta", "phi", "x_matrix", "x_vector", "x_cov"}; - const std::array - constrain_param_sizes__{1, 1, (3 * 2), 2, (2 * 2)}; + constexpr std::array names__{}; + const std::array constrain_param_sizes__{}; const auto num_constrained_params__ = std::accumulate(constrain_param_sizes__.begin(), constrain_param_sizes__.end(), 0); @@ -26015,7 +28419,7 @@ class optimizations_model final : public model_base_crtp { } }; } -using stan_model = optimizations_model_namespace::optimizations_model; +using stan_model = overloaded_fn_model_namespace::overloaded_fn_model; #ifndef USING_R // Boilerplate stan::model::model_base& @@ -26025,31 +28429,44 @@ new_model(stan::io::var_context& data_context, unsigned int seed, return *m; } stan::math::profile_map& get_stan_profile_data() { - return optimizations_model_namespace::profiles__; + return overloaded_fn_model_namespace::profiles__; } #endif - $ ../../../../../install/default/bin/stanc --O --print-cpp overloaded-fn.stan + $ ../../../../../install/default/bin/stanc --O --print-cpp overloaded-fn2.stan // Code generated by %%NAME%% %%VERSION%% #include -namespace overloaded_fn_model_namespace { +namespace overloaded_fn2_model_namespace { using stan::model::model_base_crtp; using namespace stan::math; stan::math::profile_map profiles__; -static constexpr std::array locations_array__ = +static constexpr std::array locations_array__ = {" (found before start of program)", - " (in 'overloaded-fn.stan', line 13, column 2 to column 22)", - " (in 'overloaded-fn.stan', line 3, column 5 to column 20)", - " (in 'overloaded-fn.stan', line 2, column 20 to line 4, column 4)", - " (in 'overloaded-fn.stan', line 7, column 5 to column 20)", - " (in 'overloaded-fn.stan', line 6, column 19 to line 8, column 4)"}; + " (in 'overloaded-fn2.stan', line 7, column 4 to column 26)", + " (in 'overloaded-fn2.stan', line 14, column 2 to column 11)", + " (in 'overloaded-fn2.stan', line 3, column 4 to column 18)", + " (in 'overloaded-fn2.stan', line 2, column 21 to line 4, column 3)", + " (in 'overloaded-fn2.stan', line 5, column 16 to line 8, column 3)", + " (in 'overloaded-fn2.stan', line 10, column 4 to column 16)", + " (in 'overloaded-fn2.stan', line 9, column 21 to line 11, column 3)"}; +template , + stan::is_vt_not_complex>* = nullptr> +stan::promote_args_t> +foo(const T0__& x_arg__, std::ostream* pstream__); +template void +bar_lp(T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__); template >* = nullptr> -stan::promote_args_t dumb(const T0__& x, std::ostream* pstream__); -double dumb(const int& x, std::ostream* pstream__); -template >*> -stan::promote_args_t dumb(const T0__& x, std::ostream* pstream__) { - using local_scalar_t__ = stan::promote_args_t; +Eigen::Matrix,-1,1> +foo(const T0__& x, std::ostream* pstream__); +template , + stan::is_vt_not_complex>*> +stan::promote_args_t> +foo(const T0__& x_arg__, std::ostream* pstream__) { + using local_scalar_t__ = stan::promote_args_t>; int current_statement__ = 0; + const auto& x = stan::math::to_ref(x_arg__); static constexpr bool propto__ = true; // suppress unused var warning (void) propto__; @@ -26057,18 +28474,38 @@ stan::promote_args_t dumb(const T0__& x, std::ostream* pstream__) { // suppress unused var warning (void) DUMMY_VAR__; try { - double lcm_sym1__; + double lcm_sym2__; { - current_statement__ = 2; - return (x + 0.5); + current_statement__ = 3; + return stan::math::sum(x); } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -double dumb(const int& x, std::ostream* pstream__) { +template void +bar_lp(T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) { using local_scalar_t__ = double; int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + double lcm_sym3__; + { + current_statement__ = 1; + lp_accum__.add(stan::model::rvalue(foo(1.0, pstream__), "foo(1.0)", + stan::model::index_uni(1))); + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +template >*> +Eigen::Matrix,-1,1> +foo(const T0__& x, std::ostream* pstream__) { + using local_scalar_t__ = stan::promote_args_t; + int current_statement__ = 0; static constexpr bool propto__ = true; // suppress unused var warning (void) propto__; @@ -26076,22 +28513,22 @@ double dumb(const int& x, std::ostream* pstream__) { // suppress unused var warning (void) DUMMY_VAR__; try { - double lcm_sym2__; + Eigen::Matrix lcm_sym4__; { - current_statement__ = 4; - return (x - 0.5); + current_statement__ = 6; + return (Eigen::Matrix(1) << x).finished(); } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } -class overloaded_fn_model final : public model_base_crtp { +class overloaded_fn2_model final : public model_base_crtp { private: public: - ~overloaded_fn_model() {} - overloaded_fn_model(stan::io::var_context& context__, unsigned int - random_seed__ = 0, std::ostream* pstream__ = nullptr) + ~overloaded_fn2_model() {} + overloaded_fn2_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; @@ -26100,7 +28537,7 @@ class overloaded_fn_model final : public model_base_crtp { // suppress unused var warning (void) base_rng__; static constexpr const char* function__ = - "overloaded_fn_model_namespace::overloaded_fn_model"; + "overloaded_fn2_model_namespace::overloaded_fn2_model"; // suppress unused var warning (void) function__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); @@ -26115,7 +28552,7 @@ class overloaded_fn_model final : public model_base_crtp { num_params_r__ = 0U; } inline std::string model_name() const final { - return "overloaded_fn_model"; + return "overloaded_fn2_model"; } inline std::vector model_compile_info() const noexcept { return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", @@ -26137,14 +28574,15 @@ class overloaded_fn_model final : public model_base_crtp { // suppress unused var warning (void) DUMMY_VAR__; static constexpr const char* function__ = - "overloaded_fn_model_namespace::log_prob"; + "overloaded_fn2_model_namespace::log_prob"; // suppress unused var warning (void) function__; try { - double lcm_sym5__; + double lcm_sym7__; { current_statement__ = 1; - lp_accum__.add(dumb(1.0, pstream__)); + lp_accum__.add(stan::model::rvalue(foo(1.0, pstream__), "foo(1.0)", + stan::model::index_uni(1))); } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); @@ -26179,12 +28617,12 @@ class overloaded_fn_model final : public model_base_crtp { (void) DUMMY_VAR__; constexpr bool jacobian__ = false; static constexpr const char* function__ = - "overloaded_fn_model_namespace::write_array"; + "overloaded_fn2_model_namespace::write_array"; // suppress unused var warning (void) function__; try { - int lcm_sym4__; - int lcm_sym3__; + int lcm_sym6__; + int lcm_sym5__; if (stan::math::logical_negation( (stan::math::primitive_value(emit_transformed_parameters__) || stan::math::primitive_value(emit_generated_quantities__)))) { @@ -26322,7 +28760,7 @@ class overloaded_fn_model final : public model_base_crtp { } }; } -using stan_model = overloaded_fn_model_namespace::overloaded_fn_model; +using stan_model = overloaded_fn2_model_namespace::overloaded_fn2_model; #ifndef USING_R // Boilerplate stan::model::model_base& @@ -26332,106 +28770,68 @@ new_model(stan::io::var_context& data_context, unsigned int seed, return *m; } stan::math::profile_map& get_stan_profile_data() { - return overloaded_fn_model_namespace::profiles__; + return overloaded_fn2_model_namespace::profiles__; } #endif - $ ../../../../../install/default/bin/stanc --O --print-cpp overloaded-fn2.stan + $ ../../../../../install/default/bin/stanc --O --print-cpp partial-eval.stan // Code generated by %%NAME%% %%VERSION%% #include -namespace overloaded_fn2_model_namespace { +namespace partial_eval_model_namespace { using stan::model::model_base_crtp; using namespace stan::math; stan::math::profile_map profiles__; -static constexpr std::array locations_array__ = +static constexpr std::array locations_array__ = {" (found before start of program)", - " (in 'overloaded-fn2.stan', line 7, column 4 to column 26)", - " (in 'overloaded-fn2.stan', line 14, column 2 to column 11)", - " (in 'overloaded-fn2.stan', line 3, column 4 to column 18)", - " (in 'overloaded-fn2.stan', line 2, column 21 to line 4, column 3)", - " (in 'overloaded-fn2.stan', line 5, column 16 to line 8, column 3)", - " (in 'overloaded-fn2.stan', line 10, column 4 to column 16)", - " (in 'overloaded-fn2.stan', line 9, column 21 to line 11, column 3)"}; -template , - stan::is_vt_not_complex>* = nullptr> -stan::promote_args_t> -foo(const T0__& x_arg__, std::ostream* pstream__); -template void -bar_lp(T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__); -template >* = nullptr> -Eigen::Matrix,-1,1> -foo(const T0__& x, std::ostream* pstream__); -template , - stan::is_vt_not_complex>*> -stan::promote_args_t> -foo(const T0__& x_arg__, std::ostream* pstream__) { - using local_scalar_t__ = stan::promote_args_t>; - int current_statement__ = 0; - const auto& x = stan::math::to_ref(x_arg__); - static constexpr bool propto__ = true; - // suppress unused var warning - (void) propto__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - double lcm_sym2__; - { - current_statement__ = 3; - return stan::math::sum(x); - } - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } -} -template void -bar_lp(T_lp__& lp__, T_lp_accum__& lp_accum__, std::ostream* pstream__) { - using local_scalar_t__ = double; - int current_statement__ = 0; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - double lcm_sym3__; - { - current_statement__ = 1; - lp_accum__.add(stan::model::rvalue(foo(1.0, pstream__), "foo(1.0)", - stan::model::index_uni(1))); - } - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } -} -template >*> -Eigen::Matrix,-1,1> -foo(const T0__& x, std::ostream* pstream__) { - using local_scalar_t__ = stan::promote_args_t; - int current_statement__ = 0; - static constexpr bool propto__ = true; - // suppress unused var warning - (void) propto__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - Eigen::Matrix lcm_sym4__; - { - current_statement__ = 6; - return (Eigen::Matrix(1) << x).finished(); - } - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } -} -class overloaded_fn2_model final : public model_base_crtp { + " (in 'partial-eval.stan', line 10, column 2 to column 19)", + " (in 'partial-eval.stan', line 11, column 2 to column 17)", + " (in 'partial-eval.stan', line 12, column 2 to column 12)", + " (in 'partial-eval.stan', line 13, column 2 to column 35)", + " (in 'partial-eval.stan', line 14, column 2 to column 35)", + " (in 'partial-eval.stan', line 17, column 2 to column 18)", + " (in 'partial-eval.stan', line 20, column 4 to column 75)", + " (in 'partial-eval.stan', line 19, column 2 to line 20, column 75)", + " (in 'partial-eval.stan', line 24, column 2 to column 22)", + " (in 'partial-eval.stan', line 25, column 2 to column 34)", + " (in 'partial-eval.stan', line 26, column 2 to column 24)", + " (in 'partial-eval.stan', line 27, column 2 to column 29)", + " (in 'partial-eval.stan', line 29, column 2 to column 25)", + " (in 'partial-eval.stan', line 30, column 2 to column 11)", + " (in 'partial-eval.stan', line 32, column 2 to column 24)", + " (in 'partial-eval.stan', line 2, column 2 to column 17)", + " (in 'partial-eval.stan', line 3, column 2 to column 22)", + " (in 'partial-eval.stan', line 4, column 8 to column 9)", + " (in 'partial-eval.stan', line 4, column 2 to column 43)", + " (in 'partial-eval.stan', line 5, column 9 to column 10)", + " (in 'partial-eval.stan', line 5, column 2 to column 21)", + " (in 'partial-eval.stan', line 6, column 27 to column 28)", + " (in 'partial-eval.stan', line 6, column 2 to column 40)", + " (in 'partial-eval.stan', line 7, column 9 to column 10)", + " (in 'partial-eval.stan', line 7, column 2 to column 14)", + " (in 'partial-eval.stan', line 10, column 9 to column 15)", + " (in 'partial-eval.stan', line 17, column 9 to column 10)"}; +class partial_eval_model final : public model_base_crtp { private: - - public: - ~overloaded_fn2_model() {} - overloaded_fn2_model(stan::io::var_context& context__, unsigned int - random_seed__ = 0, std::ostream* pstream__ = nullptr) + double lcm_sym24__; + double lcm_sym23__; + double lcm_sym22__; + double lcm_sym21__; + double lcm_sym20__; + double lcm_sym19__; + int lcm_sym18__; + int lcm_sym17__; + int N; + int n_pair; + std::vector pair; + Eigen::Matrix pre_test_data__; + Eigen::Matrix treatment_data__; + Eigen::Matrix y_data__; + Eigen::Map> pre_test{nullptr, 0}; + Eigen::Map> treatment{nullptr, 0}; + Eigen::Map> y{nullptr, 0}; + public: + ~partial_eval_model() {} + partial_eval_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; @@ -26440,7 +28840,7 @@ class overloaded_fn2_model final : public model_base_crtp // suppress unused var warning (void) base_rng__; static constexpr const char* function__ = - "overloaded_fn2_model_namespace::overloaded_fn2_model"; + "partial_eval_model_namespace::partial_eval_model"; // suppress unused var warning (void) function__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); @@ -26449,13 +28849,148 @@ class overloaded_fn2_model final : public model_base_crtp try { int pos__; pos__ = 1; + current_statement__ = 16; + context__.validate_dims("data initialization", "N", "int", + std::vector{}); + N = std::numeric_limits::min(); + current_statement__ = 16; + N = context__.vals_i("N")[(1 - 1)]; + current_statement__ = 16; + stan::math::check_greater_or_equal(function__, "N", N, 0); + current_statement__ = 17; + context__.validate_dims("data initialization", "n_pair", "int", + std::vector{}); + n_pair = std::numeric_limits::min(); + current_statement__ = 17; + n_pair = context__.vals_i("n_pair")[(1 - 1)]; + current_statement__ = 17; + stan::math::check_greater_or_equal(function__, "n_pair", n_pair, 0); + current_statement__ = 18; + stan::math::validate_non_negative_index("pair", "N", N); + current_statement__ = 19; + context__.validate_dims("data initialization", "pair", "int", + std::vector{static_cast(N)}); + pair = std::vector(N, std::numeric_limits::min()); + current_statement__ = 19; + pair = context__.vals_i("pair"); + current_statement__ = 19; + stan::math::check_greater_or_equal(function__, "pair", pair, 1); + current_statement__ = 19; + stan::math::check_less_or_equal(function__, "pair", pair, n_pair); + current_statement__ = 20; + stan::math::validate_non_negative_index("pre_test", "N", N); + current_statement__ = 21; + context__.validate_dims("data initialization", "pre_test", "double", + std::vector{static_cast(N)}); + pre_test_data__ = Eigen::Matrix::Constant(N, + std::numeric_limits::quiet_NaN()); + new (&pre_test) + Eigen::Map>(pre_test_data__.data(), N); + { + std::vector pre_test_flat__; + current_statement__ = 21; + pre_test_flat__ = context__.vals_r("pre_test"); + current_statement__ = 21; + pos__ = 1; + lcm_sym17__ = stan::math::logical_gte(N, 1); + if (lcm_sym17__) { + current_statement__ = 21; + stan::model::assign(pre_test, + stan::model::rvalue(pre_test_flat__, "pre_test_flat__", + stan::model::index_uni(1)), "assigning variable pre_test", + stan::model::index_uni(1)); + current_statement__ = 21; + pos__ = 2; + for (int sym1__ = 2; sym1__ <= N; ++sym1__) { + current_statement__ = 21; + stan::model::assign(pre_test, pre_test_flat__[(pos__ - 1)], + "assigning variable pre_test", stan::model::index_uni(sym1__)); + current_statement__ = 21; + pos__ = (pos__ + 1); + } + } + } + current_statement__ = 22; + stan::math::validate_non_negative_index("treatment", "N", N); + current_statement__ = 23; + context__.validate_dims("data initialization", "treatment", "double", + std::vector{static_cast(N)}); + treatment_data__ = Eigen::Matrix::Constant(N, + std::numeric_limits::quiet_NaN()); + new (&treatment) + Eigen::Map>(treatment_data__.data(), N); + { + std::vector treatment_flat__; + current_statement__ = 23; + treatment_flat__ = context__.vals_r("treatment"); + current_statement__ = 23; + pos__ = 1; + current_statement__ = 23; + if (lcm_sym17__) { + current_statement__ = 23; + stan::model::assign(treatment, + stan::model::rvalue(treatment_flat__, "treatment_flat__", + stan::model::index_uni(1)), "assigning variable treatment", + stan::model::index_uni(1)); + current_statement__ = 23; + pos__ = 2; + for (int sym1__ = 2; sym1__ <= N; ++sym1__) { + current_statement__ = 23; + stan::model::assign(treatment, treatment_flat__[(pos__ - 1)], + "assigning variable treatment", stan::model::index_uni(sym1__)); + current_statement__ = 23; + pos__ = (pos__ + 1); + } + } + } + current_statement__ = 23; + stan::math::check_greater_or_equal(function__, "treatment", treatment, + 0); + current_statement__ = 23; + stan::math::check_less_or_equal(function__, "treatment", treatment, 1); + current_statement__ = 24; + stan::math::validate_non_negative_index("y", "N", N); + current_statement__ = 25; + 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__ = 25; + y_flat__ = context__.vals_r("y"); + current_statement__ = 25; + pos__ = 1; + current_statement__ = 25; + if (lcm_sym17__) { + current_statement__ = 25; + stan::model::assign(y, + stan::model::rvalue(y_flat__, "y_flat__", + stan::model::index_uni(1)), "assigning variable y", + stan::model::index_uni(1)); + current_statement__ = 25; + pos__ = 2; + for (int sym1__ = 2; sym1__ <= N; ++sym1__) { + current_statement__ = 25; + stan::model::assign(y, y_flat__[(pos__ - 1)], + "assigning variable y", stan::model::index_uni(sym1__)); + current_statement__ = 25; + pos__ = (pos__ + 1); + } + } + } + current_statement__ = 26; + stan::math::validate_non_negative_index("a", "n_pair", n_pair); + current_statement__ = 27; + stan::math::validate_non_negative_index("y_hat", "N", N); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } - num_params_r__ = 0U; + num_params_r__ = n_pair + 2 + 1 + 1 + 1; } inline std::string model_name() const final { - return "overloaded_fn2_model"; + return "partial_eval_model"; } inline std::vector model_compile_info() const noexcept { return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", @@ -26477,15 +29012,95 @@ class overloaded_fn2_model final : public model_base_crtp // suppress unused var warning (void) DUMMY_VAR__; static constexpr const char* function__ = - "overloaded_fn2_model_namespace::log_prob"; + "partial_eval_model_namespace::log_prob"; // suppress unused var warning (void) function__; try { - double lcm_sym7__; + std::complex lcm_sym16__; + std::complex lcm_sym15__; + double lcm_sym14__; + double lcm_sym13__; + double lcm_sym12__; + double lcm_sym11__; + double lcm_sym10__; + double lcm_sym9__; + double lcm_sym8__; + int lcm_sym7__; + Eigen::Matrix a; + current_statement__ = 1; + a = in__.template read>(n_pair); + Eigen::Matrix beta; + current_statement__ = 2; + beta = in__.template read>(2); + local_scalar_t__ mu_a; + current_statement__ = 3; + mu_a = in__.template read(); + local_scalar_t__ sigma_a; + current_statement__ = 4; + sigma_a = in__.template read_constrain_lub(0, 100, lp__); + local_scalar_t__ sigma_y; + current_statement__ = 5; + sigma_y = in__.template read_constrain_lub(0, 100, lp__); + Eigen::Matrix y_hat = + Eigen::Matrix::Constant(N, DUMMY_VAR__); + current_statement__ = 8; + if (stan::math::logical_gte(N, 1)) { + current_statement__ = 7; + stan::model::assign(y_hat, + stan::math::fma( + stan::model::rvalue(beta, "beta", stan::model::index_uni(2)), + stan::model::rvalue(pre_test, "pre_test", + stan::model::index_uni(1)), + stan::math::fma( + stan::model::rvalue(beta, "beta", stan::model::index_uni(1)), + stan::model::rvalue(treatment, "treatment", + stan::model::index_uni(1)), + stan::model::rvalue(a, "a", + stan::model::index_uni( + stan::model::rvalue(pair, "pair", stan::model::index_uni(1)))))), + "assigning variable y_hat", stan::model::index_uni(1)); + for (int i = 2; i <= N; ++i) { + current_statement__ = 7; + stan::model::assign(y_hat, + stan::math::fma( + stan::model::rvalue(beta, "beta", stan::model::index_uni(2)), + stan::model::rvalue(pre_test, "pre_test", + stan::model::index_uni(i)), + stan::math::fma( + stan::model::rvalue(beta, "beta", stan::model::index_uni(1)), + stan::model::rvalue(treatment, "treatment", + stan::model::index_uni(i)), + stan::model::rvalue(a, "a", + stan::model::index_uni( + stan::model::rvalue(pair, "pair", + stan::model::index_uni(i)))))), + "assigning variable y_hat", stan::model::index_uni(i)); + } + } { - current_statement__ = 1; - lp_accum__.add(stan::model::rvalue(foo(1.0, pstream__), "foo(1.0)", - stan::model::index_uni(1))); + current_statement__ = 9; + lp_accum__.add(stan::math::normal_lpdf(mu_a, 0, 1)); + current_statement__ = 10; + lp_accum__.add(stan::math::normal_lpdf(a, (100 * mu_a), + sigma_a)); + current_statement__ = 11; + lp_accum__.add(stan::math::normal_lpdf(beta, 0, 100)); + current_statement__ = 12; + lp_accum__.add(stan::math::normal_lpdf(y, y_hat, sigma_y)); + std::complex z = + std::complex(std::numeric_limits::quiet_NaN(), + std::numeric_limits::quiet_NaN()); + lcm_sym16__ = stan::math::to_complex(7, 5); + current_statement__ = 14; + if (pstream__) { + stan::math::stan_print(pstream__, lcm_sym16__); + stan::math::stan_print(pstream__, "\n"); + } + lcm_sym15__ = stan::math::to_complex(5, 4); + current_statement__ = 15; + lp_accum__.add(stan::math::get_real(lcm_sym15__)); } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); @@ -26520,17 +29135,82 @@ class overloaded_fn2_model final : public model_base_crtp (void) DUMMY_VAR__; constexpr bool jacobian__ = false; static constexpr const char* function__ = - "overloaded_fn2_model_namespace::write_array"; + "partial_eval_model_namespace::write_array"; // suppress unused var warning (void) function__; try { - int lcm_sym6__; - int lcm_sym5__; + double lcm_sym6__; + double lcm_sym5__; + int lcm_sym4__; + int lcm_sym3__; + int lcm_sym2__; + Eigen::Matrix a; + current_statement__ = 1; + a = in__.template read>(n_pair); + Eigen::Matrix beta; + current_statement__ = 2; + beta = in__.template read>(2); + double mu_a; + current_statement__ = 3; + mu_a = in__.template read(); + double sigma_a; + current_statement__ = 4; + sigma_a = in__.template read_constrain_lub(0, 100, lp__); + double sigma_y; + current_statement__ = 5; + sigma_y = in__.template read_constrain_lub(0, 100, lp__); + Eigen::Matrix y_hat = + Eigen::Matrix::Constant(N, + std::numeric_limits::quiet_NaN()); + out__.write(a); + out__.write(beta); + out__.write(mu_a); + out__.write(sigma_a); + 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; + if (stan::math::logical_gte(N, 1)) { + current_statement__ = 7; + stan::model::assign(y_hat, + stan::math::fma( + stan::model::rvalue(beta, "beta", stan::model::index_uni(2)), + stan::model::rvalue(pre_test, "pre_test", + stan::model::index_uni(1)), + stan::math::fma( + stan::model::rvalue(beta, "beta", stan::model::index_uni(1)), + stan::model::rvalue(treatment, "treatment", + stan::model::index_uni(1)), + stan::model::rvalue(a, "a", + stan::model::index_uni( + stan::model::rvalue(pair, "pair", stan::model::index_uni(1)))))), + "assigning variable y_hat", stan::model::index_uni(1)); + for (int i = 2; i <= N; ++i) { + current_statement__ = 7; + stan::model::assign(y_hat, + stan::math::fma( + stan::model::rvalue(beta, "beta", stan::model::index_uni(2)), + stan::model::rvalue(pre_test, "pre_test", + stan::model::index_uni(i)), + stan::math::fma( + stan::model::rvalue(beta, "beta", stan::model::index_uni(1)), + stan::model::rvalue(treatment, "treatment", + stan::model::index_uni(i)), + stan::model::rvalue(a, "a", + stan::model::index_uni( + stan::model::rvalue(pair, "pair", + stan::model::index_uni(i)))))), + "assigning variable y_hat", stan::model::index_uni(i)); + } + } + if (emit_transformed_parameters__) { + out__.write(y_hat); + } if (stan::math::logical_negation(emit_generated_quantities__)) { return ; } @@ -26552,37 +29232,108 @@ class overloaded_fn2_model final : public model_base_crtp // suppress unused var warning (void) DUMMY_VAR__; try { + int lcm_sym1__; int pos__; pos__ = 1; + Eigen::Matrix a = + Eigen::Matrix::Constant(n_pair, DUMMY_VAR__); + if (stan::math::logical_gte(n_pair, 1)) { + stan::model::assign(a, in__.read(), + "assigning variable a", stan::model::index_uni(1)); + for (int sym1__ = 2; sym1__ <= n_pair; ++sym1__) { + stan::model::assign(a, in__.read(), + "assigning variable a", stan::model::index_uni(sym1__)); + } + } + out__.write(a); + Eigen::Matrix beta = + Eigen::Matrix::Constant(2, DUMMY_VAR__); + { + stan::model::assign(beta, in__.read(), + "assigning variable beta", stan::model::index_uni(1)); + { + stan::model::assign(beta, in__.read(), + "assigning variable beta", stan::model::index_uni(2)); + } + } + out__.write(beta); + local_scalar_t__ mu_a; + mu_a = in__.read(); + out__.write(mu_a); + local_scalar_t__ sigma_a; + sigma_a = in__.read(); + out__.write_free_lub(0, 100, sigma_a); + local_scalar_t__ sigma_y; + sigma_y = in__.read(); + out__.write_free_lub(0, 100, sigma_y); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } inline void get_param_names(std::vector& names__) const { - names__ = std::vector{}; + names__ = std::vector{"a", "beta", "mu_a", "sigma_a", + "sigma_y", "y_hat"}; } inline void get_dims(std::vector>& dimss__) const { - dimss__ = std::vector>{}; + dimss__ = std::vector>{std::vector{static_cast< + size_t>( + n_pair)}, + std::vector{static_cast(2)}, + std::vector{}, std::vector{}, + std::vector{}, + std::vector{static_cast(N)}}; } inline void constrained_param_names(std::vector& param_names__, bool emit_transformed_parameters__ = true, bool emit_generated_quantities__ = true) const final { - if (emit_transformed_parameters__) {} + for (int sym25__ = 1; sym25__ <= n_pair; ++sym25__) { + param_names__.emplace_back(std::string() + "a" + '.' + + std::to_string(sym25__)); + } + for (int sym25__ = 1; sym25__ <= 2; ++sym25__) { + param_names__.emplace_back(std::string() + "beta" + '.' + + std::to_string(sym25__)); + } + param_names__.emplace_back(std::string() + "mu_a"); + param_names__.emplace_back(std::string() + "sigma_a"); + param_names__.emplace_back(std::string() + "sigma_y"); + if (emit_transformed_parameters__) { + for (int sym25__ = 1; sym25__ <= N; ++sym25__) { + param_names__.emplace_back(std::string() + "y_hat" + '.' + + std::to_string(sym25__)); + } + } 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 { - if (emit_transformed_parameters__) {} + for (int sym25__ = 1; sym25__ <= n_pair; ++sym25__) { + param_names__.emplace_back(std::string() + "a" + '.' + + std::to_string(sym25__)); + } + for (int sym25__ = 1; sym25__ <= 2; ++sym25__) { + param_names__.emplace_back(std::string() + "beta" + '.' + + std::to_string(sym25__)); + } + param_names__.emplace_back(std::string() + "mu_a"); + param_names__.emplace_back(std::string() + "sigma_a"); + param_names__.emplace_back(std::string() + "sigma_y"); + if (emit_transformed_parameters__) { + for (int sym25__ = 1; sym25__ <= N; ++sym25__) { + param_names__.emplace_back(std::string() + "y_hat" + '.' + + std::to_string(sym25__)); + } + } if (emit_generated_quantities__) {} } inline std::string get_constrained_sizedtypes() const { - return std::string("[]"); + return std::string("[{\"name\":\"a\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_pair) + "},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(2) + "},\"block\":\"parameters\"},{\"name\":\"mu_a\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_a\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_y\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"y_hat\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"transformed_parameters\"}]"); } inline std::string get_unconstrained_sizedtypes() const { - return std::string("[]"); + return std::string("[{\"name\":\"a\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_pair) + "},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(2) + "},\"block\":\"parameters\"},{\"name\":\"mu_a\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_a\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_y\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"y_hat\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"transformed_parameters\"}]"); } // Begin method overload boilerplate template inline void @@ -26591,8 +29342,8 @@ class overloaded_fn2_model final : public model_base_crtp emit_transformed_parameters = true, const bool emit_generated_quantities = true, std::ostream* pstream = nullptr) const { - const size_t num_params__ = 0; - const size_t num_transformed = emit_transformed_parameters * (0); + const size_t num_params__ = ((((n_pair + 2) + 1) + 1) + 1); + const size_t num_transformed = emit_transformed_parameters * (N); const size_t num_gen_quantities = emit_generated_quantities * (0); const size_t num_to_write = num_params__ + num_transformed + num_gen_quantities; @@ -26608,8 +29359,8 @@ class overloaded_fn2_model final : public model_base_crtp emit_transformed_parameters = true, bool emit_generated_quantities = true, std::ostream* pstream = nullptr) const { - const size_t num_params__ = 0; - const size_t num_transformed = emit_transformed_parameters * (0); + const size_t num_params__ = ((((n_pair + 2) + 1) + 1) + 1); + const size_t num_transformed = emit_transformed_parameters * (N); const size_t num_gen_quantities = emit_generated_quantities * (0); const size_t num_to_write = num_params__ + num_transformed + num_gen_quantities; @@ -26642,8 +29393,10 @@ class overloaded_fn2_model final : public model_base_crtp transform_inits(const stan::io::var_context& context, std::vector& params_i, std::vector& vars, std::ostream* pstream__ = nullptr) const { - constexpr std::array names__{}; - const std::array constrain_param_sizes__{}; + constexpr std::array + names__{"a", "beta", "mu_a", "sigma_a", "sigma_y"}; + const std::array + constrain_param_sizes__{n_pair, 2, 1, 1, 1}; const auto num_constrained_params__ = std::accumulate(constrain_param_sizes__.begin(), constrain_param_sizes__.end(), 0); @@ -26656,244 +29409,1732 @@ class overloaded_fn2_model final : public model_base_crtp params_r_flat__[flat_iter__] = param_vec__[i]; ++flat_iter__; } - ++size_iter__; - } - vars.resize(num_params_r__); - transform_inits_impl(params_r_flat__, params_i, vars, pstream__); - } -}; -} -using stan_model = overloaded_fn2_model_namespace::overloaded_fn2_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* m = new stan_model(data_context, seed, msg_stream); - return *m; -} -stan::math::profile_map& get_stan_profile_data() { - return overloaded_fn2_model_namespace::profiles__; -} -#endif - $ ../../../../../install/default/bin/stanc --O --print-cpp partial-eval.stan -// Code generated by %%NAME%% %%VERSION%% -#include -namespace partial_eval_model_namespace { -using stan::model::model_base_crtp; -using namespace stan::math; -stan::math::profile_map profiles__; -static constexpr std::array locations_array__ = - {" (found before start of program)", - " (in 'partial-eval.stan', line 10, column 2 to column 19)", - " (in 'partial-eval.stan', line 11, column 2 to column 17)", - " (in 'partial-eval.stan', line 12, column 2 to column 12)", - " (in 'partial-eval.stan', line 13, column 2 to column 35)", - " (in 'partial-eval.stan', line 14, column 2 to column 35)", - " (in 'partial-eval.stan', line 17, column 2 to column 18)", - " (in 'partial-eval.stan', line 20, column 4 to column 75)", - " (in 'partial-eval.stan', line 19, column 2 to line 20, column 75)", - " (in 'partial-eval.stan', line 24, column 2 to column 22)", - " (in 'partial-eval.stan', line 25, column 2 to column 34)", - " (in 'partial-eval.stan', line 26, column 2 to column 24)", - " (in 'partial-eval.stan', line 27, column 2 to column 29)", - " (in 'partial-eval.stan', line 29, column 2 to column 25)", - " (in 'partial-eval.stan', line 30, column 2 to column 11)", - " (in 'partial-eval.stan', line 32, column 2 to column 24)", - " (in 'partial-eval.stan', line 2, column 2 to column 17)", - " (in 'partial-eval.stan', line 3, column 2 to column 22)", - " (in 'partial-eval.stan', line 4, column 8 to column 9)", - " (in 'partial-eval.stan', line 4, column 2 to column 43)", - " (in 'partial-eval.stan', line 5, column 9 to column 10)", - " (in 'partial-eval.stan', line 5, column 2 to column 21)", - " (in 'partial-eval.stan', line 6, column 27 to column 28)", - " (in 'partial-eval.stan', line 6, column 2 to column 40)", - " (in 'partial-eval.stan', line 7, column 9 to column 10)", - " (in 'partial-eval.stan', line 7, column 2 to column 14)", - " (in 'partial-eval.stan', line 10, column 9 to column 15)", - " (in 'partial-eval.stan', line 17, column 9 to column 10)"}; -class partial_eval_model final : public model_base_crtp { - private: - double lcm_sym24__; - double lcm_sym23__; - double lcm_sym22__; - double lcm_sym21__; - double lcm_sym20__; - double lcm_sym19__; - int lcm_sym18__; - int lcm_sym17__; - int N; - int n_pair; - std::vector pair; - Eigen::Matrix pre_test_data__; - Eigen::Matrix treatment_data__; - Eigen::Matrix y_data__; - Eigen::Map> pre_test{nullptr, 0}; - Eigen::Map> treatment{nullptr, 0}; - Eigen::Map> y{nullptr, 0}; - public: - ~partial_eval_model() {} - partial_eval_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__ = - "partial_eval_model_namespace::partial_eval_model"; - // suppress unused var warning - (void) function__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - int pos__; - pos__ = 1; - current_statement__ = 16; - context__.validate_dims("data initialization", "N", "int", - std::vector{}); - N = std::numeric_limits::min(); - current_statement__ = 16; - N = context__.vals_i("N")[(1 - 1)]; - current_statement__ = 16; - stan::math::check_greater_or_equal(function__, "N", N, 0); - current_statement__ = 17; - context__.validate_dims("data initialization", "n_pair", "int", - std::vector{}); - n_pair = std::numeric_limits::min(); - current_statement__ = 17; - n_pair = context__.vals_i("n_pair")[(1 - 1)]; - current_statement__ = 17; - stan::math::check_greater_or_equal(function__, "n_pair", n_pair, 0); - current_statement__ = 18; - stan::math::validate_non_negative_index("pair", "N", N); - current_statement__ = 19; - context__.validate_dims("data initialization", "pair", "int", - std::vector{static_cast(N)}); - pair = std::vector(N, std::numeric_limits::min()); - current_statement__ = 19; - pair = context__.vals_i("pair"); - current_statement__ = 19; - stan::math::check_greater_or_equal(function__, "pair", pair, 1); - current_statement__ = 19; - stan::math::check_less_or_equal(function__, "pair", pair, n_pair); - current_statement__ = 20; - stan::math::validate_non_negative_index("pre_test", "N", N); - current_statement__ = 21; - context__.validate_dims("data initialization", "pre_test", "double", - std::vector{static_cast(N)}); - pre_test_data__ = Eigen::Matrix::Constant(N, - std::numeric_limits::quiet_NaN()); - new (&pre_test) - Eigen::Map>(pre_test_data__.data(), N); + ++size_iter__; + } + vars.resize(num_params_r__); + transform_inits_impl(params_r_flat__, params_i, vars, pstream__); + } +}; +} +using stan_model = partial_eval_model_namespace::partial_eval_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* m = new stan_model(data_context, seed, msg_stream); + return *m; +} +stan::math::profile_map& get_stan_profile_data() { + return partial_eval_model_namespace::profiles__; +} +#endif + $ ../../../../../install/default/bin/stanc --O --print-cpp partial_eval_multiply.stan +// Code generated by %%NAME%% %%VERSION%% +#include +namespace partial_eval_multiply_model_namespace { +using stan::model::model_base_crtp; +using namespace stan::math; +stan::math::profile_map profiles__; +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'partial_eval_multiply.stan', line 8, column 2 to column 20)", + " (in 'partial_eval_multiply.stan', line 9, column 2 to column 20)", + " (in 'partial_eval_multiply.stan', line 12, column 2 to column 52)", + " (in 'partial_eval_multiply.stan', line 13, column 2 to column 36)", + " (in 'partial_eval_multiply.stan', line 14, column 2 to column 36)", + " (in 'partial_eval_multiply.stan', line 15, column 2 to column 40)", + " (in 'partial_eval_multiply.stan', line 2, column 2 to column 20)", + " (in 'partial_eval_multiply.stan', line 3, column 2 to column 20)", + " (in 'partial_eval_multiply.stan', line 4, column 2 to column 20)", + " (in 'partial_eval_multiply.stan', line 5, column 2 to column 20)"}; +class partial_eval_multiply_model final : public model_base_crtp { + private: + double lcm_sym10__; + double lcm_sym9__; + double lcm_sym8__; + double lcm_sym7__; + int lcm_sym6__; + Eigen::Matrix m1_data__; + Eigen::Matrix m4_data__; + std::vector idx; + std::vector idy; + Eigen::Map> m1{nullptr, 0, 0}; + Eigen::Map> m4{nullptr, 0, 0}; + public: + ~partial_eval_multiply_model() {} + partial_eval_multiply_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__ = + "partial_eval_multiply_model_namespace::partial_eval_multiply_model"; + // suppress unused var warning + (void) function__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + int pos__; + pos__ = 1; + current_statement__ = 7; + context__.validate_dims("data initialization", "m1", "double", + std::vector{static_cast(10), static_cast(10)}); + m1_data__ = Eigen::Matrix::Constant(10, 10, + std::numeric_limits::quiet_NaN()); + new (&m1) Eigen::Map>(m1_data__.data(), 10, + 10); + { + std::vector m1_flat__; + current_statement__ = 7; + m1_flat__ = context__.vals_r("m1"); + current_statement__ = 7; + pos__ = 1; + { + { + current_statement__ = 7; + stan::model::assign(m1, + stan::model::rvalue(m1_flat__, "m1_flat__", + stan::model::index_uni(1)), "assigning variable m1", + stan::model::index_uni(1), stan::model::index_uni(1)); + current_statement__ = 7; + pos__ = 2; + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(2), + stan::model::index_uni(1)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(3), + stan::model::index_uni(1)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(4), + stan::model::index_uni(1)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(5), + stan::model::index_uni(1)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(6), + stan::model::index_uni(1)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(7), + stan::model::index_uni(1)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(8), + stan::model::index_uni(1)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(9), + stan::model::index_uni(1)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(10), + stan::model::index_uni(1)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(1), + stan::model::index_uni(2)); + current_statement__ = 7; + pos__ = (pos__ + 1); + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(2), + stan::model::index_uni(2)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(3), + stan::model::index_uni(2)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(4), + stan::model::index_uni(2)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(5), + stan::model::index_uni(2)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(6), + stan::model::index_uni(2)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(7), + stan::model::index_uni(2)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(8), + stan::model::index_uni(2)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(9), + stan::model::index_uni(2)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(10), + stan::model::index_uni(2)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(1), + stan::model::index_uni(3)); + current_statement__ = 7; + pos__ = (pos__ + 1); + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(2), + stan::model::index_uni(3)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(3), + stan::model::index_uni(3)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(4), + stan::model::index_uni(3)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(5), + stan::model::index_uni(3)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(6), + stan::model::index_uni(3)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(7), + stan::model::index_uni(3)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(8), + stan::model::index_uni(3)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(9), + stan::model::index_uni(3)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(10), + stan::model::index_uni(3)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(1), + stan::model::index_uni(4)); + current_statement__ = 7; + pos__ = (pos__ + 1); + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(2), + stan::model::index_uni(4)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(3), + stan::model::index_uni(4)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(4), + stan::model::index_uni(4)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(5), + stan::model::index_uni(4)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(6), + stan::model::index_uni(4)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(7), + stan::model::index_uni(4)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(8), + stan::model::index_uni(4)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(9), + stan::model::index_uni(4)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(10), + stan::model::index_uni(4)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(1), + stan::model::index_uni(5)); + current_statement__ = 7; + pos__ = (pos__ + 1); + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(2), + stan::model::index_uni(5)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(3), + stan::model::index_uni(5)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(4), + stan::model::index_uni(5)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(5), + stan::model::index_uni(5)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(6), + stan::model::index_uni(5)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(7), + stan::model::index_uni(5)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(8), + stan::model::index_uni(5)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(9), + stan::model::index_uni(5)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(10), + stan::model::index_uni(5)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(1), + stan::model::index_uni(6)); + current_statement__ = 7; + pos__ = (pos__ + 1); + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(2), + stan::model::index_uni(6)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(3), + stan::model::index_uni(6)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(4), + stan::model::index_uni(6)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(5), + stan::model::index_uni(6)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(6), + stan::model::index_uni(6)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(7), + stan::model::index_uni(6)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(8), + stan::model::index_uni(6)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(9), + stan::model::index_uni(6)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(10), + stan::model::index_uni(6)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(1), + stan::model::index_uni(7)); + current_statement__ = 7; + pos__ = (pos__ + 1); + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(2), + stan::model::index_uni(7)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(3), + stan::model::index_uni(7)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(4), + stan::model::index_uni(7)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(5), + stan::model::index_uni(7)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(6), + stan::model::index_uni(7)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(7), + stan::model::index_uni(7)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(8), + stan::model::index_uni(7)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(9), + stan::model::index_uni(7)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(10), + stan::model::index_uni(7)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(1), + stan::model::index_uni(8)); + current_statement__ = 7; + pos__ = (pos__ + 1); + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(2), + stan::model::index_uni(8)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(3), + stan::model::index_uni(8)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(4), + stan::model::index_uni(8)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(5), + stan::model::index_uni(8)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(6), + stan::model::index_uni(8)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(7), + stan::model::index_uni(8)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(8), + stan::model::index_uni(8)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(9), + stan::model::index_uni(8)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(10), + stan::model::index_uni(8)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(1), + stan::model::index_uni(9)); + current_statement__ = 7; + pos__ = (pos__ + 1); + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(2), + stan::model::index_uni(9)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(3), + stan::model::index_uni(9)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(4), + stan::model::index_uni(9)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(5), + stan::model::index_uni(9)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(6), + stan::model::index_uni(9)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(7), + stan::model::index_uni(9)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(8), + stan::model::index_uni(9)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(9), + stan::model::index_uni(9)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(10), + stan::model::index_uni(9)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(1), + stan::model::index_uni(10)); + current_statement__ = 7; + pos__ = (pos__ + 1); + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(2), + stan::model::index_uni(10)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(3), + stan::model::index_uni(10)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(4), + stan::model::index_uni(10)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(5), + stan::model::index_uni(10)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(6), + stan::model::index_uni(10)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(7), + stan::model::index_uni(10)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(8), + stan::model::index_uni(10)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(9), + stan::model::index_uni(10)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + { + current_statement__ = 7; + stan::model::assign(m1, m1_flat__[(pos__ - 1)], + "assigning variable m1", stan::model::index_uni(10), + stan::model::index_uni(10)); + current_statement__ = 7; + pos__ = (pos__ + 1); + } + } + } + } + current_statement__ = 8; + context__.validate_dims("data initialization", "m4", "double", + std::vector{static_cast(10), static_cast(10)}); + m4_data__ = Eigen::Matrix::Constant(10, 10, + std::numeric_limits::quiet_NaN()); + new (&m4) Eigen::Map>(m4_data__.data(), 10, + 10); { - std::vector pre_test_flat__; - current_statement__ = 21; - pre_test_flat__ = context__.vals_r("pre_test"); - current_statement__ = 21; + std::vector m4_flat__; + current_statement__ = 8; + m4_flat__ = context__.vals_r("m4"); + current_statement__ = 8; pos__ = 1; - lcm_sym17__ = stan::math::logical_gte(N, 1); - if (lcm_sym17__) { - current_statement__ = 21; - stan::model::assign(pre_test, - stan::model::rvalue(pre_test_flat__, "pre_test_flat__", - stan::model::index_uni(1)), "assigning variable pre_test", - stan::model::index_uni(1)); - current_statement__ = 21; - pos__ = 2; - for (int sym1__ = 2; sym1__ <= N; ++sym1__) { - current_statement__ = 21; - stan::model::assign(pre_test, pre_test_flat__[(pos__ - 1)], - "assigning variable pre_test", stan::model::index_uni(sym1__)); - current_statement__ = 21; + { + { + current_statement__ = 8; + stan::model::assign(m4, + stan::model::rvalue(m4_flat__, "m4_flat__", + stan::model::index_uni(1)), "assigning variable m4", + stan::model::index_uni(1), stan::model::index_uni(1)); + current_statement__ = 8; + pos__ = 2; + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(2), + stan::model::index_uni(1)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(3), + stan::model::index_uni(1)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(4), + stan::model::index_uni(1)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(5), + stan::model::index_uni(1)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(6), + stan::model::index_uni(1)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(7), + stan::model::index_uni(1)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(8), + stan::model::index_uni(1)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(9), + stan::model::index_uni(1)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(10), + stan::model::index_uni(1)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(1), + stan::model::index_uni(2)); + current_statement__ = 8; + pos__ = (pos__ + 1); + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(2), + stan::model::index_uni(2)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(3), + stan::model::index_uni(2)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(4), + stan::model::index_uni(2)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(5), + stan::model::index_uni(2)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(6), + stan::model::index_uni(2)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(7), + stan::model::index_uni(2)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(8), + stan::model::index_uni(2)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(9), + stan::model::index_uni(2)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(10), + stan::model::index_uni(2)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(1), + stan::model::index_uni(3)); + current_statement__ = 8; + pos__ = (pos__ + 1); + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(2), + stan::model::index_uni(3)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(3), + stan::model::index_uni(3)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(4), + stan::model::index_uni(3)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(5), + stan::model::index_uni(3)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(6), + stan::model::index_uni(3)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(7), + stan::model::index_uni(3)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(8), + stan::model::index_uni(3)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(9), + stan::model::index_uni(3)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(10), + stan::model::index_uni(3)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(1), + stan::model::index_uni(4)); + current_statement__ = 8; + pos__ = (pos__ + 1); + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(2), + stan::model::index_uni(4)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(3), + stan::model::index_uni(4)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(4), + stan::model::index_uni(4)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(5), + stan::model::index_uni(4)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(6), + stan::model::index_uni(4)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(7), + stan::model::index_uni(4)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(8), + stan::model::index_uni(4)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(9), + stan::model::index_uni(4)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(10), + stan::model::index_uni(4)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(1), + stan::model::index_uni(5)); + current_statement__ = 8; + pos__ = (pos__ + 1); + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(2), + stan::model::index_uni(5)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(3), + stan::model::index_uni(5)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(4), + stan::model::index_uni(5)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(5), + stan::model::index_uni(5)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(6), + stan::model::index_uni(5)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(7), + stan::model::index_uni(5)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(8), + stan::model::index_uni(5)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(9), + stan::model::index_uni(5)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(10), + stan::model::index_uni(5)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(1), + stan::model::index_uni(6)); + current_statement__ = 8; + pos__ = (pos__ + 1); + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(2), + stan::model::index_uni(6)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(3), + stan::model::index_uni(6)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(4), + stan::model::index_uni(6)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(5), + stan::model::index_uni(6)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(6), + stan::model::index_uni(6)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(7), + stan::model::index_uni(6)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(8), + stan::model::index_uni(6)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(9), + stan::model::index_uni(6)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(10), + stan::model::index_uni(6)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(1), + stan::model::index_uni(7)); + current_statement__ = 8; + pos__ = (pos__ + 1); + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(2), + stan::model::index_uni(7)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(3), + stan::model::index_uni(7)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(4), + stan::model::index_uni(7)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(5), + stan::model::index_uni(7)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(6), + stan::model::index_uni(7)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(7), + stan::model::index_uni(7)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(8), + stan::model::index_uni(7)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(9), + stan::model::index_uni(7)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(10), + stan::model::index_uni(7)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(1), + stan::model::index_uni(8)); + current_statement__ = 8; pos__ = (pos__ + 1); + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(2), + stan::model::index_uni(8)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(3), + stan::model::index_uni(8)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(4), + stan::model::index_uni(8)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(5), + stan::model::index_uni(8)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(6), + stan::model::index_uni(8)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(7), + stan::model::index_uni(8)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(8), + stan::model::index_uni(8)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(9), + stan::model::index_uni(8)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(10), + stan::model::index_uni(8)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } } - } - } - current_statement__ = 22; - stan::math::validate_non_negative_index("treatment", "N", N); - current_statement__ = 23; - context__.validate_dims("data initialization", "treatment", "double", - std::vector{static_cast(N)}); - treatment_data__ = Eigen::Matrix::Constant(N, - std::numeric_limits::quiet_NaN()); - new (&treatment) - Eigen::Map>(treatment_data__.data(), N); - { - std::vector treatment_flat__; - current_statement__ = 23; - treatment_flat__ = context__.vals_r("treatment"); - current_statement__ = 23; - pos__ = 1; - current_statement__ = 23; - if (lcm_sym17__) { - current_statement__ = 23; - stan::model::assign(treatment, - stan::model::rvalue(treatment_flat__, "treatment_flat__", - stan::model::index_uni(1)), "assigning variable treatment", - stan::model::index_uni(1)); - current_statement__ = 23; - pos__ = 2; - for (int sym1__ = 2; sym1__ <= N; ++sym1__) { - current_statement__ = 23; - stan::model::assign(treatment, treatment_flat__[(pos__ - 1)], - "assigning variable treatment", stan::model::index_uni(sym1__)); - current_statement__ = 23; + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(1), + stan::model::index_uni(9)); + current_statement__ = 8; pos__ = (pos__ + 1); + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(2), + stan::model::index_uni(9)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(3), + stan::model::index_uni(9)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(4), + stan::model::index_uni(9)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(5), + stan::model::index_uni(9)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(6), + stan::model::index_uni(9)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(7), + stan::model::index_uni(9)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(8), + stan::model::index_uni(9)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(9), + stan::model::index_uni(9)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(10), + stan::model::index_uni(9)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } } - } - } - current_statement__ = 23; - stan::math::check_greater_or_equal(function__, "treatment", treatment, - 0); - current_statement__ = 23; - stan::math::check_less_or_equal(function__, "treatment", treatment, 1); - current_statement__ = 24; - stan::math::validate_non_negative_index("y", "N", N); - current_statement__ = 25; - 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__ = 25; - y_flat__ = context__.vals_r("y"); - current_statement__ = 25; - pos__ = 1; - current_statement__ = 25; - if (lcm_sym17__) { - current_statement__ = 25; - stan::model::assign(y, - stan::model::rvalue(y_flat__, "y_flat__", - stan::model::index_uni(1)), "assigning variable y", - stan::model::index_uni(1)); - current_statement__ = 25; - pos__ = 2; - for (int sym1__ = 2; sym1__ <= N; ++sym1__) { - current_statement__ = 25; - stan::model::assign(y, y_flat__[(pos__ - 1)], - "assigning variable y", stan::model::index_uni(sym1__)); - current_statement__ = 25; + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(1), + stan::model::index_uni(10)); + current_statement__ = 8; pos__ = (pos__ + 1); + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(2), + stan::model::index_uni(10)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(3), + stan::model::index_uni(10)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(4), + stan::model::index_uni(10)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(5), + stan::model::index_uni(10)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(6), + stan::model::index_uni(10)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(7), + stan::model::index_uni(10)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(8), + stan::model::index_uni(10)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(9), + stan::model::index_uni(10)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } + { + current_statement__ = 8; + stan::model::assign(m4, m4_flat__[(pos__ - 1)], + "assigning variable m4", stan::model::index_uni(10), + stan::model::index_uni(10)); + current_statement__ = 8; + pos__ = (pos__ + 1); + } } } } - current_statement__ = 26; - stan::math::validate_non_negative_index("a", "n_pair", n_pair); - current_statement__ = 27; - stan::math::validate_non_negative_index("y_hat", "N", N); + current_statement__ = 9; + context__.validate_dims("data initialization", "idx", "int", + std::vector{static_cast(10)}); + idx = std::vector(10, std::numeric_limits::min()); + current_statement__ = 9; + idx = context__.vals_i("idx"); + current_statement__ = 10; + context__.validate_dims("data initialization", "idy", "int", + std::vector{static_cast(10)}); + idy = std::vector(10, std::numeric_limits::min()); + current_statement__ = 10; + idy = context__.vals_i("idy"); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } - num_params_r__ = n_pair + 2 + 1 + 1 + 1; + num_params_r__ = (10 * 10) + (10 * 10); } inline std::string model_name() const final { - return "partial_eval_model"; + return "partial_eval_multiply_model"; } inline std::vector model_compile_info() const noexcept { return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", @@ -26915,95 +31156,47 @@ class partial_eval_model final : public model_base_crtp { // suppress unused var warning (void) DUMMY_VAR__; static constexpr const char* function__ = - "partial_eval_model_namespace::log_prob"; + "partial_eval_multiply_model_namespace::log_prob"; // suppress unused var warning (void) function__; try { - std::complex lcm_sym16__; - std::complex lcm_sym15__; - double lcm_sym14__; - double lcm_sym13__; - double lcm_sym12__; - double lcm_sym11__; - double lcm_sym10__; - double lcm_sym9__; - double lcm_sym8__; - int lcm_sym7__; - Eigen::Matrix a; + Eigen::Matrix lcm_sym5__; + Eigen::Matrix lcm_sym4__; + double lcm_sym3__; + stan::conditional_var_value_t> m2; current_statement__ = 1; - a = in__.template read>(n_pair); - Eigen::Matrix beta; + m2 = in__.template read< + stan::conditional_var_value_t>>(10, 10); + stan::conditional_var_value_t> m3; current_statement__ = 2; - beta = in__.template read>(2); - local_scalar_t__ mu_a; - current_statement__ = 3; - mu_a = in__.template read(); - local_scalar_t__ sigma_a; - current_statement__ = 4; - sigma_a = in__.template read_constrain_lub(0, 100, lp__); - local_scalar_t__ sigma_y; - current_statement__ = 5; - sigma_y = in__.template read_constrain_lub(0, 100, lp__); - Eigen::Matrix y_hat = - Eigen::Matrix::Constant(N, DUMMY_VAR__); - current_statement__ = 8; - if (stan::math::logical_gte(N, 1)) { - current_statement__ = 7; - stan::model::assign(y_hat, - stan::math::fma( - stan::model::rvalue(beta, "beta", stan::model::index_uni(2)), - stan::model::rvalue(pre_test, "pre_test", - stan::model::index_uni(1)), - stan::math::fma( - stan::model::rvalue(beta, "beta", stan::model::index_uni(1)), - stan::model::rvalue(treatment, "treatment", - stan::model::index_uni(1)), - stan::model::rvalue(a, "a", - stan::model::index_uni( - stan::model::rvalue(pair, "pair", stan::model::index_uni(1)))))), - "assigning variable y_hat", stan::model::index_uni(1)); - for (int i = 2; i <= N; ++i) { - current_statement__ = 7; - stan::model::assign(y_hat, - stan::math::fma( - stan::model::rvalue(beta, "beta", stan::model::index_uni(2)), - stan::model::rvalue(pre_test, "pre_test", - stan::model::index_uni(i)), - stan::math::fma( - stan::model::rvalue(beta, "beta", stan::model::index_uni(1)), - stan::model::rvalue(treatment, "treatment", - stan::model::index_uni(i)), - stan::model::rvalue(a, "a", - stan::model::index_uni( - stan::model::rvalue(pair, "pair", - stan::model::index_uni(i)))))), - "assigning variable y_hat", stan::model::index_uni(i)); - } - } + m3 = in__.template read< + stan::conditional_var_value_t>>(10, 10); { - current_statement__ = 9; - lp_accum__.add(stan::math::normal_lpdf(mu_a, 0, 1)); - current_statement__ = 10; - lp_accum__.add(stan::math::normal_lpdf(a, (100 * mu_a), - sigma_a)); - current_statement__ = 11; - lp_accum__.add(stan::math::normal_lpdf(beta, 0, 100)); - current_statement__ = 12; - lp_accum__.add(stan::math::normal_lpdf(y, y_hat, sigma_y)); - std::complex z = - std::complex(std::numeric_limits::quiet_NaN(), + Eigen::Matrix m5 = + Eigen::Matrix::Constant(10, 10, std::numeric_limits::quiet_NaN()); - lcm_sym16__ = stan::math::to_complex(7, 5); - current_statement__ = 14; - if (pstream__) { - stan::math::stan_print(pstream__, lcm_sym16__); - stan::math::stan_print(pstream__, "\n"); - } - lcm_sym15__ = stan::math::to_complex(5, 4); - current_statement__ = 15; - lp_accum__.add(stan::math::get_real(lcm_sym15__)); + stan::model::assign(lcm_sym4__, + stan::math::add( + stan::math::multiply(m1, + stan::math::elt_multiply(m2, + stan::model::rvalue(m3, "m3", stan::model::index_multi(idx), + stan::model::index_multi(idy)))), m4), + "assigning variable lcm_sym4__"); + Eigen::Matrix m6 = + Eigen::Matrix::Constant(10, 10, + std::numeric_limits::quiet_NaN()); + stan::model::assign(lcm_sym5__, stan::math::fma(m1, m2, m4), + "assigning variable lcm_sym5__"); + Eigen::Matrix m7 = + Eigen::Matrix::Constant(10, 10, + std::numeric_limits::quiet_NaN()); + current_statement__ = 6; + lp_accum__.add(((stan::math::sum(lcm_sym4__) + + stan::math::sum(lcm_sym5__)) + stan::math::sum(lcm_sym5__))); } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); @@ -27021,3229 +31214,1939 @@ class partial_eval_model final : public model_base_crtp { VecVar& vars__, const bool emit_transformed_parameters__ = true, const bool emit_generated_quantities__ = true, std::ostream* - pstream__ = nullptr) const { - using local_scalar_t__ = double; - 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; - // 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()); - // suppress unused var warning - (void) DUMMY_VAR__; - constexpr bool jacobian__ = false; - static constexpr const char* function__ = - "partial_eval_model_namespace::write_array"; - // suppress unused var warning - (void) function__; - try { - double lcm_sym6__; - double lcm_sym5__; - int lcm_sym4__; - int lcm_sym3__; - int lcm_sym2__; - Eigen::Matrix a; - current_statement__ = 1; - a = in__.template read>(n_pair); - Eigen::Matrix beta; - current_statement__ = 2; - beta = in__.template read>(2); - double mu_a; - current_statement__ = 3; - mu_a = in__.template read(); - double sigma_a; - current_statement__ = 4; - sigma_a = in__.template read_constrain_lub(0, 100, lp__); - double sigma_y; - current_statement__ = 5; - sigma_y = in__.template read_constrain_lub(0, 100, lp__); - Eigen::Matrix y_hat = - Eigen::Matrix::Constant(N, - std::numeric_limits::quiet_NaN()); - out__.write(a); - out__.write(beta); - out__.write(mu_a); - out__.write(sigma_a); - 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; - if (stan::math::logical_gte(N, 1)) { - current_statement__ = 7; - stan::model::assign(y_hat, - stan::math::fma( - stan::model::rvalue(beta, "beta", stan::model::index_uni(2)), - stan::model::rvalue(pre_test, "pre_test", - stan::model::index_uni(1)), - stan::math::fma( - stan::model::rvalue(beta, "beta", stan::model::index_uni(1)), - stan::model::rvalue(treatment, "treatment", - stan::model::index_uni(1)), - stan::model::rvalue(a, "a", - stan::model::index_uni( - stan::model::rvalue(pair, "pair", stan::model::index_uni(1)))))), - "assigning variable y_hat", stan::model::index_uni(1)); - for (int i = 2; i <= N; ++i) { - current_statement__ = 7; - stan::model::assign(y_hat, - stan::math::fma( - stan::model::rvalue(beta, "beta", stan::model::index_uni(2)), - stan::model::rvalue(pre_test, "pre_test", - stan::model::index_uni(i)), - stan::math::fma( - stan::model::rvalue(beta, "beta", stan::model::index_uni(1)), - stan::model::rvalue(treatment, "treatment", - stan::model::index_uni(i)), - stan::model::rvalue(a, "a", - stan::model::index_uni( - stan::model::rvalue(pair, "pair", - stan::model::index_uni(i)))))), - "assigning variable y_hat", stan::model::index_uni(i)); - } - } - if (emit_transformed_parameters__) { - out__.write(y_hat); - } - if (stan::math::logical_negation(emit_generated_quantities__)) { - return ; - } - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } - } - template * = nullptr, - stan::require_vector_like_vt* = nullptr> - inline void - transform_inits_impl(VecVar& params_r__, VecI& params_i__, VecVar& vars__, - std::ostream* pstream__ = nullptr) const { + pstream__ = nullptr) const { using local_scalar_t__ = double; 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; + // 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()); // suppress unused var warning (void) DUMMY_VAR__; + constexpr bool jacobian__ = false; + static constexpr const char* function__ = + "partial_eval_multiply_model_namespace::write_array"; + // suppress unused var warning + (void) function__; try { + int lcm_sym2__; int lcm_sym1__; - int pos__; - pos__ = 1; - Eigen::Matrix a = - Eigen::Matrix::Constant(n_pair, DUMMY_VAR__); - if (stan::math::logical_gte(n_pair, 1)) { - stan::model::assign(a, in__.read(), - "assigning variable a", stan::model::index_uni(1)); - for (int sym1__ = 2; sym1__ <= n_pair; ++sym1__) { - stan::model::assign(a, in__.read(), - "assigning variable a", stan::model::index_uni(sym1__)); - } + Eigen::Matrix m2; + current_statement__ = 1; + m2 = in__.template read>(10, 10); + Eigen::Matrix m3; + current_statement__ = 2; + m3 = in__.template read>(10, 10); + out__.write(m2); + out__.write(m3); + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { + return ; } - out__.write(a); - Eigen::Matrix beta = - Eigen::Matrix::Constant(2, DUMMY_VAR__); - { - stan::model::assign(beta, in__.read(), - "assigning variable beta", stan::model::index_uni(1)); - { - stan::model::assign(beta, in__.read(), - "assigning variable beta", stan::model::index_uni(2)); - } + if (stan::math::logical_negation(emit_generated_quantities__)) { + return ; } - out__.write(beta); - local_scalar_t__ mu_a; - mu_a = in__.read(); - out__.write(mu_a); - local_scalar_t__ sigma_a; - sigma_a = in__.read(); - out__.write_free_lub(0, 100, sigma_a); - local_scalar_t__ sigma_y; - sigma_y = in__.read(); - out__.write_free_lub(0, 100, sigma_y); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } - inline void get_param_names(std::vector& names__) const { - names__ = std::vector{"a", "beta", "mu_a", "sigma_a", - "sigma_y", "y_hat"}; - } - inline void get_dims(std::vector>& dimss__) const { - dimss__ = std::vector>{std::vector{static_cast< - size_t>( - n_pair)}, - std::vector{static_cast(2)}, - std::vector{}, std::vector{}, - std::vector{}, - std::vector{static_cast(N)}}; - } - inline void - constrained_param_names(std::vector& param_names__, bool - emit_transformed_parameters__ = true, bool - emit_generated_quantities__ = true) const final { - for (int sym25__ = 1; sym25__ <= n_pair; ++sym25__) { - param_names__.emplace_back(std::string() + "a" + '.' + - std::to_string(sym25__)); - } - for (int sym25__ = 1; sym25__ <= 2; ++sym25__) { - param_names__.emplace_back(std::string() + "beta" + '.' + - std::to_string(sym25__)); - } - param_names__.emplace_back(std::string() + "mu_a"); - param_names__.emplace_back(std::string() + "sigma_a"); - param_names__.emplace_back(std::string() + "sigma_y"); - if (emit_transformed_parameters__) { - for (int sym25__ = 1; sym25__ <= N; ++sym25__) { - param_names__.emplace_back(std::string() + "y_hat" + '.' + - std::to_string(sym25__)); - } - } - 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 sym25__ = 1; sym25__ <= n_pair; ++sym25__) { - param_names__.emplace_back(std::string() + "a" + '.' + - std::to_string(sym25__)); - } - for (int sym25__ = 1; sym25__ <= 2; ++sym25__) { - param_names__.emplace_back(std::string() + "beta" + '.' + - std::to_string(sym25__)); - } - param_names__.emplace_back(std::string() + "mu_a"); - param_names__.emplace_back(std::string() + "sigma_a"); - param_names__.emplace_back(std::string() + "sigma_y"); - if (emit_transformed_parameters__) { - for (int sym25__ = 1; sym25__ <= N; ++sym25__) { - param_names__.emplace_back(std::string() + "y_hat" + '.' + - std::to_string(sym25__)); - } - } - if (emit_generated_quantities__) {} - } - inline std::string get_constrained_sizedtypes() const { - return std::string("[{\"name\":\"a\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_pair) + "},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(2) + "},\"block\":\"parameters\"},{\"name\":\"mu_a\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_a\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_y\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"y_hat\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"transformed_parameters\"}]"); - } - inline std::string get_unconstrained_sizedtypes() const { - return std::string("[{\"name\":\"a\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_pair) + "},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(2) + "},\"block\":\"parameters\"},{\"name\":\"mu_a\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_a\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_y\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"y_hat\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"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__ = ((((n_pair + 2) + 1) + 1) + 1); - const size_t num_transformed = emit_transformed_parameters * (N); - 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__ = ((((n_pair + 2) + 1) + 1) + 1); - const size_t num_transformed = emit_transformed_parameters * (N); - 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 { - constexpr std::array - names__{"a", "beta", "mu_a", "sigma_a", "sigma_y"}; - const std::array - constrain_param_sizes__{n_pair, 2, 1, 1, 1}; - const auto num_constrained_params__ = - std::accumulate(constrain_param_sizes__.begin(), - constrain_param_sizes__.end(), 0); - std::vector params_r_flat__(num_constrained_params__); - Eigen::Index size_iter__ = 0; - Eigen::Index flat_iter__ = 0; - for (auto&& param_name__: names__) { - const auto param_vec__ = context.vals_r(param_name__); - for (Eigen::Index i = 0; i < constrain_param_sizes__[size_iter__]; ++i) { - params_r_flat__[flat_iter__] = param_vec__[i]; - ++flat_iter__; - } - ++size_iter__; - } - vars.resize(num_params_r__); - transform_inits_impl(params_r_flat__, params_i, vars, pstream__); - } -}; -} -using stan_model = partial_eval_model_namespace::partial_eval_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* m = new stan_model(data_context, seed, msg_stream); - return *m; -} -stan::math::profile_map& get_stan_profile_data() { - return partial_eval_model_namespace::profiles__; -} -#endif - $ ../../../../../install/default/bin/stanc --O --print-cpp partial_eval_multiply.stan -// Code generated by %%NAME%% %%VERSION%% -#include -namespace partial_eval_multiply_model_namespace { -using stan::model::model_base_crtp; -using namespace stan::math; -stan::math::profile_map profiles__; -static constexpr std::array locations_array__ = - {" (found before start of program)", - " (in 'partial_eval_multiply.stan', line 8, column 2 to column 20)", - " (in 'partial_eval_multiply.stan', line 9, column 2 to column 20)", - " (in 'partial_eval_multiply.stan', line 12, column 2 to column 52)", - " (in 'partial_eval_multiply.stan', line 13, column 2 to column 36)", - " (in 'partial_eval_multiply.stan', line 14, column 2 to column 36)", - " (in 'partial_eval_multiply.stan', line 15, column 2 to column 40)", - " (in 'partial_eval_multiply.stan', line 2, column 2 to column 20)", - " (in 'partial_eval_multiply.stan', line 3, column 2 to column 20)", - " (in 'partial_eval_multiply.stan', line 4, column 2 to column 20)", - " (in 'partial_eval_multiply.stan', line 5, column 2 to column 20)"}; -class partial_eval_multiply_model final : public model_base_crtp { - private: - double lcm_sym10__; - double lcm_sym9__; - double lcm_sym8__; - double lcm_sym7__; - int lcm_sym6__; - Eigen::Matrix m1_data__; - Eigen::Matrix m4_data__; - std::vector idx; - std::vector idy; - Eigen::Map> m1{nullptr, 0, 0}; - Eigen::Map> m4{nullptr, 0, 0}; - public: - ~partial_eval_multiply_model() {} - partial_eval_multiply_model(stan::io::var_context& context__, unsigned int - random_seed__ = 0, std::ostream* - pstream__ = nullptr) : model_base_crtp(0) { - int current_statement__ = 0; + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline void + transform_inits_impl(VecVar& params_r__, VecI& params_i__, VecVar& vars__, + std::ostream* pstream__ = nullptr) const { 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__ = - "partial_eval_multiply_model_namespace::partial_eval_multiply_model"; - // suppress unused var warning - (void) function__; + 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__ = 1; - current_statement__ = 7; - context__.validate_dims("data initialization", "m1", "double", - std::vector{static_cast(10), static_cast(10)}); - m1_data__ = Eigen::Matrix::Constant(10, 10, - std::numeric_limits::quiet_NaN()); - new (&m1) Eigen::Map>(m1_data__.data(), 10, - 10); + Eigen::Matrix m2 = + Eigen::Matrix::Constant(10, 10, DUMMY_VAR__); { - std::vector m1_flat__; - current_statement__ = 7; - m1_flat__ = context__.vals_r("m1"); - current_statement__ = 7; - pos__ = 1; { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(1), + stan::model::index_uni(1)); { - current_statement__ = 7; - stan::model::assign(m1, - stan::model::rvalue(m1_flat__, "m1_flat__", - stan::model::index_uni(1)), "assigning variable m1", - stan::model::index_uni(1), stan::model::index_uni(1)); - current_statement__ = 7; - pos__ = 2; - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(2), - stan::model::index_uni(1)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(3), - stan::model::index_uni(1)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(4), - stan::model::index_uni(1)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(5), - stan::model::index_uni(1)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(6), - stan::model::index_uni(1)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(7), - stan::model::index_uni(1)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(8), - stan::model::index_uni(1)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(9), - stan::model::index_uni(1)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(10), - stan::model::index_uni(1)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(2), + stan::model::index_uni(1)); } { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(1), + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(3), + stan::model::index_uni(1)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(4), + stan::model::index_uni(1)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(5), + stan::model::index_uni(1)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(6), + stan::model::index_uni(1)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(7), + stan::model::index_uni(1)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(8), + stan::model::index_uni(1)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(9), + stan::model::index_uni(1)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(10), + stan::model::index_uni(1)); + } + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(1), + stan::model::index_uni(2)); + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(2), + stan::model::index_uni(2)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(3), + stan::model::index_uni(2)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(4), + stan::model::index_uni(2)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(5), + stan::model::index_uni(2)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(6), stan::model::index_uni(2)); - current_statement__ = 7; - pos__ = (pos__ + 1); - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(2), - stan::model::index_uni(2)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(3), - stan::model::index_uni(2)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(4), - stan::model::index_uni(2)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(5), - stan::model::index_uni(2)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(6), - stan::model::index_uni(2)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(7), - stan::model::index_uni(2)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(8), - stan::model::index_uni(2)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(9), - stan::model::index_uni(2)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(10), - stan::model::index_uni(2)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } } { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(1), - stan::model::index_uni(3)); - current_statement__ = 7; - pos__ = (pos__ + 1); - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(2), - stan::model::index_uni(3)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(3), - stan::model::index_uni(3)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(4), - stan::model::index_uni(3)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(5), - stan::model::index_uni(3)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(6), - stan::model::index_uni(3)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(7), - stan::model::index_uni(3)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(8), - stan::model::index_uni(3)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(9), - stan::model::index_uni(3)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(10), - stan::model::index_uni(3)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(7), + stan::model::index_uni(2)); } { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(1), - stan::model::index_uni(4)); - current_statement__ = 7; - pos__ = (pos__ + 1); - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(2), - stan::model::index_uni(4)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(3), - stan::model::index_uni(4)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(4), - stan::model::index_uni(4)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(5), - stan::model::index_uni(4)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(6), - stan::model::index_uni(4)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(7), - stan::model::index_uni(4)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(8), - stan::model::index_uni(4)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(9), - stan::model::index_uni(4)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(10), - stan::model::index_uni(4)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(8), + stan::model::index_uni(2)); } { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(1), - stan::model::index_uni(5)); - current_statement__ = 7; - pos__ = (pos__ + 1); - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(2), - stan::model::index_uni(5)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(3), - stan::model::index_uni(5)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(4), - stan::model::index_uni(5)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(5), - stan::model::index_uni(5)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(6), - stan::model::index_uni(5)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(7), - stan::model::index_uni(5)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(8), - stan::model::index_uni(5)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(9), - stan::model::index_uni(5)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(10), - stan::model::index_uni(5)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(9), + stan::model::index_uni(2)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(10), + stan::model::index_uni(2)); + } + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(1), + stan::model::index_uni(3)); + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(2), + stan::model::index_uni(3)); } { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(1), - stan::model::index_uni(6)); - current_statement__ = 7; - pos__ = (pos__ + 1); - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(2), - stan::model::index_uni(6)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(3), - stan::model::index_uni(6)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(4), - stan::model::index_uni(6)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(5), - stan::model::index_uni(6)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(6), - stan::model::index_uni(6)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(7), - stan::model::index_uni(6)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(8), - stan::model::index_uni(6)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(9), - stan::model::index_uni(6)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(10), - stan::model::index_uni(6)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(3), + stan::model::index_uni(3)); } { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(1), - stan::model::index_uni(7)); - current_statement__ = 7; - pos__ = (pos__ + 1); - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(2), - stan::model::index_uni(7)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(3), - stan::model::index_uni(7)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(4), - stan::model::index_uni(7)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(5), - stan::model::index_uni(7)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(6), - stan::model::index_uni(7)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(7), - stan::model::index_uni(7)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(8), - stan::model::index_uni(7)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(9), - stan::model::index_uni(7)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(10), - stan::model::index_uni(7)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(4), + stan::model::index_uni(3)); } { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(1), - stan::model::index_uni(8)); - current_statement__ = 7; - pos__ = (pos__ + 1); - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(2), - stan::model::index_uni(8)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(3), - stan::model::index_uni(8)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(4), - stan::model::index_uni(8)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(5), - stan::model::index_uni(8)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(6), - stan::model::index_uni(8)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(7), - stan::model::index_uni(8)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(8), - stan::model::index_uni(8)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(9), - stan::model::index_uni(8)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(10), - stan::model::index_uni(8)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(5), + stan::model::index_uni(3)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(6), + stan::model::index_uni(3)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(7), + stan::model::index_uni(3)); } { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(1), - stan::model::index_uni(9)); - current_statement__ = 7; - pos__ = (pos__ + 1); - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(2), - stan::model::index_uni(9)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(3), - stan::model::index_uni(9)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(4), - stan::model::index_uni(9)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(5), - stan::model::index_uni(9)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(6), - stan::model::index_uni(9)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(7), - stan::model::index_uni(9)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(8), - stan::model::index_uni(9)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(9), - stan::model::index_uni(9)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(10), - stan::model::index_uni(9)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(8), + stan::model::index_uni(3)); } { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(1), - stan::model::index_uni(10)); - current_statement__ = 7; - pos__ = (pos__ + 1); - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(2), - stan::model::index_uni(10)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(3), - stan::model::index_uni(10)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(4), - stan::model::index_uni(10)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(5), - stan::model::index_uni(10)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(6), - stan::model::index_uni(10)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(7), - stan::model::index_uni(10)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(8), - stan::model::index_uni(10)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(9), - stan::model::index_uni(10)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } - { - current_statement__ = 7; - stan::model::assign(m1, m1_flat__[(pos__ - 1)], - "assigning variable m1", stan::model::index_uni(10), - stan::model::index_uni(10)); - current_statement__ = 7; - pos__ = (pos__ + 1); - } + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(9), + stan::model::index_uni(3)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(10), + stan::model::index_uni(3)); + } + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(1), + stan::model::index_uni(4)); + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(2), + stan::model::index_uni(4)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(3), + stan::model::index_uni(4)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(4), + stan::model::index_uni(4)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(5), + stan::model::index_uni(4)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(6), + stan::model::index_uni(4)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(7), + stan::model::index_uni(4)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(8), + stan::model::index_uni(4)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(9), + stan::model::index_uni(4)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(10), + stan::model::index_uni(4)); } } - } - current_statement__ = 8; - context__.validate_dims("data initialization", "m4", "double", - std::vector{static_cast(10), static_cast(10)}); - m4_data__ = Eigen::Matrix::Constant(10, 10, - std::numeric_limits::quiet_NaN()); - new (&m4) Eigen::Map>(m4_data__.data(), 10, - 10); - { - std::vector m4_flat__; - current_statement__ = 8; - m4_flat__ = context__.vals_r("m4"); - current_statement__ = 8; - pos__ = 1; { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(1), + stan::model::index_uni(5)); + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(2), + stan::model::index_uni(5)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(3), + stan::model::index_uni(5)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(4), + stan::model::index_uni(5)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(5), + stan::model::index_uni(5)); + } { - current_statement__ = 8; - stan::model::assign(m4, - stan::model::rvalue(m4_flat__, "m4_flat__", - stan::model::index_uni(1)), "assigning variable m4", - stan::model::index_uni(1), stan::model::index_uni(1)); - current_statement__ = 8; - pos__ = 2; - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(2), - stan::model::index_uni(1)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(3), - stan::model::index_uni(1)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(4), - stan::model::index_uni(1)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(5), - stan::model::index_uni(1)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(6), - stan::model::index_uni(1)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(7), - stan::model::index_uni(1)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(8), - stan::model::index_uni(1)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(9), - stan::model::index_uni(1)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(10), - stan::model::index_uni(1)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(6), + stan::model::index_uni(5)); } { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(1), - stan::model::index_uni(2)); - current_statement__ = 8; - pos__ = (pos__ + 1); - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(2), - stan::model::index_uni(2)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(3), - stan::model::index_uni(2)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(4), - stan::model::index_uni(2)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(5), - stan::model::index_uni(2)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(6), - stan::model::index_uni(2)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(7), - stan::model::index_uni(2)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(8), - stan::model::index_uni(2)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(9), - stan::model::index_uni(2)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(10), - stan::model::index_uni(2)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(7), + stan::model::index_uni(5)); } { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(1), - stan::model::index_uni(3)); - current_statement__ = 8; - pos__ = (pos__ + 1); - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(2), - stan::model::index_uni(3)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(3), - stan::model::index_uni(3)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(4), - stan::model::index_uni(3)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(5), - stan::model::index_uni(3)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(6), - stan::model::index_uni(3)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(7), - stan::model::index_uni(3)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(8), - stan::model::index_uni(3)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(9), - stan::model::index_uni(3)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(10), - stan::model::index_uni(3)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(8), + stan::model::index_uni(5)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(9), + stan::model::index_uni(5)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(10), + stan::model::index_uni(5)); + } + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(1), + stan::model::index_uni(6)); + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(2), + stan::model::index_uni(6)); } { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(1), - stan::model::index_uni(4)); - current_statement__ = 8; - pos__ = (pos__ + 1); - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(2), - stan::model::index_uni(4)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(3), - stan::model::index_uni(4)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(4), - stan::model::index_uni(4)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(5), - stan::model::index_uni(4)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(6), - stan::model::index_uni(4)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(7), - stan::model::index_uni(4)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(8), - stan::model::index_uni(4)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(9), - stan::model::index_uni(4)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(10), - stan::model::index_uni(4)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(3), + stan::model::index_uni(6)); } { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(1), - stan::model::index_uni(5)); - current_statement__ = 8; - pos__ = (pos__ + 1); - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(2), - stan::model::index_uni(5)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(3), - stan::model::index_uni(5)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(4), - stan::model::index_uni(5)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(5), - stan::model::index_uni(5)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(6), - stan::model::index_uni(5)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(7), - stan::model::index_uni(5)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(8), - stan::model::index_uni(5)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(9), - stan::model::index_uni(5)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(10), - stan::model::index_uni(5)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(4), + stan::model::index_uni(6)); } { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(1), + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(5), + stan::model::index_uni(6)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(6), + stan::model::index_uni(6)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(7), stan::model::index_uni(6)); - current_statement__ = 8; - pos__ = (pos__ + 1); - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(2), - stan::model::index_uni(6)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(3), - stan::model::index_uni(6)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(4), - stan::model::index_uni(6)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(5), - stan::model::index_uni(6)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(6), - stan::model::index_uni(6)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(7), - stan::model::index_uni(6)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(8), - stan::model::index_uni(6)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(9), - stan::model::index_uni(6)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(10), - stan::model::index_uni(6)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } } { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(1), - stan::model::index_uni(7)); - current_statement__ = 8; - pos__ = (pos__ + 1); - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(2), - stan::model::index_uni(7)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(3), - stan::model::index_uni(7)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(4), - stan::model::index_uni(7)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(5), - stan::model::index_uni(7)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(6), - stan::model::index_uni(7)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(7), - stan::model::index_uni(7)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(8), - stan::model::index_uni(7)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(9), - stan::model::index_uni(7)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(10), - stan::model::index_uni(7)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(8), + stan::model::index_uni(6)); } { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(1), - stan::model::index_uni(8)); - current_statement__ = 8; - pos__ = (pos__ + 1); - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(2), - stan::model::index_uni(8)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(3), - stan::model::index_uni(8)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(4), - stan::model::index_uni(8)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(5), - stan::model::index_uni(8)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(6), - stan::model::index_uni(8)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(7), - stan::model::index_uni(8)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(8), - stan::model::index_uni(8)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(9), - stan::model::index_uni(8)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(10), - stan::model::index_uni(8)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(9), + stan::model::index_uni(6)); } { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(1), - stan::model::index_uni(9)); - current_statement__ = 8; - pos__ = (pos__ + 1); - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(2), - stan::model::index_uni(9)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(3), - stan::model::index_uni(9)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(4), - stan::model::index_uni(9)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(5), - stan::model::index_uni(9)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(6), - stan::model::index_uni(9)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(7), - stan::model::index_uni(9)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(8), - stan::model::index_uni(9)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(9), - stan::model::index_uni(9)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(10), - stan::model::index_uni(9)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(10), + stan::model::index_uni(6)); + } + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(1), + stan::model::index_uni(7)); + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(2), + stan::model::index_uni(7)); } { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(1), - stan::model::index_uni(10)); - current_statement__ = 8; - pos__ = (pos__ + 1); - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(2), - stan::model::index_uni(10)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(3), - stan::model::index_uni(10)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(4), - stan::model::index_uni(10)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(5), - stan::model::index_uni(10)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(6), - stan::model::index_uni(10)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(7), - stan::model::index_uni(10)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(8), - stan::model::index_uni(10)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(9), - stan::model::index_uni(10)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } - { - current_statement__ = 8; - stan::model::assign(m4, m4_flat__[(pos__ - 1)], - "assigning variable m4", stan::model::index_uni(10), - stan::model::index_uni(10)); - current_statement__ = 8; - pos__ = (pos__ + 1); - } + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(3), + stan::model::index_uni(7)); } - } - } - current_statement__ = 9; - context__.validate_dims("data initialization", "idx", "int", - std::vector{static_cast(10)}); - idx = std::vector(10, std::numeric_limits::min()); - current_statement__ = 9; - idx = context__.vals_i("idx"); - current_statement__ = 10; - context__.validate_dims("data initialization", "idy", "int", - std::vector{static_cast(10)}); - idy = std::vector(10, std::numeric_limits::min()); - current_statement__ = 10; - idy = context__.vals_i("idy"); - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } - num_params_r__ = (10 * 10) + (10 * 10); - } - inline std::string model_name() const final { - return "partial_eval_multiply_model"; - } - inline std::vector model_compile_info() const noexcept { - return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", - "stancflags = --O --print-cpp"}; - } - 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__; - stan::io::deserializer in__(params_r__, params_i__); - int current_statement__ = 0; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - static constexpr const char* function__ = - "partial_eval_multiply_model_namespace::log_prob"; - // suppress unused var warning - (void) function__; - try { - Eigen::Matrix lcm_sym5__; - Eigen::Matrix lcm_sym4__; - double lcm_sym3__; - stan::conditional_var_value_t> m2; - current_statement__ = 1; - m2 = in__.template read< - stan::conditional_var_value_t>>(10, 10); - stan::conditional_var_value_t> m3; - current_statement__ = 2; - m3 = in__.template read< - stan::conditional_var_value_t>>(10, 10); - { - Eigen::Matrix m5 = - Eigen::Matrix::Constant(10, 10, - std::numeric_limits::quiet_NaN()); - stan::model::assign(lcm_sym4__, - stan::math::add( - stan::math::multiply(m1, - stan::math::elt_multiply(m2, - stan::model::rvalue(m3, "m3", stan::model::index_multi(idx), - stan::model::index_multi(idy)))), m4), - "assigning variable lcm_sym4__"); - Eigen::Matrix m6 = - Eigen::Matrix::Constant(10, 10, - std::numeric_limits::quiet_NaN()); - stan::model::assign(lcm_sym5__, stan::math::fma(m1, m2, m4), - "assigning variable lcm_sym5__"); - Eigen::Matrix m7 = - Eigen::Matrix::Constant(10, 10, - std::numeric_limits::quiet_NaN()); - current_statement__ = 6; - lp_accum__.add(((stan::math::sum(lcm_sym4__) + - stan::math::sum(lcm_sym5__)) + stan::math::sum(lcm_sym5__))); - } - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } - lp_accum__.add(lp__); - return lp_accum__.sum(); - } - 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; - 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; - // 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()); - // suppress unused var warning - (void) DUMMY_VAR__; - constexpr bool jacobian__ = false; - static constexpr const char* function__ = - "partial_eval_multiply_model_namespace::write_array"; - // suppress unused var warning - (void) function__; - try { - int lcm_sym2__; - int lcm_sym1__; - Eigen::Matrix m2; - current_statement__ = 1; - m2 = in__.template read>(10, 10); - Eigen::Matrix m3; - current_statement__ = 2; - m3 = in__.template read>(10, 10); - out__.write(m2); - out__.write(m3); - if (stan::math::logical_negation( - (stan::math::primitive_value(emit_transformed_parameters__) || - stan::math::primitive_value(emit_generated_quantities__)))) { - return ; - } - if (stan::math::logical_negation(emit_generated_quantities__)) { - return ; - } - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } - } - template * = nullptr, - stan::require_vector_like_vt* = nullptr> - inline void - transform_inits_impl(VecVar& params_r__, 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__; - pos__ = 1; - Eigen::Matrix m2 = - Eigen::Matrix::Constant(10, 10, DUMMY_VAR__); - { + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(4), + stan::model::index_uni(7)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(5), + stan::model::index_uni(7)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(6), + stan::model::index_uni(7)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(7), + stan::model::index_uni(7)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(8), + stan::model::index_uni(7)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(9), + stan::model::index_uni(7)); + } + { + stan::model::assign(m2, in__.read(), + "assigning variable m2", stan::model::index_uni(10), + stan::model::index_uni(7)); + } + } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(1), - stan::model::index_uni(1)); + stan::model::index_uni(8)); { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(2), - stan::model::index_uni(1)); + stan::model::index_uni(8)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(3), - stan::model::index_uni(1)); + stan::model::index_uni(8)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(4), - stan::model::index_uni(1)); + stan::model::index_uni(8)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(5), - stan::model::index_uni(1)); + stan::model::index_uni(8)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(6), - stan::model::index_uni(1)); + stan::model::index_uni(8)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(7), - stan::model::index_uni(1)); + stan::model::index_uni(8)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(8), - stan::model::index_uni(1)); + stan::model::index_uni(8)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(9), - stan::model::index_uni(1)); + stan::model::index_uni(8)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(10), - stan::model::index_uni(1)); + stan::model::index_uni(8)); } } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(1), - stan::model::index_uni(2)); + stan::model::index_uni(9)); { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(2), - stan::model::index_uni(2)); + stan::model::index_uni(9)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(3), - stan::model::index_uni(2)); + stan::model::index_uni(9)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(4), - stan::model::index_uni(2)); + stan::model::index_uni(9)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(5), - stan::model::index_uni(2)); + stan::model::index_uni(9)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(6), - stan::model::index_uni(2)); + stan::model::index_uni(9)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(7), - stan::model::index_uni(2)); + stan::model::index_uni(9)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(8), - stan::model::index_uni(2)); + stan::model::index_uni(9)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(9), - stan::model::index_uni(2)); + stan::model::index_uni(9)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(10), - stan::model::index_uni(2)); + stan::model::index_uni(9)); } } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(1), - stan::model::index_uni(3)); + stan::model::index_uni(10)); { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(2), - stan::model::index_uni(3)); + stan::model::index_uni(10)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(3), - stan::model::index_uni(3)); + stan::model::index_uni(10)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(4), - stan::model::index_uni(3)); + stan::model::index_uni(10)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(5), - stan::model::index_uni(3)); + stan::model::index_uni(10)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(6), - stan::model::index_uni(3)); + stan::model::index_uni(10)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(7), - stan::model::index_uni(3)); + stan::model::index_uni(10)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(8), - stan::model::index_uni(3)); + stan::model::index_uni(10)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(9), - stan::model::index_uni(3)); + stan::model::index_uni(10)); } { stan::model::assign(m2, in__.read(), "assigning variable m2", stan::model::index_uni(10), + stan::model::index_uni(10)); + } + } + } + out__.write(m2); + Eigen::Matrix m3 = + Eigen::Matrix::Constant(10, 10, DUMMY_VAR__); + { + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(1), + stan::model::index_uni(1)); + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(2), + stan::model::index_uni(1)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(3), + stan::model::index_uni(1)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(4), + stan::model::index_uni(1)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(5), + stan::model::index_uni(1)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(6), + stan::model::index_uni(1)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(7), + stan::model::index_uni(1)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(8), + stan::model::index_uni(1)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(9), + stan::model::index_uni(1)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(10), + stan::model::index_uni(1)); + } + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(1), + stan::model::index_uni(2)); + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(2), + stan::model::index_uni(2)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(3), + stan::model::index_uni(2)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(4), + stan::model::index_uni(2)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(5), + stan::model::index_uni(2)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(6), + stan::model::index_uni(2)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(7), + stan::model::index_uni(2)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(8), + stan::model::index_uni(2)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(9), + stan::model::index_uni(2)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(10), + stan::model::index_uni(2)); + } + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(1), + stan::model::index_uni(3)); + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(2), + stan::model::index_uni(3)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(3), + stan::model::index_uni(3)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(4), + stan::model::index_uni(3)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(5), + stan::model::index_uni(3)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(6), + stan::model::index_uni(3)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(7), + stan::model::index_uni(3)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(8), + stan::model::index_uni(3)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(9), + stan::model::index_uni(3)); + } + { + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(10), stan::model::index_uni(3)); } } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(1), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(1), stan::model::index_uni(4)); { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(2), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(2), stan::model::index_uni(4)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(3), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(3), stan::model::index_uni(4)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(4), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(4), stan::model::index_uni(4)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(5), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(5), stan::model::index_uni(4)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(6), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(6), stan::model::index_uni(4)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(7), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(7), stan::model::index_uni(4)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(8), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(8), stan::model::index_uni(4)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(9), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(9), stan::model::index_uni(4)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(10), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(10), stan::model::index_uni(4)); } } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(1), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(1), stan::model::index_uni(5)); { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(2), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(2), stan::model::index_uni(5)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(3), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(3), stan::model::index_uni(5)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(4), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(4), stan::model::index_uni(5)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(5), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(5), stan::model::index_uni(5)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(6), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(6), stan::model::index_uni(5)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(7), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(7), stan::model::index_uni(5)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(8), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(8), stan::model::index_uni(5)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(9), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(9), stan::model::index_uni(5)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(10), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(10), stan::model::index_uni(5)); } } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(1), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(1), stan::model::index_uni(6)); { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(2), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(2), stan::model::index_uni(6)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(3), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(3), stan::model::index_uni(6)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(4), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(4), stan::model::index_uni(6)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(5), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(5), stan::model::index_uni(6)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(6), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(6), stan::model::index_uni(6)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(7), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(7), stan::model::index_uni(6)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(8), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(8), stan::model::index_uni(6)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(9), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(9), stan::model::index_uni(6)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(10), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(10), stan::model::index_uni(6)); } } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(1), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(1), stan::model::index_uni(7)); { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(2), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(2), stan::model::index_uni(7)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(3), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(3), stan::model::index_uni(7)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(4), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(4), stan::model::index_uni(7)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(5), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(5), stan::model::index_uni(7)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(6), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(6), stan::model::index_uni(7)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(7), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(7), stan::model::index_uni(7)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(8), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(8), stan::model::index_uni(7)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(9), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(9), stan::model::index_uni(7)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(10), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(10), stan::model::index_uni(7)); } } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(1), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(1), stan::model::index_uni(8)); { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(2), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(2), stan::model::index_uni(8)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(3), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(3), stan::model::index_uni(8)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(4), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(4), stan::model::index_uni(8)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(5), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(5), stan::model::index_uni(8)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(6), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(6), stan::model::index_uni(8)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(7), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(7), stan::model::index_uni(8)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(8), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(8), stan::model::index_uni(8)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(9), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(9), stan::model::index_uni(8)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(10), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(10), stan::model::index_uni(8)); } } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(1), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(1), stan::model::index_uni(9)); { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(2), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(2), stan::model::index_uni(9)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(3), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(3), stan::model::index_uni(9)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(4), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(4), stan::model::index_uni(9)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(5), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(5), stan::model::index_uni(9)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(6), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(6), stan::model::index_uni(9)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(7), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(7), stan::model::index_uni(9)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(8), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(8), stan::model::index_uni(9)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(9), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(9), stan::model::index_uni(9)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(10), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(10), stan::model::index_uni(9)); } } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(1), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(1), stan::model::index_uni(10)); { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(2), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(2), stan::model::index_uni(10)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(3), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(3), stan::model::index_uni(10)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(4), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(4), stan::model::index_uni(10)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(5), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(5), stan::model::index_uni(10)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(6), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(6), stan::model::index_uni(10)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(7), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(7), stan::model::index_uni(10)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(8), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(8), stan::model::index_uni(10)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(9), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(9), stan::model::index_uni(10)); } { - stan::model::assign(m2, in__.read(), - "assigning variable m2", stan::model::index_uni(10), + stan::model::assign(m3, in__.read(), + "assigning variable m3", stan::model::index_uni(10), stan::model::index_uni(10)); } } } - out__.write(m2); - Eigen::Matrix m3 = - Eigen::Matrix::Constant(10, 10, DUMMY_VAR__); + out__.write(m3); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + inline void get_param_names(std::vector& names__) const { + names__ = std::vector{"m2", "m3"}; + } + inline void get_dims(std::vector>& dimss__) const { + dimss__ = std::vector>{std::vector{static_cast< + size_t>( + 10), + static_cast(10)}, + std::vector{static_cast(10), + static_cast(10)}}; + } + inline void + constrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { + for (int sym11__ = 1; sym11__ <= 10; ++sym11__) { + for (int sym12__ = 1; sym12__ <= 10; ++sym12__) { + param_names__.emplace_back(std::string() + "m2" + '.' + + std::to_string(sym12__) + '.' + std::to_string(sym11__)); + } + } + for (int sym11__ = 1; sym11__ <= 10; ++sym11__) { + for (int sym12__ = 1; sym12__ <= 10; ++sym12__) { + param_names__.emplace_back(std::string() + "m3" + '.' + + std::to_string(sym12__) + '.' + std::to_string(sym11__)); + } + } + if (emit_transformed_parameters__) {} + 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 sym11__ = 1; sym11__ <= 10; ++sym11__) { + for (int sym12__ = 1; sym12__ <= 10; ++sym12__) { + param_names__.emplace_back(std::string() + "m2" + '.' + + std::to_string(sym12__) + '.' + std::to_string(sym11__)); + } + } + for (int sym11__ = 1; sym11__ <= 10; ++sym11__) { + for (int sym12__ = 1; sym12__ <= 10; ++sym12__) { + param_names__.emplace_back(std::string() + "m3" + '.' + + std::to_string(sym12__) + '.' + std::to_string(sym11__)); + } + } + if (emit_transformed_parameters__) {} + if (emit_generated_quantities__) {} + } + inline std::string get_constrained_sizedtypes() const { + return std::string("[{\"name\":\"m2\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(10) + ",\"cols\":" + std::to_string(10) + "},\"block\":\"parameters\"},{\"name\":\"m3\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(10) + ",\"cols\":" + std::to_string(10) + "},\"block\":\"parameters\"}]"); + } + inline std::string get_unconstrained_sizedtypes() const { + return std::string("[{\"name\":\"m2\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(10) + ",\"cols\":" + std::to_string(10) + "},\"block\":\"parameters\"},{\"name\":\"m3\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(10) + ",\"cols\":" + std::to_string(10) + "},\"block\":\"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__ = ((10 * 10) + (10 * 10)); + const size_t num_transformed = emit_transformed_parameters * (0); + 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__ = ((10 * 10) + (10 * 10)); + const size_t num_transformed = emit_transformed_parameters * (0); + 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 { + constexpr std::array names__{"m2", "m3"}; + const std::array + constrain_param_sizes__{(10 * 10), (10 * 10)}; + const auto num_constrained_params__ = + std::accumulate(constrain_param_sizes__.begin(), + constrain_param_sizes__.end(), 0); + std::vector params_r_flat__(num_constrained_params__); + Eigen::Index size_iter__ = 0; + Eigen::Index flat_iter__ = 0; + for (auto&& param_name__: names__) { + const auto param_vec__ = context.vals_r(param_name__); + for (Eigen::Index i = 0; i < constrain_param_sizes__[size_iter__]; ++i) { + params_r_flat__[flat_iter__] = param_vec__[i]; + ++flat_iter__; + } + ++size_iter__; + } + vars.resize(num_params_r__); + transform_inits_impl(params_r_flat__, params_i, vars, pstream__); + } +}; +} +using stan_model = partial_eval_multiply_model_namespace::partial_eval_multiply_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* m = new stan_model(data_context, seed, msg_stream); + return *m; +} +stan::math::profile_map& get_stan_profile_data() { + return partial_eval_multiply_model_namespace::profiles__; +} +#endif + $ ../../../../../install/default/bin/stanc --O --print-cpp stalled1-failure.stan +// Code generated by %%NAME%% %%VERSION%% +#include +namespace stalled1_failure_model_namespace { +using stan::model::model_base_crtp; +using namespace stan::math; +stan::math::profile_map profiles__; +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'stalled1-failure.stan', line 27, column 2 to column 14)", + " (in 'stalled1-failure.stan', line 28, column 2 to column 14)", + " (in 'stalled1-failure.stan', line 29, column 2 to column 14)", + " (in 'stalled1-failure.stan', line 30, column 2 to column 15)", + " (in 'stalled1-failure.stan', line 31, column 2 to column 20)", + " (in 'stalled1-failure.stan', line 32, column 2 to column 23)", + " (in 'stalled1-failure.stan', line 35, column 2 to column 13)", + " (in 'stalled1-failure.stan', line 39, column 2 to column 30)", + " (in 'stalled1-failure.stan', line 40, column 2 to column 30)", + " (in 'stalled1-failure.stan', line 41, column 2 to column 30)", + " (in 'stalled1-failure.stan', line 42, column 2 to column 31)", + " (in 'stalled1-failure.stan', line 43, column 2 to column 30)", + " (in 'stalled1-failure.stan', line 45, column 4 to column 30)", + " (in 'stalled1-failure.stan', line 46, column 4 to line 48, column 54)", + " (in 'stalled1-failure.stan', line 44, column 19 to line 49, column 3)", + " (in 'stalled1-failure.stan', line 44, column 2 to line 49, column 3)", + " (in 'stalled1-failure.stan', line 14, column 2 to column 17)", + " (in 'stalled1-failure.stan', line 15, column 8 to column 9)", + " (in 'stalled1-failure.stan', line 15, column 2 to column 26)", + " (in 'stalled1-failure.stan', line 16, column 8 to column 9)", + " (in 'stalled1-failure.stan', line 16, column 2 to column 26)", + " (in 'stalled1-failure.stan', line 17, column 9 to column 10)", + " (in 'stalled1-failure.stan', line 17, column 2 to column 15)", + " (in 'stalled1-failure.stan', line 18, column 9 to column 10)", + " (in 'stalled1-failure.stan', line 18, column 2 to column 15)", + " (in 'stalled1-failure.stan', line 21, column 2 to column 8)", + " (in 'stalled1-failure.stan', line 22, column 9 to column 10)", + " (in 'stalled1-failure.stan', line 22, column 2 to column 17)", + " (in 'stalled1-failure.stan', line 23, column 2 to column 8)", + " (in 'stalled1-failure.stan', line 24, column 2 to column 18)", + " (in 'stalled1-failure.stan', line 32, column 8 to column 9)", + " (in 'stalled1-failure.stan', line 32, column 18 to column 19)"}; +class stalled1_failure_model final : public model_base_crtp { + private: + double lcm_sym27__; + double lcm_sym26__; + double lcm_sym25__; + double lcm_sym24__; + int lcm_sym23__; + int lcm_sym22__; + Eigen::Matrix lcm_sym21___data__; + int I; + std::vector n; + std::vector N; + Eigen::Matrix x1_data__; + Eigen::Matrix x2_data__; + int K; + Eigen::Matrix x1x2_data__; + Eigen::Map> lcm_sym21__{nullptr, 0}; + Eigen::Map> x1{nullptr, 0}; + Eigen::Map> x2{nullptr, 0}; + Eigen::Map> x1x2{nullptr, 0}; + public: + ~stalled1_failure_model() {} + stalled1_failure_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__ = + "stalled1_failure_model_namespace::stalled1_failure_model"; + // suppress unused var warning + (void) function__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + int pos__; + pos__ = 1; + current_statement__ = 17; + context__.validate_dims("data initialization", "I", "int", + std::vector{}); + I = std::numeric_limits::min(); + current_statement__ = 17; + I = context__.vals_i("I")[(1 - 1)]; + current_statement__ = 17; + stan::math::check_greater_or_equal(function__, "I", I, 0); + current_statement__ = 18; + stan::math::validate_non_negative_index("n", "I", I); + current_statement__ = 19; + context__.validate_dims("data initialization", "n", "int", + std::vector{static_cast(I)}); + n = std::vector(I, std::numeric_limits::min()); + current_statement__ = 19; + n = context__.vals_i("n"); + current_statement__ = 19; + stan::math::check_greater_or_equal(function__, "n", n, 0); + current_statement__ = 20; + stan::math::validate_non_negative_index("N", "I", I); + current_statement__ = 21; + context__.validate_dims("data initialization", "N", "int", + std::vector{static_cast(I)}); + N = std::vector(I, std::numeric_limits::min()); + current_statement__ = 21; + N = context__.vals_i("N"); + current_statement__ = 21; + stan::math::check_greater_or_equal(function__, "N", N, 0); + current_statement__ = 22; + stan::math::validate_non_negative_index("x1", "I", I); + current_statement__ = 23; + context__.validate_dims("data initialization", "x1", "double", + std::vector{static_cast(I)}); + x1_data__ = Eigen::Matrix::Constant(I, + std::numeric_limits::quiet_NaN()); + new (&x1) Eigen::Map>(x1_data__.data(), I); + { + std::vector x1_flat__; + current_statement__ = 23; + x1_flat__ = context__.vals_r("x1"); + current_statement__ = 23; + pos__ = 1; + lcm_sym22__ = stan::math::logical_gte(I, 1); + if (lcm_sym22__) { + current_statement__ = 23; + stan::model::assign(x1, + stan::model::rvalue(x1_flat__, "x1_flat__", + stan::model::index_uni(1)), "assigning variable x1", + stan::model::index_uni(1)); + current_statement__ = 23; + pos__ = 2; + for (int sym1__ = 2; sym1__ <= I; ++sym1__) { + current_statement__ = 23; + stan::model::assign(x1, x1_flat__[(pos__ - 1)], + "assigning variable x1", stan::model::index_uni(sym1__)); + current_statement__ = 23; + pos__ = (pos__ + 1); + } + } + } + current_statement__ = 24; + stan::math::validate_non_negative_index("x2", "I", I); + current_statement__ = 25; + context__.validate_dims("data initialization", "x2", "double", + std::vector{static_cast(I)}); + x2_data__ = Eigen::Matrix::Constant(I, + std::numeric_limits::quiet_NaN()); + new (&x2) Eigen::Map>(x2_data__.data(), I); { - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(1), + std::vector x2_flat__; + current_statement__ = 25; + x2_flat__ = context__.vals_r("x2"); + current_statement__ = 25; + pos__ = 1; + current_statement__ = 25; + if (lcm_sym22__) { + current_statement__ = 25; + stan::model::assign(x2, + stan::model::rvalue(x2_flat__, "x2_flat__", + stan::model::index_uni(1)), "assigning variable x2", stan::model::index_uni(1)); - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(2), - stan::model::index_uni(1)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(3), - stan::model::index_uni(1)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(4), - stan::model::index_uni(1)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(5), - stan::model::index_uni(1)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(6), - stan::model::index_uni(1)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(7), - stan::model::index_uni(1)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(8), - stan::model::index_uni(1)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(9), - stan::model::index_uni(1)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(10), - stan::model::index_uni(1)); + current_statement__ = 25; + pos__ = 2; + for (int sym1__ = 2; sym1__ <= I; ++sym1__) { + current_statement__ = 25; + stan::model::assign(x2, x2_flat__[(pos__ - 1)], + "assigning variable x2", stan::model::index_uni(sym1__)); + current_statement__ = 25; + pos__ = (pos__ + 1); } } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(1), - stan::model::index_uni(2)); - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(2), - stan::model::index_uni(2)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(3), - stan::model::index_uni(2)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(4), - stan::model::index_uni(2)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(5), - stan::model::index_uni(2)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(6), - stan::model::index_uni(2)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(7), - stan::model::index_uni(2)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(8), - stan::model::index_uni(2)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(9), - stan::model::index_uni(2)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(10), - stan::model::index_uni(2)); + } + current_statement__ = 26; + K = std::numeric_limits::min(); + current_statement__ = 27; + stan::math::validate_non_negative_index("x1x2", "I", I); + current_statement__ = 28; + x1x2_data__ = Eigen::Matrix::Constant(I, + std::numeric_limits::quiet_NaN()); + new (&x1x2) Eigen::Map>(x1x2_data__.data(), + I); + current_statement__ = 29; + K = 8; + current_statement__ = 30; + stan::model::assign(x1x2, stan::math::elt_multiply(x1, x2), + "assigning variable x1x2"); + current_statement__ = 31; + stan::math::validate_non_negative_index("b", "I", I); + current_statement__ = 32; + stan::math::validate_non_negative_index("b", "K", 8); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + num_params_r__ = 1 + 1 + 1 + 1 + 1 + (I * K); + } + inline std::string model_name() const final { + return "stalled1_failure_model"; + } + inline std::vector model_compile_info() const noexcept { + return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", + "stancflags = --O --print-cpp"}; + } + 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__; + stan::io::deserializer in__(params_r__, params_i__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + static constexpr const char* function__ = + "stalled1_failure_model_namespace::log_prob"; + // suppress unused var warning + (void) function__; + try { + double lcm_sym20__; + double lcm_sym19__; + double lcm_sym18__; + double lcm_sym17__; + double lcm_sym16__; + double lcm_sym15__; + double lcm_sym14__; + double lcm_sym13__; + double lcm_sym12__; + int lcm_sym11__; + local_scalar_t__ lcm_sym10__; + local_scalar_t__ alpha0; + current_statement__ = 1; + alpha0 = in__.template read(); + local_scalar_t__ alpha1; + current_statement__ = 2; + alpha1 = in__.template read(); + local_scalar_t__ alpha2; + current_statement__ = 3; + alpha2 = in__.template read(); + local_scalar_t__ alpha12; + current_statement__ = 4; + alpha12 = in__.template read(); + local_scalar_t__ tau; + current_statement__ = 5; + tau = in__.template read_constrain_lb(0, + lp__); + std::vector< + stan::conditional_var_value_t>> b = + std::vector< + stan::conditional_var_value_t>>(I, + stan::conditional_var_value_t>(Eigen::Matrix::Constant(8, + std::numeric_limits::quiet_NaN( + )))); + current_statement__ = 6; + b = in__.template read< + std::vector< + stan::conditional_var_value_t>>>(I, 8); + local_scalar_t__ sigma = DUMMY_VAR__; + lcm_sym10__ = (1 / stan::math::sqrt(tau)); + sigma = lcm_sym10__; + { + current_statement__ = 8; + lp_accum__.add(stan::math::normal_lpdf(alpha0, 0.0, 1.0E3)); + current_statement__ = 9; + lp_accum__.add(stan::math::normal_lpdf(alpha1, 0.0, 1.0E3)); + current_statement__ = 10; + lp_accum__.add(stan::math::normal_lpdf(alpha2, 0.0, 1.0E3)); + current_statement__ = 11; + lp_accum__.add(stan::math::normal_lpdf(alpha12, 0.0, 1.0E3)); + current_statement__ = 12; + lp_accum__.add(stan::math::gamma_lpdf(tau, 1.0E-3, 1.0E-3)); + current_statement__ = 16; + if (stan::math::logical_gte(I, 1)) { + current_statement__ = 13; + lp_accum__.add(stan::math::normal_lpdf( + stan::model::rvalue(b, "b", + stan::model::index_uni(1)), 0.0, lcm_sym10__)); + current_statement__ = 14; + lp_accum__.add(stan::math::binomial_logit_lpmf( + stan::model::rvalue(n, "n", + stan::model::index_uni(1)), + stan::model::rvalue(N, "N", + stan::model::index_uni(1)), + stan::math::add( + stan::math::fma(alpha12, + stan::model::rvalue( + stan::math::elt_multiply(x1, x2), + "(x1 .* x2)", stan::model::index_uni(1)), + stan::math::fma(alpha2, + stan::model::rvalue(x2, "x2", + stan::model::index_uni(1)), + stan::math::fma(alpha1, + stan::model::rvalue(x1, "x1", + stan::model::index_uni(1)), alpha0))), + stan::model::rvalue(b, "b", + stan::model::index_uni(1))))); + for (int i = 2; i <= I; ++i) { + current_statement__ = 13; + lp_accum__.add(stan::math::normal_lpdf( + stan::model::rvalue(b, "b", + stan::model::index_uni(i)), 0.0, lcm_sym10__)); + current_statement__ = 14; + lp_accum__.add(stan::math::binomial_logit_lpmf( + stan::model::rvalue(n, "n", + stan::model::index_uni(i)), + stan::model::rvalue(N, "N", + stan::model::index_uni(i)), + stan::math::add( + stan::math::fma(alpha12, + stan::model::rvalue( + stan::math::elt_multiply(x1, x2), + "(x1 .* x2)", stan::model::index_uni(i)), + stan::math::fma(alpha2, + stan::model::rvalue(x2, "x2", + stan::model::index_uni(i)), + stan::math::fma(alpha1, + stan::model::rvalue(x1, "x1", + stan::model::index_uni(i)), alpha0))), + stan::model::rvalue(b, "b", + stan::model::index_uni(i))))); } } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(1), - stan::model::index_uni(3)); - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(2), - stan::model::index_uni(3)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(3), - stan::model::index_uni(3)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(4), - stan::model::index_uni(3)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(5), - stan::model::index_uni(3)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(6), - stan::model::index_uni(3)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(7), - stan::model::index_uni(3)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(8), - stan::model::index_uni(3)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(9), - stan::model::index_uni(3)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(10), - stan::model::index_uni(3)); + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + lp_accum__.add(lp__); + return lp_accum__.sum(); + } + 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; + 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; + // 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()); + // suppress unused var warning + (void) DUMMY_VAR__; + constexpr bool jacobian__ = false; + static constexpr const char* function__ = + "stalled1_failure_model_namespace::write_array"; + // suppress unused var warning + (void) function__; + try { + double lcm_sym9__; + double lcm_sym8__; + double lcm_sym7__; + double lcm_sym6__; + int lcm_sym5__; + int lcm_sym4__; + int lcm_sym3__; + double lcm_sym2__; + double alpha0; + current_statement__ = 1; + alpha0 = in__.template read(); + double alpha1; + current_statement__ = 2; + alpha1 = in__.template read(); + double alpha2; + current_statement__ = 3; + alpha2 = in__.template read(); + double alpha12; + current_statement__ = 4; + alpha12 = in__.template read(); + double tau; + current_statement__ = 5; + tau = in__.template read_constrain_lb(0, + lp__); + std::vector> b = + std::vector>(I, + Eigen::Matrix::Constant(8, + std::numeric_limits::quiet_NaN())); + current_statement__ = 6; + b = in__.template read< + std::vector>>(I, 8); + double sigma = std::numeric_limits::quiet_NaN(); + out__.write(alpha0); + out__.write(alpha1); + out__.write(alpha2); + out__.write(alpha12); + out__.write(tau); + { + lcm_sym3__ = stan::math::logical_gte(I, 1); + if (lcm_sym3__) { + out__.write(stan::model::rvalue(b, "b", stan::model::index_uni(1), + stan::model::index_uni(1))); + for (int sym2__ = 2; sym2__ <= I; ++sym2__) { + out__.write(stan::model::rvalue(b, "b", + stan::model::index_uni(sym2__), + stan::model::index_uni(1))); } } { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(1), - stan::model::index_uni(4)); - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(2), - stan::model::index_uni(4)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(3), - stan::model::index_uni(4)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(4), - stan::model::index_uni(4)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(5), - stan::model::index_uni(4)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(6), - stan::model::index_uni(4)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(7), - stan::model::index_uni(4)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(8), - stan::model::index_uni(4)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(9), - stan::model::index_uni(4)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(10), - stan::model::index_uni(4)); + if (lcm_sym3__) { + out__.write(stan::model::rvalue(b, "b", + stan::model::index_uni(1), + stan::model::index_uni(2))); + for (int sym2__ = 2; sym2__ <= I; ++sym2__) { + out__.write(stan::model::rvalue(b, "b", + stan::model::index_uni(sym2__), + stan::model::index_uni(2))); + } } } { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(1), - stan::model::index_uni(5)); - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(2), - stan::model::index_uni(5)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(3), - stan::model::index_uni(5)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(4), - stan::model::index_uni(5)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(5), - stan::model::index_uni(5)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(6), - stan::model::index_uni(5)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(7), - stan::model::index_uni(5)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(8), - stan::model::index_uni(5)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(9), - stan::model::index_uni(5)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(10), - stan::model::index_uni(5)); + if (lcm_sym3__) { + out__.write(stan::model::rvalue(b, "b", + stan::model::index_uni(1), + stan::model::index_uni(3))); + for (int sym2__ = 2; sym2__ <= I; ++sym2__) { + out__.write(stan::model::rvalue(b, "b", + stan::model::index_uni(sym2__), + stan::model::index_uni(3))); + } } } { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(1), - stan::model::index_uni(6)); - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(2), - stan::model::index_uni(6)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(3), - stan::model::index_uni(6)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(4), - stan::model::index_uni(6)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(5), - stan::model::index_uni(6)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(6), - stan::model::index_uni(6)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(7), - stan::model::index_uni(6)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(8), - stan::model::index_uni(6)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(9), - stan::model::index_uni(6)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(10), - stan::model::index_uni(6)); + if (lcm_sym3__) { + out__.write(stan::model::rvalue(b, "b", + stan::model::index_uni(1), + stan::model::index_uni(4))); + for (int sym2__ = 2; sym2__ <= I; ++sym2__) { + out__.write(stan::model::rvalue(b, "b", + stan::model::index_uni(sym2__), + stan::model::index_uni(4))); + } } } { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(1), - stan::model::index_uni(7)); - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(2), - stan::model::index_uni(7)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(3), - stan::model::index_uni(7)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(4), - stan::model::index_uni(7)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(5), - stan::model::index_uni(7)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(6), - stan::model::index_uni(7)); + if (lcm_sym3__) { + out__.write(stan::model::rvalue(b, "b", + stan::model::index_uni(1), + stan::model::index_uni(5))); + for (int sym2__ = 2; sym2__ <= I; ++sym2__) { + out__.write(stan::model::rvalue(b, "b", + stan::model::index_uni(sym2__), + stan::model::index_uni(5))); + } } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(7), - stan::model::index_uni(7)); + } + { + if (lcm_sym3__) { + out__.write(stan::model::rvalue(b, "b", + stan::model::index_uni(1), + stan::model::index_uni(6))); + for (int sym2__ = 2; sym2__ <= I; ++sym2__) { + out__.write(stan::model::rvalue(b, "b", + stan::model::index_uni(sym2__), + stan::model::index_uni(6))); + } } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(8), - stan::model::index_uni(7)); + } + { + if (lcm_sym3__) { + out__.write(stan::model::rvalue(b, "b", + stan::model::index_uni(1), + stan::model::index_uni(7))); + for (int sym2__ = 2; sym2__ <= I; ++sym2__) { + out__.write(stan::model::rvalue(b, "b", + stan::model::index_uni(sym2__), + stan::model::index_uni(7))); + } } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(9), - stan::model::index_uni(7)); + } + { + if (lcm_sym3__) { + out__.write(stan::model::rvalue(b, "b", + stan::model::index_uni(1), + stan::model::index_uni(8))); + for (int sym2__ = 2; sym2__ <= I; ++sym2__) { + out__.write(stan::model::rvalue(b, "b", + stan::model::index_uni(sym2__), + stan::model::index_uni(8))); + } } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(10), - stan::model::index_uni(7)); + } + } + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { + return ; + } + lcm_sym2__ = (1 / stan::math::sqrt(tau)); + sigma = lcm_sym2__; + if (emit_transformed_parameters__) { + out__.write(lcm_sym2__); + } + if (stan::math::logical_negation(emit_generated_quantities__)) { + return ; + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline void + transform_inits_impl(VecVar& params_r__, 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 lcm_sym1__; + int pos__; + pos__ = 1; + local_scalar_t__ alpha0; + alpha0 = in__.read(); + out__.write(alpha0); + local_scalar_t__ alpha1; + alpha1 = in__.read(); + out__.write(alpha1); + local_scalar_t__ alpha2; + alpha2 = in__.read(); + out__.write(alpha2); + local_scalar_t__ alpha12; + alpha12 = in__.read(); + out__.write(alpha12); + local_scalar_t__ tau; + tau = in__.read(); + out__.write_free_lb(0, tau); + std::vector> b = + std::vector>(I, + Eigen::Matrix::Constant(8, DUMMY_VAR__)); + { + lcm_sym1__ = stan::math::logical_gte(I, 1); + if (lcm_sym1__) { + stan::model::assign(b, in__.read(), + "assigning variable b", stan::model::index_uni(1), + stan::model::index_uni(1)); + for (int sym2__ = 2; sym2__ <= I; ++sym2__) { + stan::model::assign(b, in__.read(), + "assigning variable b", stan::model::index_uni(sym2__), + stan::model::index_uni(1)); } } { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(1), - stan::model::index_uni(8)); - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(2), - stan::model::index_uni(8)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(3), - stan::model::index_uni(8)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(4), - stan::model::index_uni(8)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(5), - stan::model::index_uni(8)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(6), - stan::model::index_uni(8)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(7), - stan::model::index_uni(8)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(8), - stan::model::index_uni(8)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(9), - stan::model::index_uni(8)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(10), - stan::model::index_uni(8)); + if (lcm_sym1__) { + stan::model::assign(b, in__.read(), + "assigning variable b", stan::model::index_uni(1), + stan::model::index_uni(2)); + for (int sym2__ = 2; sym2__ <= I; ++sym2__) { + stan::model::assign(b, in__.read(), + "assigning variable b", stan::model::index_uni(sym2__), + stan::model::index_uni(2)); + } } } { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(1), - stan::model::index_uni(9)); - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(2), - stan::model::index_uni(9)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(3), - stan::model::index_uni(9)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(4), - stan::model::index_uni(9)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(5), - stan::model::index_uni(9)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(6), - stan::model::index_uni(9)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(7), - stan::model::index_uni(9)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(8), - stan::model::index_uni(9)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(9), - stan::model::index_uni(9)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(10), - stan::model::index_uni(9)); + if (lcm_sym1__) { + stan::model::assign(b, in__.read(), + "assigning variable b", stan::model::index_uni(1), + stan::model::index_uni(3)); + for (int sym2__ = 2; sym2__ <= I; ++sym2__) { + stan::model::assign(b, in__.read(), + "assigning variable b", stan::model::index_uni(sym2__), + stan::model::index_uni(3)); + } } } { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(1), - stan::model::index_uni(10)); - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(2), - stan::model::index_uni(10)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(3), - stan::model::index_uni(10)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(4), - stan::model::index_uni(10)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(5), - stan::model::index_uni(10)); - } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(6), - stan::model::index_uni(10)); + if (lcm_sym1__) { + stan::model::assign(b, in__.read(), + "assigning variable b", stan::model::index_uni(1), + stan::model::index_uni(4)); + for (int sym2__ = 2; sym2__ <= I; ++sym2__) { + stan::model::assign(b, in__.read(), + "assigning variable b", stan::model::index_uni(sym2__), + stan::model::index_uni(4)); + } } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(7), - stan::model::index_uni(10)); + } + { + if (lcm_sym1__) { + stan::model::assign(b, in__.read(), + "assigning variable b", stan::model::index_uni(1), + stan::model::index_uni(5)); + for (int sym2__ = 2; sym2__ <= I; ++sym2__) { + stan::model::assign(b, in__.read(), + "assigning variable b", stan::model::index_uni(sym2__), + stan::model::index_uni(5)); + } } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(8), - stan::model::index_uni(10)); + } + { + if (lcm_sym1__) { + stan::model::assign(b, in__.read(), + "assigning variable b", stan::model::index_uni(1), + stan::model::index_uni(6)); + for (int sym2__ = 2; sym2__ <= I; ++sym2__) { + stan::model::assign(b, in__.read(), + "assigning variable b", stan::model::index_uni(sym2__), + stan::model::index_uni(6)); + } } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(9), - stan::model::index_uni(10)); + } + { + if (lcm_sym1__) { + stan::model::assign(b, in__.read(), + "assigning variable b", stan::model::index_uni(1), + stan::model::index_uni(7)); + for (int sym2__ = 2; sym2__ <= I; ++sym2__) { + stan::model::assign(b, in__.read(), + "assigning variable b", stan::model::index_uni(sym2__), + stan::model::index_uni(7)); + } } - { - stan::model::assign(m3, in__.read(), - "assigning variable m3", stan::model::index_uni(10), - stan::model::index_uni(10)); + } + { + if (lcm_sym1__) { + stan::model::assign(b, in__.read(), + "assigning variable b", stan::model::index_uni(1), + stan::model::index_uni(8)); + for (int sym2__ = 2; sym2__ <= I; ++sym2__) { + stan::model::assign(b, in__.read(), + "assigning variable b", stan::model::index_uni(sym2__), + stan::model::index_uni(8)); + } } } } - out__.write(m3); + out__.write(b); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } inline void get_param_names(std::vector& names__) const { - names__ = std::vector{"m2", "m3"}; + names__ = std::vector{"alpha0", "alpha1", "alpha2", + "alpha12", "tau", "b", "sigma"}; } inline void get_dims(std::vector>& dimss__) const { - dimss__ = std::vector>{std::vector{static_cast< - size_t>( - 10), - static_cast(10)}, - std::vector{static_cast(10), - static_cast(10)}}; + dimss__ = std::vector>{std::vector{}, + std::vector{}, std::vector{}, + std::vector{}, std::vector{}, + std::vector{static_cast(I), + static_cast(K)}, std::vector{}}; } inline void constrained_param_names(std::vector& param_names__, bool emit_transformed_parameters__ = true, bool emit_generated_quantities__ = true) const final { - for (int sym11__ = 1; sym11__ <= 10; ++sym11__) { - for (int sym12__ = 1; sym12__ <= 10; ++sym12__) { - param_names__.emplace_back(std::string() + "m2" + '.' + - std::to_string(sym12__) + '.' + std::to_string(sym11__)); + param_names__.emplace_back(std::string() + "alpha0"); + param_names__.emplace_back(std::string() + "alpha1"); + param_names__.emplace_back(std::string() + "alpha2"); + param_names__.emplace_back(std::string() + "alpha12"); + param_names__.emplace_back(std::string() + "tau"); + for (int sym28__ = 1; sym28__ <= K; ++sym28__) { + for (int sym29__ = 1; sym29__ <= I; ++sym29__) { + param_names__.emplace_back(std::string() + "b" + '.' + + std::to_string(sym29__) + '.' + std::to_string(sym28__)); } } - for (int sym11__ = 1; sym11__ <= 10; ++sym11__) { - for (int sym12__ = 1; sym12__ <= 10; ++sym12__) { - param_names__.emplace_back(std::string() + "m3" + '.' + - std::to_string(sym12__) + '.' + std::to_string(sym11__)); - } + if (emit_transformed_parameters__) { + param_names__.emplace_back(std::string() + "sigma"); } - if (emit_transformed_parameters__) {} 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 sym11__ = 1; sym11__ <= 10; ++sym11__) { - for (int sym12__ = 1; sym12__ <= 10; ++sym12__) { - param_names__.emplace_back(std::string() + "m2" + '.' + - std::to_string(sym12__) + '.' + std::to_string(sym11__)); + param_names__.emplace_back(std::string() + "alpha0"); + param_names__.emplace_back(std::string() + "alpha1"); + param_names__.emplace_back(std::string() + "alpha2"); + param_names__.emplace_back(std::string() + "alpha12"); + param_names__.emplace_back(std::string() + "tau"); + for (int sym28__ = 1; sym28__ <= K; ++sym28__) { + for (int sym29__ = 1; sym29__ <= I; ++sym29__) { + param_names__.emplace_back(std::string() + "b" + '.' + + std::to_string(sym29__) + '.' + std::to_string(sym28__)); } } - for (int sym11__ = 1; sym11__ <= 10; ++sym11__) { - for (int sym12__ = 1; sym12__ <= 10; ++sym12__) { - param_names__.emplace_back(std::string() + "m3" + '.' + - std::to_string(sym12__) + '.' + std::to_string(sym11__)); - } + if (emit_transformed_parameters__) { + param_names__.emplace_back(std::string() + "sigma"); } - if (emit_transformed_parameters__) {} if (emit_generated_quantities__) {} } inline std::string get_constrained_sizedtypes() const { - return std::string("[{\"name\":\"m2\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(10) + ",\"cols\":" + std::to_string(10) + "},\"block\":\"parameters\"},{\"name\":\"m3\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(10) + ",\"cols\":" + std::to_string(10) + "},\"block\":\"parameters\"}]"); + return std::string("[{\"name\":\"alpha0\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"alpha1\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"alpha2\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"alpha12\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"tau\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(I) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string(K) + "}},\"block\":\"parameters\"},{\"name\":\"sigma\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"}]"); } inline std::string get_unconstrained_sizedtypes() const { - return std::string("[{\"name\":\"m2\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(10) + ",\"cols\":" + std::to_string(10) + "},\"block\":\"parameters\"},{\"name\":\"m3\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(10) + ",\"cols\":" + std::to_string(10) + "},\"block\":\"parameters\"}]"); + return std::string("[{\"name\":\"alpha0\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"alpha1\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"alpha2\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"alpha12\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"tau\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(I) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string(K) + "}},\"block\":\"parameters\"},{\"name\":\"sigma\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"}]"); } // Begin method overload boilerplate template inline void @@ -30252,8 +33155,8 @@ class partial_eval_multiply_model final : public model_base_crtp& params_i, std::vector& vars, std::ostream* - pstream__ = nullptr) const { - constexpr std::array names__{"m2", "m3"}; - const std::array - constrain_param_sizes__{(10 * 10), (10 * 10)}; - const auto num_constrained_params__ = - std::accumulate(constrain_param_sizes__.begin(), - constrain_param_sizes__.end(), 0); - std::vector params_r_flat__(num_constrained_params__); - Eigen::Index size_iter__ = 0; - Eigen::Index flat_iter__ = 0; - for (auto&& param_name__: names__) { - const auto param_vec__ = context.vals_r(param_name__); - for (Eigen::Index i = 0; i < constrain_param_sizes__[size_iter__]; ++i) { - params_r_flat__[flat_iter__] = param_vec__[i]; - ++flat_iter__; - } - ++size_iter__; - } - vars.resize(num_params_r__); - transform_inits_impl(params_r_flat__, params_i, vars, pstream__); - } -}; -} -using stan_model = partial_eval_multiply_model_namespace::partial_eval_multiply_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* m = new stan_model(data_context, seed, msg_stream); - return *m; -} -stan::math::profile_map& get_stan_profile_data() { - return partial_eval_multiply_model_namespace::profiles__; -} -#endif - $ ../../../../../install/default/bin/stanc --O --print-cpp stalled1-failure.stan -// Code generated by %%NAME%% %%VERSION%% -#include -namespace stalled1_failure_model_namespace { -using stan::model::model_base_crtp; -using namespace stan::math; -stan::math::profile_map profiles__; -static constexpr std::array locations_array__ = - {" (found before start of program)", - " (in 'stalled1-failure.stan', line 27, column 2 to column 14)", - " (in 'stalled1-failure.stan', line 28, column 2 to column 14)", - " (in 'stalled1-failure.stan', line 29, column 2 to column 14)", - " (in 'stalled1-failure.stan', line 30, column 2 to column 15)", - " (in 'stalled1-failure.stan', line 31, column 2 to column 20)", - " (in 'stalled1-failure.stan', line 32, column 2 to column 23)", - " (in 'stalled1-failure.stan', line 35, column 2 to column 13)", - " (in 'stalled1-failure.stan', line 39, column 2 to column 30)", - " (in 'stalled1-failure.stan', line 40, column 2 to column 30)", - " (in 'stalled1-failure.stan', line 41, column 2 to column 30)", - " (in 'stalled1-failure.stan', line 42, column 2 to column 31)", - " (in 'stalled1-failure.stan', line 43, column 2 to column 30)", - " (in 'stalled1-failure.stan', line 45, column 4 to column 30)", - " (in 'stalled1-failure.stan', line 46, column 4 to line 48, column 54)", - " (in 'stalled1-failure.stan', line 44, column 19 to line 49, column 3)", - " (in 'stalled1-failure.stan', line 44, column 2 to line 49, column 3)", - " (in 'stalled1-failure.stan', line 14, column 2 to column 17)", - " (in 'stalled1-failure.stan', line 15, column 8 to column 9)", - " (in 'stalled1-failure.stan', line 15, column 2 to column 26)", - " (in 'stalled1-failure.stan', line 16, column 8 to column 9)", - " (in 'stalled1-failure.stan', line 16, column 2 to column 26)", - " (in 'stalled1-failure.stan', line 17, column 9 to column 10)", - " (in 'stalled1-failure.stan', line 17, column 2 to column 15)", - " (in 'stalled1-failure.stan', line 18, column 9 to column 10)", - " (in 'stalled1-failure.stan', line 18, column 2 to column 15)", - " (in 'stalled1-failure.stan', line 21, column 2 to column 8)", - " (in 'stalled1-failure.stan', line 22, column 9 to column 10)", - " (in 'stalled1-failure.stan', line 22, column 2 to column 17)", - " (in 'stalled1-failure.stan', line 23, column 2 to column 8)", - " (in 'stalled1-failure.stan', line 24, column 2 to column 18)", - " (in 'stalled1-failure.stan', line 32, column 8 to column 9)", - " (in 'stalled1-failure.stan', line 32, column 18 to column 19)"}; -class stalled1_failure_model final : public model_base_crtp { - private: - double lcm_sym27__; - double lcm_sym26__; - double lcm_sym25__; - double lcm_sym24__; - int lcm_sym23__; - int lcm_sym22__; - Eigen::Matrix lcm_sym21___data__; - int I; - std::vector n; - std::vector N; - Eigen::Matrix x1_data__; - Eigen::Matrix x2_data__; - int K; - Eigen::Matrix x1x2_data__; - Eigen::Map> lcm_sym21__{nullptr, 0}; - Eigen::Map> x1{nullptr, 0}; - Eigen::Map> x2{nullptr, 0}; - Eigen::Map> x1x2{nullptr, 0}; - public: - ~stalled1_failure_model() {} - stalled1_failure_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__ = - "stalled1_failure_model_namespace::stalled1_failure_model"; - // suppress unused var warning - (void) function__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - int pos__; - pos__ = 1; - current_statement__ = 17; - context__.validate_dims("data initialization", "I", "int", - std::vector{}); - I = std::numeric_limits::min(); - current_statement__ = 17; - I = context__.vals_i("I")[(1 - 1)]; - current_statement__ = 17; - stan::math::check_greater_or_equal(function__, "I", I, 0); - current_statement__ = 18; - stan::math::validate_non_negative_index("n", "I", I); - current_statement__ = 19; - context__.validate_dims("data initialization", "n", "int", - std::vector{static_cast(I)}); - n = std::vector(I, std::numeric_limits::min()); - current_statement__ = 19; - n = context__.vals_i("n"); - current_statement__ = 19; - stan::math::check_greater_or_equal(function__, "n", n, 0); - current_statement__ = 20; - stan::math::validate_non_negative_index("N", "I", I); - current_statement__ = 21; - context__.validate_dims("data initialization", "N", "int", - std::vector{static_cast(I)}); - N = std::vector(I, std::numeric_limits::min()); - current_statement__ = 21; - N = context__.vals_i("N"); - current_statement__ = 21; - stan::math::check_greater_or_equal(function__, "N", N, 0); - current_statement__ = 22; - stan::math::validate_non_negative_index("x1", "I", I); - current_statement__ = 23; - context__.validate_dims("data initialization", "x1", "double", - std::vector{static_cast(I)}); - x1_data__ = Eigen::Matrix::Constant(I, - std::numeric_limits::quiet_NaN()); - new (&x1) Eigen::Map>(x1_data__.data(), I); - { - std::vector x1_flat__; - current_statement__ = 23; - x1_flat__ = context__.vals_r("x1"); - current_statement__ = 23; - pos__ = 1; - lcm_sym22__ = stan::math::logical_gte(I, 1); - if (lcm_sym22__) { - current_statement__ = 23; - stan::model::assign(x1, - stan::model::rvalue(x1_flat__, "x1_flat__", - stan::model::index_uni(1)), "assigning variable x1", - stan::model::index_uni(1)); - current_statement__ = 23; - pos__ = 2; - for (int sym1__ = 2; sym1__ <= I; ++sym1__) { - current_statement__ = 23; - stan::model::assign(x1, x1_flat__[(pos__ - 1)], - "assigning variable x1", stan::model::index_uni(sym1__)); - current_statement__ = 23; - pos__ = (pos__ + 1); - } - } - } - current_statement__ = 24; - stan::math::validate_non_negative_index("x2", "I", I); - current_statement__ = 25; - context__.validate_dims("data initialization", "x2", "double", - std::vector{static_cast(I)}); - x2_data__ = Eigen::Matrix::Constant(I, - std::numeric_limits::quiet_NaN()); - new (&x2) Eigen::Map>(x2_data__.data(), I); - { - std::vector x2_flat__; - current_statement__ = 25; - x2_flat__ = context__.vals_r("x2"); - current_statement__ = 25; - pos__ = 1; - current_statement__ = 25; - if (lcm_sym22__) { - current_statement__ = 25; - stan::model::assign(x2, - stan::model::rvalue(x2_flat__, "x2_flat__", - stan::model::index_uni(1)), "assigning variable x2", - stan::model::index_uni(1)); - current_statement__ = 25; - pos__ = 2; - for (int sym1__ = 2; sym1__ <= I; ++sym1__) { - current_statement__ = 25; - stan::model::assign(x2, x2_flat__[(pos__ - 1)], - "assigning variable x2", stan::model::index_uni(sym1__)); - current_statement__ = 25; - pos__ = (pos__ + 1); - } - } - } - current_statement__ = 26; - K = std::numeric_limits::min(); - current_statement__ = 27; - stan::math::validate_non_negative_index("x1x2", "I", I); - current_statement__ = 28; - x1x2_data__ = Eigen::Matrix::Constant(I, - std::numeric_limits::quiet_NaN()); - new (&x1x2) Eigen::Map>(x1x2_data__.data(), - I); - current_statement__ = 29; - K = 8; - current_statement__ = 30; - stan::model::assign(x1x2, stan::math::elt_multiply(x1, x2), - "assigning variable x1x2"); - current_statement__ = 31; - stan::math::validate_non_negative_index("b", "I", I); - current_statement__ = 32; - stan::math::validate_non_negative_index("b", "K", 8); + pstream__ = nullptr) const { + constexpr std::array + names__{"alpha0", "alpha1", "alpha2", "alpha12", "tau", "b"}; + const std::array + constrain_param_sizes__{1, 1, 1, 1, 1, (I * K)}; + const auto num_constrained_params__ = + std::accumulate(constrain_param_sizes__.begin(), + constrain_param_sizes__.end(), 0); + std::vector params_r_flat__(num_constrained_params__); + Eigen::Index size_iter__ = 0; + Eigen::Index flat_iter__ = 0; + for (auto&& param_name__: names__) { + const auto param_vec__ = context.vals_r(param_name__); + for (Eigen::Index i = 0; i < constrain_param_sizes__[size_iter__]; ++i) { + params_r_flat__[flat_iter__] = param_vec__[i]; + ++flat_iter__; + } + ++size_iter__; + } + vars.resize(num_params_r__); + transform_inits_impl(params_r_flat__, params_i, vars, pstream__); + } +}; +} +using stan_model = stalled1_failure_model_namespace::stalled1_failure_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* m = new stan_model(data_context, seed, msg_stream); + return *m; +} +stan::math::profile_map& get_stan_profile_data() { + return stalled1_failure_model_namespace::profiles__; +} +#endif + $ ../../../../../install/default/bin/stanc --O --print-cpp unenforce-initialize-should-fail.stan +// Code generated by %%NAME%% %%VERSION%% +#include +namespace unenforce_initialize_should_fail_model_namespace { +using stan::model::model_base_crtp; +using namespace stan::math; +stan::math::profile_map profiles__; +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'unenforce-initialize-should-fail.stan', line 5, column 2 to column 13)", + " (in 'unenforce-initialize-should-fail.stan', line 8, column 2 to column 36)", + " (in 'unenforce-initialize-should-fail.stan', line 11, column 6 to column 23)", + " (in 'unenforce-initialize-should-fail.stan', line 10, column 4 to line 12, column 5)", + " (in 'unenforce-initialize-should-fail.stan', line 9, column 2 to line 13, column 3)", + " (in 'unenforce-initialize-should-fail.stan', line 16, column 2 to column 23)", + " (in 'unenforce-initialize-should-fail.stan', line 2, column 2 to column 60)"}; +class unenforce_initialize_should_fail_model final : public model_base_crtp { + private: + std::vector> lcm_sym18__; + std::vector> inputs; + public: + ~unenforce_initialize_should_fail_model() {} + unenforce_initialize_should_fail_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__ = + "unenforce_initialize_should_fail_model_namespace::unenforce_initialize_should_fail_model"; + // suppress unused var warning + (void) function__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + int pos__; + pos__ = 1; + current_statement__ = 7; + inputs = std::vector>(2, + Eigen::Matrix::Constant(5, + std::numeric_limits::quiet_NaN())); + current_statement__ = 7; + stan::model::assign(inputs, + stan::math::rep_array(stan::math::zeros_vector(5), 2), + "assigning variable inputs"); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } - num_params_r__ = 1 + 1 + 1 + 1 + 1 + (I * K); + num_params_r__ = 1; } inline std::string model_name() const final { - return "stalled1_failure_model"; + return "unenforce_initialize_should_fail_model"; } inline std::vector model_compile_info() const noexcept { return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", @@ -30558,118 +33320,110 @@ class stalled1_failure_model final : public model_base_crtp> lcm_sym16__; double lcm_sym15__; double lcm_sym14__; double lcm_sym13__; double lcm_sym12__; - int lcm_sym11__; - local_scalar_t__ lcm_sym10__; - local_scalar_t__ alpha0; + local_scalar_t__ param; current_statement__ = 1; - alpha0 = in__.template read(); - local_scalar_t__ alpha1; - current_statement__ = 2; - alpha1 = in__.template read(); - local_scalar_t__ alpha2; - current_statement__ = 3; - alpha2 = in__.template read(); - local_scalar_t__ alpha12; - current_statement__ = 4; - alpha12 = in__.template read(); - local_scalar_t__ tau; - current_statement__ = 5; - tau = in__.template read_constrain_lb(0, - lp__); + param = in__.template read(); std::vector< stan::conditional_var_value_t>> b = + Eigen::Matrix>> local = std::vector< stan::conditional_var_value_t>>(I, + Eigen::Matrix>>(2, stan::conditional_var_value_t>(Eigen::Matrix::Constant(8, + Eigen::Matrix>(Eigen::Matrix::Constant(5, std::numeric_limits::quiet_NaN( )))); - current_statement__ = 6; - b = in__.template read< - std::vector< - stan::conditional_var_value_t>>>(I, 8); - local_scalar_t__ sigma = DUMMY_VAR__; - lcm_sym10__ = (1 / stan::math::sqrt(tau)); - sigma = lcm_sym10__; + stan::model::assign(lcm_sym16__, + stan::math::rep_array(stan::math::zeros_vector(5), 2), + "assigning variable lcm_sym16__"); + stan::model::assign(local, lcm_sym16__, "assigning variable local"); { - current_statement__ = 8; - lp_accum__.add(stan::math::normal_lpdf(alpha0, 0.0, 1.0E3)); - current_statement__ = 9; - lp_accum__.add(stan::math::normal_lpdf(alpha1, 0.0, 1.0E3)); - current_statement__ = 10; - lp_accum__.add(stan::math::normal_lpdf(alpha2, 0.0, 1.0E3)); - current_statement__ = 11; - lp_accum__.add(stan::math::normal_lpdf(alpha12, 0.0, 1.0E3)); - current_statement__ = 12; - lp_accum__.add(stan::math::gamma_lpdf(tau, 1.0E-3, 1.0E-3)); - current_statement__ = 16; - if (stan::math::logical_gte(I, 1)) { - current_statement__ = 13; - lp_accum__.add(stan::math::normal_lpdf( - stan::model::rvalue(b, "b", - stan::model::index_uni(1)), 0.0, lcm_sym10__)); - current_statement__ = 14; - lp_accum__.add(stan::math::binomial_logit_lpmf( - stan::model::rvalue(n, "n", - stan::model::index_uni(1)), - stan::model::rvalue(N, "N", - stan::model::index_uni(1)), - stan::math::add( - stan::math::fma(alpha12, - stan::model::rvalue( - stan::math::elt_multiply(x1, x2), - "(x1 .* x2)", stan::model::index_uni(1)), - stan::math::fma(alpha2, - stan::model::rvalue(x2, "x2", - stan::model::index_uni(1)), - stan::math::fma(alpha1, - stan::model::rvalue(x1, "x1", - stan::model::index_uni(1)), alpha0))), - stan::model::rvalue(b, "b", - stan::model::index_uni(1))))); - for (int i = 2; i <= I; ++i) { - current_statement__ = 13; - lp_accum__.add(stan::math::normal_lpdf( - stan::model::rvalue(b, "b", - stan::model::index_uni(i)), 0.0, lcm_sym10__)); - current_statement__ = 14; - lp_accum__.add(stan::math::binomial_logit_lpmf( - stan::model::rvalue(n, "n", - stan::model::index_uni(i)), - stan::model::rvalue(N, "N", - stan::model::index_uni(i)), - stan::math::add( - stan::math::fma(alpha12, - stan::model::rvalue( - stan::math::elt_multiply(x1, x2), - "(x1 .* x2)", stan::model::index_uni(i)), - stan::math::fma(alpha2, - stan::model::rvalue(x2, "x2", - stan::model::index_uni(i)), - stan::math::fma(alpha1, - stan::model::rvalue(x1, "x1", - stan::model::index_uni(i)), alpha0))), - stan::model::rvalue(b, "b", - stan::model::index_uni(i))))); + { + current_statement__ = 3; + stan::model::assign(local, + (stan::model::rvalue(lcm_sym16__, "lcm_sym16__", + stan::model::index_uni(1), stan::model::index_uni(1)) + 1), + "assigning variable local", stan::model::index_uni(1), + stan::model::index_uni(1)); + { + current_statement__ = 3; + stan::model::assign(local, + (stan::model::rvalue(local, "local", stan::model::index_uni(1), + stan::model::index_uni(2)) + 1), "assigning variable local", + stan::model::index_uni(1), stan::model::index_uni(2)); + } + { + current_statement__ = 3; + stan::model::assign(local, + (stan::model::rvalue(local, "local", stan::model::index_uni(1), + stan::model::index_uni(3)) + 1), "assigning variable local", + stan::model::index_uni(1), stan::model::index_uni(3)); + } + { + current_statement__ = 3; + stan::model::assign(local, + (stan::model::rvalue(local, "local", stan::model::index_uni(1), + stan::model::index_uni(4)) + 1), "assigning variable local", + stan::model::index_uni(1), stan::model::index_uni(4)); + } + { + current_statement__ = 3; + stan::model::assign(local, + (stan::model::rvalue(local, "local", stan::model::index_uni(1), + stan::model::index_uni(5)) + 1), "assigning variable local", + stan::model::index_uni(1), stan::model::index_uni(5)); + } + } + { + current_statement__ = 3; + stan::model::assign(local, + (stan::model::rvalue(local, "local", stan::model::index_uni(2), + stan::model::index_uni(1)) + 1), "assigning variable local", + stan::model::index_uni(2), stan::model::index_uni(1)); + { + current_statement__ = 3; + stan::model::assign(local, + (stan::model::rvalue(local, "local", stan::model::index_uni(2), + stan::model::index_uni(2)) + 1), "assigning variable local", + stan::model::index_uni(2), stan::model::index_uni(2)); + } + { + current_statement__ = 3; + stan::model::assign(local, + (stan::model::rvalue(local, "local", stan::model::index_uni(2), + stan::model::index_uni(3)) + 1), "assigning variable local", + stan::model::index_uni(2), stan::model::index_uni(3)); + } + { + current_statement__ = 3; + stan::model::assign(local, + (stan::model::rvalue(local, "local", stan::model::index_uni(2), + stan::model::index_uni(4)) + 1), "assigning variable local", + stan::model::index_uni(2), stan::model::index_uni(4)); + } + { + current_statement__ = 3; + stan::model::assign(local, + (stan::model::rvalue(local, "local", stan::model::index_uni(2), + stan::model::index_uni(5)) + 1), "assigning variable local", + stan::model::index_uni(2), stan::model::index_uni(5)); } } } + { + current_statement__ = 6; + lp_accum__.add(stan::math::std_normal_lpdf(param)); + } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } @@ -30703,153 +33457,158 @@ class stalled1_failure_model final : public model_base_crtp> lcm_sym7__; double lcm_sym6__; - int lcm_sym5__; - int lcm_sym4__; - int lcm_sym3__; - double lcm_sym2__; - double alpha0; + double lcm_sym5__; + double lcm_sym4__; + double lcm_sym3__; + int lcm_sym2__; + int lcm_sym1__; + double param; current_statement__ = 1; - alpha0 = in__.template read(); - double alpha1; - current_statement__ = 2; - alpha1 = in__.template read(); - double alpha2; - current_statement__ = 3; - alpha2 = in__.template read(); - double alpha12; - current_statement__ = 4; - alpha12 = in__.template read(); - double tau; - current_statement__ = 5; - tau = in__.template read_constrain_lb(0, - lp__); - std::vector> b = - std::vector>(I, - Eigen::Matrix::Constant(8, + param = in__.template read(); + std::vector> local = + std::vector>(2, + Eigen::Matrix::Constant(5, std::numeric_limits::quiet_NaN())); - current_statement__ = 6; - b = in__.template read< - std::vector>>(I, 8); - double sigma = std::numeric_limits::quiet_NaN(); - out__.write(alpha0); - out__.write(alpha1); - out__.write(alpha2); - out__.write(alpha12); - out__.write(tau); + out__.write(param); + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { + return ; + } + stan::model::assign(lcm_sym7__, + stan::math::rep_array(stan::math::zeros_vector(5), 2), + "assigning variable lcm_sym7__"); + stan::model::assign(local, lcm_sym7__, "assigning variable local"); { - lcm_sym3__ = stan::math::logical_gte(I, 1); - if (lcm_sym3__) { - out__.write(stan::model::rvalue(b, "b", stan::model::index_uni(1), - stan::model::index_uni(1))); - for (int sym2__ = 2; sym2__ <= I; ++sym2__) { - out__.write(stan::model::rvalue(b, "b", - stan::model::index_uni(sym2__), - stan::model::index_uni(1))); - } - } { - if (lcm_sym3__) { - out__.write(stan::model::rvalue(b, "b", - stan::model::index_uni(1), - stan::model::index_uni(2))); - for (int sym2__ = 2; sym2__ <= I; ++sym2__) { - out__.write(stan::model::rvalue(b, "b", - stan::model::index_uni(sym2__), - stan::model::index_uni(2))); - } + current_statement__ = 3; + stan::model::assign(local, + (stan::model::rvalue(lcm_sym7__, "lcm_sym7__", + stan::model::index_uni(1), stan::model::index_uni(1)) + 1), + "assigning variable local", stan::model::index_uni(1), + stan::model::index_uni(1)); + { + current_statement__ = 3; + stan::model::assign(local, + (stan::model::rvalue(local, "local", stan::model::index_uni(1), + stan::model::index_uni(2)) + 1), "assigning variable local", + stan::model::index_uni(1), stan::model::index_uni(2)); + } + { + current_statement__ = 3; + stan::model::assign(local, + (stan::model::rvalue(local, "local", stan::model::index_uni(1), + stan::model::index_uni(3)) + 1), "assigning variable local", + stan::model::index_uni(1), stan::model::index_uni(3)); + } + { + current_statement__ = 3; + stan::model::assign(local, + (stan::model::rvalue(local, "local", stan::model::index_uni(1), + stan::model::index_uni(4)) + 1), "assigning variable local", + stan::model::index_uni(1), stan::model::index_uni(4)); + } + { + current_statement__ = 3; + stan::model::assign(local, + (stan::model::rvalue(local, "local", stan::model::index_uni(1), + stan::model::index_uni(5)) + 1), "assigning variable local", + stan::model::index_uni(1), stan::model::index_uni(5)); } } { - if (lcm_sym3__) { - out__.write(stan::model::rvalue(b, "b", - stan::model::index_uni(1), - stan::model::index_uni(3))); - for (int sym2__ = 2; sym2__ <= I; ++sym2__) { - out__.write(stan::model::rvalue(b, "b", - stan::model::index_uni(sym2__), - stan::model::index_uni(3))); - } + current_statement__ = 3; + stan::model::assign(local, + (stan::model::rvalue(local, "local", stan::model::index_uni(2), + stan::model::index_uni(1)) + 1), "assigning variable local", + stan::model::index_uni(2), stan::model::index_uni(1)); + { + current_statement__ = 3; + stan::model::assign(local, + (stan::model::rvalue(local, "local", stan::model::index_uni(2), + stan::model::index_uni(2)) + 1), "assigning variable local", + stan::model::index_uni(2), stan::model::index_uni(2)); + } + { + current_statement__ = 3; + stan::model::assign(local, + (stan::model::rvalue(local, "local", stan::model::index_uni(2), + stan::model::index_uni(3)) + 1), "assigning variable local", + stan::model::index_uni(2), stan::model::index_uni(3)); + } + { + current_statement__ = 3; + stan::model::assign(local, + (stan::model::rvalue(local, "local", stan::model::index_uni(2), + stan::model::index_uni(4)) + 1), "assigning variable local", + stan::model::index_uni(2), stan::model::index_uni(4)); + } + { + current_statement__ = 3; + stan::model::assign(local, + (stan::model::rvalue(local, "local", stan::model::index_uni(2), + stan::model::index_uni(5)) + 1), "assigning variable local", + stan::model::index_uni(2), stan::model::index_uni(5)); } } + } + if (emit_transformed_parameters__) { { - if (lcm_sym3__) { - out__.write(stan::model::rvalue(b, "b", - stan::model::index_uni(1), - stan::model::index_uni(4))); - for (int sym2__ = 2; sym2__ <= I; ++sym2__) { - out__.write(stan::model::rvalue(b, "b", - stan::model::index_uni(sym2__), - stan::model::index_uni(4))); - } + out__.write(stan::model::rvalue(local, "local", + stan::model::index_uni(1), stan::model::index_uni(1))); + { + out__.write(stan::model::rvalue(local, "local", + stan::model::index_uni(2), + stan::model::index_uni(1))); } } { - if (lcm_sym3__) { - out__.write(stan::model::rvalue(b, "b", - stan::model::index_uni(1), - stan::model::index_uni(5))); - for (int sym2__ = 2; sym2__ <= I; ++sym2__) { - out__.write(stan::model::rvalue(b, "b", - stan::model::index_uni(sym2__), - stan::model::index_uni(5))); - } + out__.write(stan::model::rvalue(local, "local", + stan::model::index_uni(1), stan::model::index_uni(2))); + { + out__.write(stan::model::rvalue(local, "local", + stan::model::index_uni(2), + stan::model::index_uni(2))); } } { - if (lcm_sym3__) { - out__.write(stan::model::rvalue(b, "b", - stan::model::index_uni(1), - stan::model::index_uni(6))); - for (int sym2__ = 2; sym2__ <= I; ++sym2__) { - out__.write(stan::model::rvalue(b, "b", - stan::model::index_uni(sym2__), - stan::model::index_uni(6))); - } + out__.write(stan::model::rvalue(local, "local", + stan::model::index_uni(1), stan::model::index_uni(3))); + { + out__.write(stan::model::rvalue(local, "local", + stan::model::index_uni(2), + stan::model::index_uni(3))); } } { - if (lcm_sym3__) { - out__.write(stan::model::rvalue(b, "b", - stan::model::index_uni(1), - stan::model::index_uni(7))); - for (int sym2__ = 2; sym2__ <= I; ++sym2__) { - out__.write(stan::model::rvalue(b, "b", - stan::model::index_uni(sym2__), - stan::model::index_uni(7))); - } + out__.write(stan::model::rvalue(local, "local", + stan::model::index_uni(1), stan::model::index_uni(4))); + { + out__.write(stan::model::rvalue(local, "local", + stan::model::index_uni(2), + stan::model::index_uni(4))); } } { - if (lcm_sym3__) { - out__.write(stan::model::rvalue(b, "b", - stan::model::index_uni(1), - stan::model::index_uni(8))); - for (int sym2__ = 2; sym2__ <= I; ++sym2__) { - out__.write(stan::model::rvalue(b, "b", - stan::model::index_uni(sym2__), - stan::model::index_uni(8))); - } + out__.write(stan::model::rvalue(local, "local", + stan::model::index_uni(1), stan::model::index_uni(5))); + { + out__.write(stan::model::rvalue(local, "local", + stan::model::index_uni(2), + stan::model::index_uni(5))); } } } - if (stan::math::logical_negation( - (stan::math::primitive_value(emit_transformed_parameters__) || - stan::math::primitive_value(emit_generated_quantities__)))) { - return ; - } - lcm_sym2__ = (1 / stan::math::sqrt(tau)); - sigma = lcm_sym2__; - if (emit_transformed_parameters__) { - out__.write(lcm_sym2__); - } if (stan::math::logical_negation(emit_generated_quantities__)) { return ; } @@ -30871,157 +33630,35 @@ class stalled1_failure_model final : public model_base_crtp(); - out__.write(alpha0); - local_scalar_t__ alpha1; - alpha1 = in__.read(); - out__.write(alpha1); - local_scalar_t__ alpha2; - alpha2 = in__.read(); - out__.write(alpha2); - local_scalar_t__ alpha12; - alpha12 = in__.read(); - out__.write(alpha12); - local_scalar_t__ tau; - tau = in__.read(); - out__.write_free_lb(0, tau); - std::vector> b = - std::vector>(I, - Eigen::Matrix::Constant(8, DUMMY_VAR__)); - { - lcm_sym1__ = stan::math::logical_gte(I, 1); - if (lcm_sym1__) { - stan::model::assign(b, in__.read(), - "assigning variable b", stan::model::index_uni(1), - stan::model::index_uni(1)); - for (int sym2__ = 2; sym2__ <= I; ++sym2__) { - stan::model::assign(b, in__.read(), - "assigning variable b", stan::model::index_uni(sym2__), - stan::model::index_uni(1)); - } - } - { - if (lcm_sym1__) { - stan::model::assign(b, in__.read(), - "assigning variable b", stan::model::index_uni(1), - stan::model::index_uni(2)); - for (int sym2__ = 2; sym2__ <= I; ++sym2__) { - stan::model::assign(b, in__.read(), - "assigning variable b", stan::model::index_uni(sym2__), - stan::model::index_uni(2)); - } - } - } - { - if (lcm_sym1__) { - stan::model::assign(b, in__.read(), - "assigning variable b", stan::model::index_uni(1), - stan::model::index_uni(3)); - for (int sym2__ = 2; sym2__ <= I; ++sym2__) { - stan::model::assign(b, in__.read(), - "assigning variable b", stan::model::index_uni(sym2__), - stan::model::index_uni(3)); - } - } - } - { - if (lcm_sym1__) { - stan::model::assign(b, in__.read(), - "assigning variable b", stan::model::index_uni(1), - stan::model::index_uni(4)); - for (int sym2__ = 2; sym2__ <= I; ++sym2__) { - stan::model::assign(b, in__.read(), - "assigning variable b", stan::model::index_uni(sym2__), - stan::model::index_uni(4)); - } - } - } - { - if (lcm_sym1__) { - stan::model::assign(b, in__.read(), - "assigning variable b", stan::model::index_uni(1), - stan::model::index_uni(5)); - for (int sym2__ = 2; sym2__ <= I; ++sym2__) { - stan::model::assign(b, in__.read(), - "assigning variable b", stan::model::index_uni(sym2__), - stan::model::index_uni(5)); - } - } - } - { - if (lcm_sym1__) { - stan::model::assign(b, in__.read(), - "assigning variable b", stan::model::index_uni(1), - stan::model::index_uni(6)); - for (int sym2__ = 2; sym2__ <= I; ++sym2__) { - stan::model::assign(b, in__.read(), - "assigning variable b", stan::model::index_uni(sym2__), - stan::model::index_uni(6)); - } - } - } - { - if (lcm_sym1__) { - stan::model::assign(b, in__.read(), - "assigning variable b", stan::model::index_uni(1), - stan::model::index_uni(7)); - for (int sym2__ = 2; sym2__ <= I; ++sym2__) { - stan::model::assign(b, in__.read(), - "assigning variable b", stan::model::index_uni(sym2__), - stan::model::index_uni(7)); - } - } - } - { - if (lcm_sym1__) { - stan::model::assign(b, in__.read(), - "assigning variable b", stan::model::index_uni(1), - stan::model::index_uni(8)); - for (int sym2__ = 2; sym2__ <= I; ++sym2__) { - stan::model::assign(b, in__.read(), - "assigning variable b", stan::model::index_uni(sym2__), - stan::model::index_uni(8)); - } - } - } - } - out__.write(b); + local_scalar_t__ param; + param = in__.read(); + out__.write(param); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } inline void get_param_names(std::vector& names__) const { - names__ = std::vector{"alpha0", "alpha1", "alpha2", - "alpha12", "tau", "b", "sigma"}; + names__ = std::vector{"param", "local"}; } inline void get_dims(std::vector>& dimss__) const { dimss__ = std::vector>{std::vector{}, - std::vector{}, std::vector{}, - std::vector{}, std::vector{}, - std::vector{static_cast(I), - static_cast(K)}, std::vector{}}; + std::vector{static_cast(2), + static_cast(5)}}; } inline void constrained_param_names(std::vector& param_names__, bool emit_transformed_parameters__ = true, bool emit_generated_quantities__ = true) const final { - param_names__.emplace_back(std::string() + "alpha0"); - param_names__.emplace_back(std::string() + "alpha1"); - param_names__.emplace_back(std::string() + "alpha2"); - param_names__.emplace_back(std::string() + "alpha12"); - param_names__.emplace_back(std::string() + "tau"); - for (int sym28__ = 1; sym28__ <= K; ++sym28__) { - for (int sym29__ = 1; sym29__ <= I; ++sym29__) { - param_names__.emplace_back(std::string() + "b" + '.' + - std::to_string(sym29__) + '.' + std::to_string(sym28__)); - } - } + param_names__.emplace_back(std::string() + "param"); if (emit_transformed_parameters__) { - param_names__.emplace_back(std::string() + "sigma"); + for (int sym19__ = 1; sym19__ <= 5; ++sym19__) { + for (int sym20__ = 1; sym20__ <= 2; ++sym20__) { + param_names__.emplace_back(std::string() + "local" + '.' + + std::to_string(sym20__) + '.' + std::to_string(sym19__)); + } + } } if (emit_generated_quantities__) {} } @@ -31029,27 +33666,22 @@ class stalled1_failure_model final : public model_base_crtp& param_names__, bool emit_transformed_parameters__ = true, bool emit_generated_quantities__ = true) const final { - param_names__.emplace_back(std::string() + "alpha0"); - param_names__.emplace_back(std::string() + "alpha1"); - param_names__.emplace_back(std::string() + "alpha2"); - param_names__.emplace_back(std::string() + "alpha12"); - param_names__.emplace_back(std::string() + "tau"); - for (int sym28__ = 1; sym28__ <= K; ++sym28__) { - for (int sym29__ = 1; sym29__ <= I; ++sym29__) { - param_names__.emplace_back(std::string() + "b" + '.' + - std::to_string(sym29__) + '.' + std::to_string(sym28__)); - } - } + param_names__.emplace_back(std::string() + "param"); if (emit_transformed_parameters__) { - param_names__.emplace_back(std::string() + "sigma"); + for (int sym19__ = 1; sym19__ <= 5; ++sym19__) { + for (int sym20__ = 1; sym20__ <= 2; ++sym20__) { + param_names__.emplace_back(std::string() + "local" + '.' + + std::to_string(sym20__) + '.' + std::to_string(sym19__)); + } + } } if (emit_generated_quantities__) {} } inline std::string get_constrained_sizedtypes() const { - return std::string("[{\"name\":\"alpha0\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"alpha1\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"alpha2\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"alpha12\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"tau\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(I) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string(K) + "}},\"block\":\"parameters\"},{\"name\":\"sigma\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"}]"); + return std::string("[{\"name\":\"param\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"local\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(2) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string(5) + "}},\"block\":\"transformed_parameters\"}]"); } inline std::string get_unconstrained_sizedtypes() const { - return std::string("[{\"name\":\"alpha0\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"alpha1\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"alpha2\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"alpha12\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"tau\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(I) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string(K) + "}},\"block\":\"parameters\"},{\"name\":\"sigma\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"}]"); + return std::string("[{\"name\":\"param\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"local\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(2) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string(5) + "}},\"block\":\"transformed_parameters\"}]"); } // Begin method overload boilerplate template inline void @@ -31058,8 +33690,8 @@ class stalled1_failure_model final : public model_base_crtp& params_i, std::vector& vars, std::ostream* pstream__ = nullptr) const { - constexpr std::array - names__{"alpha0", "alpha1", "alpha2", "alpha12", "tau", "b"}; - const std::array - constrain_param_sizes__{1, 1, 1, 1, 1, (I * K)}; + constexpr std::array names__{"param"}; + const std::array constrain_param_sizes__{1}; const auto num_constrained_params__ = std::accumulate(constrain_param_sizes__.begin(), constrain_param_sizes__.end(), 0); @@ -31132,7 +33762,7 @@ class stalled1_failure_model final : public model_base_crtp -namespace copy_fail_model_namespace { +namespace ad_levels_deep_model_namespace { using stan::model::model_base_crtp; using namespace stan::math; stan::math::profile_map profiles__; -static constexpr std::array locations_array__ = +static constexpr std::array locations_array__ = {" (found before start of program)", - " (in 'copy_fail.stan', line 68, column 2 to column 32)", - " (in 'copy_fail.stan', line 69, column 2 to column 41)", - " (in 'copy_fail.stan', line 72, column 2 to column 52)", - " (in 'copy_fail.stan', line 73, column 2 to column 50)", - " (in 'copy_fail.stan', line 74, column 2 to column 50)", - " (in 'copy_fail.stan', line 79, column 6 to column 20)", - " (in 'copy_fail.stan', line 80, column 6 to column 18)", - " (in 'copy_fail.stan', line 78, column 34 to line 81, column 5)", - " (in 'copy_fail.stan', line 78, column 4 to line 81, column 5)", - " (in 'copy_fail.stan', line 83, column 6 to column 32)", - " (in 'copy_fail.stan', line 84, column 6 to column 23)", - " (in 'copy_fail.stan', line 82, column 40 to line 85, column 5)", - " (in 'copy_fail.stan', line 82, column 4 to line 85, column 5)", - " (in 'copy_fail.stan', line 77, column 22 to line 86, column 3)", - " (in 'copy_fail.stan', line 77, column 2 to line 86, column 3)", - " (in 'copy_fail.stan', line 25, column 11 to column 15)", - " (in 'copy_fail.stan', line 25, column 17 to column 28)", - " (in 'copy_fail.stan', line 25, column 4 to column 34)", - " (in 'copy_fail.stan', line 28, column 6 to column 32)", - " (in 'copy_fail.stan', line 31, column 8 to column 37)", - " (in 'copy_fail.stan', line 32, column 8 to column 32)", - " (in 'copy_fail.stan', line 40, column 8 to line 42, column 44)", - " (in 'copy_fail.stan', line 29, column 39 to line 43, column 7)", - " (in 'copy_fail.stan', line 29, column 6 to line 43, column 7)", - " (in 'copy_fail.stan', line 27, column 24 to line 44, column 5)", - " (in 'copy_fail.stan', line 27, column 4 to line 44, column 5)", - " (in 'copy_fail.stan', line 45, column 4 to column 15)", - " (in 'copy_fail.stan', line 100, column 8 to column 37)", - " (in 'copy_fail.stan', line 101, column 8 to column 41)", - " (in 'copy_fail.stan', line 99, column 42 to line 102, column 7)", - " (in 'copy_fail.stan', line 99, column 6 to line 102, column 7)", - " (in 'copy_fail.stan', line 103, column 6 to column 37)", - " (in 'copy_fail.stan', line 98, column 22 to line 104, column 5)", - " (in 'copy_fail.stan', line 98, column 4 to line 104, column 5)", - " (in 'copy_fail.stan', line 97, column 22 to line 105, column 3)", - " (in 'copy_fail.stan', line 97, column 2 to line 105, column 3)", - " (in 'copy_fail.stan', line 49, column 2 to column 20)", - " (in 'copy_fail.stan', line 50, column 2 to column 27)", - " (in 'copy_fail.stan', line 51, column 8 to column 12)", - " (in 'copy_fail.stan', line 51, column 14 to column 25)", - " (in 'copy_fail.stan', line 51, column 2 to column 51)", - " (in 'copy_fail.stan', line 52, column 2 to column 23)", - " (in 'copy_fail.stan', line 53, column 8 to column 12)", - " (in 'copy_fail.stan', line 53, column 14 to column 29)", - " (in 'copy_fail.stan', line 53, column 2 to column 61)", - " (in 'copy_fail.stan', line 56, column 2 to column 38)", - " (in 'copy_fail.stan', line 58, column 8 to column 12)", - " (in 'copy_fail.stan', line 58, column 2 to column 52)", - " (in 'copy_fail.stan', line 59, column 8 to column 12)", - " (in 'copy_fail.stan', line 59, column 2 to column 51)", - " (in 'copy_fail.stan', line 63, column 4 to column 35)", - " (in 'copy_fail.stan', line 62, column 2 to line 63, column 35)", - " (in 'copy_fail.stan', line 65, column 4 to column 33)", - " (in 'copy_fail.stan', line 64, column 2 to line 65, column 33)", - " (in 'copy_fail.stan', line 69, column 27 to column 34)", - " (in 'copy_fail.stan', line 72, column 27 to column 31)", - " (in 'copy_fail.stan', line 72, column 33 to column 46)", - " (in 'copy_fail.stan', line 73, column 27 to column 31)", - " (in 'copy_fail.stan', line 73, column 33 to column 46)", - " (in 'copy_fail.stan', line 74, column 27 to column 31)", - " (in 'copy_fail.stan', line 74, column 33 to column 44)", - " (in 'copy_fail.stan', line 8, column 8 to column 17)", - " (in 'copy_fail.stan', line 7, column 6 to line 8, column 17)", - " (in 'copy_fail.stan', line 6, column 4 to line 8, column 17)", - " (in 'copy_fail.stan', line 9, column 4 to column 13)", - " (in 'copy_fail.stan', line 5, column 37 to line 10, column 3)", - " (in 'copy_fail.stan', line 15, column 6 to column 32)", - " (in 'copy_fail.stan', line 19, column 8 to column 17)", - " (in 'copy_fail.stan', line 18, column 6 to line 19, column 17)", - " (in 'copy_fail.stan', line 13, column 39 to line 20, column 5)", - " (in 'copy_fail.stan', line 13, column 4 to line 20, column 5)", - " (in 'copy_fail.stan', line 21, column 4 to column 13)", - " (in 'copy_fail.stan', line 12, column 36 to line 22, column 3)", - " (in 'copy_fail.stan', line 24, column 74 to line 46, column 3)"}; -int first_capture(const std::vector& y_i, std::ostream* pstream__); -int last_capture(const std::vector& y_i, std::ostream* pstream__); -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, - const T3__& phi_arg__, std::ostream* pstream__); -int first_capture(const std::vector& y_i, std::ostream* pstream__) { - using local_scalar_t__ = double; - int current_statement__ = 0; - static constexpr bool propto__ = true; - // suppress unused var warning - (void) propto__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - current_statement__ = 64; - for (int k = 1; k <= stan::math::size(y_i); ++k) { - current_statement__ = 63; - if (stan::model::rvalue(y_i, "y_i", stan::model::index_uni(k))) { - current_statement__ = 62; - return k; - } - } - current_statement__ = 65; - return 0; - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } -} -int last_capture(const std::vector& y_i, std::ostream* pstream__) { - using local_scalar_t__ = double; - int current_statement__ = 0; - static constexpr bool propto__ = true; - // suppress unused var warning - (void) propto__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - current_statement__ = 71; - for (int k_rev = 0; k_rev <= (stan::math::size(y_i) - 1); ++k_rev) { - int k; - current_statement__ = 67; - k = (stan::math::size(y_i) - k_rev); - current_statement__ = 69; - if (stan::model::rvalue(y_i, "y_i", stan::model::index_uni(k))) { - current_statement__ = 68; - return k; - } - } - current_statement__ = 72; - return 0; - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } -} -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, - const T3__& phi_arg__, std::ostream* pstream__) { - using local_scalar_t__ = stan::promote_args_t, - stan::base_type_t>; - int current_statement__ = 0; - const auto& p = stan::math::to_ref(p_arg__); - const auto& phi = stan::math::to_ref(phi_arg__); - static constexpr bool propto__ = true; - // suppress unused var warning - (void) propto__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - current_statement__ = 16; - stan::math::validate_non_negative_index("chi", "nind", nind); - current_statement__ = 17; - stan::math::validate_non_negative_index("chi", "n_occasions", n_occasions); - Eigen::Matrix chi = - Eigen::Matrix::Constant(nind, n_occasions, - DUMMY_VAR__); - current_statement__ = 26; - for (int i = 1; i <= nind; ++i) { - current_statement__ = 19; - stan::model::assign(chi, 1.0, "assigning variable chi", - stan::model::index_uni(i), stan::model::index_uni(n_occasions)); - current_statement__ = 24; - for (int t = 1; t <= (n_occasions - 1); ++t) { - int t_curr; - current_statement__ = 20; - t_curr = (n_occasions - t); - int t_next; - current_statement__ = 21; - t_next = (t_curr + 1); - current_statement__ = 22; - stan::model::assign(chi, - stan::math::fma( - (stan::model::rvalue(phi, "phi", stan::model::index_uni(i), - stan::model::index_uni(t_curr)) * (1 - - stan::model::rvalue(p, "p", stan::model::index_uni(i), - stan::model::index_uni((t_next - 1))))), - stan::model::rvalue(chi, "chi", stan::model::index_uni(i), - stan::model::index_uni(t_next)), (1 - - stan::model::rvalue(phi, "phi", stan::model::index_uni(i), - stan::model::index_uni(t_curr)))), "assigning variable chi", - stan::model::index_uni(i), stan::model::index_uni(t_curr)); - } - } - current_statement__ = 27; - return chi; - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } -} -class copy_fail_model final : public model_base_crtp { + " (in 'ad-levels-deep.stan', line 6, column 4 to column 23)", + " (in 'ad-levels-deep.stan', line 10, column 4 to column 39)", + " (in 'ad-levels-deep.stan', line 11, column 4 to column 38)", + " (in 'ad-levels-deep.stan', line 12, column 4 to column 16)", + " (in 'ad-levels-deep.stan', line 2, column 4 to column 26)"}; +class ad_levels_deep_model final : public model_base_crtp { private: - int nind; - int n_occasions; - std::vector> y; - int max_age; - std::vector> x; - int n_occ_minus_1; - std::vector first; - std::vector last; + Eigen::Matrix X_data_data__; + Eigen::Map> X_data{nullptr, 0, 0}; public: - ~copy_fail_model() {} - copy_fail_model(stan::io::var_context& context__, unsigned int - random_seed__ = 0, std::ostream* pstream__ = nullptr) + ~ad_levels_deep_model() {} + ad_levels_deep_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; @@ -1328,7 +1130,7 @@ class copy_fail_model final : public model_base_crtp { // suppress unused var warning (void) base_rng__; static constexpr const char* function__ = - "copy_fail_model_namespace::copy_fail_model"; + "ad_levels_deep_model_namespace::ad_levels_deep_model"; // suppress unused var warning (void) function__; local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); @@ -1337,159 +1139,39 @@ class copy_fail_model final : public model_base_crtp { try { int pos__; pos__ = 1; - current_statement__ = 37; - context__.validate_dims("data initialization", "nind", "int", - std::vector{}); - nind = std::numeric_limits::min(); - current_statement__ = 37; - nind = context__.vals_i("nind")[(1 - 1)]; - current_statement__ = 37; - stan::math::check_greater_or_equal(function__, "nind", nind, 0); - current_statement__ = 38; - context__.validate_dims("data initialization", "n_occasions", "int", - std::vector{}); - n_occasions = std::numeric_limits::min(); - current_statement__ = 38; - n_occasions = context__.vals_i("n_occasions")[(1 - 1)]; - current_statement__ = 38; - stan::math::check_greater_or_equal(function__, "n_occasions", - n_occasions, 2); - current_statement__ = 39; - stan::math::validate_non_negative_index("y", "nind", nind); - current_statement__ = 40; - stan::math::validate_non_negative_index("y", "n_occasions", n_occasions); - current_statement__ = 41; - context__.validate_dims("data initialization", "y", "int", - std::vector{static_cast(nind), - static_cast(n_occasions)}); - y = std::vector>(nind, - std::vector(n_occasions, std::numeric_limits::min())); + current_statement__ = 5; + context__.validate_dims("data initialization", "X_data", "double", + std::vector{static_cast(10), static_cast(10)}); + X_data_data__ = Eigen::Matrix::Constant(10, 10, + std::numeric_limits::quiet_NaN()); + new (&X_data) + Eigen::Map>(X_data_data__.data(), 10, 10); { - std::vector y_flat__; - current_statement__ = 41; - y_flat__ = context__.vals_i("y"); - current_statement__ = 41; + std::vector X_data_flat__; + current_statement__ = 5; + X_data_flat__ = context__.vals_r("X_data"); + current_statement__ = 5; pos__ = 1; - current_statement__ = 41; - for (int sym1__ = 1; sym1__ <= n_occasions; ++sym1__) { - current_statement__ = 41; - for (int sym2__ = 1; sym2__ <= nind; ++sym2__) { - current_statement__ = 41; - stan::model::assign(y, y_flat__[(pos__ - 1)], - "assigning variable y", stan::model::index_uni(sym2__), - stan::model::index_uni(sym1__)); - current_statement__ = 41; - pos__ = (pos__ + 1); - } - } - } - current_statement__ = 41; - stan::math::check_greater_or_equal(function__, "y", y, 0); - current_statement__ = 41; - stan::math::check_less_or_equal(function__, "y", y, 1); - current_statement__ = 42; - context__.validate_dims("data initialization", "max_age", "int", - std::vector{}); - max_age = std::numeric_limits::min(); - current_statement__ = 42; - max_age = context__.vals_i("max_age")[(1 - 1)]; - current_statement__ = 42; - stan::math::check_greater_or_equal(function__, "max_age", max_age, 1); - current_statement__ = 43; - stan::math::validate_non_negative_index("x", "nind", nind); - current_statement__ = 44; - stan::math::validate_non_negative_index("x", "n_occasions - 1", - (n_occasions - 1)); - current_statement__ = 45; - context__.validate_dims("data initialization", "x", "int", - std::vector{static_cast(nind), - static_cast((n_occasions - 1))}); - x = std::vector>(nind, - std::vector((n_occasions - 1), - std::numeric_limits::min())); - { - std::vector x_flat__; - current_statement__ = 45; - x_flat__ = context__.vals_i("x"); - current_statement__ = 45; - pos__ = 1; - current_statement__ = 45; - for (int sym1__ = 1; sym1__ <= (n_occasions - 1); ++sym1__) { - current_statement__ = 45; - for (int sym2__ = 1; sym2__ <= nind; ++sym2__) { - current_statement__ = 45; - stan::model::assign(x, x_flat__[(pos__ - 1)], - "assigning variable x", stan::model::index_uni(sym2__), + current_statement__ = 5; + for (int sym1__ = 1; sym1__ <= 10; ++sym1__) { + current_statement__ = 5; + for (int sym2__ = 1; sym2__ <= 10; ++sym2__) { + current_statement__ = 5; + stan::model::assign(X_data, X_data_flat__[(pos__ - 1)], + "assigning variable X_data", stan::model::index_uni(sym2__), stan::model::index_uni(sym1__)); - current_statement__ = 45; + current_statement__ = 5; pos__ = (pos__ + 1); } } } - current_statement__ = 45; - stan::math::check_greater_or_equal(function__, "x", x, 0); - current_statement__ = 45; - stan::math::check_less_or_equal(function__, "x", x, max_age); - current_statement__ = 46; - n_occ_minus_1 = std::numeric_limits::min(); - current_statement__ = 46; - n_occ_minus_1 = (n_occasions - 1); - current_statement__ = 47; - stan::math::validate_non_negative_index("first", "nind", nind); - current_statement__ = 48; - first = std::vector(nind, std::numeric_limits::min()); - current_statement__ = 49; - stan::math::validate_non_negative_index("last", "nind", nind); - current_statement__ = 50; - last = std::vector(nind, std::numeric_limits::min()); - current_statement__ = 52; - for (int i = 1; i <= nind; ++i) { - current_statement__ = 51; - stan::model::assign(first, - first_capture( - stan::model::rvalue(y, "y", stan::model::index_uni(i)), pstream__), - "assigning variable first", stan::model::index_uni(i)); - } - current_statement__ = 54; - for (int i = 1; i <= nind; ++i) { - current_statement__ = 53; - stan::model::assign(last, - last_capture( - stan::model::rvalue(y, "y", stan::model::index_uni(i)), pstream__), - "assigning variable last", stan::model::index_uni(i)); - } - current_statement__ = 48; - stan::math::check_greater_or_equal(function__, "first", first, 0); - current_statement__ = 48; - stan::math::check_less_or_equal(function__, "first", first, n_occasions); - current_statement__ = 50; - stan::math::check_greater_or_equal(function__, "last", last, 0); - current_statement__ = 50; - stan::math::check_less_or_equal(function__, "last", last, n_occasions); - current_statement__ = 55; - stan::math::validate_non_negative_index("beta", "max_age", max_age); - current_statement__ = 56; - stan::math::validate_non_negative_index("phi", "nind", nind); - current_statement__ = 57; - stan::math::validate_non_negative_index("phi", "n_occ_minus_1", - n_occ_minus_1); - current_statement__ = 58; - stan::math::validate_non_negative_index("p", "nind", nind); - current_statement__ = 59; - stan::math::validate_non_negative_index("p", "n_occ_minus_1", - n_occ_minus_1); - current_statement__ = 60; - stan::math::validate_non_negative_index("chi", "nind", nind); - current_statement__ = 61; - stan::math::validate_non_negative_index("chi", "n_occasions", - n_occasions); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } - num_params_r__ = 1 + max_age; + num_params_r__ = (10 * 10); } inline std::string model_name() const final { - return "copy_fail_model"; + return "ad_levels_deep_model"; } inline std::vector model_compile_info() const noexcept { return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", @@ -1511,168 +1193,28 @@ class copy_fail_model final : public model_base_crtp { // suppress unused var warning (void) DUMMY_VAR__; static constexpr const char* function__ = - "copy_fail_model_namespace::log_prob"; + "ad_levels_deep_model_namespace::log_prob"; // suppress unused var warning (void) function__; try { - local_scalar_t__ mean_p; + stan::conditional_var_value_t> X_p; current_statement__ = 1; - mean_p = in__.template read_constrain_lub(0, 1, lp__); - Eigen::Matrix beta; + X_p = in__.template read< + stan::conditional_var_value_t>>(10, 10); + stan::conditional_var_value_t> X_tp1; current_statement__ = 2; - beta = in__.template read_constrain_lub< - Eigen::Matrix, jacobian__>(0, 1, lp__, - max_age); - Eigen::Matrix phi = - Eigen::Matrix::Constant(nind, n_occ_minus_1, - DUMMY_VAR__); - Eigen::Matrix p = - Eigen::Matrix::Constant(nind, n_occ_minus_1, - DUMMY_VAR__); - Eigen::Matrix chi = - Eigen::Matrix::Constant(nind, n_occasions, - DUMMY_VAR__); - current_statement__ = 15; - for (int i = 1; i <= nind; ++i) { - current_statement__ = 9; - for (int t = 1; t <= - (stan::model::rvalue(first, "first", stan::model::index_uni(i)) - - 1); ++t) { - current_statement__ = 6; - stan::model::assign(phi, 0, "assigning variable phi", - stan::model::index_uni(i), stan::model::index_uni(t)); - current_statement__ = 7; - stan::model::assign(p, 0, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(t)); - } - current_statement__ = 13; - for (int t = - stan::model::rvalue(first, "first", stan::model::index_uni(i)); t - <= n_occ_minus_1; ++t) { - current_statement__ = 10; - stan::model::assign(phi, - stan::model::rvalue(beta, "beta", - stan::model::index_uni( - stan::model::rvalue(x, "x", stan::model::index_uni(i), - stan::model::index_uni(t)))), "assigning variable phi", - stan::model::index_uni(i), stan::model::index_uni(t)); - current_statement__ = 11; - stan::model::assign(p, mean_p, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(t)); - } - } - Eigen::Matrix - inline_prob_uncaptured_return_sym8__; - { - current_statement__ = 16; - stan::math::validate_non_negative_index("chi", "nind", nind); - current_statement__ = 17; - stan::math::validate_non_negative_index("chi", "n_occasions", - n_occasions); - Eigen::Matrix - inline_prob_uncaptured_chi_sym9__ = - Eigen::Matrix::Constant(nind, n_occasions, - DUMMY_VAR__); - current_statement__ = 26; - for (int inline_prob_uncaptured_i_sym13__ = 1; inline_prob_uncaptured_i_sym13__ - <= nind; ++inline_prob_uncaptured_i_sym13__) { - current_statement__ = 19; - stan::model::assign(inline_prob_uncaptured_chi_sym9__, 1.0, - "assigning variable inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni(n_occasions)); - current_statement__ = 24; - for (int inline_prob_uncaptured_t_sym12__ = 1; inline_prob_uncaptured_t_sym12__ - <= (n_occasions - 1); ++inline_prob_uncaptured_t_sym12__) { - int inline_prob_uncaptured_t_curr_sym10__; - current_statement__ = 20; - inline_prob_uncaptured_t_curr_sym10__ = (n_occasions - - inline_prob_uncaptured_t_sym12__); - int inline_prob_uncaptured_t_next_sym11__; - current_statement__ = 21; - inline_prob_uncaptured_t_next_sym11__ = (inline_prob_uncaptured_t_curr_sym10__ - + 1); - current_statement__ = 22; - stan::model::assign(inline_prob_uncaptured_chi_sym9__, - stan::math::fma( - (stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni( - inline_prob_uncaptured_t_curr_sym10__)) * (1 - - stan::model::rvalue(p, "p", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni( - (inline_prob_uncaptured_t_next_sym11__ - 1))))), - stan::model::rvalue(inline_prob_uncaptured_chi_sym9__, - "inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni( - inline_prob_uncaptured_t_next_sym11__)), (1 - - stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni( - inline_prob_uncaptured_t_curr_sym10__)))), - "assigning variable inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni(inline_prob_uncaptured_t_curr_sym10__)); - } - } - current_statement__ = 27; - stan::model::assign(inline_prob_uncaptured_return_sym8__, - inline_prob_uncaptured_chi_sym9__, - "assigning variable inline_prob_uncaptured_return_sym8__"); - } - stan::model::assign(chi, inline_prob_uncaptured_return_sym8__, - "assigning variable chi"); - current_statement__ = 3; - stan::math::check_greater_or_equal(function__, "phi", phi, 0); + stan::model::assign(X_tp1, stan::math::exp(X_data), + "assigning variable X_tp1"); + stan::conditional_var_value_t> X_tp2; current_statement__ = 3; - stan::math::check_less_or_equal(function__, "phi", phi, 1); - current_statement__ = 4; - stan::math::check_greater_or_equal(function__, "p", p, 0); + stan::model::assign(X_tp2, stan::math::exp(X_tp1), + "assigning variable X_tp2"); current_statement__ = 4; - stan::math::check_less_or_equal(function__, "p", p, 1); - current_statement__ = 5; - stan::math::check_greater_or_equal(function__, "chi", chi, 0); - current_statement__ = 5; - stan::math::check_less_or_equal(function__, "chi", chi, 1); - { - current_statement__ = 36; - for (int i = 1; i <= nind; ++i) { - current_statement__ = 34; - if (stan::math::logical_gt( - stan::model::rvalue(first, "first", stan::model::index_uni(i)), - 0)) { - current_statement__ = 31; - for (int t = - (stan::model::rvalue(first, "first", - stan::model::index_uni(i)) + 1); t <= - stan::model::rvalue(last, "last", stan::model::index_uni(i)); ++t) { - current_statement__ = 28; - lp_accum__.add(stan::math::bernoulli_lpmf(1, - stan::model::rvalue(phi, "phi", - stan::model::index_uni(i), - stan::model::index_uni((t - 1))))); - current_statement__ = 29; - lp_accum__.add(stan::math::bernoulli_lpmf( - stan::model::rvalue(y, "y", - stan::model::index_uni(i), - stan::model::index_uni(t)), - stan::model::rvalue(p, "p", - stan::model::index_uni(i), - stan::model::index_uni((t - 1))))); - } - current_statement__ = 32; - lp_accum__.add(stan::math::bernoulli_lpmf(1, - stan::model::rvalue(chi, "chi", - stan::model::index_uni(i), - stan::model::index_uni( - stan::model::rvalue(last, "last", - stan::model::index_uni(i)))))); - } - } - } + stan::model::assign(X_tp1, X_p, "assigning variable X_tp1"); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } @@ -1706,141 +1248,36 @@ class copy_fail_model final : public model_base_crtp { (void) DUMMY_VAR__; constexpr bool jacobian__ = false; static constexpr const char* function__ = - "copy_fail_model_namespace::write_array"; + "ad_levels_deep_model_namespace::write_array"; // suppress unused var warning (void) function__; try { - double mean_p; + Eigen::Matrix X_p; current_statement__ = 1; - mean_p = in__.template read_constrain_lub(0, 1, lp__); - Eigen::Matrix beta; - current_statement__ = 2; - beta = in__.template read_constrain_lub< - Eigen::Matrix, jacobian__>(0, 1, lp__, - max_age); - Eigen::Matrix phi = - Eigen::Matrix::Constant(nind, n_occ_minus_1, - std::numeric_limits::quiet_NaN()); - Eigen::Matrix p = - Eigen::Matrix::Constant(nind, n_occ_minus_1, + X_p = in__.template read>(10, 10); + Eigen::Matrix X_tp1 = + Eigen::Matrix::Constant(10, 10, std::numeric_limits::quiet_NaN()); - Eigen::Matrix chi = - Eigen::Matrix::Constant(nind, n_occasions, + Eigen::Matrix X_tp2 = + Eigen::Matrix::Constant(10, 10, std::numeric_limits::quiet_NaN()); - out__.write(mean_p); - out__.write(beta); + out__.write(X_p); if (stan::math::logical_negation( (stan::math::primitive_value(emit_transformed_parameters__) || stan::math::primitive_value(emit_generated_quantities__)))) { return ; } - current_statement__ = 15; - for (int i = 1; i <= nind; ++i) { - current_statement__ = 9; - for (int t = 1; t <= - (stan::model::rvalue(first, "first", stan::model::index_uni(i)) - - 1); ++t) { - current_statement__ = 6; - stan::model::assign(phi, 0, "assigning variable phi", - stan::model::index_uni(i), stan::model::index_uni(t)); - current_statement__ = 7; - stan::model::assign(p, 0, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(t)); - } - current_statement__ = 13; - for (int t = - stan::model::rvalue(first, "first", stan::model::index_uni(i)); t - <= n_occ_minus_1; ++t) { - current_statement__ = 10; - stan::model::assign(phi, - stan::model::rvalue(beta, "beta", - stan::model::index_uni( - stan::model::rvalue(x, "x", stan::model::index_uni(i), - stan::model::index_uni(t)))), "assigning variable phi", - stan::model::index_uni(i), stan::model::index_uni(t)); - current_statement__ = 11; - stan::model::assign(p, mean_p, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(t)); - } - } - Eigen::Matrix inline_prob_uncaptured_return_sym1__; - { - current_statement__ = 16; - stan::math::validate_non_negative_index("chi", "nind", nind); - current_statement__ = 17; - stan::math::validate_non_negative_index("chi", "n_occasions", - n_occasions); - Eigen::Matrix - inline_prob_uncaptured_chi_sym2__ = - Eigen::Matrix::Constant(nind, n_occasions, - DUMMY_VAR__); - current_statement__ = 26; - for (int inline_prob_uncaptured_i_sym6__ = 1; inline_prob_uncaptured_i_sym6__ - <= nind; ++inline_prob_uncaptured_i_sym6__) { - current_statement__ = 19; - stan::model::assign(inline_prob_uncaptured_chi_sym2__, 1.0, - "assigning variable inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(n_occasions)); - current_statement__ = 24; - for (int inline_prob_uncaptured_t_sym5__ = 1; inline_prob_uncaptured_t_sym5__ - <= (n_occasions - 1); ++inline_prob_uncaptured_t_sym5__) { - int inline_prob_uncaptured_t_curr_sym3__; - current_statement__ = 20; - inline_prob_uncaptured_t_curr_sym3__ = (n_occasions - - inline_prob_uncaptured_t_sym5__); - int inline_prob_uncaptured_t_next_sym4__; - current_statement__ = 21; - inline_prob_uncaptured_t_next_sym4__ = (inline_prob_uncaptured_t_curr_sym3__ - + 1); - current_statement__ = 22; - stan::model::assign(inline_prob_uncaptured_chi_sym2__, - stan::math::fma( - (stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni( - inline_prob_uncaptured_t_curr_sym3__)) * (1 - - stan::model::rvalue(p, "p", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni( - (inline_prob_uncaptured_t_next_sym4__ - 1))))), - stan::model::rvalue(inline_prob_uncaptured_chi_sym2__, - "inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(inline_prob_uncaptured_t_next_sym4__)), - (1 - - stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(inline_prob_uncaptured_t_curr_sym3__)))), - "assigning variable inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(inline_prob_uncaptured_t_curr_sym3__)); - } - } - current_statement__ = 27; - stan::model::assign(inline_prob_uncaptured_return_sym1__, - inline_prob_uncaptured_chi_sym2__, - "assigning variable inline_prob_uncaptured_return_sym1__"); - } - stan::model::assign(chi, inline_prob_uncaptured_return_sym1__, - "assigning variable chi"); - current_statement__ = 3; - stan::math::check_greater_or_equal(function__, "phi", phi, 0); + current_statement__ = 2; + stan::model::assign(X_tp1, stan::math::exp(X_data), + "assigning variable X_tp1"); current_statement__ = 3; - stan::math::check_less_or_equal(function__, "phi", phi, 1); - current_statement__ = 4; - stan::math::check_greater_or_equal(function__, "p", p, 0); + stan::model::assign(X_tp2, stan::math::exp(X_tp1), + "assigning variable X_tp2"); current_statement__ = 4; - stan::math::check_less_or_equal(function__, "p", p, 1); - current_statement__ = 5; - stan::math::check_greater_or_equal(function__, "chi", chi, 0); - current_statement__ = 5; - stan::math::check_less_or_equal(function__, "chi", chi, 1); + stan::model::assign(X_tp1, X_p, "assigning variable X_tp1"); if (emit_transformed_parameters__) { - out__.write(phi); - out__.write(p); - out__.write(chi); + out__.write(X_tp1); + out__.write(X_tp2); } if (stan::math::logical_negation(emit_generated_quantities__)) { return ; @@ -1865,59 +1302,54 @@ class copy_fail_model final : public model_base_crtp { try { int pos__; pos__ = 1; - local_scalar_t__ mean_p; - mean_p = in__.read(); - out__.write_free_lub(0, 1, mean_p); - Eigen::Matrix beta = - Eigen::Matrix::Constant(max_age, DUMMY_VAR__); - for (int sym1__ = 1; sym1__ <= max_age; ++sym1__) { - stan::model::assign(beta, in__.read(), - "assigning variable beta", stan::model::index_uni(sym1__)); + Eigen::Matrix X_p = + Eigen::Matrix::Constant(10, 10, DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= 10; ++sym1__) { + for (int sym2__ = 1; sym2__ <= 10; ++sym2__) { + stan::model::assign(X_p, in__.read(), + "assigning variable X_p", stan::model::index_uni(sym2__), + stan::model::index_uni(sym1__)); + } } - out__.write_free_lub(0, 1, beta); + out__.write(X_p); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } inline void get_param_names(std::vector& names__) const { - names__ = std::vector{"mean_p", "beta", "phi", "p", "chi"}; + names__ = std::vector{"X_p", "X_tp1", "X_tp2"}; } inline void get_dims(std::vector>& dimss__) const { - dimss__ = std::vector>{std::vector{}, - std::vector{static_cast(max_age)}, - std::vector{static_cast(nind), - static_cast(n_occ_minus_1)}, - std::vector{static_cast(nind), - static_cast(n_occ_minus_1)}, - std::vector{static_cast(nind), - static_cast(n_occasions)}}; + dimss__ = std::vector>{std::vector{static_cast< + size_t>( + 10), + static_cast(10)}, + std::vector{static_cast(10), + static_cast(10)}, + std::vector{static_cast(10), + static_cast(10)}}; } inline void constrained_param_names(std::vector& param_names__, bool emit_transformed_parameters__ = true, bool emit_generated_quantities__ = true) const final { - param_names__.emplace_back(std::string() + "mean_p"); - for (int sym15__ = 1; sym15__ <= max_age; ++sym15__) { - param_names__.emplace_back(std::string() + "beta" + '.' + - std::to_string(sym15__)); + for (int sym1__ = 1; sym1__ <= 10; ++sym1__) { + for (int sym2__ = 1; sym2__ <= 10; ++sym2__) { + param_names__.emplace_back(std::string() + "X_p" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } } if (emit_transformed_parameters__) { - for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { - for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { - param_names__.emplace_back(std::string() + "phi" + '.' + - std::to_string(sym16__) + '.' + std::to_string(sym15__)); - } - } - for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { - for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { - param_names__.emplace_back(std::string() + "p" + '.' + - std::to_string(sym16__) + '.' + std::to_string(sym15__)); + for (int sym1__ = 1; sym1__ <= 10; ++sym1__) { + for (int sym2__ = 1; sym2__ <= 10; ++sym2__) { + param_names__.emplace_back(std::string() + "X_tp1" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); } } - for (int sym15__ = 1; sym15__ <= n_occasions; ++sym15__) { - for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { - param_names__.emplace_back(std::string() + "chi" + '.' + - std::to_string(sym16__) + '.' + std::to_string(sym15__)); + for (int sym1__ = 1; sym1__ <= 10; ++sym1__) { + for (int sym2__ = 1; sym2__ <= 10; ++sym2__) { + param_names__.emplace_back(std::string() + "X_tp2" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); } } } @@ -1927,38 +1359,33 @@ class copy_fail_model final : public model_base_crtp { unconstrained_param_names(std::vector& param_names__, bool emit_transformed_parameters__ = true, bool emit_generated_quantities__ = true) const final { - param_names__.emplace_back(std::string() + "mean_p"); - for (int sym15__ = 1; sym15__ <= max_age; ++sym15__) { - param_names__.emplace_back(std::string() + "beta" + '.' + - std::to_string(sym15__)); + for (int sym1__ = 1; sym1__ <= 10; ++sym1__) { + for (int sym2__ = 1; sym2__ <= 10; ++sym2__) { + param_names__.emplace_back(std::string() + "X_p" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } } if (emit_transformed_parameters__) { - for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { - for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { - param_names__.emplace_back(std::string() + "phi" + '.' + - std::to_string(sym16__) + '.' + std::to_string(sym15__)); - } - } - for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { - for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { - param_names__.emplace_back(std::string() + "p" + '.' + - std::to_string(sym16__) + '.' + std::to_string(sym15__)); + for (int sym1__ = 1; sym1__ <= 10; ++sym1__) { + for (int sym2__ = 1; sym2__ <= 10; ++sym2__) { + param_names__.emplace_back(std::string() + "X_tp1" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); } } - for (int sym15__ = 1; sym15__ <= n_occasions; ++sym15__) { - for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { - param_names__.emplace_back(std::string() + "chi" + '.' + - std::to_string(sym16__) + '.' + std::to_string(sym15__)); + for (int sym1__ = 1; sym1__ <= 10; ++sym1__) { + for (int sym2__ = 1; sym2__ <= 10; ++sym2__) { + param_names__.emplace_back(std::string() + "X_tp2" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); } } } if (emit_generated_quantities__) {} } inline std::string get_constrained_sizedtypes() const { - return std::string("[{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(max_age) + "},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"}]"); + return std::string("[{\"name\":\"X_p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(10) + ",\"cols\":" + std::to_string(10) + "},\"block\":\"parameters\"},{\"name\":\"X_tp1\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(10) + ",\"cols\":" + std::to_string(10) + "},\"block\":\"transformed_parameters\"},{\"name\":\"X_tp2\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(10) + ",\"cols\":" + std::to_string(10) + "},\"block\":\"transformed_parameters\"}]"); } inline std::string get_unconstrained_sizedtypes() const { - return std::string("[{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(max_age) + "},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"}]"); + return std::string("[{\"name\":\"X_p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(10) + ",\"cols\":" + std::to_string(10) + "},\"block\":\"parameters\"},{\"name\":\"X_tp1\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(10) + ",\"cols\":" + std::to_string(10) + "},\"block\":\"transformed_parameters\"},{\"name\":\"X_tp2\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(10) + ",\"cols\":" + std::to_string(10) + "},\"block\":\"transformed_parameters\"}]"); } // Begin method overload boilerplate template inline void @@ -1967,9 +1394,9 @@ class copy_fail_model final : public model_base_crtp { emit_transformed_parameters = true, const bool emit_generated_quantities = true, std::ostream* pstream = nullptr) const { - const size_t num_params__ = (1 + max_age); - const size_t num_transformed = emit_transformed_parameters * ((((nind * - n_occ_minus_1) + (nind * n_occ_minus_1)) + (nind * n_occasions))); + const size_t num_params__ = (10 * 10); + const size_t num_transformed = emit_transformed_parameters * (((10 * 10) + + (10 * 10))); const size_t num_gen_quantities = emit_generated_quantities * (0); const size_t num_to_write = num_params__ + num_transformed + num_gen_quantities; @@ -1985,9 +1412,9 @@ class copy_fail_model final : public model_base_crtp { emit_transformed_parameters = true, bool emit_generated_quantities = true, std::ostream* pstream = nullptr) const { - const size_t num_params__ = (1 + max_age); - const size_t num_transformed = emit_transformed_parameters * ((((nind * - n_occ_minus_1) + (nind * n_occ_minus_1)) + (nind * n_occasions))); + const size_t num_params__ = (10 * 10); + const size_t num_transformed = emit_transformed_parameters * (((10 * 10) + + (10 * 10))); const size_t num_gen_quantities = emit_generated_quantities * (0); const size_t num_to_write = num_params__ + num_transformed + num_gen_quantities; @@ -2020,8 +1447,8 @@ class copy_fail_model final : public model_base_crtp { transform_inits(const stan::io::var_context& context, std::vector& params_i, std::vector& vars, std::ostream* pstream__ = nullptr) const { - constexpr std::array names__{"mean_p", "beta"}; - const std::array constrain_param_sizes__{1, max_age}; + constexpr std::array names__{"X_p"}; + const std::array constrain_param_sizes__{(10 * 10)}; const auto num_constrained_params__ = std::accumulate(constrain_param_sizes__.begin(), constrain_param_sizes__.end(), 0); @@ -2041,7 +1468,7 @@ class copy_fail_model final : public model_base_crtp { } }; } -using stan_model = copy_fail_model_namespace::copy_fail_model; +using stan_model = ad_levels_deep_model_namespace::ad_levels_deep_model; #ifndef USING_R // Boilerplate stan::model::model_base& @@ -2051,1004 +1478,593 @@ new_model(stan::io::var_context& data_context, unsigned int seed, return *m; } stan::math::profile_map& get_stan_profile_data() { - return copy_fail_model_namespace::profiles__; + return ad_levels_deep_model_namespace::profiles__; } #endif - $ ../../../../../install/default/bin/stanc --O1 --print-cpp dce-fail.stan + $ ../../../../../install/default/bin/stanc --O1 --print-cpp copy_fail.stan // Code generated by %%NAME%% %%VERSION%% #include -namespace dce_fail_model_namespace { +namespace copy_fail_model_namespace { using stan::model::model_base_crtp; using namespace stan::math; stan::math::profile_map profiles__; -static constexpr std::array locations_array__ = +static constexpr std::array locations_array__ = {" (found before start of program)", - " (in 'dce-fail.stan', line 18, column 2 to column 22)", - " (in 'dce-fail.stan', line 19, column 2 to column 26)", - " (in 'dce-fail.stan', line 20, column 2 to column 26)", - " (in 'dce-fail.stan', line 21, column 2 to column 28)", - " (in 'dce-fail.stan', line 22, column 2 to column 29)", - " (in 'dce-fail.stan', line 23, column 2 to column 30)", - " (in 'dce-fail.stan', line 25, column 2 to column 11)", - " (in 'dce-fail.stan', line 26, column 2 to column 16)", - " (in 'dce-fail.stan', line 27, column 2 to column 15)", - " (in 'dce-fail.stan', line 28, column 2 to column 22)", - " (in 'dce-fail.stan', line 30, column 2 to column 16)", - " (in 'dce-fail.stan', line 32, column 2 to column 22)", - " (in 'dce-fail.stan', line 33, column 2 to column 22)", - " (in 'dce-fail.stan', line 34, column 2 to column 28)", - " (in 'dce-fail.stan', line 35, column 2 to column 32)", - " (in 'dce-fail.stan', line 37, column 2 to column 24)", - " (in 'dce-fail.stan', line 40, column 9 to column 10)", - " (in 'dce-fail.stan', line 40, column 2 to column 14)", - " (in 'dce-fail.stan', line 41, column 9 to column 16)", - " (in 'dce-fail.stan', line 41, column 2 to column 30)", - " (in 'dce-fail.stan', line 43, column 2 to column 23)", - " (in 'dce-fail.stan', line 44, column 2 to column 28)", - " (in 'dce-fail.stan', line 45, column 2 to column 27)", - " (in 'dce-fail.stan', line 46, column 2 to column 34)", - " (in 'dce-fail.stan', line 48, column 2 to column 31)", - " (in 'dce-fail.stan', line 49, column 2 to column 31)", - " (in 'dce-fail.stan', line 50, column 2 to column 37)", - " (in 'dce-fail.stan', line 54, column 6 to column 48)", - " (in 'dce-fail.stan', line 53, column 4 to line 54, column 48)", - " (in 'dce-fail.stan', line 52, column 21 to line 55, column 3)", - " (in 'dce-fail.stan', line 52, column 2 to line 55, column 3)", - " (in 'dce-fail.stan', line 57, column 2 to column 28)", - " (in 'dce-fail.stan', line 60, column 4 to column 64)", - " (in 'dce-fail.stan', line 59, column 2 to line 60, column 64)", - " (in 'dce-fail.stan', line 62, column 2 to column 43)", - " (in 'dce-fail.stan', line 65, column 4 to line 68, column 25)", - " (in 'dce-fail.stan', line 64, column 2 to line 68, column 25)", - " (in 'dce-fail.stan', line 70, column 2 to column 19)", - " (in 'dce-fail.stan', line 2, column 2 to column 17)", - " (in 'dce-fail.stan', line 3, column 2 to column 21)", - " (in 'dce-fail.stan', line 4, column 2 to column 21)", - " (in 'dce-fail.stan', line 5, column 2 to column 24)", - " (in 'dce-fail.stan', line 6, column 2 to column 23)", - " (in 'dce-fail.stan', line 8, column 8 to column 9)", - " (in 'dce-fail.stan', line 8, column 2 to column 40)", - " (in 'dce-fail.stan', line 9, column 8 to column 9)", - " (in 'dce-fail.stan', line 9, column 2 to column 39)", - " (in 'dce-fail.stan', line 10, column 8 to column 9)", - " (in 'dce-fail.stan', line 10, column 2 to column 41)", - " (in 'dce-fail.stan', line 11, column 8 to column 9)", - " (in 'dce-fail.stan', line 11, column 2 to column 41)", - " (in 'dce-fail.stan', line 12, column 8 to column 15)", - " (in 'dce-fail.stan', line 12, column 2 to column 52)", - " (in 'dce-fail.stan', line 13, column 8 to column 9)", - " (in 'dce-fail.stan', line 13, column 2 to column 45)", - " (in 'dce-fail.stan', line 14, column 8 to column 9)", - " (in 'dce-fail.stan', line 14, column 2 to column 35)", - " (in 'dce-fail.stan', line 15, column 9 to column 16)", - " (in 'dce-fail.stan', line 15, column 2 to column 25)", - " (in 'dce-fail.stan', line 32, column 9 to column 14)", - " (in 'dce-fail.stan', line 33, column 9 to column 14)", - " (in 'dce-fail.stan', line 34, column 9 to column 17)", - " (in 'dce-fail.stan', line 35, column 9 to column 14)", - " (in 'dce-fail.stan', line 35, column 15 to column 20)", - " (in 'dce-fail.stan', line 37, column 9 to column 16)"}; -class dce_fail_model final : public model_base_crtp { - private: - int N; - int n_age; - int n_edu; - int n_region; - int n_state; - std::vector female; - std::vector black; - std::vector age; - std::vector edu; - std::vector region; - std::vector state; - std::vector y; - Eigen::Matrix v_prev_data__; - Eigen::Map> v_prev{nullptr, 0}; - public: - ~dce_fail_model() {} - dce_fail_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__ = - "dce_fail_model_namespace::dce_fail_model"; - // suppress unused var warning - (void) function__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - int pos__; - pos__ = 1; - current_statement__ = 39; - context__.validate_dims("data initialization", "N", "int", - std::vector{}); - N = std::numeric_limits::min(); - current_statement__ = 39; - N = context__.vals_i("N")[(1 - 1)]; - current_statement__ = 39; - stan::math::check_greater_or_equal(function__, "N", N, 0); - current_statement__ = 40; - context__.validate_dims("data initialization", "n_age", "int", - std::vector{}); - n_age = std::numeric_limits::min(); - current_statement__ = 40; - n_age = context__.vals_i("n_age")[(1 - 1)]; - current_statement__ = 40; - stan::math::check_greater_or_equal(function__, "n_age", n_age, 0); - current_statement__ = 41; - context__.validate_dims("data initialization", "n_edu", "int", - std::vector{}); - n_edu = std::numeric_limits::min(); - current_statement__ = 41; - n_edu = context__.vals_i("n_edu")[(1 - 1)]; - current_statement__ = 41; - stan::math::check_greater_or_equal(function__, "n_edu", n_edu, 0); - current_statement__ = 42; - context__.validate_dims("data initialization", "n_region", "int", - std::vector{}); - n_region = std::numeric_limits::min(); - current_statement__ = 42; - n_region = context__.vals_i("n_region")[(1 - 1)]; - current_statement__ = 42; - stan::math::check_greater_or_equal(function__, "n_region", n_region, 0); - current_statement__ = 43; - context__.validate_dims("data initialization", "n_state", "int", - std::vector{}); - n_state = std::numeric_limits::min(); - current_statement__ = 43; - n_state = context__.vals_i("n_state")[(1 - 1)]; - current_statement__ = 43; - stan::math::check_greater_or_equal(function__, "n_state", n_state, 0); - current_statement__ = 44; - stan::math::validate_non_negative_index("female", "N", N); - current_statement__ = 45; - context__.validate_dims("data initialization", "female", "int", - std::vector{static_cast(N)}); - female = std::vector(N, std::numeric_limits::min()); - current_statement__ = 45; - female = context__.vals_i("female"); - current_statement__ = 45; - stan::math::check_greater_or_equal(function__, "female", female, 0); - current_statement__ = 45; - stan::math::check_less_or_equal(function__, "female", female, 1); - current_statement__ = 46; - stan::math::validate_non_negative_index("black", "N", N); - current_statement__ = 47; - context__.validate_dims("data initialization", "black", "int", - std::vector{static_cast(N)}); - black = std::vector(N, std::numeric_limits::min()); - current_statement__ = 47; - black = context__.vals_i("black"); - current_statement__ = 47; - stan::math::check_greater_or_equal(function__, "black", black, 0); - current_statement__ = 47; - stan::math::check_less_or_equal(function__, "black", black, 1); - current_statement__ = 48; - stan::math::validate_non_negative_index("age", "N", N); - current_statement__ = 49; - context__.validate_dims("data initialization", "age", "int", - std::vector{static_cast(N)}); - age = std::vector(N, std::numeric_limits::min()); - current_statement__ = 49; - age = context__.vals_i("age"); - current_statement__ = 49; - stan::math::check_greater_or_equal(function__, "age", age, 0); - current_statement__ = 49; - stan::math::check_less_or_equal(function__, "age", age, n_age); - current_statement__ = 50; - stan::math::validate_non_negative_index("edu", "N", N); - current_statement__ = 51; - context__.validate_dims("data initialization", "edu", "int", - std::vector{static_cast(N)}); - edu = std::vector(N, std::numeric_limits::min()); - current_statement__ = 51; - edu = context__.vals_i("edu"); - current_statement__ = 51; - stan::math::check_greater_or_equal(function__, "edu", edu, 0); - current_statement__ = 51; - stan::math::check_less_or_equal(function__, "edu", edu, n_edu); - current_statement__ = 52; - stan::math::validate_non_negative_index("region", "n_state", n_state); - current_statement__ = 53; - context__.validate_dims("data initialization", "region", "int", - std::vector{static_cast(n_state)}); - region = std::vector(n_state, std::numeric_limits::min()); - current_statement__ = 53; - region = context__.vals_i("region"); - current_statement__ = 53; - stan::math::check_greater_or_equal(function__, "region", region, 0); - current_statement__ = 53; - stan::math::check_less_or_equal(function__, "region", region, n_state); - current_statement__ = 54; - stan::math::validate_non_negative_index("state", "N", N); - current_statement__ = 55; - context__.validate_dims("data initialization", "state", "int", - std::vector{static_cast(N)}); - state = std::vector(N, std::numeric_limits::min()); - current_statement__ = 55; - state = context__.vals_i("state"); - current_statement__ = 55; - stan::math::check_greater_or_equal(function__, "state", state, 0); - current_statement__ = 55; - stan::math::check_less_or_equal(function__, "state", state, n_state); - current_statement__ = 56; - stan::math::validate_non_negative_index("y", "N", N); - current_statement__ = 57; - context__.validate_dims("data initialization", "y", "int", - std::vector{static_cast(N)}); - y = std::vector(N, std::numeric_limits::min()); - current_statement__ = 57; - y = context__.vals_i("y"); - current_statement__ = 57; - stan::math::check_greater_or_equal(function__, "y", y, 0); - current_statement__ = 57; - stan::math::check_less_or_equal(function__, "y", y, 1); - current_statement__ = 58; - stan::math::validate_non_negative_index("v_prev", "n_state", n_state); - current_statement__ = 59; - context__.validate_dims("data initialization", "v_prev", "double", - std::vector{static_cast(n_state)}); - v_prev_data__ = Eigen::Matrix::Constant(n_state, - std::numeric_limits::quiet_NaN()); - new (&v_prev) - Eigen::Map>(v_prev_data__.data(), n_state); - { - std::vector v_prev_flat__; - current_statement__ = 59; - v_prev_flat__ = context__.vals_r("v_prev"); - current_statement__ = 59; - pos__ = 1; - current_statement__ = 59; - for (int sym1__ = 1; sym1__ <= n_state; ++sym1__) { - current_statement__ = 59; - stan::model::assign(v_prev, v_prev_flat__[(pos__ - 1)], - "assigning variable v_prev", stan::model::index_uni(sym1__)); - current_statement__ = 59; - pos__ = (pos__ + 1); - } - } - current_statement__ = 60; - stan::math::validate_non_negative_index("b_age", "n_age", n_age); - current_statement__ = 61; - stan::math::validate_non_negative_index("b_edu", "n_edu", n_edu); - current_statement__ = 62; - stan::math::validate_non_negative_index("b_region", "n_region", - n_region); + " (in 'copy_fail.stan', line 68, column 2 to column 32)", + " (in 'copy_fail.stan', line 69, column 2 to column 41)", + " (in 'copy_fail.stan', line 72, column 2 to column 52)", + " (in 'copy_fail.stan', line 73, column 2 to column 50)", + " (in 'copy_fail.stan', line 74, column 2 to column 50)", + " (in 'copy_fail.stan', line 79, column 6 to column 20)", + " (in 'copy_fail.stan', line 80, column 6 to column 18)", + " (in 'copy_fail.stan', line 78, column 34 to line 81, column 5)", + " (in 'copy_fail.stan', line 78, column 4 to line 81, column 5)", + " (in 'copy_fail.stan', line 83, column 6 to column 32)", + " (in 'copy_fail.stan', line 84, column 6 to column 23)", + " (in 'copy_fail.stan', line 82, column 40 to line 85, column 5)", + " (in 'copy_fail.stan', line 82, column 4 to line 85, column 5)", + " (in 'copy_fail.stan', line 77, column 22 to line 86, column 3)", + " (in 'copy_fail.stan', line 77, column 2 to line 86, column 3)", + " (in 'copy_fail.stan', line 25, column 11 to column 15)", + " (in 'copy_fail.stan', line 25, column 17 to column 28)", + " (in 'copy_fail.stan', line 25, column 4 to column 34)", + " (in 'copy_fail.stan', line 28, column 6 to column 32)", + " (in 'copy_fail.stan', line 31, column 8 to column 37)", + " (in 'copy_fail.stan', line 32, column 8 to column 32)", + " (in 'copy_fail.stan', line 40, column 8 to line 42, column 44)", + " (in 'copy_fail.stan', line 29, column 39 to line 43, column 7)", + " (in 'copy_fail.stan', line 29, column 6 to line 43, column 7)", + " (in 'copy_fail.stan', line 27, column 24 to line 44, column 5)", + " (in 'copy_fail.stan', line 27, column 4 to line 44, column 5)", + " (in 'copy_fail.stan', line 45, column 4 to column 15)", + " (in 'copy_fail.stan', line 100, column 8 to column 37)", + " (in 'copy_fail.stan', line 101, column 8 to column 41)", + " (in 'copy_fail.stan', line 99, column 42 to line 102, column 7)", + " (in 'copy_fail.stan', line 99, column 6 to line 102, column 7)", + " (in 'copy_fail.stan', line 103, column 6 to column 37)", + " (in 'copy_fail.stan', line 98, column 22 to line 104, column 5)", + " (in 'copy_fail.stan', line 98, column 4 to line 104, column 5)", + " (in 'copy_fail.stan', line 97, column 22 to line 105, column 3)", + " (in 'copy_fail.stan', line 97, column 2 to line 105, column 3)", + " (in 'copy_fail.stan', line 49, column 2 to column 20)", + " (in 'copy_fail.stan', line 50, column 2 to column 27)", + " (in 'copy_fail.stan', line 51, column 8 to column 12)", + " (in 'copy_fail.stan', line 51, column 14 to column 25)", + " (in 'copy_fail.stan', line 51, column 2 to column 51)", + " (in 'copy_fail.stan', line 52, column 2 to column 23)", + " (in 'copy_fail.stan', line 53, column 8 to column 12)", + " (in 'copy_fail.stan', line 53, column 14 to column 29)", + " (in 'copy_fail.stan', line 53, column 2 to column 61)", + " (in 'copy_fail.stan', line 56, column 2 to column 38)", + " (in 'copy_fail.stan', line 58, column 8 to column 12)", + " (in 'copy_fail.stan', line 58, column 2 to column 52)", + " (in 'copy_fail.stan', line 59, column 8 to column 12)", + " (in 'copy_fail.stan', line 59, column 2 to column 51)", + " (in 'copy_fail.stan', line 63, column 4 to column 35)", + " (in 'copy_fail.stan', line 62, column 2 to line 63, column 35)", + " (in 'copy_fail.stan', line 65, column 4 to column 33)", + " (in 'copy_fail.stan', line 64, column 2 to line 65, column 33)", + " (in 'copy_fail.stan', line 69, column 27 to column 34)", + " (in 'copy_fail.stan', line 72, column 27 to column 31)", + " (in 'copy_fail.stan', line 72, column 33 to column 46)", + " (in 'copy_fail.stan', line 73, column 27 to column 31)", + " (in 'copy_fail.stan', line 73, column 33 to column 46)", + " (in 'copy_fail.stan', line 74, column 27 to column 31)", + " (in 'copy_fail.stan', line 74, column 33 to column 44)", + " (in 'copy_fail.stan', line 8, column 8 to column 17)", + " (in 'copy_fail.stan', line 7, column 6 to line 8, column 17)", + " (in 'copy_fail.stan', line 6, column 4 to line 8, column 17)", + " (in 'copy_fail.stan', line 9, column 4 to column 13)", + " (in 'copy_fail.stan', line 5, column 37 to line 10, column 3)", + " (in 'copy_fail.stan', line 15, column 6 to column 32)", + " (in 'copy_fail.stan', line 19, column 8 to column 17)", + " (in 'copy_fail.stan', line 18, column 6 to line 19, column 17)", + " (in 'copy_fail.stan', line 13, column 39 to line 20, column 5)", + " (in 'copy_fail.stan', line 13, column 4 to line 20, column 5)", + " (in 'copy_fail.stan', line 21, column 4 to column 13)", + " (in 'copy_fail.stan', line 12, column 36 to line 22, column 3)", + " (in 'copy_fail.stan', line 24, column 74 to line 46, column 3)"}; +int first_capture(const std::vector& y_i, std::ostream* pstream__); +int last_capture(const std::vector& y_i, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, + const T3__& phi_arg__, std::ostream* pstream__); +int first_capture(const std::vector& y_i, std::ostream* pstream__) { + using local_scalar_t__ = double; + int current_statement__ = 0; + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 64; + for (int k = 1; k <= stan::math::size(y_i); ++k) { current_statement__ = 63; - stan::math::validate_non_negative_index("b_age_edu", "n_age", n_age); - current_statement__ = 64; - stan::math::validate_non_negative_index("b_age_edu", "n_edu", n_edu); - current_statement__ = 65; - stan::math::validate_non_negative_index("b_hat", "n_state", n_state); - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); + if (stan::model::rvalue(y_i, "y_i", stan::model::index_uni(k))) { + current_statement__ = 62; + return k; + } } - num_params_r__ = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + n_age + - n_edu + n_region + (n_age * n_edu) + n_state; + current_statement__ = 65; + return 0; + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); } - inline std::string model_name() const final { - return "dce_fail_model"; +} +int last_capture(const std::vector& y_i, std::ostream* pstream__) { + using local_scalar_t__ = double; + int current_statement__ = 0; + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 71; + for (int k_rev = 0; k_rev <= (stan::math::size(y_i) - 1); ++k_rev) { + int k; + current_statement__ = 67; + k = (stan::math::size(y_i) - k_rev); + current_statement__ = 69; + if (stan::model::rvalue(y_i, "y_i", stan::model::index_uni(k))) { + current_statement__ = 68; + return k; + } + } + current_statement__ = 72; + return 0; + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); } - inline std::vector model_compile_info() const noexcept { - return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", - "stancflags = --O1 --print-cpp"}; +} +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>*> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, + const T3__& phi_arg__, std::ostream* pstream__) { + using local_scalar_t__ = stan::promote_args_t, + stan::base_type_t>; + int current_statement__ = 0; + const auto& p = stan::math::to_ref(p_arg__); + const auto& phi = stan::math::to_ref(phi_arg__); + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 16; + stan::math::validate_non_negative_index("chi", "nind", nind); + current_statement__ = 17; + stan::math::validate_non_negative_index("chi", "n_occasions", n_occasions); + Eigen::Matrix chi = + Eigen::Matrix::Constant(nind, n_occasions, + DUMMY_VAR__); + current_statement__ = 26; + for (int i = 1; i <= nind; ++i) { + current_statement__ = 19; + stan::model::assign(chi, 1.0, "assigning variable chi", + stan::model::index_uni(i), stan::model::index_uni(n_occasions)); + current_statement__ = 24; + for (int t = 1; t <= (n_occasions - 1); ++t) { + int t_curr; + current_statement__ = 20; + t_curr = (n_occasions - t); + int t_next; + current_statement__ = 21; + t_next = (t_curr + 1); + current_statement__ = 22; + stan::model::assign(chi, + stan::math::fma( + (stan::model::rvalue(phi, "phi", stan::model::index_uni(i), + stan::model::index_uni(t_curr)) * (1 - + stan::model::rvalue(p, "p", stan::model::index_uni(i), + stan::model::index_uni((t_next - 1))))), + stan::model::rvalue(chi, "chi", stan::model::index_uni(i), + stan::model::index_uni(t_next)), (1 - + stan::model::rvalue(phi, "phi", stan::model::index_uni(i), + stan::model::index_uni(t_curr)))), "assigning variable chi", + stan::model::index_uni(i), stan::model::index_uni(t_curr)); + } + } + current_statement__ = 27; + return chi; + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); } - 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__; - stan::io::deserializer in__(params_r__, params_i__); +} +class copy_fail_model final : public model_base_crtp { + private: + int nind; + int n_occasions; + std::vector> y; + int max_age; + std::vector> x; + int n_occ_minus_1; + std::vector first; + std::vector last; + public: + ~copy_fail_model() {} + copy_fail_model(stan::io::var_context& context__, unsigned int + random_seed__ = 0, std::ostream* pstream__ = nullptr) + : model_base_crtp(0) { int current_statement__ = 0; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + using local_scalar_t__ = double; + boost::ecuyer1988 base_rng__ = + stan::services::util::create_rng(random_seed__, 0); // suppress unused var warning - (void) DUMMY_VAR__; + (void) base_rng__; static constexpr const char* function__ = - "dce_fail_model_namespace::log_prob"; + "copy_fail_model_namespace::copy_fail_model"; // suppress unused var warning (void) function__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; try { - local_scalar_t__ sigma; - current_statement__ = 1; - sigma = in__.template read_constrain_lb(0, lp__); - local_scalar_t__ sigma_age; - current_statement__ = 2; - sigma_age = in__.template read_constrain_lb(0, lp__); - local_scalar_t__ sigma_edu; - current_statement__ = 3; - sigma_edu = in__.template read_constrain_lb(0, lp__); - local_scalar_t__ sigma_state; - current_statement__ = 4; - sigma_state = in__.template read_constrain_lb(0, lp__); - local_scalar_t__ sigma_region; - current_statement__ = 5; - sigma_region = in__.template read_constrain_lb(0, lp__); - local_scalar_t__ sigma_age_edu; - current_statement__ = 6; - sigma_age_edu = in__.template read_constrain_lb(0, lp__); - local_scalar_t__ b_0; - current_statement__ = 7; - b_0 = in__.template read(); - local_scalar_t__ b_female; - current_statement__ = 8; - b_female = in__.template read(); - local_scalar_t__ b_black; - current_statement__ = 9; - b_black = in__.template read(); - local_scalar_t__ b_female_black; - current_statement__ = 10; - b_female_black = in__.template read(); - local_scalar_t__ b_v_prev; - current_statement__ = 11; - b_v_prev = in__.template read(); - Eigen::Matrix b_age; - current_statement__ = 12; - b_age = in__.template read>(n_age); - Eigen::Matrix b_edu; - current_statement__ = 13; - b_edu = in__.template read>(n_edu); - Eigen::Matrix b_region; - current_statement__ = 14; - b_region = in__.template read< - Eigen::Matrix>(n_region); - Eigen::Matrix b_age_edu; - current_statement__ = 15; - b_age_edu = in__.template read< - Eigen::Matrix>(n_age, n_edu); - Eigen::Matrix b_hat; - current_statement__ = 16; - b_hat = in__.template read< - Eigen::Matrix>(n_state); + int pos__; + pos__ = 1; + current_statement__ = 37; + context__.validate_dims("data initialization", "nind", "int", + std::vector{}); + nind = std::numeric_limits::min(); + current_statement__ = 37; + nind = context__.vals_i("nind")[(1 - 1)]; + current_statement__ = 37; + stan::math::check_greater_or_equal(function__, "nind", nind, 0); + current_statement__ = 38; + context__.validate_dims("data initialization", "n_occasions", "int", + std::vector{}); + n_occasions = std::numeric_limits::min(); + current_statement__ = 38; + n_occasions = context__.vals_i("n_occasions")[(1 - 1)]; + current_statement__ = 38; + stan::math::check_greater_or_equal(function__, "n_occasions", + n_occasions, 2); + current_statement__ = 39; + stan::math::validate_non_negative_index("y", "nind", nind); + current_statement__ = 40; + stan::math::validate_non_negative_index("y", "n_occasions", n_occasions); + current_statement__ = 41; + context__.validate_dims("data initialization", "y", "int", + std::vector{static_cast(nind), + static_cast(n_occasions)}); + y = std::vector>(nind, + std::vector(n_occasions, std::numeric_limits::min())); { - current_statement__ = 17; - stan::math::validate_non_negative_index("p", "N", N); - Eigen::Matrix p = - Eigen::Matrix::Constant(N, DUMMY_VAR__); - current_statement__ = 19; - stan::math::validate_non_negative_index("b_state_hat", "n_state", - n_state); - Eigen::Matrix b_state_hat = - Eigen::Matrix::Constant(n_state, - DUMMY_VAR__); - current_statement__ = 21; - lp_accum__.add(stan::math::normal_lpdf(b_0, 0, 100)); - current_statement__ = 22; - lp_accum__.add(stan::math::normal_lpdf(b_female, 0, 100)); - current_statement__ = 23; - lp_accum__.add(stan::math::normal_lpdf(b_black, 0, 100)); - current_statement__ = 24; - lp_accum__.add(stan::math::normal_lpdf(b_female_black, 0, - 100)); - current_statement__ = 25; - lp_accum__.add(stan::math::normal_lpdf(b_age, 0, sigma_age)); - current_statement__ = 26; - lp_accum__.add(stan::math::normal_lpdf(b_edu, 0, sigma_edu)); - current_statement__ = 27; - lp_accum__.add(stan::math::normal_lpdf(b_region, 0, - sigma_region)); - current_statement__ = 31; - for (int j = 1; j <= n_age; ++j) { - current_statement__ = 29; - for (int i = 1; i <= n_edu; ++i) { - current_statement__ = 28; - lp_accum__.add(stan::math::normal_lpdf( - stan::model::rvalue(b_age_edu, "b_age_edu", - stan::model::index_uni(j), - stan::model::index_uni(i)), 0, sigma_age_edu)); + std::vector y_flat__; + current_statement__ = 41; + y_flat__ = context__.vals_i("y"); + current_statement__ = 41; + pos__ = 1; + current_statement__ = 41; + for (int sym1__ = 1; sym1__ <= n_occasions; ++sym1__) { + current_statement__ = 41; + for (int sym2__ = 1; sym2__ <= nind; ++sym2__) { + current_statement__ = 41; + stan::model::assign(y, y_flat__[(pos__ - 1)], + "assigning variable y", stan::model::index_uni(sym2__), + stan::model::index_uni(sym1__)); + current_statement__ = 41; + pos__ = (pos__ + 1); } } - current_statement__ = 32; - lp_accum__.add(stan::math::normal_lpdf(b_v_prev, 0, 100)); - current_statement__ = 34; - for (int j = 1; j <= n_state; ++j) { - current_statement__ = 33; - stan::model::assign(b_state_hat, - stan::math::fma(b_v_prev, - stan::model::rvalue(v_prev, "v_prev", stan::model::index_uni(j)), - stan::model::rvalue(b_region, "b_region", - stan::model::index_uni( - stan::model::rvalue(region, "region", - stan::model::index_uni(j))))), - "assigning variable b_state_hat", stan::model::index_uni(j)); - } - current_statement__ = 35; - lp_accum__.add(stan::math::normal_lpdf(b_hat, b_state_hat, - sigma_state)); - current_statement__ = 37; - for (int i = 1; i <= N; ++i) { - current_statement__ = 36; - stan::model::assign(p, - stan::math::fmax(0, - stan::math::fmin(1, - stan::math::inv_logit( - ((((stan::math::fma((b_female_black * - stan::model::rvalue(female, "female", - stan::model::index_uni(i))), - stan::model::rvalue(black, "black", - stan::model::index_uni(i)), - stan::math::fma(b_black, - stan::model::rvalue(black, "black", - stan::model::index_uni(i)), - stan::math::fma(b_female, - stan::model::rvalue(female, "female", - stan::model::index_uni(i)), b_0))) + - stan::model::rvalue(b_age, "b_age", - stan::model::index_uni( - stan::model::rvalue(age, "age", - stan::model::index_uni(i))))) + - stan::model::rvalue(b_edu, "b_edu", - stan::model::index_uni( - stan::model::rvalue(edu, "edu", - stan::model::index_uni(i))))) + - stan::model::rvalue(b_age_edu, "b_age_edu", - stan::model::index_uni( - stan::model::rvalue(age, "age", - stan::model::index_uni(i))), - stan::model::index_uni( - stan::model::rvalue(edu, "edu", - stan::model::index_uni(i))))) + - stan::model::rvalue(b_hat, "b_hat", - stan::model::index_uni( - stan::model::rvalue(state, "state", - stan::model::index_uni(i)))))))), - "assigning variable p", stan::model::index_uni(i)); + } + current_statement__ = 41; + stan::math::check_greater_or_equal(function__, "y", y, 0); + current_statement__ = 41; + stan::math::check_less_or_equal(function__, "y", y, 1); + current_statement__ = 42; + context__.validate_dims("data initialization", "max_age", "int", + std::vector{}); + max_age = std::numeric_limits::min(); + current_statement__ = 42; + max_age = context__.vals_i("max_age")[(1 - 1)]; + current_statement__ = 42; + stan::math::check_greater_or_equal(function__, "max_age", max_age, 1); + current_statement__ = 43; + stan::math::validate_non_negative_index("x", "nind", nind); + current_statement__ = 44; + stan::math::validate_non_negative_index("x", "n_occasions - 1", + (n_occasions - 1)); + current_statement__ = 45; + context__.validate_dims("data initialization", "x", "int", + std::vector{static_cast(nind), + static_cast((n_occasions - 1))}); + x = std::vector>(nind, + std::vector((n_occasions - 1), + std::numeric_limits::min())); + { + std::vector x_flat__; + current_statement__ = 45; + x_flat__ = context__.vals_i("x"); + current_statement__ = 45; + pos__ = 1; + current_statement__ = 45; + for (int sym1__ = 1; sym1__ <= (n_occasions - 1); ++sym1__) { + current_statement__ = 45; + for (int sym2__ = 1; sym2__ <= nind; ++sym2__) { + current_statement__ = 45; + stan::model::assign(x, x_flat__[(pos__ - 1)], + "assigning variable x", stan::model::index_uni(sym2__), + stan::model::index_uni(sym1__)); + current_statement__ = 45; + pos__ = (pos__ + 1); + } } - current_statement__ = 38; - lp_accum__.add(stan::math::bernoulli_lpmf(y, p)); } - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } - lp_accum__.add(lp__); - return lp_accum__.sum(); - } - 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; - 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; - // 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()); - // suppress unused var warning - (void) DUMMY_VAR__; - constexpr bool jacobian__ = false; - static constexpr const char* function__ = - "dce_fail_model_namespace::write_array"; - // suppress unused var warning - (void) function__; - try { - double sigma; - current_statement__ = 1; - sigma = in__.template read_constrain_lb(0, lp__); - double sigma_age; - current_statement__ = 2; - sigma_age = in__.template read_constrain_lb(0, lp__); - double sigma_edu; - current_statement__ = 3; - sigma_edu = in__.template read_constrain_lb(0, lp__); - double sigma_state; - current_statement__ = 4; - sigma_state = in__.template read_constrain_lb(0, lp__); - double sigma_region; - current_statement__ = 5; - sigma_region = in__.template read_constrain_lb(0, lp__); - double sigma_age_edu; - current_statement__ = 6; - sigma_age_edu = in__.template read_constrain_lb(0, lp__); - double b_0; - current_statement__ = 7; - b_0 = in__.template read(); - double b_female; - current_statement__ = 8; - b_female = in__.template read(); - double b_black; - current_statement__ = 9; - b_black = in__.template read(); - double b_female_black; - current_statement__ = 10; - b_female_black = in__.template read(); - double b_v_prev; - current_statement__ = 11; - b_v_prev = in__.template read(); - Eigen::Matrix b_age; - current_statement__ = 12; - b_age = in__.template read>(n_age); - Eigen::Matrix b_edu; - current_statement__ = 13; - b_edu = in__.template read>(n_edu); - Eigen::Matrix b_region; - current_statement__ = 14; - b_region = in__.template read< - Eigen::Matrix>(n_region); - Eigen::Matrix b_age_edu; - current_statement__ = 15; - b_age_edu = in__.template read< - Eigen::Matrix>(n_age, n_edu); - Eigen::Matrix b_hat; - current_statement__ = 16; - b_hat = in__.template read< - Eigen::Matrix>(n_state); - out__.write(sigma); - out__.write(sigma_age); - out__.write(sigma_edu); - out__.write(sigma_state); - out__.write(sigma_region); - out__.write(sigma_age_edu); - out__.write(b_0); - out__.write(b_female); - out__.write(b_black); - out__.write(b_female_black); - out__.write(b_v_prev); - out__.write(b_age); - out__.write(b_edu); - out__.write(b_region); - out__.write(b_age_edu); - out__.write(b_hat); - if (stan::math::logical_negation( - (stan::math::primitive_value(emit_transformed_parameters__) || - stan::math::primitive_value(emit_generated_quantities__)))) { - return ; + current_statement__ = 45; + stan::math::check_greater_or_equal(function__, "x", x, 0); + current_statement__ = 45; + stan::math::check_less_or_equal(function__, "x", x, max_age); + current_statement__ = 46; + n_occ_minus_1 = std::numeric_limits::min(); + current_statement__ = 46; + n_occ_minus_1 = (n_occasions - 1); + current_statement__ = 47; + stan::math::validate_non_negative_index("first", "nind", nind); + current_statement__ = 48; + first = std::vector(nind, std::numeric_limits::min()); + current_statement__ = 49; + stan::math::validate_non_negative_index("last", "nind", nind); + current_statement__ = 50; + last = std::vector(nind, std::numeric_limits::min()); + current_statement__ = 52; + for (int i = 1; i <= nind; ++i) { + current_statement__ = 51; + stan::model::assign(first, + first_capture( + stan::model::rvalue(y, "y", stan::model::index_uni(i)), pstream__), + "assigning variable first", stan::model::index_uni(i)); } - if (stan::math::logical_negation(emit_generated_quantities__)) { - return ; + current_statement__ = 54; + for (int i = 1; i <= nind; ++i) { + current_statement__ = 53; + stan::model::assign(last, + last_capture( + stan::model::rvalue(y, "y", stan::model::index_uni(i)), pstream__), + "assigning variable last", stan::model::index_uni(i)); } + current_statement__ = 48; + stan::math::check_greater_or_equal(function__, "first", first, 0); + current_statement__ = 48; + stan::math::check_less_or_equal(function__, "first", first, n_occasions); + current_statement__ = 50; + stan::math::check_greater_or_equal(function__, "last", last, 0); + current_statement__ = 50; + stan::math::check_less_or_equal(function__, "last", last, n_occasions); + current_statement__ = 55; + stan::math::validate_non_negative_index("beta", "max_age", max_age); + current_statement__ = 56; + stan::math::validate_non_negative_index("phi", "nind", nind); + current_statement__ = 57; + stan::math::validate_non_negative_index("phi", "n_occ_minus_1", + n_occ_minus_1); + current_statement__ = 58; + stan::math::validate_non_negative_index("p", "nind", nind); + current_statement__ = 59; + stan::math::validate_non_negative_index("p", "n_occ_minus_1", + n_occ_minus_1); + current_statement__ = 60; + stan::math::validate_non_negative_index("chi", "nind", nind); + current_statement__ = 61; + stan::math::validate_non_negative_index("chi", "n_occasions", + n_occasions); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } + num_params_r__ = 1 + max_age; } - template * = nullptr, + inline std::string model_name() const final { + return "copy_fail_model"; + } + inline std::vector model_compile_info() const noexcept { + return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", + "stancflags = --O1 --print-cpp"}; + } + template * = nullptr, stan::require_vector_like_vt* = nullptr> - inline void - transform_inits_impl(VecVar& params_r__, VecI& params_i__, VecVar& vars__, - std::ostream* pstream__ = nullptr) const { - using local_scalar_t__ = double; + 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__; 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__; + static constexpr const char* function__ = + "copy_fail_model_namespace::log_prob"; + // suppress unused var warning + (void) function__; try { - int pos__; - pos__ = 1; - local_scalar_t__ sigma; - sigma = in__.read(); - out__.write_free_lb(0, sigma); - local_scalar_t__ sigma_age; - sigma_age = in__.read(); - out__.write_free_lb(0, sigma_age); - local_scalar_t__ sigma_edu; - sigma_edu = in__.read(); - out__.write_free_lb(0, sigma_edu); - local_scalar_t__ sigma_state; - sigma_state = in__.read(); - out__.write_free_lb(0, sigma_state); - local_scalar_t__ sigma_region; - sigma_region = in__.read(); - out__.write_free_lb(0, sigma_region); - local_scalar_t__ sigma_age_edu; - sigma_age_edu = in__.read(); - out__.write_free_lb(0, sigma_age_edu); - local_scalar_t__ b_0; - b_0 = in__.read(); - out__.write(b_0); - local_scalar_t__ b_female; - b_female = in__.read(); - out__.write(b_female); - local_scalar_t__ b_black; - b_black = in__.read(); - out__.write(b_black); - local_scalar_t__ b_female_black; - b_female_black = in__.read(); - out__.write(b_female_black); - local_scalar_t__ b_v_prev; - b_v_prev = in__.read(); - out__.write(b_v_prev); - Eigen::Matrix b_age = - Eigen::Matrix::Constant(n_age, DUMMY_VAR__); - for (int sym1__ = 1; sym1__ <= n_age; ++sym1__) { - stan::model::assign(b_age, in__.read(), - "assigning variable b_age", stan::model::index_uni(sym1__)); - } - out__.write(b_age); - Eigen::Matrix b_edu = - Eigen::Matrix::Constant(n_edu, DUMMY_VAR__); - for (int sym1__ = 1; sym1__ <= n_edu; ++sym1__) { - stan::model::assign(b_edu, in__.read(), - "assigning variable b_edu", stan::model::index_uni(sym1__)); - } - out__.write(b_edu); - Eigen::Matrix b_region = - Eigen::Matrix::Constant(n_region, DUMMY_VAR__); - for (int sym1__ = 1; sym1__ <= n_region; ++sym1__) { - stan::model::assign(b_region, in__.read(), - "assigning variable b_region", stan::model::index_uni(sym1__)); - } - out__.write(b_region); - Eigen::Matrix b_age_edu = - Eigen::Matrix::Constant(n_age, n_edu, + local_scalar_t__ mean_p; + current_statement__ = 1; + mean_p = in__.template read_constrain_lub(0, 1, lp__); + Eigen::Matrix beta; + current_statement__ = 2; + beta = in__.template read_constrain_lub< + Eigen::Matrix, jacobian__>(0, 1, lp__, + max_age); + Eigen::Matrix phi = + Eigen::Matrix::Constant(nind, n_occ_minus_1, DUMMY_VAR__); - for (int sym1__ = 1; sym1__ <= n_edu; ++sym1__) { - for (int sym2__ = 1; sym2__ <= n_age; ++sym2__) { - stan::model::assign(b_age_edu, in__.read(), - "assigning variable b_age_edu", stan::model::index_uni(sym2__), - stan::model::index_uni(sym1__)); + Eigen::Matrix p = + Eigen::Matrix::Constant(nind, n_occ_minus_1, + DUMMY_VAR__); + Eigen::Matrix chi = + Eigen::Matrix::Constant(nind, n_occasions, + DUMMY_VAR__); + current_statement__ = 15; + for (int i = 1; i <= nind; ++i) { + current_statement__ = 9; + for (int t = 1; t <= + (stan::model::rvalue(first, "first", stan::model::index_uni(i)) + - 1); ++t) { + current_statement__ = 6; + stan::model::assign(phi, 0, "assigning variable phi", + stan::model::index_uni(i), stan::model::index_uni(t)); + current_statement__ = 7; + stan::model::assign(p, 0, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(t)); + } + current_statement__ = 13; + for (int t = + stan::model::rvalue(first, "first", stan::model::index_uni(i)); t + <= n_occ_minus_1; ++t) { + current_statement__ = 10; + stan::model::assign(phi, + stan::model::rvalue(beta, "beta", + stan::model::index_uni( + stan::model::rvalue(x, "x", stan::model::index_uni(i), + stan::model::index_uni(t)))), "assigning variable phi", + stan::model::index_uni(i), stan::model::index_uni(t)); + current_statement__ = 11; + stan::model::assign(p, mean_p, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(t)); } } - out__.write(b_age_edu); - Eigen::Matrix b_hat = - Eigen::Matrix::Constant(n_state, DUMMY_VAR__); - for (int sym1__ = 1; sym1__ <= n_state; ++sym1__) { - stan::model::assign(b_hat, in__.read(), - "assigning variable b_hat", stan::model::index_uni(sym1__)); + Eigen::Matrix + inline_prob_uncaptured_return_sym8__; + { + current_statement__ = 16; + stan::math::validate_non_negative_index("chi", "nind", nind); + current_statement__ = 17; + stan::math::validate_non_negative_index("chi", "n_occasions", + n_occasions); + Eigen::Matrix + inline_prob_uncaptured_chi_sym9__ = + Eigen::Matrix::Constant(nind, n_occasions, + DUMMY_VAR__); + current_statement__ = 26; + for (int inline_prob_uncaptured_i_sym13__ = 1; inline_prob_uncaptured_i_sym13__ + <= nind; ++inline_prob_uncaptured_i_sym13__) { + current_statement__ = 19; + stan::model::assign(inline_prob_uncaptured_chi_sym9__, 1.0, + "assigning variable inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(n_occasions)); + current_statement__ = 24; + for (int inline_prob_uncaptured_t_sym12__ = 1; inline_prob_uncaptured_t_sym12__ + <= (n_occasions - 1); ++inline_prob_uncaptured_t_sym12__) { + int inline_prob_uncaptured_t_curr_sym10__; + current_statement__ = 20; + inline_prob_uncaptured_t_curr_sym10__ = (n_occasions - + inline_prob_uncaptured_t_sym12__); + int inline_prob_uncaptured_t_next_sym11__; + current_statement__ = 21; + inline_prob_uncaptured_t_next_sym11__ = (inline_prob_uncaptured_t_curr_sym10__ + + 1); + current_statement__ = 22; + stan::model::assign(inline_prob_uncaptured_chi_sym9__, + stan::math::fma( + (stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni( + inline_prob_uncaptured_t_curr_sym10__)) * (1 - + stan::model::rvalue(p, "p", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni( + (inline_prob_uncaptured_t_next_sym11__ - 1))))), + stan::model::rvalue(inline_prob_uncaptured_chi_sym9__, + "inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni( + inline_prob_uncaptured_t_next_sym11__)), (1 - + stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni( + inline_prob_uncaptured_t_curr_sym10__)))), + "assigning variable inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(inline_prob_uncaptured_t_curr_sym10__)); + } + } + current_statement__ = 27; + stan::model::assign(inline_prob_uncaptured_return_sym8__, + inline_prob_uncaptured_chi_sym9__, + "assigning variable inline_prob_uncaptured_return_sym8__"); + } + stan::model::assign(chi, inline_prob_uncaptured_return_sym8__, + "assigning variable chi"); + current_statement__ = 3; + stan::math::check_greater_or_equal(function__, "phi", phi, 0); + current_statement__ = 3; + stan::math::check_less_or_equal(function__, "phi", phi, 1); + current_statement__ = 4; + stan::math::check_greater_or_equal(function__, "p", p, 0); + current_statement__ = 4; + stan::math::check_less_or_equal(function__, "p", p, 1); + current_statement__ = 5; + stan::math::check_greater_or_equal(function__, "chi", chi, 0); + current_statement__ = 5; + stan::math::check_less_or_equal(function__, "chi", chi, 1); + { + current_statement__ = 36; + for (int i = 1; i <= nind; ++i) { + current_statement__ = 34; + if (stan::math::logical_gt( + stan::model::rvalue(first, "first", stan::model::index_uni(i)), + 0)) { + current_statement__ = 31; + for (int t = + (stan::model::rvalue(first, "first", + stan::model::index_uni(i)) + 1); t <= + stan::model::rvalue(last, "last", stan::model::index_uni(i)); ++t) { + current_statement__ = 28; + lp_accum__.add(stan::math::bernoulli_lpmf(1, + stan::model::rvalue(phi, "phi", + stan::model::index_uni(i), + stan::model::index_uni((t - 1))))); + current_statement__ = 29; + lp_accum__.add(stan::math::bernoulli_lpmf( + stan::model::rvalue(y, "y", + stan::model::index_uni(i), + stan::model::index_uni(t)), + stan::model::rvalue(p, "p", + stan::model::index_uni(i), + stan::model::index_uni((t - 1))))); + } + current_statement__ = 32; + lp_accum__.add(stan::math::bernoulli_lpmf(1, + stan::model::rvalue(chi, "chi", + stan::model::index_uni(i), + stan::model::index_uni( + stan::model::rvalue(last, "last", + stan::model::index_uni(i)))))); + } + } } - out__.write(b_hat); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } + lp_accum__.add(lp__); + return lp_accum__.sum(); } - inline void get_param_names(std::vector& names__) const { - names__ = std::vector{"sigma", "sigma_age", "sigma_edu", - "sigma_state", "sigma_region", "sigma_age_edu", "b_0", - "b_female", "b_black", "b_female_black", "b_v_prev", "b_age", - "b_edu", "b_region", "b_age_edu", "b_hat"}; - } - inline void get_dims(std::vector>& dimss__) const { - dimss__ = std::vector>{std::vector{}, - std::vector{}, std::vector{}, - std::vector{}, std::vector{}, - std::vector{}, std::vector{}, - std::vector{}, std::vector{}, - std::vector{}, std::vector{}, - std::vector{static_cast(n_age)}, - std::vector{static_cast(n_edu)}, - std::vector{static_cast(n_region)}, - std::vector{static_cast(n_age), - static_cast(n_edu)}, - std::vector{static_cast(n_state)}}; - } - inline void - constrained_param_names(std::vector& param_names__, bool - emit_transformed_parameters__ = true, bool - emit_generated_quantities__ = true) const final { - param_names__.emplace_back(std::string() + "sigma"); - param_names__.emplace_back(std::string() + "sigma_age"); - param_names__.emplace_back(std::string() + "sigma_edu"); - param_names__.emplace_back(std::string() + "sigma_state"); - param_names__.emplace_back(std::string() + "sigma_region"); - param_names__.emplace_back(std::string() + "sigma_age_edu"); - param_names__.emplace_back(std::string() + "b_0"); - param_names__.emplace_back(std::string() + "b_female"); - param_names__.emplace_back(std::string() + "b_black"); - param_names__.emplace_back(std::string() + "b_female_black"); - param_names__.emplace_back(std::string() + "b_v_prev"); - for (int sym1__ = 1; sym1__ <= n_age; ++sym1__) { - param_names__.emplace_back(std::string() + "b_age" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= n_edu; ++sym1__) { - param_names__.emplace_back(std::string() + "b_edu" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= n_region; ++sym1__) { - param_names__.emplace_back(std::string() + "b_region" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= n_edu; ++sym1__) { - for (int sym2__ = 1; sym2__ <= n_age; ++sym2__) { - param_names__.emplace_back(std::string() + "b_age_edu" + '.' + - std::to_string(sym2__) + '.' + std::to_string(sym1__)); - } - } - for (int sym1__ = 1; sym1__ <= n_state; ++sym1__) { - param_names__.emplace_back(std::string() + "b_hat" + '.' + - std::to_string(sym1__)); - } - if (emit_transformed_parameters__) {} - 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 { - param_names__.emplace_back(std::string() + "sigma"); - param_names__.emplace_back(std::string() + "sigma_age"); - param_names__.emplace_back(std::string() + "sigma_edu"); - param_names__.emplace_back(std::string() + "sigma_state"); - param_names__.emplace_back(std::string() + "sigma_region"); - param_names__.emplace_back(std::string() + "sigma_age_edu"); - param_names__.emplace_back(std::string() + "b_0"); - param_names__.emplace_back(std::string() + "b_female"); - param_names__.emplace_back(std::string() + "b_black"); - param_names__.emplace_back(std::string() + "b_female_black"); - param_names__.emplace_back(std::string() + "b_v_prev"); - for (int sym1__ = 1; sym1__ <= n_age; ++sym1__) { - param_names__.emplace_back(std::string() + "b_age" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= n_edu; ++sym1__) { - param_names__.emplace_back(std::string() + "b_edu" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= n_region; ++sym1__) { - param_names__.emplace_back(std::string() + "b_region" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= n_edu; ++sym1__) { - for (int sym2__ = 1; sym2__ <= n_age; ++sym2__) { - param_names__.emplace_back(std::string() + "b_age_edu" + '.' + - std::to_string(sym2__) + '.' + std::to_string(sym1__)); - } - } - for (int sym1__ = 1; sym1__ <= n_state; ++sym1__) { - param_names__.emplace_back(std::string() + "b_hat" + '.' + - std::to_string(sym1__)); - } - if (emit_transformed_parameters__) {} - if (emit_generated_quantities__) {} - } - inline std::string get_constrained_sizedtypes() const { - return std::string("[{\"name\":\"sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_age\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_edu\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_state\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_region\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_age_edu\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_0\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_female\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_black\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_female_black\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_v_prev\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_age\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_age) + "},\"block\":\"parameters\"},{\"name\":\"b_edu\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_edu) + "},\"block\":\"parameters\"},{\"name\":\"b_region\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_region) + "},\"block\":\"parameters\"},{\"name\":\"b_age_edu\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(n_age) + ",\"cols\":" + std::to_string(n_edu) + "},\"block\":\"parameters\"},{\"name\":\"b_hat\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_state) + "},\"block\":\"parameters\"}]"); - } - inline std::string get_unconstrained_sizedtypes() const { - return std::string("[{\"name\":\"sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_age\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_edu\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_state\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_region\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_age_edu\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_0\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_female\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_black\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_female_black\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_v_prev\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_age\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_age) + "},\"block\":\"parameters\"},{\"name\":\"b_edu\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_edu) + "},\"block\":\"parameters\"},{\"name\":\"b_region\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_region) + "},\"block\":\"parameters\"},{\"name\":\"b_age_edu\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(n_age) + ",\"cols\":" + std::to_string(n_edu) + "},\"block\":\"parameters\"},{\"name\":\"b_hat\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_state) + "},\"block\":\"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__ = (((((((((((((((1 + 1) + 1) + 1) + 1) + 1) + - 1) + 1) + 1) + 1) + 1) + n_age) + n_edu) + n_region) + (n_age * n_edu)) - + n_state); - const size_t num_transformed = emit_transformed_parameters * (0); - 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__ = (((((((((((((((1 + 1) + 1) + 1) + 1) + 1) + - 1) + 1) + 1) + 1) + 1) + n_age) + n_edu) + n_region) + (n_age * n_edu)) - + n_state); - const size_t num_transformed = emit_transformed_parameters * (0); - 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 { - constexpr std::array - names__{"sigma", "sigma_age", "sigma_edu", "sigma_state", - "sigma_region", "sigma_age_edu", "b_0", "b_female", "b_black", - "b_female_black", "b_v_prev", "b_age", "b_edu", "b_region", - "b_age_edu", "b_hat"}; - const std::array - constrain_param_sizes__{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, n_age, n_edu, - n_region, (n_age * n_edu), n_state}; - const auto num_constrained_params__ = - std::accumulate(constrain_param_sizes__.begin(), - constrain_param_sizes__.end(), 0); - std::vector params_r_flat__(num_constrained_params__); - Eigen::Index size_iter__ = 0; - Eigen::Index flat_iter__ = 0; - for (auto&& param_name__: names__) { - const auto param_vec__ = context.vals_r(param_name__); - for (Eigen::Index i = 0; i < constrain_param_sizes__[size_iter__]; ++i) { - params_r_flat__[flat_iter__] = param_vec__[i]; - ++flat_iter__; - } - ++size_iter__; - } - vars.resize(num_params_r__); - transform_inits_impl(params_r_flat__, params_i, vars, pstream__); - } -}; -} -using stan_model = dce_fail_model_namespace::dce_fail_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* m = new stan_model(data_context, seed, msg_stream); - return *m; -} -stan::math::profile_map& get_stan_profile_data() { - return dce_fail_model_namespace::profiles__; -} -#endif - $ ../../../../../install/default/bin/stanc --O1 --print-cpp expr-prop-experiment.stan -// Code generated by %%NAME%% %%VERSION%% -#include -namespace expr_prop_experiment_model_namespace { -using stan::model::model_base_crtp; -using namespace stan::math; -stan::math::profile_map profiles__; -static constexpr std::array locations_array__ = - {" (found before start of program)", - " (in 'expr-prop-experiment.stan', line 2, column 2 to column 8)", - " (in 'expr-prop-experiment.stan', line 5, column 2 to column 9)", - " (in 'expr-prop-experiment.stan', line 6, column 2 to column 9)", - " (in 'expr-prop-experiment.stan', line 7, column 2 to column 9)", - " (in 'expr-prop-experiment.stan', line 8, column 2 to column 28)", - " (in 'expr-prop-experiment.stan', line 9, column 2 to column 12)", - " (in 'expr-prop-experiment.stan', line 10, column 2 to column 23)", - " (in 'expr-prop-experiment.stan', line 11, column 2 to column 23)", - " (in 'expr-prop-experiment.stan', line 12, column 2 to column 23)"}; -class expr_prop_experiment_model final : public model_base_crtp { - private: - int j; - double z; - double x; - double y; - double i; - public: - ~expr_prop_experiment_model() {} - expr_prop_experiment_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__ = - "expr_prop_experiment_model_namespace::expr_prop_experiment_model"; - // suppress unused var warning - (void) function__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - int pos__; - pos__ = 1; - current_statement__ = 1; - context__.validate_dims("data initialization", "j", "int", - std::vector{}); - j = std::numeric_limits::min(); - current_statement__ = 1; - j = context__.vals_i("j")[(1 - 1)]; - current_statement__ = 2; - z = std::numeric_limits::quiet_NaN(); - current_statement__ = 3; - x = std::numeric_limits::quiet_NaN(); - current_statement__ = 4; - y = std::numeric_limits::quiet_NaN(); - current_statement__ = 5; - i = std::numeric_limits::quiet_NaN(); - current_statement__ = 5; - i = stan::math::normal_rng(5, 1, base_rng__); - current_statement__ = 6; - z = (i * j); - current_statement__ = 7; - x = stan::math::normal_rng(z, 1, base_rng__); - current_statement__ = 8; - i = stan::math::normal_rng(5, 1, base_rng__); - current_statement__ = 9; - y = stan::math::normal_rng(z, 1, base_rng__); - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } - num_params_r__ = 0U; - } - inline std::string model_name() const final { - return "expr_prop_experiment_model"; - } - inline std::vector model_compile_info() const noexcept { - return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", - "stancflags = --O1 --print-cpp"}; - } - 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__; - stan::io::deserializer in__(params_r__, params_i__); - int current_statement__ = 0; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - static constexpr const char* function__ = - "expr_prop_experiment_model_namespace::log_prob"; - // suppress unused var warning - (void) function__; - try { - - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } - lp_accum__.add(lp__); - return lp_accum__.sum(); - } - template * = nullptr, stan::require_vector_like_vt* = nullptr, stan::require_vector_vt* = nullptr> + 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 @@ -3071,25 +2087,152 @@ class expr_prop_experiment_model final : public model_base_crtp(0, 1, lp__); + Eigen::Matrix beta; + current_statement__ = 2; + beta = in__.template read_constrain_lub< + Eigen::Matrix, jacobian__>(0, 1, lp__, + max_age); + Eigen::Matrix phi = + Eigen::Matrix::Constant(nind, n_occ_minus_1, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix p = + Eigen::Matrix::Constant(nind, n_occ_minus_1, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix chi = + Eigen::Matrix::Constant(nind, n_occasions, + std::numeric_limits::quiet_NaN()); + out__.write(mean_p); + out__.write(beta); if (stan::math::logical_negation( (stan::math::primitive_value(emit_transformed_parameters__) || stan::math::primitive_value(emit_generated_quantities__)))) { return ; } - if (stan::math::logical_negation(emit_generated_quantities__)) { - return ; - } - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } - } - template * = nullptr, - stan::require_vector_like_vt* = nullptr> + current_statement__ = 15; + for (int i = 1; i <= nind; ++i) { + current_statement__ = 9; + for (int t = 1; t <= + (stan::model::rvalue(first, "first", stan::model::index_uni(i)) + - 1); ++t) { + current_statement__ = 6; + stan::model::assign(phi, 0, "assigning variable phi", + stan::model::index_uni(i), stan::model::index_uni(t)); + current_statement__ = 7; + stan::model::assign(p, 0, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(t)); + } + current_statement__ = 13; + for (int t = + stan::model::rvalue(first, "first", stan::model::index_uni(i)); t + <= n_occ_minus_1; ++t) { + current_statement__ = 10; + stan::model::assign(phi, + stan::model::rvalue(beta, "beta", + stan::model::index_uni( + stan::model::rvalue(x, "x", stan::model::index_uni(i), + stan::model::index_uni(t)))), "assigning variable phi", + stan::model::index_uni(i), stan::model::index_uni(t)); + current_statement__ = 11; + stan::model::assign(p, mean_p, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(t)); + } + } + Eigen::Matrix inline_prob_uncaptured_return_sym1__; + { + current_statement__ = 16; + stan::math::validate_non_negative_index("chi", "nind", nind); + current_statement__ = 17; + stan::math::validate_non_negative_index("chi", "n_occasions", + n_occasions); + Eigen::Matrix + inline_prob_uncaptured_chi_sym2__ = + Eigen::Matrix::Constant(nind, n_occasions, + DUMMY_VAR__); + current_statement__ = 26; + for (int inline_prob_uncaptured_i_sym6__ = 1; inline_prob_uncaptured_i_sym6__ + <= nind; ++inline_prob_uncaptured_i_sym6__) { + current_statement__ = 19; + stan::model::assign(inline_prob_uncaptured_chi_sym2__, 1.0, + "assigning variable inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(n_occasions)); + current_statement__ = 24; + for (int inline_prob_uncaptured_t_sym5__ = 1; inline_prob_uncaptured_t_sym5__ + <= (n_occasions - 1); ++inline_prob_uncaptured_t_sym5__) { + int inline_prob_uncaptured_t_curr_sym3__; + current_statement__ = 20; + inline_prob_uncaptured_t_curr_sym3__ = (n_occasions - + inline_prob_uncaptured_t_sym5__); + int inline_prob_uncaptured_t_next_sym4__; + current_statement__ = 21; + inline_prob_uncaptured_t_next_sym4__ = (inline_prob_uncaptured_t_curr_sym3__ + + 1); + current_statement__ = 22; + stan::model::assign(inline_prob_uncaptured_chi_sym2__, + stan::math::fma( + (stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni( + inline_prob_uncaptured_t_curr_sym3__)) * (1 - + stan::model::rvalue(p, "p", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni( + (inline_prob_uncaptured_t_next_sym4__ - 1))))), + stan::model::rvalue(inline_prob_uncaptured_chi_sym2__, + "inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(inline_prob_uncaptured_t_next_sym4__)), + (1 - + stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(inline_prob_uncaptured_t_curr_sym3__)))), + "assigning variable inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(inline_prob_uncaptured_t_curr_sym3__)); + } + } + current_statement__ = 27; + stan::model::assign(inline_prob_uncaptured_return_sym1__, + inline_prob_uncaptured_chi_sym2__, + "assigning variable inline_prob_uncaptured_return_sym1__"); + } + stan::model::assign(chi, inline_prob_uncaptured_return_sym1__, + "assigning variable chi"); + current_statement__ = 3; + stan::math::check_greater_or_equal(function__, "phi", phi, 0); + current_statement__ = 3; + stan::math::check_less_or_equal(function__, "phi", phi, 1); + current_statement__ = 4; + stan::math::check_greater_or_equal(function__, "p", p, 0); + current_statement__ = 4; + stan::math::check_less_or_equal(function__, "p", p, 1); + current_statement__ = 5; + stan::math::check_greater_or_equal(function__, "chi", chi, 0); + current_statement__ = 5; + stan::math::check_less_or_equal(function__, "chi", chi, 1); + if (emit_transformed_parameters__) { + out__.write(phi); + out__.write(p); + out__.write(chi); + } + if (stan::math::logical_negation(emit_generated_quantities__)) { + return ; + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> inline void transform_inits_impl(VecVar& params_r__, VecI& params_i__, VecVar& vars__, std::ostream* pstream__ = nullptr) const { @@ -3103,35 +2246,100 @@ class expr_prop_experiment_model final : public model_base_crtp(); + out__.write_free_lub(0, 1, mean_p); + Eigen::Matrix beta = + Eigen::Matrix::Constant(max_age, DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= max_age; ++sym1__) { + stan::model::assign(beta, in__.read(), + "assigning variable beta", stan::model::index_uni(sym1__)); + } + out__.write_free_lub(0, 1, beta); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } inline void get_param_names(std::vector& names__) const { - names__ = std::vector{}; + names__ = std::vector{"mean_p", "beta", "phi", "p", "chi"}; } inline void get_dims(std::vector>& dimss__) const { - dimss__ = std::vector>{}; + dimss__ = std::vector>{std::vector{}, + std::vector{static_cast(max_age)}, + std::vector{static_cast(nind), + static_cast(n_occ_minus_1)}, + std::vector{static_cast(nind), + static_cast(n_occ_minus_1)}, + std::vector{static_cast(nind), + static_cast(n_occasions)}}; } inline void constrained_param_names(std::vector& param_names__, bool emit_transformed_parameters__ = true, bool emit_generated_quantities__ = true) const final { - if (emit_transformed_parameters__) {} + param_names__.emplace_back(std::string() + "mean_p"); + for (int sym15__ = 1; sym15__ <= max_age; ++sym15__) { + param_names__.emplace_back(std::string() + "beta" + '.' + + std::to_string(sym15__)); + } + if (emit_transformed_parameters__) { + for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { + for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { + param_names__.emplace_back(std::string() + "phi" + '.' + + std::to_string(sym16__) + '.' + std::to_string(sym15__)); + } + } + for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { + for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { + param_names__.emplace_back(std::string() + "p" + '.' + + std::to_string(sym16__) + '.' + std::to_string(sym15__)); + } + } + for (int sym15__ = 1; sym15__ <= n_occasions; ++sym15__) { + for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { + param_names__.emplace_back(std::string() + "chi" + '.' + + std::to_string(sym16__) + '.' + std::to_string(sym15__)); + } + } + } 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 { - if (emit_transformed_parameters__) {} + param_names__.emplace_back(std::string() + "mean_p"); + for (int sym15__ = 1; sym15__ <= max_age; ++sym15__) { + param_names__.emplace_back(std::string() + "beta" + '.' + + std::to_string(sym15__)); + } + if (emit_transformed_parameters__) { + for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { + for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { + param_names__.emplace_back(std::string() + "phi" + '.' + + std::to_string(sym16__) + '.' + std::to_string(sym15__)); + } + } + for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { + for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { + param_names__.emplace_back(std::string() + "p" + '.' + + std::to_string(sym16__) + '.' + std::to_string(sym15__)); + } + } + for (int sym15__ = 1; sym15__ <= n_occasions; ++sym15__) { + for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { + param_names__.emplace_back(std::string() + "chi" + '.' + + std::to_string(sym16__) + '.' + std::to_string(sym15__)); + } + } + } if (emit_generated_quantities__) {} } inline std::string get_constrained_sizedtypes() const { - return std::string("[]"); + return std::string("[{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(max_age) + "},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"}]"); } inline std::string get_unconstrained_sizedtypes() const { - return std::string("[]"); + return std::string("[{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(max_age) + "},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"}]"); } // Begin method overload boilerplate template inline void @@ -3140,8 +2348,9 @@ class expr_prop_experiment_model final : public model_base_crtp& params_i, std::vector& vars, std::ostream* pstream__ = nullptr) const { - constexpr std::array names__{}; - const std::array constrain_param_sizes__{}; + constexpr std::array names__{"mean_p", "beta"}; + const std::array constrain_param_sizes__{1, max_age}; const auto num_constrained_params__ = std::accumulate(constrain_param_sizes__.begin(), constrain_param_sizes__.end(), 0); @@ -3212,7 +2422,7 @@ class expr_prop_experiment_model final : public model_base_crtp -namespace expr_prop_experiment2_model_namespace { +namespace dce_fail_model_namespace { using stan::model::model_base_crtp; using namespace stan::math; stan::math::profile_map profiles__; -static constexpr std::array locations_array__ = +static constexpr std::array locations_array__ = {" (found before start of program)", - " (in 'expr-prop-experiment2.stan', line 2, column 2 to column 8)", - " (in 'expr-prop-experiment2.stan', line 5, column 2 to column 13)", - " (in 'expr-prop-experiment2.stan', line 6, column 2 to column 9)", - " (in 'expr-prop-experiment2.stan', line 8, column 4 to column 32)", - " (in 'expr-prop-experiment2.stan', line 9, column 4 to column 14)", - " (in 'expr-prop-experiment2.stan', line 10, column 4 to column 25)", - " (in 'expr-prop-experiment2.stan', line 7, column 2 to line 11, column 3)", - " (in 'expr-prop-experiment2.stan', line 12, column 2 to column 23)"}; -class expr_prop_experiment2_model final : public model_base_crtp { - private: - int j; - double z; - double y; - public: - ~expr_prop_experiment2_model() {} - expr_prop_experiment2_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__ = - "expr_prop_experiment2_model_namespace::expr_prop_experiment2_model"; - // suppress unused var warning - (void) function__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - int pos__; - pos__ = 1; - current_statement__ = 1; - context__.validate_dims("data initialization", "j", "int", - std::vector{}); - j = std::numeric_limits::min(); - current_statement__ = 1; - j = context__.vals_i("j")[(1 - 1)]; - current_statement__ = 2; - z = std::numeric_limits::quiet_NaN(); - current_statement__ = 2; - z = 1; - current_statement__ = 3; - y = std::numeric_limits::quiet_NaN(); - { - double x; - current_statement__ = 4; - x = stan::math::normal_rng(123, 1, base_rng__); - current_statement__ = 5; - z = (x * 2); - current_statement__ = 6; - y = stan::math::normal_rng(z, 1, base_rng__); - } - current_statement__ = 8; - y = stan::math::normal_rng(z, 1, base_rng__); - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } - num_params_r__ = 0U; - } - inline std::string model_name() const final { - return "expr_prop_experiment2_model"; - } - inline std::vector model_compile_info() const noexcept { - return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", - "stancflags = --O1 --print-cpp"}; - } - 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__; - stan::io::deserializer in__(params_r__, params_i__); + " (in 'dce-fail.stan', line 18, column 2 to column 22)", + " (in 'dce-fail.stan', line 19, column 2 to column 26)", + " (in 'dce-fail.stan', line 20, column 2 to column 26)", + " (in 'dce-fail.stan', line 21, column 2 to column 28)", + " (in 'dce-fail.stan', line 22, column 2 to column 29)", + " (in 'dce-fail.stan', line 23, column 2 to column 30)", + " (in 'dce-fail.stan', line 25, column 2 to column 11)", + " (in 'dce-fail.stan', line 26, column 2 to column 16)", + " (in 'dce-fail.stan', line 27, column 2 to column 15)", + " (in 'dce-fail.stan', line 28, column 2 to column 22)", + " (in 'dce-fail.stan', line 30, column 2 to column 16)", + " (in 'dce-fail.stan', line 32, column 2 to column 22)", + " (in 'dce-fail.stan', line 33, column 2 to column 22)", + " (in 'dce-fail.stan', line 34, column 2 to column 28)", + " (in 'dce-fail.stan', line 35, column 2 to column 32)", + " (in 'dce-fail.stan', line 37, column 2 to column 24)", + " (in 'dce-fail.stan', line 40, column 9 to column 10)", + " (in 'dce-fail.stan', line 40, column 2 to column 14)", + " (in 'dce-fail.stan', line 41, column 9 to column 16)", + " (in 'dce-fail.stan', line 41, column 2 to column 30)", + " (in 'dce-fail.stan', line 43, column 2 to column 23)", + " (in 'dce-fail.stan', line 44, column 2 to column 28)", + " (in 'dce-fail.stan', line 45, column 2 to column 27)", + " (in 'dce-fail.stan', line 46, column 2 to column 34)", + " (in 'dce-fail.stan', line 48, column 2 to column 31)", + " (in 'dce-fail.stan', line 49, column 2 to column 31)", + " (in 'dce-fail.stan', line 50, column 2 to column 37)", + " (in 'dce-fail.stan', line 54, column 6 to column 48)", + " (in 'dce-fail.stan', line 53, column 4 to line 54, column 48)", + " (in 'dce-fail.stan', line 52, column 21 to line 55, column 3)", + " (in 'dce-fail.stan', line 52, column 2 to line 55, column 3)", + " (in 'dce-fail.stan', line 57, column 2 to column 28)", + " (in 'dce-fail.stan', line 60, column 4 to column 64)", + " (in 'dce-fail.stan', line 59, column 2 to line 60, column 64)", + " (in 'dce-fail.stan', line 62, column 2 to column 43)", + " (in 'dce-fail.stan', line 65, column 4 to line 68, column 25)", + " (in 'dce-fail.stan', line 64, column 2 to line 68, column 25)", + " (in 'dce-fail.stan', line 70, column 2 to column 19)", + " (in 'dce-fail.stan', line 2, column 2 to column 17)", + " (in 'dce-fail.stan', line 3, column 2 to column 21)", + " (in 'dce-fail.stan', line 4, column 2 to column 21)", + " (in 'dce-fail.stan', line 5, column 2 to column 24)", + " (in 'dce-fail.stan', line 6, column 2 to column 23)", + " (in 'dce-fail.stan', line 8, column 8 to column 9)", + " (in 'dce-fail.stan', line 8, column 2 to column 40)", + " (in 'dce-fail.stan', line 9, column 8 to column 9)", + " (in 'dce-fail.stan', line 9, column 2 to column 39)", + " (in 'dce-fail.stan', line 10, column 8 to column 9)", + " (in 'dce-fail.stan', line 10, column 2 to column 41)", + " (in 'dce-fail.stan', line 11, column 8 to column 9)", + " (in 'dce-fail.stan', line 11, column 2 to column 41)", + " (in 'dce-fail.stan', line 12, column 8 to column 15)", + " (in 'dce-fail.stan', line 12, column 2 to column 52)", + " (in 'dce-fail.stan', line 13, column 8 to column 9)", + " (in 'dce-fail.stan', line 13, column 2 to column 45)", + " (in 'dce-fail.stan', line 14, column 8 to column 9)", + " (in 'dce-fail.stan', line 14, column 2 to column 35)", + " (in 'dce-fail.stan', line 15, column 9 to column 16)", + " (in 'dce-fail.stan', line 15, column 2 to column 25)", + " (in 'dce-fail.stan', line 32, column 9 to column 14)", + " (in 'dce-fail.stan', line 33, column 9 to column 14)", + " (in 'dce-fail.stan', line 34, column 9 to column 17)", + " (in 'dce-fail.stan', line 35, column 9 to column 14)", + " (in 'dce-fail.stan', line 35, column 15 to column 20)", + " (in 'dce-fail.stan', line 37, column 9 to column 16)"}; +class dce_fail_model final : public model_base_crtp { + private: + int N; + int n_age; + int n_edu; + int n_region; + int n_state; + std::vector female; + std::vector black; + std::vector age; + std::vector edu; + std::vector region; + std::vector state; + std::vector y; + Eigen::Matrix v_prev_data__; + Eigen::Map> v_prev{nullptr, 0}; + public: + ~dce_fail_model() {} + dce_fail_model(stan::io::var_context& context__, unsigned int + random_seed__ = 0, std::ostream* pstream__ = nullptr) + : model_base_crtp(0) { int current_statement__ = 0; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - static constexpr const char* function__ = - "expr_prop_experiment2_model_namespace::log_prob"; - // suppress unused var warning - (void) function__; - try { - - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } - lp_accum__.add(lp__); - return lp_accum__.sum(); - } - 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; - 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; - // 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()); + boost::ecuyer1988 base_rng__ = + stan::services::util::create_rng(random_seed__, 0); // suppress unused var warning - (void) DUMMY_VAR__; - constexpr bool jacobian__ = false; + (void) base_rng__; static constexpr const char* function__ = - "expr_prop_experiment2_model_namespace::write_array"; + "dce_fail_model_namespace::dce_fail_model"; // suppress unused var warning (void) function__; - try { - if (stan::math::logical_negation( - (stan::math::primitive_value(emit_transformed_parameters__) || - stan::math::primitive_value(emit_generated_quantities__)))) { - return ; - } - if (stan::math::logical_negation(emit_generated_quantities__)) { - return ; - } - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } - } - template * = nullptr, - stan::require_vector_like_vt* = nullptr> - inline void - transform_inits_impl(VecVar& params_r__, 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__; pos__ = 1; - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } - } - inline void get_param_names(std::vector& names__) const { - names__ = std::vector{}; - } - inline void get_dims(std::vector>& dimss__) const { - dimss__ = std::vector>{}; - } - inline void - constrained_param_names(std::vector& param_names__, bool - emit_transformed_parameters__ = true, bool - emit_generated_quantities__ = true) const final { - if (emit_transformed_parameters__) {} - 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 { - if (emit_transformed_parameters__) {} - if (emit_generated_quantities__) {} - } - inline std::string get_constrained_sizedtypes() const { - return std::string("[]"); - } - inline std::string get_unconstrained_sizedtypes() const { - return std::string("[]"); - } - // 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__ = 0; - const size_t num_transformed = emit_transformed_parameters * (0); - 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__ = 0; - const size_t num_transformed = emit_transformed_parameters * (0); - 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 { - constexpr std::array names__{}; - const std::array constrain_param_sizes__{}; - const auto num_constrained_params__ = - std::accumulate(constrain_param_sizes__.begin(), - constrain_param_sizes__.end(), 0); - std::vector params_r_flat__(num_constrained_params__); - Eigen::Index size_iter__ = 0; - Eigen::Index flat_iter__ = 0; - for (auto&& param_name__: names__) { - const auto param_vec__ = context.vals_r(param_name__); - for (Eigen::Index i = 0; i < constrain_param_sizes__[size_iter__]; ++i) { - params_r_flat__[flat_iter__] = param_vec__[i]; - ++flat_iter__; - } - ++size_iter__; - } - vars.resize(num_params_r__); - transform_inits_impl(params_r_flat__, params_i, vars, pstream__); - } -}; -} -using stan_model = expr_prop_experiment2_model_namespace::expr_prop_experiment2_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* m = new stan_model(data_context, seed, msg_stream); - return *m; -} -stan::math::profile_map& get_stan_profile_data() { - return expr_prop_experiment2_model_namespace::profiles__; -} -#endif - $ ../../../../../install/default/bin/stanc --O1 --print-cpp expr-prop-fail.stan -// Code generated by %%NAME%% %%VERSION%% -#include -namespace expr_prop_fail_model_namespace { -using stan::model::model_base_crtp; -using namespace stan::math; -stan::math::profile_map profiles__; -static constexpr std::array locations_array__ = - {" (found before start of program)", - " (in 'expr-prop-fail.stan', line 6, column 2 to column 16)", - " (in 'expr-prop-fail.stan', line 7, column 2 to column 31)", - " (in 'expr-prop-fail.stan', line 8, column 2 to column 31)", - " (in 'expr-prop-fail.stan', line 11, column 2 to column 23)", - " (in 'expr-prop-fail.stan', line 12, column 2 to column 20)", - " (in 'expr-prop-fail.stan', line 13, column 2 to column 21)", - " (in 'expr-prop-fail.stan', line 15, column 4 to line 16, column 59)", - " (in 'expr-prop-fail.stan', line 14, column 2 to line 16, column 59)", - " (in 'expr-prop-fail.stan', line 2, column 2 to column 17)", - " (in 'expr-prop-fail.stan', line 3, column 9 to column 10)", - " (in 'expr-prop-fail.stan', line 3, column 2 to column 14)"}; -class expr_prop_fail_model final : public model_base_crtp { - private: - int N; - Eigen::Matrix y_data__; - Eigen::Map> y{nullptr, 0}; - public: - ~expr_prop_fail_model() {} - expr_prop_fail_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__ = - "expr_prop_fail_model_namespace::expr_prop_fail_model"; - // suppress unused var warning - (void) function__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - int pos__; - pos__ = 1; - current_statement__ = 9; + current_statement__ = 39; context__.validate_dims("data initialization", "N", "int", std::vector{}); N = std::numeric_limits::min(); - current_statement__ = 9; + current_statement__ = 39; N = context__.vals_i("N")[(1 - 1)]; - current_statement__ = 9; + current_statement__ = 39; stan::math::check_greater_or_equal(function__, "N", N, 0); - current_statement__ = 10; + current_statement__ = 40; + context__.validate_dims("data initialization", "n_age", "int", + std::vector{}); + n_age = std::numeric_limits::min(); + current_statement__ = 40; + n_age = context__.vals_i("n_age")[(1 - 1)]; + current_statement__ = 40; + stan::math::check_greater_or_equal(function__, "n_age", n_age, 0); + current_statement__ = 41; + context__.validate_dims("data initialization", "n_edu", "int", + std::vector{}); + n_edu = std::numeric_limits::min(); + current_statement__ = 41; + n_edu = context__.vals_i("n_edu")[(1 - 1)]; + current_statement__ = 41; + stan::math::check_greater_or_equal(function__, "n_edu", n_edu, 0); + current_statement__ = 42; + context__.validate_dims("data initialization", "n_region", "int", + std::vector{}); + n_region = std::numeric_limits::min(); + current_statement__ = 42; + n_region = context__.vals_i("n_region")[(1 - 1)]; + current_statement__ = 42; + stan::math::check_greater_or_equal(function__, "n_region", n_region, 0); + current_statement__ = 43; + context__.validate_dims("data initialization", "n_state", "int", + std::vector{}); + n_state = std::numeric_limits::min(); + current_statement__ = 43; + n_state = context__.vals_i("n_state")[(1 - 1)]; + current_statement__ = 43; + stan::math::check_greater_or_equal(function__, "n_state", n_state, 0); + current_statement__ = 44; + stan::math::validate_non_negative_index("female", "N", N); + current_statement__ = 45; + context__.validate_dims("data initialization", "female", "int", + std::vector{static_cast(N)}); + female = std::vector(N, std::numeric_limits::min()); + current_statement__ = 45; + female = context__.vals_i("female"); + current_statement__ = 45; + stan::math::check_greater_or_equal(function__, "female", female, 0); + current_statement__ = 45; + stan::math::check_less_or_equal(function__, "female", female, 1); + current_statement__ = 46; + stan::math::validate_non_negative_index("black", "N", N); + current_statement__ = 47; + context__.validate_dims("data initialization", "black", "int", + std::vector{static_cast(N)}); + black = std::vector(N, std::numeric_limits::min()); + current_statement__ = 47; + black = context__.vals_i("black"); + current_statement__ = 47; + stan::math::check_greater_or_equal(function__, "black", black, 0); + current_statement__ = 47; + stan::math::check_less_or_equal(function__, "black", black, 1); + current_statement__ = 48; + stan::math::validate_non_negative_index("age", "N", N); + current_statement__ = 49; + context__.validate_dims("data initialization", "age", "int", + std::vector{static_cast(N)}); + age = std::vector(N, std::numeric_limits::min()); + current_statement__ = 49; + age = context__.vals_i("age"); + current_statement__ = 49; + stan::math::check_greater_or_equal(function__, "age", age, 0); + current_statement__ = 49; + stan::math::check_less_or_equal(function__, "age", age, n_age); + current_statement__ = 50; + stan::math::validate_non_negative_index("edu", "N", N); + current_statement__ = 51; + context__.validate_dims("data initialization", "edu", "int", + std::vector{static_cast(N)}); + edu = std::vector(N, std::numeric_limits::min()); + current_statement__ = 51; + edu = context__.vals_i("edu"); + current_statement__ = 51; + stan::math::check_greater_or_equal(function__, "edu", edu, 0); + current_statement__ = 51; + stan::math::check_less_or_equal(function__, "edu", edu, n_edu); + current_statement__ = 52; + stan::math::validate_non_negative_index("region", "n_state", n_state); + current_statement__ = 53; + context__.validate_dims("data initialization", "region", "int", + std::vector{static_cast(n_state)}); + region = std::vector(n_state, std::numeric_limits::min()); + current_statement__ = 53; + region = context__.vals_i("region"); + current_statement__ = 53; + stan::math::check_greater_or_equal(function__, "region", region, 0); + current_statement__ = 53; + stan::math::check_less_or_equal(function__, "region", region, n_state); + current_statement__ = 54; + stan::math::validate_non_negative_index("state", "N", N); + current_statement__ = 55; + context__.validate_dims("data initialization", "state", "int", + std::vector{static_cast(N)}); + state = std::vector(N, std::numeric_limits::min()); + current_statement__ = 55; + state = context__.vals_i("state"); + current_statement__ = 55; + stan::math::check_greater_or_equal(function__, "state", state, 0); + current_statement__ = 55; + stan::math::check_less_or_equal(function__, "state", state, n_state); + current_statement__ = 56; stan::math::validate_non_negative_index("y", "N", N); - current_statement__ = 11; - context__.validate_dims("data initialization", "y", "double", + current_statement__ = 57; + context__.validate_dims("data initialization", "y", "int", std::vector{static_cast(N)}); - y_data__ = Eigen::Matrix::Constant(N, - std::numeric_limits::quiet_NaN()); - new (&y) Eigen::Map>(y_data__.data(), N); + y = std::vector(N, std::numeric_limits::min()); + current_statement__ = 57; + y = context__.vals_i("y"); + current_statement__ = 57; + stan::math::check_greater_or_equal(function__, "y", y, 0); + current_statement__ = 57; + stan::math::check_less_or_equal(function__, "y", y, 1); + current_statement__ = 58; + stan::math::validate_non_negative_index("v_prev", "n_state", n_state); + current_statement__ = 59; + context__.validate_dims("data initialization", "v_prev", "double", + std::vector{static_cast(n_state)}); + v_prev_data__ = Eigen::Matrix::Constant(n_state, + std::numeric_limits::quiet_NaN()); + new (&v_prev) + Eigen::Map>(v_prev_data__.data(), n_state); { - std::vector y_flat__; - current_statement__ = 11; - y_flat__ = context__.vals_r("y"); - current_statement__ = 11; + std::vector v_prev_flat__; + current_statement__ = 59; + v_prev_flat__ = context__.vals_r("v_prev"); + current_statement__ = 59; pos__ = 1; - current_statement__ = 11; - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - current_statement__ = 11; - stan::model::assign(y, y_flat__[(pos__ - 1)], - "assigning variable y", stan::model::index_uni(sym1__)); - current_statement__ = 11; + current_statement__ = 59; + for (int sym1__ = 1; sym1__ <= n_state; ++sym1__) { + current_statement__ = 59; + stan::model::assign(v_prev, v_prev_flat__[(pos__ - 1)], + "assigning variable v_prev", stan::model::index_uni(sym1__)); + current_statement__ = 59; pos__ = (pos__ + 1); } } + current_statement__ = 60; + stan::math::validate_non_negative_index("b_age", "n_age", n_age); + current_statement__ = 61; + stan::math::validate_non_negative_index("b_edu", "n_edu", n_edu); + current_statement__ = 62; + stan::math::validate_non_negative_index("b_region", "n_region", + n_region); + current_statement__ = 63; + stan::math::validate_non_negative_index("b_age_edu", "n_age", n_age); + current_statement__ = 64; + stan::math::validate_non_negative_index("b_age_edu", "n_edu", n_edu); + current_statement__ = 65; + stan::math::validate_non_negative_index("b_hat", "n_state", n_state); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } - num_params_r__ = 2 + 2 + 1; + num_params_r__ = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + n_age + + n_edu + n_region + (n_age * n_edu) + n_state; } inline std::string model_name() const final { - return "expr_prop_fail_model"; + return "dce_fail_model"; } inline std::vector model_compile_info() const noexcept { return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", @@ -3616,48 +2736,163 @@ class expr_prop_fail_model final : public model_base_crtp // suppress unused var warning (void) DUMMY_VAR__; static constexpr const char* function__ = - "expr_prop_fail_model_namespace::log_prob"; + "dce_fail_model_namespace::log_prob"; // suppress unused var warning (void) function__; try { - Eigen::Matrix mu; + local_scalar_t__ sigma; current_statement__ = 1; - mu = in__.template read_constrain_ordered< - Eigen::Matrix, jacobian__>(lp__, 2); - std::vector sigma; + sigma = in__.template read_constrain_lb(0, lp__); + local_scalar_t__ sigma_age; current_statement__ = 2; - sigma = in__.template read_constrain_lb, - jacobian__>(0, lp__, 2); - local_scalar_t__ theta; + sigma_age = in__.template read_constrain_lb(0, lp__); + local_scalar_t__ sigma_edu; current_statement__ = 3; - theta = in__.template read_constrain_lub(0, 1, lp__); + sigma_edu = in__.template read_constrain_lb(0, lp__); + local_scalar_t__ sigma_state; + current_statement__ = 4; + sigma_state = in__.template read_constrain_lb(0, lp__); + local_scalar_t__ sigma_region; + current_statement__ = 5; + sigma_region = in__.template read_constrain_lb(0, lp__); + local_scalar_t__ sigma_age_edu; + current_statement__ = 6; + sigma_age_edu = in__.template read_constrain_lb(0, lp__); + local_scalar_t__ b_0; + current_statement__ = 7; + b_0 = in__.template read(); + local_scalar_t__ b_female; + current_statement__ = 8; + b_female = in__.template read(); + local_scalar_t__ b_black; + current_statement__ = 9; + b_black = in__.template read(); + local_scalar_t__ b_female_black; + current_statement__ = 10; + b_female_black = in__.template read(); + local_scalar_t__ b_v_prev; + current_statement__ = 11; + b_v_prev = in__.template read(); + Eigen::Matrix b_age; + current_statement__ = 12; + b_age = in__.template read>(n_age); + Eigen::Matrix b_edu; + current_statement__ = 13; + b_edu = in__.template read>(n_edu); + Eigen::Matrix b_region; + current_statement__ = 14; + b_region = in__.template read< + Eigen::Matrix>(n_region); + Eigen::Matrix b_age_edu; + current_statement__ = 15; + b_age_edu = in__.template read< + Eigen::Matrix>(n_age, n_edu); + Eigen::Matrix b_hat; + current_statement__ = 16; + b_hat = in__.template read< + Eigen::Matrix>(n_state); { - current_statement__ = 4; - lp_accum__.add(stan::math::normal_lpdf(sigma, 0, 2)); - current_statement__ = 5; - lp_accum__.add(stan::math::normal_lpdf(mu, 0, 2)); - current_statement__ = 6; - lp_accum__.add(stan::math::beta_lpdf(theta, 5, 5)); - current_statement__ = 8; - for (int n = 1; n <= N; ++n) { - current_statement__ = 7; - lp_accum__.add(stan::math::log_mix(theta, - stan::math::normal_lpdf( - stan::model::rvalue(y, "y", - stan::model::index_uni(n)), - stan::model::rvalue(mu, "mu", - stan::model::index_uni(1)), - stan::model::rvalue(sigma, "sigma", - stan::model::index_uni(1))), - stan::math::normal_lpdf( - stan::model::rvalue(y, "y", - stan::model::index_uni(n)), - stan::model::rvalue(mu, "mu", - stan::model::index_uni(2)), - stan::model::rvalue(sigma, "sigma", - stan::model::index_uni(2))))); + current_statement__ = 17; + stan::math::validate_non_negative_index("p", "N", N); + Eigen::Matrix p = + Eigen::Matrix::Constant(N, DUMMY_VAR__); + current_statement__ = 19; + stan::math::validate_non_negative_index("b_state_hat", "n_state", + n_state); + Eigen::Matrix b_state_hat = + Eigen::Matrix::Constant(n_state, + DUMMY_VAR__); + current_statement__ = 21; + lp_accum__.add(stan::math::normal_lpdf(b_0, 0, 100)); + current_statement__ = 22; + lp_accum__.add(stan::math::normal_lpdf(b_female, 0, 100)); + current_statement__ = 23; + lp_accum__.add(stan::math::normal_lpdf(b_black, 0, 100)); + current_statement__ = 24; + lp_accum__.add(stan::math::normal_lpdf(b_female_black, 0, + 100)); + current_statement__ = 25; + lp_accum__.add(stan::math::normal_lpdf(b_age, 0, sigma_age)); + current_statement__ = 26; + lp_accum__.add(stan::math::normal_lpdf(b_edu, 0, sigma_edu)); + current_statement__ = 27; + lp_accum__.add(stan::math::normal_lpdf(b_region, 0, + sigma_region)); + current_statement__ = 31; + for (int j = 1; j <= n_age; ++j) { + current_statement__ = 29; + for (int i = 1; i <= n_edu; ++i) { + current_statement__ = 28; + lp_accum__.add(stan::math::normal_lpdf( + stan::model::rvalue(b_age_edu, "b_age_edu", + stan::model::index_uni(j), + stan::model::index_uni(i)), 0, sigma_age_edu)); + } + } + current_statement__ = 32; + lp_accum__.add(stan::math::normal_lpdf(b_v_prev, 0, 100)); + current_statement__ = 34; + for (int j = 1; j <= n_state; ++j) { + current_statement__ = 33; + stan::model::assign(b_state_hat, + stan::math::fma(b_v_prev, + stan::model::rvalue(v_prev, "v_prev", stan::model::index_uni(j)), + stan::model::rvalue(b_region, "b_region", + stan::model::index_uni( + stan::model::rvalue(region, "region", + stan::model::index_uni(j))))), + "assigning variable b_state_hat", stan::model::index_uni(j)); + } + current_statement__ = 35; + lp_accum__.add(stan::math::normal_lpdf(b_hat, b_state_hat, + sigma_state)); + current_statement__ = 37; + for (int i = 1; i <= N; ++i) { + current_statement__ = 36; + stan::model::assign(p, + stan::math::fmax(0, + stan::math::fmin(1, + stan::math::inv_logit( + ((((stan::math::fma((b_female_black * + stan::model::rvalue(female, "female", + stan::model::index_uni(i))), + stan::model::rvalue(black, "black", + stan::model::index_uni(i)), + stan::math::fma(b_black, + stan::model::rvalue(black, "black", + stan::model::index_uni(i)), + stan::math::fma(b_female, + stan::model::rvalue(female, "female", + stan::model::index_uni(i)), b_0))) + + stan::model::rvalue(b_age, "b_age", + stan::model::index_uni( + stan::model::rvalue(age, "age", + stan::model::index_uni(i))))) + + stan::model::rvalue(b_edu, "b_edu", + stan::model::index_uni( + stan::model::rvalue(edu, "edu", + stan::model::index_uni(i))))) + + stan::model::rvalue(b_age_edu, "b_age_edu", + stan::model::index_uni( + stan::model::rvalue(age, "age", + stan::model::index_uni(i))), + stan::model::index_uni( + stan::model::rvalue(edu, "edu", + stan::model::index_uni(i))))) + + stan::model::rvalue(b_hat, "b_hat", + stan::model::index_uni( + stan::model::rvalue(state, "state", + stan::model::index_uni(i)))))))), + "assigning variable p", stan::model::index_uni(i)); } + current_statement__ = 38; + lp_accum__.add(stan::math::bernoulli_lpmf(y, p)); } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); @@ -3692,95 +2927,244 @@ class expr_prop_fail_model final : public model_base_crtp (void) DUMMY_VAR__; constexpr bool jacobian__ = false; static constexpr const char* function__ = - "expr_prop_fail_model_namespace::write_array"; + "dce_fail_model_namespace::write_array"; // suppress unused var warning (void) function__; try { - Eigen::Matrix mu; + double sigma; current_statement__ = 1; - mu = in__.template read_constrain_ordered< - Eigen::Matrix, jacobian__>(lp__, 2); - std::vector sigma; + sigma = in__.template read_constrain_lb(0, lp__); + double sigma_age; current_statement__ = 2; - sigma = in__.template read_constrain_lb, - jacobian__>(0, lp__, 2); - double theta; + sigma_age = in__.template read_constrain_lb(0, lp__); + double sigma_edu; current_statement__ = 3; - theta = in__.template read_constrain_lub(0, 1, lp__); - out__.write(mu); - out__.write(sigma); - out__.write(theta); - if (stan::math::logical_negation( - (stan::math::primitive_value(emit_transformed_parameters__) || - stan::math::primitive_value(emit_generated_quantities__)))) { - return ; - } - if (stan::math::logical_negation(emit_generated_quantities__)) { - return ; - } - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } - } - template * = nullptr, - stan::require_vector_like_vt* = nullptr> - inline void - transform_inits_impl(VecVar& params_r__, 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__; - pos__ = 1; - Eigen::Matrix mu = - Eigen::Matrix::Constant(2, DUMMY_VAR__); - for (int sym1__ = 1; sym1__ <= 2; ++sym1__) { - stan::model::assign(mu, in__.read(), - "assigning variable mu", stan::model::index_uni(sym1__)); + sigma_edu = in__.template read_constrain_lb(0, lp__); + double sigma_state; + current_statement__ = 4; + sigma_state = in__.template read_constrain_lb(0, lp__); + double sigma_region; + current_statement__ = 5; + sigma_region = in__.template read_constrain_lb(0, lp__); + double sigma_age_edu; + current_statement__ = 6; + sigma_age_edu = in__.template read_constrain_lb(0, lp__); + double b_0; + current_statement__ = 7; + b_0 = in__.template read(); + double b_female; + current_statement__ = 8; + b_female = in__.template read(); + double b_black; + current_statement__ = 9; + b_black = in__.template read(); + double b_female_black; + current_statement__ = 10; + b_female_black = in__.template read(); + double b_v_prev; + current_statement__ = 11; + b_v_prev = in__.template read(); + Eigen::Matrix b_age; + current_statement__ = 12; + b_age = in__.template read>(n_age); + Eigen::Matrix b_edu; + current_statement__ = 13; + b_edu = in__.template read>(n_edu); + Eigen::Matrix b_region; + current_statement__ = 14; + b_region = in__.template read< + Eigen::Matrix>(n_region); + Eigen::Matrix b_age_edu; + current_statement__ = 15; + b_age_edu = in__.template read< + Eigen::Matrix>(n_age, n_edu); + Eigen::Matrix b_hat; + current_statement__ = 16; + b_hat = in__.template read< + Eigen::Matrix>(n_state); + out__.write(sigma); + out__.write(sigma_age); + out__.write(sigma_edu); + out__.write(sigma_state); + out__.write(sigma_region); + out__.write(sigma_age_edu); + out__.write(b_0); + out__.write(b_female); + out__.write(b_black); + out__.write(b_female_black); + out__.write(b_v_prev); + out__.write(b_age); + out__.write(b_edu); + out__.write(b_region); + out__.write(b_age_edu); + out__.write(b_hat); + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { + return ; } - out__.write_free_ordered(mu); - std::vector sigma = - std::vector(2, DUMMY_VAR__); - for (int sym1__ = 1; sym1__ <= 2; ++sym1__) { - sigma[(sym1__ - 1)] = in__.read(); + if (stan::math::logical_negation(emit_generated_quantities__)) { + return ; } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline void + transform_inits_impl(VecVar& params_r__, 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__; + pos__ = 1; + local_scalar_t__ sigma; + sigma = in__.read(); out__.write_free_lb(0, sigma); - local_scalar_t__ theta; - theta = in__.read(); - out__.write_free_lub(0, 1, theta); + local_scalar_t__ sigma_age; + sigma_age = in__.read(); + out__.write_free_lb(0, sigma_age); + local_scalar_t__ sigma_edu; + sigma_edu = in__.read(); + out__.write_free_lb(0, sigma_edu); + local_scalar_t__ sigma_state; + sigma_state = in__.read(); + out__.write_free_lb(0, sigma_state); + local_scalar_t__ sigma_region; + sigma_region = in__.read(); + out__.write_free_lb(0, sigma_region); + local_scalar_t__ sigma_age_edu; + sigma_age_edu = in__.read(); + out__.write_free_lb(0, sigma_age_edu); + local_scalar_t__ b_0; + b_0 = in__.read(); + out__.write(b_0); + local_scalar_t__ b_female; + b_female = in__.read(); + out__.write(b_female); + local_scalar_t__ b_black; + b_black = in__.read(); + out__.write(b_black); + local_scalar_t__ b_female_black; + b_female_black = in__.read(); + out__.write(b_female_black); + local_scalar_t__ b_v_prev; + b_v_prev = in__.read(); + out__.write(b_v_prev); + Eigen::Matrix b_age = + Eigen::Matrix::Constant(n_age, DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= n_age; ++sym1__) { + stan::model::assign(b_age, in__.read(), + "assigning variable b_age", stan::model::index_uni(sym1__)); + } + out__.write(b_age); + Eigen::Matrix b_edu = + Eigen::Matrix::Constant(n_edu, DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= n_edu; ++sym1__) { + stan::model::assign(b_edu, in__.read(), + "assigning variable b_edu", stan::model::index_uni(sym1__)); + } + out__.write(b_edu); + Eigen::Matrix b_region = + Eigen::Matrix::Constant(n_region, DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= n_region; ++sym1__) { + stan::model::assign(b_region, in__.read(), + "assigning variable b_region", stan::model::index_uni(sym1__)); + } + out__.write(b_region); + Eigen::Matrix b_age_edu = + Eigen::Matrix::Constant(n_age, n_edu, + DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= n_edu; ++sym1__) { + for (int sym2__ = 1; sym2__ <= n_age; ++sym2__) { + stan::model::assign(b_age_edu, in__.read(), + "assigning variable b_age_edu", stan::model::index_uni(sym2__), + stan::model::index_uni(sym1__)); + } + } + out__.write(b_age_edu); + Eigen::Matrix b_hat = + Eigen::Matrix::Constant(n_state, DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= n_state; ++sym1__) { + stan::model::assign(b_hat, in__.read(), + "assigning variable b_hat", stan::model::index_uni(sym1__)); + } + out__.write(b_hat); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } inline void get_param_names(std::vector& names__) const { - names__ = std::vector{"mu", "sigma", "theta"}; + names__ = std::vector{"sigma", "sigma_age", "sigma_edu", + "sigma_state", "sigma_region", "sigma_age_edu", "b_0", + "b_female", "b_black", "b_female_black", "b_v_prev", "b_age", + "b_edu", "b_region", "b_age_edu", "b_hat"}; } inline void get_dims(std::vector>& dimss__) const { - dimss__ = std::vector>{std::vector{static_cast< - size_t>(2)}, - std::vector{static_cast(2)}, - std::vector{}}; + dimss__ = std::vector>{std::vector{}, + std::vector{}, std::vector{}, + std::vector{}, std::vector{}, + std::vector{}, std::vector{}, + std::vector{}, std::vector{}, + std::vector{}, std::vector{}, + std::vector{static_cast(n_age)}, + std::vector{static_cast(n_edu)}, + std::vector{static_cast(n_region)}, + std::vector{static_cast(n_age), + static_cast(n_edu)}, + std::vector{static_cast(n_state)}}; } 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__ <= 2; ++sym1__) { - param_names__.emplace_back(std::string() + "mu" + '.' + + param_names__.emplace_back(std::string() + "sigma"); + param_names__.emplace_back(std::string() + "sigma_age"); + param_names__.emplace_back(std::string() + "sigma_edu"); + param_names__.emplace_back(std::string() + "sigma_state"); + param_names__.emplace_back(std::string() + "sigma_region"); + param_names__.emplace_back(std::string() + "sigma_age_edu"); + param_names__.emplace_back(std::string() + "b_0"); + param_names__.emplace_back(std::string() + "b_female"); + param_names__.emplace_back(std::string() + "b_black"); + param_names__.emplace_back(std::string() + "b_female_black"); + param_names__.emplace_back(std::string() + "b_v_prev"); + for (int sym1__ = 1; sym1__ <= n_age; ++sym1__) { + param_names__.emplace_back(std::string() + "b_age" + '.' + std::to_string(sym1__)); } - for (int sym1__ = 1; sym1__ <= 2; ++sym1__) { - param_names__.emplace_back(std::string() + "sigma" + '.' + + for (int sym1__ = 1; sym1__ <= n_edu; ++sym1__) { + param_names__.emplace_back(std::string() + "b_edu" + '.' + + std::to_string(sym1__)); + } + for (int sym1__ = 1; sym1__ <= n_region; ++sym1__) { + param_names__.emplace_back(std::string() + "b_region" + '.' + + std::to_string(sym1__)); + } + for (int sym1__ = 1; sym1__ <= n_edu; ++sym1__) { + for (int sym2__ = 1; sym2__ <= n_age; ++sym2__) { + param_names__.emplace_back(std::string() + "b_age_edu" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } + for (int sym1__ = 1; sym1__ <= n_state; ++sym1__) { + param_names__.emplace_back(std::string() + "b_hat" + '.' + std::to_string(sym1__)); } - param_names__.emplace_back(std::string() + "theta"); if (emit_transformed_parameters__) {} if (emit_generated_quantities__) {} } @@ -3788,23 +3172,47 @@ class expr_prop_fail_model final : public model_base_crtp unconstrained_param_names(std::vector& param_names__, bool emit_transformed_parameters__ = true, bool emit_generated_quantities__ = true) const final { - for (int sym1__ = 1; sym1__ <= 2; ++sym1__) { - param_names__.emplace_back(std::string() + "mu" + '.' + + param_names__.emplace_back(std::string() + "sigma"); + param_names__.emplace_back(std::string() + "sigma_age"); + param_names__.emplace_back(std::string() + "sigma_edu"); + param_names__.emplace_back(std::string() + "sigma_state"); + param_names__.emplace_back(std::string() + "sigma_region"); + param_names__.emplace_back(std::string() + "sigma_age_edu"); + param_names__.emplace_back(std::string() + "b_0"); + param_names__.emplace_back(std::string() + "b_female"); + param_names__.emplace_back(std::string() + "b_black"); + param_names__.emplace_back(std::string() + "b_female_black"); + param_names__.emplace_back(std::string() + "b_v_prev"); + for (int sym1__ = 1; sym1__ <= n_age; ++sym1__) { + param_names__.emplace_back(std::string() + "b_age" + '.' + std::to_string(sym1__)); } - for (int sym1__ = 1; sym1__ <= 2; ++sym1__) { - param_names__.emplace_back(std::string() + "sigma" + '.' + + for (int sym1__ = 1; sym1__ <= n_edu; ++sym1__) { + param_names__.emplace_back(std::string() + "b_edu" + '.' + std::to_string(sym1__)); } - param_names__.emplace_back(std::string() + "theta"); - if (emit_transformed_parameters__) {} - if (emit_generated_quantities__) {} - } - inline std::string get_constrained_sizedtypes() const { - return std::string("[{\"name\":\"mu\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(2) + "},\"block\":\"parameters\"},{\"name\":\"sigma\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(2) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"theta\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"}]"); - } - inline std::string get_unconstrained_sizedtypes() const { - return std::string("[{\"name\":\"mu\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(2) + "},\"block\":\"parameters\"},{\"name\":\"sigma\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(2) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"theta\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"}]"); + for (int sym1__ = 1; sym1__ <= n_region; ++sym1__) { + param_names__.emplace_back(std::string() + "b_region" + '.' + + std::to_string(sym1__)); + } + for (int sym1__ = 1; sym1__ <= n_edu; ++sym1__) { + for (int sym2__ = 1; sym2__ <= n_age; ++sym2__) { + param_names__.emplace_back(std::string() + "b_age_edu" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); + } + } + for (int sym1__ = 1; sym1__ <= n_state; ++sym1__) { + param_names__.emplace_back(std::string() + "b_hat" + '.' + + std::to_string(sym1__)); + } + if (emit_transformed_parameters__) {} + if (emit_generated_quantities__) {} + } + inline std::string get_constrained_sizedtypes() const { + return std::string("[{\"name\":\"sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_age\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_edu\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_state\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_region\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_age_edu\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_0\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_female\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_black\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_female_black\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_v_prev\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_age\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_age) + "},\"block\":\"parameters\"},{\"name\":\"b_edu\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_edu) + "},\"block\":\"parameters\"},{\"name\":\"b_region\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_region) + "},\"block\":\"parameters\"},{\"name\":\"b_age_edu\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(n_age) + ",\"cols\":" + std::to_string(n_edu) + "},\"block\":\"parameters\"},{\"name\":\"b_hat\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_state) + "},\"block\":\"parameters\"}]"); + } + inline std::string get_unconstrained_sizedtypes() const { + return std::string("[{\"name\":\"sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_age\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_edu\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_state\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_region\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_age_edu\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_0\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_female\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_black\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_female_black\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_v_prev\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"b_age\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_age) + "},\"block\":\"parameters\"},{\"name\":\"b_edu\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_edu) + "},\"block\":\"parameters\"},{\"name\":\"b_region\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_region) + "},\"block\":\"parameters\"},{\"name\":\"b_age_edu\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(n_age) + ",\"cols\":" + std::to_string(n_edu) + "},\"block\":\"parameters\"},{\"name\":\"b_hat\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_state) + "},\"block\":\"parameters\"}]"); } // Begin method overload boilerplate template inline void @@ -3813,7 +3221,9 @@ class expr_prop_fail_model final : public model_base_crtp emit_transformed_parameters = true, const bool emit_generated_quantities = true, std::ostream* pstream = nullptr) const { - const size_t num_params__ = ((2 + 2) + 1); + const size_t num_params__ = (((((((((((((((1 + 1) + 1) + 1) + 1) + 1) + + 1) + 1) + 1) + 1) + 1) + n_age) + n_edu) + n_region) + (n_age * n_edu)) + + n_state); const size_t num_transformed = emit_transformed_parameters * (0); const size_t num_gen_quantities = emit_generated_quantities * (0); const size_t num_to_write = num_params__ + num_transformed + @@ -3830,7 +3240,9 @@ class expr_prop_fail_model final : public model_base_crtp emit_transformed_parameters = true, bool emit_generated_quantities = true, std::ostream* pstream = nullptr) const { - const size_t num_params__ = ((2 + 2) + 1); + const size_t num_params__ = (((((((((((((((1 + 1) + 1) + 1) + 1) + 1) + + 1) + 1) + 1) + 1) + 1) + n_age) + n_edu) + n_region) + (n_age * n_edu)) + + n_state); const size_t num_transformed = emit_transformed_parameters * (0); const size_t num_gen_quantities = emit_generated_quantities * (0); const size_t num_to_write = num_params__ + num_transformed + @@ -3864,8 +3276,14 @@ class expr_prop_fail_model final : public model_base_crtp transform_inits(const stan::io::var_context& context, std::vector& params_i, std::vector& vars, std::ostream* pstream__ = nullptr) const { - constexpr std::array names__{"mu", "sigma", "theta"}; - const std::array constrain_param_sizes__{2, 2, 1}; + constexpr std::array + names__{"sigma", "sigma_age", "sigma_edu", "sigma_state", + "sigma_region", "sigma_age_edu", "b_0", "b_female", "b_black", + "b_female_black", "b_v_prev", "b_age", "b_edu", "b_region", + "b_age_edu", "b_hat"}; + const std::array + constrain_param_sizes__{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, n_age, n_edu, + n_region, (n_age * n_edu), n_state}; const auto num_constrained_params__ = std::accumulate(constrain_param_sizes__.begin(), constrain_param_sizes__.end(), 0); @@ -3885,7 +3303,7 @@ class expr_prop_fail_model final : public model_base_crtp } }; } -using stan_model = expr_prop_fail_model_namespace::expr_prop_fail_model; +using stan_model = dce_fail_model_namespace::dce_fail_model; #ifndef USING_R // Boilerplate stan::model::model_base& @@ -3895,39 +3313,39 @@ new_model(stan::io::var_context& data_context, unsigned int seed, return *m; } stan::math::profile_map& get_stan_profile_data() { - return expr_prop_fail_model_namespace::profiles__; + return dce_fail_model_namespace::profiles__; } #endif - $ ../../../../../install/default/bin/stanc --O1 --print-cpp expr-prop-fail2.stan + $ ../../../../../install/default/bin/stanc --O1 --print-cpp expr-prop-experiment.stan // Code generated by %%NAME%% %%VERSION%% #include -namespace expr_prop_fail2_model_namespace { +namespace expr_prop_experiment_model_namespace { using stan::model::model_base_crtp; using namespace stan::math; stan::math::profile_map profiles__; -static constexpr std::array locations_array__ = +static constexpr std::array locations_array__ = {" (found before start of program)", - " (in 'expr-prop-fail2.stan', line 7, column 2 to column 10)", - " (in 'expr-prop-fail2.stan', line 8, column 2 to column 22)", - " (in 'expr-prop-fail2.stan', line 9, column 2 to column 20)", - " (in 'expr-prop-fail2.stan', line 12, column 2 to column 26)", - " (in 'expr-prop-fail2.stan', line 13, column 2 to column 27)", - " (in 'expr-prop-fail2.stan', line 2, column 2 to column 17)", - " (in 'expr-prop-fail2.stan', line 3, column 8 to column 9)", - " (in 'expr-prop-fail2.stan', line 3, column 2 to column 18)", - " (in 'expr-prop-fail2.stan', line 4, column 8 to column 9)", - " (in 'expr-prop-fail2.stan', line 4, column 2 to column 31)", - " (in 'expr-prop-fail2.stan', line 8, column 8 to column 9)"}; -class expr_prop_fail2_model final : public model_base_crtp { + " (in 'expr-prop-experiment.stan', line 2, column 2 to column 8)", + " (in 'expr-prop-experiment.stan', line 5, column 2 to column 9)", + " (in 'expr-prop-experiment.stan', line 6, column 2 to column 9)", + " (in 'expr-prop-experiment.stan', line 7, column 2 to column 9)", + " (in 'expr-prop-experiment.stan', line 8, column 2 to column 28)", + " (in 'expr-prop-experiment.stan', line 9, column 2 to column 12)", + " (in 'expr-prop-experiment.stan', line 10, column 2 to column 23)", + " (in 'expr-prop-experiment.stan', line 11, column 2 to column 23)", + " (in 'expr-prop-experiment.stan', line 12, column 2 to column 23)"}; +class expr_prop_experiment_model final : public model_base_crtp { private: - int J; - std::vector y; - std::vector sigma; + int j; + double z; + double x; + double y; + double i; public: - ~expr_prop_fail2_model() {} - expr_prop_fail2_model(stan::io::var_context& context__, unsigned int - random_seed__ = 0, std::ostream* pstream__ = nullptr) - : model_base_crtp(0) { + ~expr_prop_experiment_model() {} + expr_prop_experiment_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__ = @@ -3935,7 +3353,7 @@ class expr_prop_fail2_model final : public model_base_crtp::quiet_NaN()); @@ -3944,42 +3362,37 @@ class expr_prop_fail2_model final : public model_base_crtp{}); - J = std::numeric_limits::min(); - current_statement__ = 6; - J = context__.vals_i("J")[(1 - 1)]; + j = std::numeric_limits::min(); + current_statement__ = 1; + j = context__.vals_i("j")[(1 - 1)]; + current_statement__ = 2; + z = std::numeric_limits::quiet_NaN(); + current_statement__ = 3; + x = std::numeric_limits::quiet_NaN(); + current_statement__ = 4; + y = std::numeric_limits::quiet_NaN(); + current_statement__ = 5; + i = std::numeric_limits::quiet_NaN(); + current_statement__ = 5; + i = stan::math::normal_rng(5, 1, base_rng__); current_statement__ = 6; - stan::math::check_greater_or_equal(function__, "J", J, 0); + z = (i * j); current_statement__ = 7; - stan::math::validate_non_negative_index("y", "J", J); - current_statement__ = 8; - context__.validate_dims("data initialization", "y", "double", - std::vector{static_cast(J)}); - y = std::vector(J, std::numeric_limits::quiet_NaN()); + x = stan::math::normal_rng(z, 1, base_rng__); current_statement__ = 8; - y = context__.vals_r("y"); + i = stan::math::normal_rng(5, 1, base_rng__); current_statement__ = 9; - stan::math::validate_non_negative_index("sigma", "J", J); - current_statement__ = 10; - context__.validate_dims("data initialization", "sigma", "double", - std::vector{static_cast(J)}); - sigma = std::vector(J, - std::numeric_limits::quiet_NaN()); - current_statement__ = 10; - sigma = context__.vals_r("sigma"); - current_statement__ = 10; - stan::math::check_greater_or_equal(function__, "sigma", sigma, 0); - current_statement__ = 11; - stan::math::validate_non_negative_index("theta", "J", J); + y = stan::math::normal_rng(z, 1, base_rng__); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } - num_params_r__ = 1 + J + 1; + num_params_r__ = 0U; } inline std::string model_name() const final { - return "expr_prop_fail2_model"; + return "expr_prop_experiment_model"; } inline std::vector model_compile_info() const noexcept { return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", @@ -4001,26 +3414,11 @@ class expr_prop_fail2_model final : public model_base_crtp(); - std::vector theta; - current_statement__ = 2; - theta = in__.template read>(J); - local_scalar_t__ tau; - current_statement__ = 3; - tau = in__.template read_constrain_lb(0, - lp__); - { - current_statement__ = 4; - lp_accum__.add(stan::math::normal_lpdf(theta, mu, tau)); - current_statement__ = 5; - lp_accum__.add(stan::math::normal_lpdf(y, theta, sigma)); - } + } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } @@ -4054,23 +3452,10 @@ class expr_prop_fail2_model final : public model_base_crtp(); - std::vector theta; - current_statement__ = 2; - theta = in__.template read>(J); - double tau; - current_statement__ = 3; - tau = in__.template read_constrain_lb(0, - lp__); - out__.write(mu); - out__.write(theta); - out__.write(tau); if (stan::math::logical_negation( (stan::math::primitive_value(emit_transformed_parameters__) || stan::math::primitive_value(emit_generated_quantities__)))) { @@ -4099,40 +3484,20 @@ class expr_prop_fail2_model final : public model_base_crtp(); - out__.write(mu); - std::vector theta = - std::vector(J, DUMMY_VAR__); - for (int sym1__ = 1; sym1__ <= J; ++sym1__) { - theta[(sym1__ - 1)] = in__.read(); - } - out__.write(theta); - local_scalar_t__ tau; - tau = in__.read(); - out__.write_free_lb(0, tau); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } inline void get_param_names(std::vector& names__) const { - names__ = std::vector{"mu", "theta", "tau"}; + names__ = std::vector{}; } inline void get_dims(std::vector>& dimss__) const { - dimss__ = std::vector>{std::vector{}, - std::vector{static_cast(J)}, - std::vector{}}; + dimss__ = std::vector>{}; } inline void constrained_param_names(std::vector& param_names__, bool emit_transformed_parameters__ = true, bool emit_generated_quantities__ = true) const final { - param_names__.emplace_back(std::string() + "mu"); - for (int sym1__ = 1; sym1__ <= J; ++sym1__) { - param_names__.emplace_back(std::string() + "theta" + '.' + - std::to_string(sym1__)); - } - param_names__.emplace_back(std::string() + "tau"); if (emit_transformed_parameters__) {} if (emit_generated_quantities__) {} } @@ -4140,20 +3505,14 @@ class expr_prop_fail2_model final : public model_base_crtp& param_names__, bool emit_transformed_parameters__ = true, bool emit_generated_quantities__ = true) const final { - param_names__.emplace_back(std::string() + "mu"); - for (int sym1__ = 1; sym1__ <= J; ++sym1__) { - param_names__.emplace_back(std::string() + "theta" + '.' + - std::to_string(sym1__)); - } - param_names__.emplace_back(std::string() + "tau"); if (emit_transformed_parameters__) {} if (emit_generated_quantities__) {} } inline std::string get_constrained_sizedtypes() const { - return std::string("[{\"name\":\"mu\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"theta\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(J) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"tau\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"}]"); + return std::string("[]"); } inline std::string get_unconstrained_sizedtypes() const { - return std::string("[{\"name\":\"mu\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"theta\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(J) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"tau\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"}]"); + return std::string("[]"); } // Begin method overload boilerplate template inline void @@ -4162,7 +3521,7 @@ class expr_prop_fail2_model final : public model_base_crtp& params_i, std::vector& vars, std::ostream* pstream__ = nullptr) const { - constexpr std::array names__{"mu", "theta", "tau"}; - const std::array constrain_param_sizes__{1, J, 1}; + constexpr std::array names__{}; + const std::array constrain_param_sizes__{}; const auto num_constrained_params__ = std::accumulate(constrain_param_sizes__.begin(), constrain_param_sizes__.end(), 0); @@ -4234,7 +3593,7 @@ class expr_prop_fail2_model final : public model_base_crtp -namespace expr_prop_fail3_model_namespace { +namespace expr_prop_experiment2_model_namespace { using stan::model::model_base_crtp; using namespace stan::math; stan::math::profile_map profiles__; -static constexpr std::array locations_array__ = +static constexpr std::array locations_array__ = {" (found before start of program)", - " (in 'expr-prop-fail3.stan', line 19, column 2 to column 18)", - " (in 'expr-prop-fail3.stan', line 20, column 2 to column 18)", - " (in 'expr-prop-fail3.stan', line 21, column 2 to column 22)", - " (in 'expr-prop-fail3.stan', line 22, column 2 to column 20)", - " (in 'expr-prop-fail3.stan', line 23, column 2 to column 26)", - " (in 'expr-prop-fail3.stan', line 24, column 2 to column 17)", - " (in 'expr-prop-fail3.stan', line 25, column 2 to column 35)", - " (in 'expr-prop-fail3.stan', line 26, column 2 to column 35)", - " (in 'expr-prop-fail3.stan', line 27, column 2 to column 35)", - " (in 'expr-prop-fail3.stan', line 28, column 2 to column 35)", - " (in 'expr-prop-fail3.stan', line 29, column 2 to column 35)", - " (in 'expr-prop-fail3.stan', line 32, column 2 to column 18)", - " (in 'expr-prop-fail3.stan', line 35, column 4 to line 38, column 35)", - " (in 'expr-prop-fail3.stan', line 34, column 2 to line 38, column 35)", - " (in 'expr-prop-fail3.stan', line 41, column 2 to column 25)", - " (in 'expr-prop-fail3.stan', line 42, column 2 to column 25)", - " (in 'expr-prop-fail3.stan', line 43, column 2 to column 25)", - " (in 'expr-prop-fail3.stan', line 44, column 2 to column 25)", - " (in 'expr-prop-fail3.stan', line 45, column 2 to column 25)", - " (in 'expr-prop-fail3.stan', line 46, column 2 to column 24)", - " (in 'expr-prop-fail3.stan', line 47, column 2 to column 29)", - " (in 'expr-prop-fail3.stan', line 2, column 2 to column 17)", - " (in 'expr-prop-fail3.stan', line 3, column 2 to column 21)", - " (in 'expr-prop-fail3.stan', line 4, column 2 to column 25)", - " (in 'expr-prop-fail3.stan', line 5, column 2 to column 21)", - " (in 'expr-prop-fail3.stan', line 6, column 2 to column 29)", - " (in 'expr-prop-fail3.stan', line 7, column 2 to column 23)", - " (in 'expr-prop-fail3.stan', line 8, column 8 to column 9)", - " (in 'expr-prop-fail3.stan', line 8, column 2 to column 41)", - " (in 'expr-prop-fail3.stan', line 9, column 8 to column 9)", - " (in 'expr-prop-fail3.stan', line 9, column 2 to column 49)", - " (in 'expr-prop-fail3.stan', line 10, column 27 to column 28)", - " (in 'expr-prop-fail3.stan', line 10, column 2 to column 36)", - " (in 'expr-prop-fail3.stan', line 11, column 8 to column 9)", - " (in 'expr-prop-fail3.stan', line 11, column 2 to column 41)", - " (in 'expr-prop-fail3.stan', line 12, column 27 to column 28)", - " (in 'expr-prop-fail3.stan', line 12, column 2 to column 37)", - " (in 'expr-prop-fail3.stan', line 13, column 8 to column 9)", - " (in 'expr-prop-fail3.stan', line 13, column 2 to column 57)", - " (in 'expr-prop-fail3.stan', line 14, column 8 to column 9)", - " (in 'expr-prop-fail3.stan', line 14, column 2 to column 45)", - " (in 'expr-prop-fail3.stan', line 15, column 9 to column 10)", - " (in 'expr-prop-fail3.stan', line 15, column 2 to column 24)", - " (in 'expr-prop-fail3.stan', line 16, column 8 to column 9)", - " (in 'expr-prop-fail3.stan', line 16, column 2 to column 35)", - " (in 'expr-prop-fail3.stan', line 19, column 9 to column 14)", - " (in 'expr-prop-fail3.stan', line 20, column 9 to column 14)", - " (in 'expr-prop-fail3.stan', line 21, column 9 to column 18)", - " (in 'expr-prop-fail3.stan', line 22, column 9 to column 16)", - " (in 'expr-prop-fail3.stan', line 23, column 9 to column 22)", - " (in 'expr-prop-fail3.stan', line 32, column 9 to column 10)"}; -class expr_prop_fail3_model final : public model_base_crtp { + " (in 'expr-prop-experiment2.stan', line 2, column 2 to column 8)", + " (in 'expr-prop-experiment2.stan', line 5, column 2 to column 13)", + " (in 'expr-prop-experiment2.stan', line 6, column 2 to column 9)", + " (in 'expr-prop-experiment2.stan', line 8, column 4 to column 32)", + " (in 'expr-prop-experiment2.stan', line 9, column 4 to column 14)", + " (in 'expr-prop-experiment2.stan', line 10, column 4 to column 25)", + " (in 'expr-prop-experiment2.stan', line 7, column 2 to line 11, column 3)", + " (in 'expr-prop-experiment2.stan', line 12, column 2 to column 23)"}; +class expr_prop_experiment2_model final : public model_base_crtp { private: - int N; - int n_age; - int n_age_edu; - int n_edu; - int n_region_full; - int n_state; - std::vector age; - std::vector age_edu; - Eigen::Matrix black_data__; - std::vector edu; - Eigen::Matrix female_data__; - std::vector region_full; - std::vector state; - Eigen::Matrix v_prev_full_data__; - std::vector y; - Eigen::Map> black{nullptr, 0}; - Eigen::Map> female{nullptr, 0}; - Eigen::Map> v_prev_full{nullptr, 0}; + int j; + double z; + double y; public: - ~expr_prop_fail3_model() {} - expr_prop_fail3_model(stan::io::var_context& context__, unsigned int - random_seed__ = 0, std::ostream* pstream__ = nullptr) - : model_base_crtp(0) { + ~expr_prop_experiment2_model() {} + expr_prop_experiment2_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__ = @@ -4339,7 +3640,7 @@ class expr_prop_fail3_model final : public model_base_crtp::quiet_NaN()); @@ -4348,232 +3649,36 @@ class expr_prop_fail3_model final : public model_base_crtp{}); - N = std::numeric_limits::min(); - current_statement__ = 22; - N = context__.vals_i("N")[(1 - 1)]; - current_statement__ = 22; - stan::math::check_greater_or_equal(function__, "N", N, 0); - current_statement__ = 23; - context__.validate_dims("data initialization", "n_age", "int", - std::vector{}); - n_age = std::numeric_limits::min(); - current_statement__ = 23; - n_age = context__.vals_i("n_age")[(1 - 1)]; - current_statement__ = 23; - stan::math::check_greater_or_equal(function__, "n_age", n_age, 0); - current_statement__ = 24; - context__.validate_dims("data initialization", "n_age_edu", "int", - std::vector{}); - n_age_edu = std::numeric_limits::min(); - current_statement__ = 24; - n_age_edu = context__.vals_i("n_age_edu")[(1 - 1)]; - current_statement__ = 24; - stan::math::check_greater_or_equal(function__, "n_age_edu", n_age_edu, - 0); - current_statement__ = 25; - context__.validate_dims("data initialization", "n_edu", "int", - std::vector{}); - n_edu = std::numeric_limits::min(); - current_statement__ = 25; - n_edu = context__.vals_i("n_edu")[(1 - 1)]; - current_statement__ = 25; - stan::math::check_greater_or_equal(function__, "n_edu", n_edu, 0); - current_statement__ = 26; - context__.validate_dims("data initialization", "n_region_full", "int", - std::vector{}); - n_region_full = std::numeric_limits::min(); - current_statement__ = 26; - n_region_full = context__.vals_i("n_region_full")[(1 - 1)]; - current_statement__ = 26; - stan::math::check_greater_or_equal(function__, "n_region_full", - n_region_full, 0); - current_statement__ = 27; - context__.validate_dims("data initialization", "n_state", "int", + current_statement__ = 1; + context__.validate_dims("data initialization", "j", "int", std::vector{}); - n_state = std::numeric_limits::min(); - current_statement__ = 27; - n_state = context__.vals_i("n_state")[(1 - 1)]; - current_statement__ = 27; - stan::math::check_greater_or_equal(function__, "n_state", n_state, 0); - current_statement__ = 28; - stan::math::validate_non_negative_index("age", "N", N); - current_statement__ = 29; - context__.validate_dims("data initialization", "age", "int", - std::vector{static_cast(N)}); - age = std::vector(N, std::numeric_limits::min()); - current_statement__ = 29; - age = context__.vals_i("age"); - current_statement__ = 29; - stan::math::check_greater_or_equal(function__, "age", age, 0); - current_statement__ = 29; - stan::math::check_less_or_equal(function__, "age", age, n_age); - current_statement__ = 30; - stan::math::validate_non_negative_index("age_edu", "N", N); - current_statement__ = 31; - context__.validate_dims("data initialization", "age_edu", "int", - std::vector{static_cast(N)}); - age_edu = std::vector(N, std::numeric_limits::min()); - current_statement__ = 31; - age_edu = context__.vals_i("age_edu"); - current_statement__ = 31; - stan::math::check_greater_or_equal(function__, "age_edu", age_edu, 0); - current_statement__ = 31; - stan::math::check_less_or_equal(function__, "age_edu", age_edu, - n_age_edu); - current_statement__ = 32; - stan::math::validate_non_negative_index("black", "N", N); - current_statement__ = 33; - context__.validate_dims("data initialization", "black", "double", - std::vector{static_cast(N)}); - black_data__ = Eigen::Matrix::Constant(N, - std::numeric_limits::quiet_NaN()); - new (&black) - Eigen::Map>(black_data__.data(), N); - { - std::vector black_flat__; - current_statement__ = 33; - black_flat__ = context__.vals_r("black"); - current_statement__ = 33; - pos__ = 1; - current_statement__ = 33; - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - current_statement__ = 33; - stan::model::assign(black, black_flat__[(pos__ - 1)], - "assigning variable black", stan::model::index_uni(sym1__)); - current_statement__ = 33; - pos__ = (pos__ + 1); - } - } - current_statement__ = 33; - stan::math::check_greater_or_equal(function__, "black", black, 0); - current_statement__ = 33; - stan::math::check_less_or_equal(function__, "black", black, 1); - current_statement__ = 34; - stan::math::validate_non_negative_index("edu", "N", N); - current_statement__ = 35; - context__.validate_dims("data initialization", "edu", "int", - std::vector{static_cast(N)}); - edu = std::vector(N, std::numeric_limits::min()); - current_statement__ = 35; - edu = context__.vals_i("edu"); - current_statement__ = 35; - stan::math::check_greater_or_equal(function__, "edu", edu, 0); - current_statement__ = 35; - stan::math::check_less_or_equal(function__, "edu", edu, n_edu); - current_statement__ = 36; - stan::math::validate_non_negative_index("female", "N", N); - current_statement__ = 37; - context__.validate_dims("data initialization", "female", "double", - std::vector{static_cast(N)}); - female_data__ = Eigen::Matrix::Constant(N, - std::numeric_limits::quiet_NaN()); - new (&female) - Eigen::Map>(female_data__.data(), N); + j = std::numeric_limits::min(); + current_statement__ = 1; + j = context__.vals_i("j")[(1 - 1)]; + current_statement__ = 2; + z = std::numeric_limits::quiet_NaN(); + current_statement__ = 2; + z = 1; + current_statement__ = 3; + y = std::numeric_limits::quiet_NaN(); { - std::vector female_flat__; - current_statement__ = 37; - female_flat__ = context__.vals_r("female"); - current_statement__ = 37; - pos__ = 1; - current_statement__ = 37; - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - current_statement__ = 37; - stan::model::assign(female, female_flat__[(pos__ - 1)], - "assigning variable female", stan::model::index_uni(sym1__)); - current_statement__ = 37; - pos__ = (pos__ + 1); - } + double x; + current_statement__ = 4; + x = stan::math::normal_rng(123, 1, base_rng__); + current_statement__ = 5; + z = (x * 2); + current_statement__ = 6; + y = stan::math::normal_rng(z, 1, base_rng__); } - current_statement__ = 37; - stan::math::check_greater_or_equal(function__, "female", female, 0); - current_statement__ = 37; - stan::math::check_less_or_equal(function__, "female", female, 1); - current_statement__ = 38; - stan::math::validate_non_negative_index("region_full", "N", N); - current_statement__ = 39; - context__.validate_dims("data initialization", "region_full", "int", - std::vector{static_cast(N)}); - region_full = std::vector(N, std::numeric_limits::min()); - current_statement__ = 39; - region_full = context__.vals_i("region_full"); - current_statement__ = 39; - stan::math::check_greater_or_equal(function__, "region_full", - region_full, 0); - current_statement__ = 39; - stan::math::check_less_or_equal(function__, "region_full", region_full, - n_region_full); - current_statement__ = 40; - stan::math::validate_non_negative_index("state", "N", N); - current_statement__ = 41; - context__.validate_dims("data initialization", "state", "int", - std::vector{static_cast(N)}); - state = std::vector(N, std::numeric_limits::min()); - current_statement__ = 41; - state = context__.vals_i("state"); - current_statement__ = 41; - stan::math::check_greater_or_equal(function__, "state", state, 0); - current_statement__ = 41; - stan::math::check_less_or_equal(function__, "state", state, n_state); - current_statement__ = 42; - stan::math::validate_non_negative_index("v_prev_full", "N", N); - current_statement__ = 43; - context__.validate_dims("data initialization", "v_prev_full", "double", - std::vector{static_cast(N)}); - v_prev_full_data__ = Eigen::Matrix::Constant(N, - std::numeric_limits::quiet_NaN()); - new (&v_prev_full) - Eigen::Map>(v_prev_full_data__.data(), N); - { - std::vector v_prev_full_flat__; - current_statement__ = 43; - v_prev_full_flat__ = context__.vals_r("v_prev_full"); - current_statement__ = 43; - pos__ = 1; - current_statement__ = 43; - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - current_statement__ = 43; - stan::model::assign(v_prev_full, v_prev_full_flat__[(pos__ - 1)], - "assigning variable v_prev_full", stan::model::index_uni(sym1__)); - current_statement__ = 43; - pos__ = (pos__ + 1); - } - } - current_statement__ = 44; - stan::math::validate_non_negative_index("y", "N", N); - current_statement__ = 45; - context__.validate_dims("data initialization", "y", "int", - std::vector{static_cast(N)}); - y = std::vector(N, std::numeric_limits::min()); - current_statement__ = 45; - y = context__.vals_i("y"); - current_statement__ = 45; - stan::math::check_greater_or_equal(function__, "y", y, 0); - current_statement__ = 45; - stan::math::check_less_or_equal(function__, "y", y, 1); - current_statement__ = 46; - stan::math::validate_non_negative_index("a", "n_age", n_age); - current_statement__ = 47; - stan::math::validate_non_negative_index("b", "n_edu", n_edu); - current_statement__ = 48; - stan::math::validate_non_negative_index("c", "n_age_edu", n_age_edu); - current_statement__ = 49; - stan::math::validate_non_negative_index("d", "n_state", n_state); - current_statement__ = 50; - stan::math::validate_non_negative_index("e", "n_region_full", - n_region_full); - current_statement__ = 51; - stan::math::validate_non_negative_index("y_hat", "N", N); + current_statement__ = 8; + y = stan::math::normal_rng(z, 1, base_rng__); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } - num_params_r__ = n_age + n_edu + n_age_edu + n_state + n_region_full + 5 - + 1 + 1 + 1 + 1 + 1; + num_params_r__ = 0U; } inline std::string model_name() const final { - return "expr_prop_fail3_model"; + return "expr_prop_experiment2_model"; } inline std::vector model_compile_info() const noexcept { return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", @@ -4595,114 +3700,11 @@ class expr_prop_fail3_model final : public model_base_crtp a; - current_statement__ = 1; - a = in__.template read>(n_age); - Eigen::Matrix b; - current_statement__ = 2; - b = in__.template read>(n_edu); - Eigen::Matrix c; - current_statement__ = 3; - c = in__.template read>(n_age_edu); - Eigen::Matrix d; - current_statement__ = 4; - d = in__.template read>(n_state); - Eigen::Matrix e; - current_statement__ = 5; - e = in__.template read< - Eigen::Matrix>(n_region_full); - Eigen::Matrix beta; - current_statement__ = 6; - beta = in__.template read>(5); - local_scalar_t__ sigma_a; - current_statement__ = 7; - sigma_a = in__.template read_constrain_lub(0, 100, lp__); - local_scalar_t__ sigma_b; - current_statement__ = 8; - sigma_b = in__.template read_constrain_lub(0, 100, lp__); - local_scalar_t__ sigma_c; - current_statement__ = 9; - sigma_c = in__.template read_constrain_lub(0, 100, lp__); - local_scalar_t__ sigma_d; - current_statement__ = 10; - sigma_d = in__.template read_constrain_lub(0, 100, lp__); - local_scalar_t__ sigma_e; - current_statement__ = 11; - sigma_e = in__.template read_constrain_lub(0, 100, lp__); - Eigen::Matrix y_hat = - Eigen::Matrix::Constant(N, DUMMY_VAR__); - current_statement__ = 14; - for (int i = 1; i <= N; ++i) { - current_statement__ = 13; - stan::model::assign(y_hat, - (((((stan::math::fma( - stan::model::rvalue(beta, "beta", stan::model::index_uni(4)), - stan::model::rvalue(v_prev_full, "v_prev_full", - stan::model::index_uni(i)), - stan::math::fma( - (stan::model::rvalue(beta, "beta", - stan::model::index_uni(5)) * - stan::model::rvalue(female, "female", - stan::model::index_uni(i))), - stan::model::rvalue(black, "black", - stan::model::index_uni(i)), - stan::math::fma( - stan::model::rvalue(beta, "beta", - stan::model::index_uni(3)), - stan::model::rvalue(female, "female", - stan::model::index_uni(i)), - stan::math::fma( - stan::model::rvalue(beta, "beta", - stan::model::index_uni(2)), - stan::model::rvalue(black, "black", - stan::model::index_uni(i)), - stan::model::rvalue(beta, "beta", - stan::model::index_uni(1)))))) + - stan::model::rvalue(a, "a", - stan::model::index_uni( - stan::model::rvalue(age, "age", stan::model::index_uni(i))))) + - stan::model::rvalue(b, "b", - stan::model::index_uni( - stan::model::rvalue(edu, "edu", stan::model::index_uni(i))))) + - stan::model::rvalue(c, "c", - stan::model::index_uni( - stan::model::rvalue(age_edu, "age_edu", - stan::model::index_uni(i))))) + - stan::model::rvalue(d, "d", - stan::model::index_uni( - stan::model::rvalue(state, "state", stan::model::index_uni(i))))) - + - stan::model::rvalue(e, "e", - stan::model::index_uni( - stan::model::rvalue(region_full, "region_full", - stan::model::index_uni(i))))), "assigning variable y_hat", - stan::model::index_uni(i)); - } - { - current_statement__ = 15; - lp_accum__.add(stan::math::normal_lpdf(a, 0, sigma_a)); - current_statement__ = 16; - lp_accum__.add(stan::math::normal_lpdf(b, 0, sigma_b)); - current_statement__ = 17; - lp_accum__.add(stan::math::normal_lpdf(c, 0, sigma_c)); - current_statement__ = 18; - lp_accum__.add(stan::math::normal_lpdf(d, 0, sigma_d)); - current_statement__ = 19; - lp_accum__.add(stan::math::normal_lpdf(e, 0, sigma_e)); - current_statement__ = 20; - lp_accum__.add(stan::math::normal_lpdf(beta, 0, 100)); - current_statement__ = 21; - lp_accum__.add(stan::math::bernoulli_logit_lpmf(y, y_hat)); - } + } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } @@ -4736,118 +3738,15 @@ class expr_prop_fail3_model final : public model_base_crtp a; - current_statement__ = 1; - a = in__.template read>(n_age); - Eigen::Matrix b; - current_statement__ = 2; - b = in__.template read>(n_edu); - Eigen::Matrix c; - current_statement__ = 3; - c = in__.template read>(n_age_edu); - Eigen::Matrix d; - current_statement__ = 4; - d = in__.template read>(n_state); - Eigen::Matrix e; - current_statement__ = 5; - e = in__.template read< - Eigen::Matrix>(n_region_full); - Eigen::Matrix beta; - current_statement__ = 6; - beta = in__.template read>(5); - double sigma_a; - current_statement__ = 7; - sigma_a = in__.template read_constrain_lub(0, 100, lp__); - double sigma_b; - current_statement__ = 8; - sigma_b = in__.template read_constrain_lub(0, 100, lp__); - double sigma_c; - current_statement__ = 9; - sigma_c = in__.template read_constrain_lub(0, 100, lp__); - double sigma_d; - current_statement__ = 10; - sigma_d = in__.template read_constrain_lub(0, 100, lp__); - double sigma_e; - current_statement__ = 11; - sigma_e = in__.template read_constrain_lub(0, 100, lp__); - Eigen::Matrix y_hat = - Eigen::Matrix::Constant(N, - std::numeric_limits::quiet_NaN()); - out__.write(a); - out__.write(b); - out__.write(c); - out__.write(d); - out__.write(e); - out__.write(beta); - out__.write(sigma_a); - out__.write(sigma_b); - out__.write(sigma_c); - out__.write(sigma_d); - out__.write(sigma_e); if (stan::math::logical_negation( (stan::math::primitive_value(emit_transformed_parameters__) || stan::math::primitive_value(emit_generated_quantities__)))) { return ; } - current_statement__ = 14; - for (int i = 1; i <= N; ++i) { - current_statement__ = 13; - stan::model::assign(y_hat, - (((((stan::math::fma( - stan::model::rvalue(beta, "beta", stan::model::index_uni(4)), - stan::model::rvalue(v_prev_full, "v_prev_full", - stan::model::index_uni(i)), - stan::math::fma( - (stan::model::rvalue(beta, "beta", - stan::model::index_uni(5)) * - stan::model::rvalue(female, "female", - stan::model::index_uni(i))), - stan::model::rvalue(black, "black", - stan::model::index_uni(i)), - stan::math::fma( - stan::model::rvalue(beta, "beta", - stan::model::index_uni(3)), - stan::model::rvalue(female, "female", - stan::model::index_uni(i)), - stan::math::fma( - stan::model::rvalue(beta, "beta", - stan::model::index_uni(2)), - stan::model::rvalue(black, "black", - stan::model::index_uni(i)), - stan::model::rvalue(beta, "beta", - stan::model::index_uni(1)))))) + - stan::model::rvalue(a, "a", - stan::model::index_uni( - stan::model::rvalue(age, "age", stan::model::index_uni(i))))) + - stan::model::rvalue(b, "b", - stan::model::index_uni( - stan::model::rvalue(edu, "edu", stan::model::index_uni(i))))) + - stan::model::rvalue(c, "c", - stan::model::index_uni( - stan::model::rvalue(age_edu, "age_edu", - stan::model::index_uni(i))))) + - stan::model::rvalue(d, "d", - stan::model::index_uni( - stan::model::rvalue(state, "state", stan::model::index_uni(i))))) - + - stan::model::rvalue(e, "e", - stan::model::index_uni( - stan::model::rvalue(region_full, "region_full", - stan::model::index_uni(i))))), "assigning variable y_hat", - stan::model::index_uni(i)); - } - if (emit_transformed_parameters__) { - out__.write(y_hat); - } if (stan::math::logical_negation(emit_generated_quantities__)) { return ; } @@ -4871,175 +3770,35 @@ class expr_prop_fail3_model final : public model_base_crtp a = - Eigen::Matrix::Constant(n_age, DUMMY_VAR__); - for (int sym1__ = 1; sym1__ <= n_age; ++sym1__) { - stan::model::assign(a, in__.read(), - "assigning variable a", stan::model::index_uni(sym1__)); - } - out__.write(a); - Eigen::Matrix b = - Eigen::Matrix::Constant(n_edu, DUMMY_VAR__); - for (int sym1__ = 1; sym1__ <= n_edu; ++sym1__) { - stan::model::assign(b, in__.read(), - "assigning variable b", stan::model::index_uni(sym1__)); - } - out__.write(b); - Eigen::Matrix c = - Eigen::Matrix::Constant(n_age_edu, - DUMMY_VAR__); - for (int sym1__ = 1; sym1__ <= n_age_edu; ++sym1__) { - stan::model::assign(c, in__.read(), - "assigning variable c", stan::model::index_uni(sym1__)); - } - out__.write(c); - Eigen::Matrix d = - Eigen::Matrix::Constant(n_state, DUMMY_VAR__); - for (int sym1__ = 1; sym1__ <= n_state; ++sym1__) { - stan::model::assign(d, in__.read(), - "assigning variable d", stan::model::index_uni(sym1__)); - } - out__.write(d); - Eigen::Matrix e = - Eigen::Matrix::Constant(n_region_full, - DUMMY_VAR__); - for (int sym1__ = 1; sym1__ <= n_region_full; ++sym1__) { - stan::model::assign(e, in__.read(), - "assigning variable e", stan::model::index_uni(sym1__)); - } - out__.write(e); - Eigen::Matrix beta = - Eigen::Matrix::Constant(5, DUMMY_VAR__); - for (int sym1__ = 1; sym1__ <= 5; ++sym1__) { - stan::model::assign(beta, in__.read(), - "assigning variable beta", stan::model::index_uni(sym1__)); - } - out__.write(beta); - local_scalar_t__ sigma_a; - sigma_a = in__.read(); - out__.write_free_lub(0, 100, sigma_a); - local_scalar_t__ sigma_b; - sigma_b = in__.read(); - out__.write_free_lub(0, 100, sigma_b); - local_scalar_t__ sigma_c; - sigma_c = in__.read(); - out__.write_free_lub(0, 100, sigma_c); - local_scalar_t__ sigma_d; - sigma_d = in__.read(); - out__.write_free_lub(0, 100, sigma_d); - local_scalar_t__ sigma_e; - sigma_e = in__.read(); - out__.write_free_lub(0, 100, sigma_e); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } inline void get_param_names(std::vector& names__) const { - names__ = std::vector{"a", "b", "c", "d", "e", "beta", - "sigma_a", "sigma_b", "sigma_c", "sigma_d", "sigma_e", - "y_hat"}; + names__ = std::vector{}; } inline void get_dims(std::vector>& dimss__) const { - dimss__ = std::vector>{std::vector{static_cast< - size_t>( - n_age)}, - std::vector{static_cast(n_edu)}, - std::vector{static_cast(n_age_edu)}, - std::vector{static_cast(n_state)}, - std::vector{static_cast(n_region_full)}, - std::vector{static_cast(5)}, - std::vector{}, std::vector{}, - std::vector{}, std::vector{}, - std::vector{}, - std::vector{static_cast(N)}}; + dimss__ = std::vector>{}; } 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__ <= n_age; ++sym1__) { - param_names__.emplace_back(std::string() + "a" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= n_edu; ++sym1__) { - param_names__.emplace_back(std::string() + "b" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= n_age_edu; ++sym1__) { - param_names__.emplace_back(std::string() + "c" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= n_state; ++sym1__) { - param_names__.emplace_back(std::string() + "d" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= n_region_full; ++sym1__) { - param_names__.emplace_back(std::string() + "e" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= 5; ++sym1__) { - param_names__.emplace_back(std::string() + "beta" + '.' + - std::to_string(sym1__)); - } - param_names__.emplace_back(std::string() + "sigma_a"); - param_names__.emplace_back(std::string() + "sigma_b"); - param_names__.emplace_back(std::string() + "sigma_c"); - param_names__.emplace_back(std::string() + "sigma_d"); - param_names__.emplace_back(std::string() + "sigma_e"); - if (emit_transformed_parameters__) { - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - param_names__.emplace_back(std::string() + "y_hat" + '.' + - std::to_string(sym1__)); - } - } + if (emit_transformed_parameters__) {} 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__ <= n_age; ++sym1__) { - param_names__.emplace_back(std::string() + "a" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= n_edu; ++sym1__) { - param_names__.emplace_back(std::string() + "b" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= n_age_edu; ++sym1__) { - param_names__.emplace_back(std::string() + "c" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= n_state; ++sym1__) { - param_names__.emplace_back(std::string() + "d" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= n_region_full; ++sym1__) { - param_names__.emplace_back(std::string() + "e" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= 5; ++sym1__) { - param_names__.emplace_back(std::string() + "beta" + '.' + - std::to_string(sym1__)); - } - param_names__.emplace_back(std::string() + "sigma_a"); - param_names__.emplace_back(std::string() + "sigma_b"); - param_names__.emplace_back(std::string() + "sigma_c"); - param_names__.emplace_back(std::string() + "sigma_d"); - param_names__.emplace_back(std::string() + "sigma_e"); - if (emit_transformed_parameters__) { - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - param_names__.emplace_back(std::string() + "y_hat" + '.' + - std::to_string(sym1__)); - } - } + if (emit_transformed_parameters__) {} if (emit_generated_quantities__) {} } inline std::string get_constrained_sizedtypes() const { - return std::string("[{\"name\":\"a\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_age) + "},\"block\":\"parameters\"},{\"name\":\"b\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_edu) + "},\"block\":\"parameters\"},{\"name\":\"c\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_age_edu) + "},\"block\":\"parameters\"},{\"name\":\"d\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_state) + "},\"block\":\"parameters\"},{\"name\":\"e\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_region_full) + "},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(5) + "},\"block\":\"parameters\"},{\"name\":\"sigma_a\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_b\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_c\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_d\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_e\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"y_hat\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"transformed_parameters\"}]"); + return std::string("[]"); } inline std::string get_unconstrained_sizedtypes() const { - return std::string("[{\"name\":\"a\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_age) + "},\"block\":\"parameters\"},{\"name\":\"b\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_edu) + "},\"block\":\"parameters\"},{\"name\":\"c\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_age_edu) + "},\"block\":\"parameters\"},{\"name\":\"d\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_state) + "},\"block\":\"parameters\"},{\"name\":\"e\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_region_full) + "},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(5) + "},\"block\":\"parameters\"},{\"name\":\"sigma_a\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_b\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_c\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_d\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_e\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"y_hat\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"transformed_parameters\"}]"); + return std::string("[]"); } // Begin method overload boilerplate template inline void @@ -5048,9 +3807,8 @@ class expr_prop_fail3_model final : public model_base_crtp& params_i, std::vector& vars, std::ostream* pstream__ = nullptr) const { - constexpr std::array - names__{"a", "b", "c", "d", "e", "beta", "sigma_a", "sigma_b", - "sigma_c", "sigma_d", "sigma_e"}; - const std::array - constrain_param_sizes__{n_age, n_edu, n_age_edu, n_state, - n_region_full, 5, 1, 1, 1, 1, 1}; + constexpr std::array names__{}; + const std::array constrain_param_sizes__{}; const auto num_constrained_params__ = std::accumulate(constrain_param_sizes__.begin(), constrain_param_sizes__.end(), 0); @@ -5126,7 +3879,7 @@ class expr_prop_fail3_model final : public model_base_crtp -namespace expr_prop_fail4_model_namespace { +namespace expr_prop_fail_model_namespace { using stan::model::model_base_crtp; using namespace stan::math; stan::math::profile_map profiles__; -static constexpr std::array locations_array__ = +static constexpr std::array locations_array__ = {" (found before start of program)", - " (in 'expr-prop-fail4.stan', line 12, column 2 to column 24)", - " (in 'expr-prop-fail4.stan', line 13, column 2 to column 28)", - " (in 'expr-prop-fail4.stan', line 16, column 2 to column 47)", - " (in 'expr-prop-fail4.stan', line 17, column 2 to column 16)", - " (in 'expr-prop-fail4.stan', line 18, column 2 to column 33)", - " (in 'expr-prop-fail4.stan', line 19, column 2 to column 29)", - " (in 'expr-prop-fail4.stan', line 20, column 2 to column 24)", - " (in 'expr-prop-fail4.stan', line 27, column 2 to column 13)", - " (in 'expr-prop-fail4.stan', line 28, column 2 to column 13)", - " (in 'expr-prop-fail4.stan', line 29, column 2 to column 26)", - " (in 'expr-prop-fail4.stan', line 30, column 2 to column 28)", - " (in 'expr-prop-fail4.stan', line 31, column 2 to column 18)", - " (in 'expr-prop-fail4.stan', line 32, column 2 to column 22)", - " (in 'expr-prop-fail4.stan', line 34, column 2 to column 14)", - " (in 'expr-prop-fail4.stan', line 35, column 2 to column 17)", - " (in 'expr-prop-fail4.stan', line 37, column 2 to column 27)", - " (in 'expr-prop-fail4.stan', line 38, column 2 to column 27)", - " (in 'expr-prop-fail4.stan', line 40, column 4 to column 36)", - " (in 'expr-prop-fail4.stan', line 39, column 19 to line 41, column 3)", - " (in 'expr-prop-fail4.stan', line 39, column 2 to line 41, column 3)", - " (in 'expr-prop-fail4.stan', line 42, column 2 to column 38)", - " (in 'expr-prop-fail4.stan', line 43, column 2 to column 37)", - " (in 'expr-prop-fail4.stan', line 44, column 2 to column 34)", - " (in 'expr-prop-fail4.stan', line 47, column 4 to column 28)", - " (in 'expr-prop-fail4.stan', line 48, column 4 to line 49, column 39)", - " (in 'expr-prop-fail4.stan', line 46, column 19 to line 50, column 3)", - " (in 'expr-prop-fail4.stan', line 46, column 2 to line 50, column 3)", - " (in 'expr-prop-fail4.stan', line 23, column 2 to column 53)", - " (in 'expr-prop-fail4.stan', line 24, column 2 to column 24)", - " (in 'expr-prop-fail4.stan', line 2, column 2 to column 17)", - " (in 'expr-prop-fail4.stan', line 3, column 2 to column 23)", - " (in 'expr-prop-fail4.stan', line 4, column 8 to column 15)", - " (in 'expr-prop-fail4.stan', line 4, column 2 to column 45)", - " (in 'expr-prop-fail4.stan', line 5, column 8 to column 15)", - " (in 'expr-prop-fail4.stan', line 5, column 2 to column 45)", - " (in 'expr-prop-fail4.stan', line 6, column 18 to column 19)", - " (in 'expr-prop-fail4.stan', line 6, column 2 to column 23)", - " (in 'expr-prop-fail4.stan', line 9, column 9 to column 10)", - " (in 'expr-prop-fail4.stan', line 9, column 2 to column 27)", - " (in 'expr-prop-fail4.stan', line 13, column 9 to column 14)", - " (in 'expr-prop-fail4.stan', line 17, column 9 to column 10)", - " (in 'expr-prop-fail4.stan', line 31, column 9 to column 10)", - " (in 'expr-prop-fail4.stan', line 32, column 9 to column 10)", - " (in 'expr-prop-fail4.stan', line 34, column 9 to column 10)", - " (in 'expr-prop-fail4.stan', line 35, column 8 to column 9)"}; -class expr_prop_fail4_model final : public model_base_crtp { + " (in 'expr-prop-fail.stan', line 6, column 2 to column 16)", + " (in 'expr-prop-fail.stan', line 7, column 2 to column 31)", + " (in 'expr-prop-fail.stan', line 8, column 2 to column 31)", + " (in 'expr-prop-fail.stan', line 11, column 2 to column 23)", + " (in 'expr-prop-fail.stan', line 12, column 2 to column 20)", + " (in 'expr-prop-fail.stan', line 13, column 2 to column 21)", + " (in 'expr-prop-fail.stan', line 15, column 4 to line 16, column 59)", + " (in 'expr-prop-fail.stan', line 14, column 2 to line 16, column 59)", + " (in 'expr-prop-fail.stan', line 2, column 2 to column 17)", + " (in 'expr-prop-fail.stan', line 3, column 9 to column 10)", + " (in 'expr-prop-fail.stan', line 3, column 2 to column 14)"}; +class expr_prop_fail_model final : public model_base_crtp { private: int N; - int N_edges; - std::vector node1; - std::vector node2; - Eigen::Matrix E_data__; - Eigen::Matrix log_E_data__; - int phi_std_raw_1dim__; - Eigen::Map> E{nullptr, 0}; - Eigen::Map> log_E{nullptr, 0}; + Eigen::Matrix y_data__; + Eigen::Map> y{nullptr, 0}; public: - ~expr_prop_fail4_model() {} - expr_prop_fail4_model(stan::io::var_context& context__, unsigned int - random_seed__ = 0, std::ostream* pstream__ = nullptr) + ~expr_prop_fail_model() {} + expr_prop_fail_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; @@ -5216,7 +3929,7 @@ class expr_prop_fail4_model final : public model_base_crtp::quiet_NaN()); @@ -5225,105 +3938,44 @@ class expr_prop_fail4_model final : public model_base_crtp{}); N = std::numeric_limits::min(); - current_statement__ = 30; + current_statement__ = 9; N = context__.vals_i("N")[(1 - 1)]; - current_statement__ = 30; + current_statement__ = 9; stan::math::check_greater_or_equal(function__, "N", N, 0); - current_statement__ = 31; - context__.validate_dims("data initialization", "N_edges", "int", - std::vector{}); - N_edges = std::numeric_limits::min(); - current_statement__ = 31; - N_edges = context__.vals_i("N_edges")[(1 - 1)]; - current_statement__ = 31; - stan::math::check_greater_or_equal(function__, "N_edges", N_edges, 0); - current_statement__ = 32; - stan::math::validate_non_negative_index("node1", "N_edges", N_edges); - current_statement__ = 33; - context__.validate_dims("data initialization", "node1", "int", - std::vector{static_cast(N_edges)}); - node1 = std::vector(N_edges, std::numeric_limits::min()); - current_statement__ = 33; - node1 = context__.vals_i("node1"); - current_statement__ = 33; - stan::math::check_greater_or_equal(function__, "node1", node1, 1); - current_statement__ = 33; - stan::math::check_less_or_equal(function__, "node1", node1, N); - current_statement__ = 34; - stan::math::validate_non_negative_index("node2", "N_edges", N_edges); - current_statement__ = 35; - context__.validate_dims("data initialization", "node2", "int", - std::vector{static_cast(N_edges)}); - node2 = std::vector(N_edges, std::numeric_limits::min()); - current_statement__ = 35; - node2 = context__.vals_i("node2"); - current_statement__ = 35; - stan::math::check_greater_or_equal(function__, "node2", node2, 1); - current_statement__ = 35; - stan::math::check_less_or_equal(function__, "node2", node2, N); - current_statement__ = 36; - stan::math::validate_non_negative_index("E", "N", N); - current_statement__ = 37; - context__.validate_dims("data initialization", "E", "double", + current_statement__ = 10; + stan::math::validate_non_negative_index("y", "N", N); + current_statement__ = 11; + context__.validate_dims("data initialization", "y", "double", std::vector{static_cast(N)}); - E_data__ = Eigen::Matrix::Constant(N, + y_data__ = Eigen::Matrix::Constant(N, std::numeric_limits::quiet_NaN()); - new (&E) Eigen::Map>(E_data__.data(), N); + new (&y) Eigen::Map>(y_data__.data(), N); { - std::vector E_flat__; - current_statement__ = 37; - E_flat__ = context__.vals_r("E"); - current_statement__ = 37; + std::vector y_flat__; + current_statement__ = 11; + y_flat__ = context__.vals_r("y"); + current_statement__ = 11; pos__ = 1; - current_statement__ = 37; + current_statement__ = 11; for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - current_statement__ = 37; - stan::model::assign(E, E_flat__[(pos__ - 1)], - "assigning variable E", stan::model::index_uni(sym1__)); - current_statement__ = 37; + current_statement__ = 11; + stan::model::assign(y, y_flat__[(pos__ - 1)], + "assigning variable y", stan::model::index_uni(sym1__)); + current_statement__ = 11; pos__ = (pos__ + 1); } } - current_statement__ = 37; - stan::math::check_greater_or_equal(function__, "E", E, 0); - current_statement__ = 38; - stan::math::validate_non_negative_index("log_E", "N", N); - current_statement__ = 39; - log_E_data__ = Eigen::Matrix::Constant(N, - std::numeric_limits::quiet_NaN()); - new (&log_E) - Eigen::Map>(log_E_data__.data(), N); - current_statement__ = 39; - stan::model::assign(log_E, stan::math::log(E), - "assigning variable log_E"); - current_statement__ = 40; - phi_std_raw_1dim__ = std::numeric_limits::min(); - current_statement__ = 40; - phi_std_raw_1dim__ = (N - 1); - current_statement__ = 40; - stan::math::validate_non_negative_index("phi_std_raw", "N - 1", - phi_std_raw_1dim__); - current_statement__ = 41; - stan::math::validate_non_negative_index("phi", "N", N); - current_statement__ = 42; - stan::math::validate_non_negative_index("theta", "N", N); - current_statement__ = 43; - stan::math::validate_non_negative_index("theta_std", "N", N); - current_statement__ = 44; - stan::math::validate_non_negative_index("x", "N", N); - current_statement__ = 45; - stan::math::validate_non_negative_index("y", "N", N); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } - num_params_r__ = 1 + phi_std_raw_1dim__; + num_params_r__ = 2 + 2 + 1; } inline std::string model_name() const final { - return "expr_prop_fail4_model"; + return "expr_prop_fail_model"; } inline std::vector model_compile_info() const noexcept { return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", @@ -5345,51 +3997,48 @@ class expr_prop_fail4_model final : public model_base_crtp mu; current_statement__ = 1; - tau_phi = in__.template read_constrain_lb(0, lp__); - stan::conditional_var_value_t> phi_std_raw; + mu = in__.template read_constrain_ordered< + Eigen::Matrix, jacobian__>(lp__, 2); + std::vector sigma; current_statement__ = 2; - phi_std_raw = in__.template read< - stan::conditional_var_value_t>>(phi_std_raw_1dim__); - local_scalar_t__ sigma_phi; - current_statement__ = 3; - sigma_phi = stan::math::inv_sqrt(tau_phi); - stan::conditional_var_value_t> phi = - stan::conditional_var_value_t>(Eigen::Matrix::Constant(N, - std::numeric_limits::quiet_NaN( - ))); - current_statement__ = 5; - stan::model::assign(phi, phi_std_raw, "assigning variable phi", - stan::model::index_min_max(1, (N - 1))); - current_statement__ = 6; - stan::model::assign(phi, -stan::math::sum(phi_std_raw), - "assigning variable phi", stan::model::index_uni(N)); - current_statement__ = 7; - stan::model::assign(phi, - stan::math::multiply(stan::model::deep_copy(phi), sigma_phi), - "assigning variable phi"); + sigma = in__.template read_constrain_lb, + jacobian__>(0, lp__, 2); + local_scalar_t__ theta; current_statement__ = 3; - stan::math::check_greater_or_equal(function__, "sigma_phi", sigma_phi, - 0); + theta = in__.template read_constrain_lub(0, 1, lp__); { - current_statement__ = 28; - lp_accum__.add((-0.5 * - stan::math::dot_self( - stan::math::subtract( - stan::model::rvalue(phi, "phi", stan::model::index_multi(node1)), - stan::model::rvalue(phi, "phi", stan::model::index_multi(node2)))))); - current_statement__ = 29; - lp_accum__.add(stan::math::gamma_lpdf(tau_phi, 1, 1)); + current_statement__ = 4; + lp_accum__.add(stan::math::normal_lpdf(sigma, 0, 2)); + current_statement__ = 5; + lp_accum__.add(stan::math::normal_lpdf(mu, 0, 2)); + current_statement__ = 6; + lp_accum__.add(stan::math::beta_lpdf(theta, 5, 5)); + current_statement__ = 8; + for (int n = 1; n <= N; ++n) { + current_statement__ = 7; + lp_accum__.add(stan::math::log_mix(theta, + stan::math::normal_lpdf( + stan::model::rvalue(y, "y", + stan::model::index_uni(n)), + stan::model::rvalue(mu, "mu", + stan::model::index_uni(1)), + stan::model::rvalue(sigma, "sigma", + stan::model::index_uni(1))), + stan::math::normal_lpdf( + stan::model::rvalue(y, "y", + stan::model::index_uni(n)), + stan::model::rvalue(mu, "mu", + stan::model::index_uni(2)), + stan::model::rvalue(sigma, "sigma", + stan::model::index_uni(2))))); + } } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); @@ -5424,115 +4073,33 @@ class expr_prop_fail4_model final : public model_base_crtp mu; current_statement__ = 1; - tau_phi = in__.template read_constrain_lb(0, lp__); - Eigen::Matrix phi_std_raw; + mu = in__.template read_constrain_ordered< + Eigen::Matrix, jacobian__>(lp__, 2); + std::vector sigma; current_statement__ = 2; - phi_std_raw = in__.template read< - Eigen::Matrix>(phi_std_raw_1dim__); - double sigma_phi = std::numeric_limits::quiet_NaN(); - Eigen::Matrix phi = - Eigen::Matrix::Constant(N, - std::numeric_limits::quiet_NaN()); - out__.write(tau_phi); - out__.write(phi_std_raw); + sigma = in__.template read_constrain_lb, + jacobian__>(0, lp__, 2); + double theta; + current_statement__ = 3; + theta = in__.template read_constrain_lub(0, 1, lp__); + out__.write(mu); + out__.write(sigma); + out__.write(theta); if (stan::math::logical_negation( (stan::math::primitive_value(emit_transformed_parameters__) || stan::math::primitive_value(emit_generated_quantities__)))) { return ; } - current_statement__ = 3; - sigma_phi = stan::math::inv_sqrt(tau_phi); - current_statement__ = 5; - stan::model::assign(phi, phi_std_raw, "assigning variable phi", - stan::model::index_min_max(1, (N - 1))); - current_statement__ = 6; - stan::model::assign(phi, -stan::math::sum(phi_std_raw), - "assigning variable phi", stan::model::index_uni(N)); - current_statement__ = 7; - stan::model::assign(phi, - stan::math::multiply(stan::model::deep_copy(phi), sigma_phi), - "assigning variable phi"); - current_statement__ = 3; - stan::math::check_greater_or_equal(function__, "sigma_phi", sigma_phi, - 0); - if (emit_transformed_parameters__) { - out__.write(sigma_phi); - out__.write(phi); - } if (stan::math::logical_negation(emit_generated_quantities__)) { return ; } - double beta0 = std::numeric_limits::quiet_NaN(); - double beta1 = std::numeric_limits::quiet_NaN(); - double tau_theta = std::numeric_limits::quiet_NaN(); - double sigma_theta = std::numeric_limits::quiet_NaN(); - Eigen::Matrix theta = - Eigen::Matrix::Constant(N, - std::numeric_limits::quiet_NaN()); - Eigen::Matrix theta_std = - Eigen::Matrix::Constant(N, - std::numeric_limits::quiet_NaN()); - Eigen::Matrix x = - Eigen::Matrix::Constant(N, - std::numeric_limits::quiet_NaN()); - std::vector y = - std::vector(N, std::numeric_limits::min()); - current_statement__ = 16; - beta0 = stan::math::normal_rng(0, 1, base_rng__); - current_statement__ = 17; - beta1 = stan::math::normal_rng(0, 1, base_rng__); - current_statement__ = 20; - for (int i = 1; i <= N; ++i) { - current_statement__ = 18; - stan::model::assign(theta_std, - stan::math::normal_rng(0, 1, base_rng__), - "assigning variable theta_std", stan::model::index_uni(i)); - } - current_statement__ = 21; - tau_theta = stan::math::gamma_rng(3.2761, 1.81, base_rng__); - current_statement__ = 22; - sigma_theta = stan::math::inv_sqrt(tau_theta); - current_statement__ = 23; - stan::model::assign(theta, - stan::math::multiply(theta_std, sigma_theta), - "assigning variable theta"); - current_statement__ = 27; - for (int i = 1; i <= N; ++i) { - current_statement__ = 24; - stan::model::assign(x, stan::math::normal_rng(0, 1, base_rng__), - "assigning variable x", stan::model::index_uni(i)); - current_statement__ = 25; - stan::model::assign(y, - stan::math::poisson_log_rng( - ((stan::math::fma(beta1, - stan::model::rvalue(x, "x", stan::model::index_uni(i)), - (stan::model::rvalue(log_E, "log_E", - stan::model::index_uni(i)) + beta0)) + - stan::model::rvalue(phi, "phi", stan::model::index_uni(i))) + - stan::model::rvalue(theta, "theta", stan::model::index_uni(i))), - base_rng__), "assigning variable y", stan::model::index_uni(i)); - } - current_statement__ = 10; - stan::math::check_greater_or_equal(function__, "tau_theta", tau_theta, - 0); - current_statement__ = 11; - stan::math::check_greater_or_equal(function__, "sigma_theta", - sigma_theta, 0); - out__.write(beta0); - out__.write(beta1); - out__.write(tau_theta); - out__.write(sigma_theta); - out__.write(theta); - out__.write(theta_std); - out__.write(x); - out__.write(y); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } @@ -5553,121 +4120,72 @@ class expr_prop_fail4_model final : public model_base_crtp(); - out__.write_free_lb(0, tau_phi); - Eigen::Matrix phi_std_raw = - Eigen::Matrix::Constant(phi_std_raw_1dim__, - DUMMY_VAR__); - for (int sym1__ = 1; sym1__ <= phi_std_raw_1dim__; ++sym1__) { - stan::model::assign(phi_std_raw, in__.read(), - "assigning variable phi_std_raw", stan::model::index_uni(sym1__)); + Eigen::Matrix mu = + Eigen::Matrix::Constant(2, DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= 2; ++sym1__) { + stan::model::assign(mu, in__.read(), + "assigning variable mu", stan::model::index_uni(sym1__)); } - out__.write(phi_std_raw); + out__.write_free_ordered(mu); + std::vector sigma = + std::vector(2, DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= 2; ++sym1__) { + sigma[(sym1__ - 1)] = in__.read(); + } + out__.write_free_lb(0, sigma); + local_scalar_t__ theta; + theta = in__.read(); + out__.write_free_lub(0, 1, theta); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } inline void get_param_names(std::vector& names__) const { - names__ = std::vector{"tau_phi", "phi_std_raw", "sigma_phi", - "phi", "beta0", "beta1", "tau_theta", "sigma_theta", "theta", - "theta_std", "x", "y"}; + names__ = std::vector{"mu", "sigma", "theta"}; } inline void get_dims(std::vector>& dimss__) const { - dimss__ = std::vector>{std::vector{}, - std::vector{static_cast(phi_std_raw_1dim__)}, - std::vector{}, - std::vector{static_cast(N)}, - std::vector{}, std::vector{}, - std::vector{}, std::vector{}, - std::vector{static_cast(N)}, - std::vector{static_cast(N)}, - std::vector{static_cast(N)}, - std::vector{static_cast(N)}}; + dimss__ = std::vector>{std::vector{static_cast< + size_t>(2)}, + std::vector{static_cast(2)}, + std::vector{}}; } inline void constrained_param_names(std::vector& param_names__, bool emit_transformed_parameters__ = true, bool emit_generated_quantities__ = true) const final { - param_names__.emplace_back(std::string() + "tau_phi"); - for (int sym1__ = 1; sym1__ <= phi_std_raw_1dim__; ++sym1__) { - param_names__.emplace_back(std::string() + "phi_std_raw" + '.' + + for (int sym1__ = 1; sym1__ <= 2; ++sym1__) { + param_names__.emplace_back(std::string() + "mu" + '.' + std::to_string(sym1__)); } - if (emit_transformed_parameters__) { - param_names__.emplace_back(std::string() + "sigma_phi"); - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - param_names__.emplace_back(std::string() + "phi" + '.' + - std::to_string(sym1__)); - } - } - if (emit_generated_quantities__) { - param_names__.emplace_back(std::string() + "beta0"); - param_names__.emplace_back(std::string() + "beta1"); - param_names__.emplace_back(std::string() + "tau_theta"); - param_names__.emplace_back(std::string() + "sigma_theta"); - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - param_names__.emplace_back(std::string() + "theta" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - param_names__.emplace_back(std::string() + "theta_std" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - param_names__.emplace_back(std::string() + "x" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - param_names__.emplace_back(std::string() + "y" + '.' + - std::to_string(sym1__)); - } + for (int sym1__ = 1; sym1__ <= 2; ++sym1__) { + param_names__.emplace_back(std::string() + "sigma" + '.' + + std::to_string(sym1__)); } + param_names__.emplace_back(std::string() + "theta"); + if (emit_transformed_parameters__) {} + 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 { - param_names__.emplace_back(std::string() + "tau_phi"); - for (int sym1__ = 1; sym1__ <= phi_std_raw_1dim__; ++sym1__) { - param_names__.emplace_back(std::string() + "phi_std_raw" + '.' + + for (int sym1__ = 1; sym1__ <= 2; ++sym1__) { + param_names__.emplace_back(std::string() + "mu" + '.' + std::to_string(sym1__)); } - if (emit_transformed_parameters__) { - param_names__.emplace_back(std::string() + "sigma_phi"); - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - param_names__.emplace_back(std::string() + "phi" + '.' + - std::to_string(sym1__)); - } - } - if (emit_generated_quantities__) { - param_names__.emplace_back(std::string() + "beta0"); - param_names__.emplace_back(std::string() + "beta1"); - param_names__.emplace_back(std::string() + "tau_theta"); - param_names__.emplace_back(std::string() + "sigma_theta"); - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - param_names__.emplace_back(std::string() + "theta" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - param_names__.emplace_back(std::string() + "theta_std" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - param_names__.emplace_back(std::string() + "x" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - param_names__.emplace_back(std::string() + "y" + '.' + - std::to_string(sym1__)); - } + for (int sym1__ = 1; sym1__ <= 2; ++sym1__) { + param_names__.emplace_back(std::string() + "sigma" + '.' + + std::to_string(sym1__)); } + param_names__.emplace_back(std::string() + "theta"); + if (emit_transformed_parameters__) {} + if (emit_generated_quantities__) {} } inline std::string get_constrained_sizedtypes() const { - return std::string("[{\"name\":\"tau_phi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"phi_std_raw\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(phi_std_raw_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"sigma_phi\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"transformed_parameters\"},{\"name\":\"beta0\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"beta1\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"tau_theta\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"sigma_theta\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"theta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"generated_quantities\"},{\"name\":\"theta_std\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"generated_quantities\"},{\"name\":\"x\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"generated_quantities\"},{\"name\":\"y\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(N) + ",\"element_type\":{\"name\":\"int\"}},\"block\":\"generated_quantities\"}]"); + return std::string("[{\"name\":\"mu\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(2) + "},\"block\":\"parameters\"},{\"name\":\"sigma\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(2) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"theta\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"}]"); } inline std::string get_unconstrained_sizedtypes() const { - return std::string("[{\"name\":\"tau_phi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"phi_std_raw\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(phi_std_raw_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"sigma_phi\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"transformed_parameters\"},{\"name\":\"beta0\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"beta1\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"tau_theta\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"sigma_theta\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"theta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"generated_quantities\"},{\"name\":\"theta_std\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"generated_quantities\"},{\"name\":\"x\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"generated_quantities\"},{\"name\":\"y\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(N) + ",\"element_type\":{\"name\":\"int\"}},\"block\":\"generated_quantities\"}]"); + return std::string("[{\"name\":\"mu\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(2) + "},\"block\":\"parameters\"},{\"name\":\"sigma\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(2) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"theta\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"}]"); } // Begin method overload boilerplate template inline void @@ -5676,10 +4194,9 @@ class expr_prop_fail4_model final : public model_base_crtp params_i; @@ -5694,10 +4211,9 @@ class expr_prop_fail4_model final : public model_base_crtp(num_to_write, @@ -5729,9 +4245,8 @@ class expr_prop_fail4_model final : public model_base_crtp& params_i, std::vector& vars, std::ostream* pstream__ = nullptr) const { - constexpr std::array names__{"tau_phi", "phi_std_raw"}; - const std::array - constrain_param_sizes__{1, phi_std_raw_1dim__}; + constexpr std::array names__{"mu", "sigma", "theta"}; + const std::array constrain_param_sizes__{2, 2, 1}; const auto num_constrained_params__ = std::accumulate(constrain_param_sizes__.begin(), constrain_param_sizes__.end(), 0); @@ -5751,7 +4266,7 @@ class expr_prop_fail4_model final : public model_base_crtp -namespace expr_prop_fail5_model_namespace { +namespace expr_prop_fail2_model_namespace { using stan::model::model_base_crtp; using namespace stan::math; stan::math::profile_map profiles__; -static constexpr std::array locations_array__ = +static constexpr std::array locations_array__ = {" (found before start of program)", - " (in 'expr-prop-fail5.stan', line 68, column 2 to column 34)", - " (in 'expr-prop-fail5.stan', line 69, column 2 to column 32)", - " (in 'expr-prop-fail5.stan', line 70, column 2 to column 23)", - " (in 'expr-prop-fail5.stan', line 71, column 2 to column 31)", - " (in 'expr-prop-fail5.stan', line 76, column 2 to column 52)", - " (in 'expr-prop-fail5.stan', line 77, column 2 to column 50)", - " (in 'expr-prop-fail5.stan', line 78, column 2 to column 50)", - " (in 'expr-prop-fail5.stan', line 79, column 2 to column 10)", - " (in 'expr-prop-fail5.stan', line 82, column 2 to column 23)", - " (in 'expr-prop-fail5.stan', line 85, column 6 to column 20)", - " (in 'expr-prop-fail5.stan', line 86, column 6 to column 18)", - " (in 'expr-prop-fail5.stan', line 84, column 34 to line 87, column 5)", - " (in 'expr-prop-fail5.stan', line 84, column 4 to line 87, column 5)", - " (in 'expr-prop-fail5.stan', line 89, column 6 to column 45)", - " (in 'expr-prop-fail5.stan', line 90, column 6 to column 23)", - " (in 'expr-prop-fail5.stan', line 88, column 40 to line 91, column 5)", - " (in 'expr-prop-fail5.stan', line 88, column 4 to line 91, column 5)", - " (in 'expr-prop-fail5.stan', line 83, column 22 to line 92, column 3)", - " (in 'expr-prop-fail5.stan', line 83, column 2 to line 92, column 3)", - " (in 'expr-prop-fail5.stan', line 25, column 11 to column 15)", - " (in 'expr-prop-fail5.stan', line 25, column 17 to column 28)", - " (in 'expr-prop-fail5.stan', line 25, column 4 to column 34)", - " (in 'expr-prop-fail5.stan', line 28, column 6 to column 32)", - " (in 'expr-prop-fail5.stan', line 31, column 8 to column 37)", - " (in 'expr-prop-fail5.stan', line 32, column 8 to column 32)", - " (in 'expr-prop-fail5.stan', line 40, column 8 to column 33)", - " (in 'expr-prop-fail5.stan', line 41, column 8 to column 28)", - " (in 'expr-prop-fail5.stan', line 42, column 8 to line 44, column 44)", - " (in 'expr-prop-fail5.stan', line 29, column 39 to line 45, column 7)", - " (in 'expr-prop-fail5.stan', line 29, column 6 to line 45, column 7)", - " (in 'expr-prop-fail5.stan', line 27, column 24 to line 46, column 5)", - " (in 'expr-prop-fail5.stan', line 27, column 4 to line 46, column 5)", - " (in 'expr-prop-fail5.stan', line 47, column 4 to column 15)", - " (in 'expr-prop-fail5.stan', line 118, column 2 to column 23)", - " (in 'expr-prop-fail5.stan', line 120, column 2 to column 25)", - " (in 'expr-prop-fail5.stan', line 104, column 2 to column 29)", - " (in 'expr-prop-fail5.stan', line 110, column 8 to column 37)", - " (in 'expr-prop-fail5.stan', line 111, column 8 to column 41)", - " (in 'expr-prop-fail5.stan', line 109, column 42 to line 112, column 7)", - " (in 'expr-prop-fail5.stan', line 109, column 6 to line 112, column 7)", - " (in 'expr-prop-fail5.stan', line 113, column 6 to column 37)", - " (in 'expr-prop-fail5.stan', line 108, column 22 to line 114, column 5)", - " (in 'expr-prop-fail5.stan', line 108, column 4 to line 114, column 5)", - " (in 'expr-prop-fail5.stan', line 107, column 22 to line 115, column 3)", - " (in 'expr-prop-fail5.stan', line 107, column 2 to line 115, column 3)", - " (in 'expr-prop-fail5.stan', line 51, column 2 to column 20)", - " (in 'expr-prop-fail5.stan', line 52, column 2 to column 27)", - " (in 'expr-prop-fail5.stan', line 53, column 8 to column 12)", - " (in 'expr-prop-fail5.stan', line 53, column 14 to column 25)", - " (in 'expr-prop-fail5.stan', line 53, column 2 to column 51)", - " (in 'expr-prop-fail5.stan', line 56, column 2 to column 38)", - " (in 'expr-prop-fail5.stan', line 58, column 8 to column 12)", - " (in 'expr-prop-fail5.stan', line 58, column 2 to column 52)", - " (in 'expr-prop-fail5.stan', line 59, column 8 to column 12)", - " (in 'expr-prop-fail5.stan', line 59, column 2 to column 51)", - " (in 'expr-prop-fail5.stan', line 63, column 4 to column 35)", - " (in 'expr-prop-fail5.stan', line 62, column 2 to line 63, column 35)", - " (in 'expr-prop-fail5.stan', line 65, column 4 to column 33)", - " (in 'expr-prop-fail5.stan', line 64, column 2 to line 65, column 33)", - " (in 'expr-prop-fail5.stan', line 70, column 9 to column 13)", - " (in 'expr-prop-fail5.stan', line 76, column 27 to column 31)", - " (in 'expr-prop-fail5.stan', line 76, column 33 to column 46)", - " (in 'expr-prop-fail5.stan', line 77, column 27 to column 31)", - " (in 'expr-prop-fail5.stan', line 77, column 33 to column 46)", - " (in 'expr-prop-fail5.stan', line 78, column 27 to column 31)", - " (in 'expr-prop-fail5.stan', line 78, column 33 to column 44)", - " (in 'expr-prop-fail5.stan', line 8, column 8 to column 17)", - " (in 'expr-prop-fail5.stan', line 7, column 6 to line 8, column 17)", - " (in 'expr-prop-fail5.stan', line 6, column 4 to line 8, column 17)", - " (in 'expr-prop-fail5.stan', line 9, column 4 to column 13)", - " (in 'expr-prop-fail5.stan', line 5, column 37 to line 10, column 3)", - " (in 'expr-prop-fail5.stan', line 15, column 6 to column 32)", - " (in 'expr-prop-fail5.stan', line 19, column 8 to column 17)", - " (in 'expr-prop-fail5.stan', line 18, column 6 to line 19, column 17)", - " (in 'expr-prop-fail5.stan', line 13, column 39 to line 20, column 5)", - " (in 'expr-prop-fail5.stan', line 13, column 4 to line 20, column 5)", - " (in 'expr-prop-fail5.stan', line 21, column 4 to column 13)", - " (in 'expr-prop-fail5.stan', line 12, column 36 to line 22, column 3)", - " (in 'expr-prop-fail5.stan', line 24, column 74 to line 48, column 3)"}; -int first_capture(const std::vector& y_i, std::ostream* pstream__); -int last_capture(const std::vector& y_i, std::ostream* pstream__); -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, - const T3__& phi_arg__, std::ostream* pstream__); -int first_capture(const std::vector& y_i, std::ostream* pstream__) { - using local_scalar_t__ = double; - int current_statement__ = 0; - static constexpr bool propto__ = true; - // suppress unused var warning - (void) propto__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - current_statement__ = 69; - for (int k = 1; k <= stan::math::size(y_i); ++k) { - current_statement__ = 68; - if (stan::model::rvalue(y_i, "y_i", stan::model::index_uni(k))) { - current_statement__ = 67; - return k; - } - } - current_statement__ = 70; - return 0; - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } -} -int last_capture(const std::vector& y_i, std::ostream* pstream__) { - using local_scalar_t__ = double; - int current_statement__ = 0; - static constexpr bool propto__ = true; - // suppress unused var warning - (void) propto__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - current_statement__ = 76; - for (int k_rev = 0; k_rev <= (stan::math::size(y_i) - 1); ++k_rev) { - int k; - current_statement__ = 72; - k = (stan::math::size(y_i) - k_rev); - current_statement__ = 74; - if (stan::model::rvalue(y_i, "y_i", stan::model::index_uni(k))) { - current_statement__ = 73; - return k; - } - } - current_statement__ = 77; - return 0; - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } -} -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, - const T3__& phi_arg__, std::ostream* pstream__) { - using local_scalar_t__ = stan::promote_args_t, - stan::base_type_t>; - int current_statement__ = 0; - const auto& p = stan::math::to_ref(p_arg__); - const auto& phi = stan::math::to_ref(phi_arg__); - static constexpr bool propto__ = true; - // suppress unused var warning - (void) propto__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - current_statement__ = 20; - stan::math::validate_non_negative_index("chi", "nind", nind); - current_statement__ = 21; - stan::math::validate_non_negative_index("chi", "n_occasions", n_occasions); - Eigen::Matrix chi = - Eigen::Matrix::Constant(nind, n_occasions, - DUMMY_VAR__); - current_statement__ = 32; - for (int i = 1; i <= nind; ++i) { - current_statement__ = 23; - stan::model::assign(chi, 1.0, "assigning variable chi", - stan::model::index_uni(i), stan::model::index_uni(n_occasions)); - current_statement__ = 30; - for (int t = 1; t <= (n_occasions - 1); ++t) { - int t_curr = std::numeric_limits::min(); - int t_next = std::numeric_limits::min(); - current_statement__ = 26; - t_curr = (n_occasions - t); - current_statement__ = 27; - t_next = (t_curr + 1); - current_statement__ = 28; - stan::model::assign(chi, - stan::math::fma( - (stan::model::rvalue(phi, "phi", stan::model::index_uni(i), - stan::model::index_uni(t_curr)) * (1 - - stan::model::rvalue(p, "p", stan::model::index_uni(i), - stan::model::index_uni((t_next - 1))))), - stan::model::rvalue(chi, "chi", stan::model::index_uni(i), - stan::model::index_uni(t_next)), (1 - - stan::model::rvalue(phi, "phi", stan::model::index_uni(i), - stan::model::index_uni(t_curr)))), "assigning variable chi", - stan::model::index_uni(i), stan::model::index_uni(t_curr)); - } - } - current_statement__ = 33; - return chi; - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } -} -class expr_prop_fail5_model final : public model_base_crtp { + " (in 'expr-prop-fail2.stan', line 7, column 2 to column 10)", + " (in 'expr-prop-fail2.stan', line 8, column 2 to column 22)", + " (in 'expr-prop-fail2.stan', line 9, column 2 to column 20)", + " (in 'expr-prop-fail2.stan', line 12, column 2 to column 26)", + " (in 'expr-prop-fail2.stan', line 13, column 2 to column 27)", + " (in 'expr-prop-fail2.stan', line 2, column 2 to column 17)", + " (in 'expr-prop-fail2.stan', line 3, column 8 to column 9)", + " (in 'expr-prop-fail2.stan', line 3, column 2 to column 18)", + " (in 'expr-prop-fail2.stan', line 4, column 8 to column 9)", + " (in 'expr-prop-fail2.stan', line 4, column 2 to column 31)", + " (in 'expr-prop-fail2.stan', line 8, column 8 to column 9)"}; +class expr_prop_fail2_model final : public model_base_crtp { private: - int nind; - int n_occasions; - std::vector> y; - int n_occ_minus_1; - std::vector first; - std::vector last; + int J; + std::vector y; + std::vector sigma; public: - ~expr_prop_fail5_model() {} - expr_prop_fail5_model(stan::io::var_context& context__, unsigned int + ~expr_prop_fail2_model() {} + expr_prop_fail2_model(stan::io::var_context& context__, unsigned int random_seed__ = 0, std::ostream* pstream__ = nullptr) : model_base_crtp(0) { int current_statement__ = 0; @@ -5995,7 +4316,7 @@ class expr_prop_fail5_model final : public model_base_crtp::quiet_NaN()); @@ -6004,504 +4325,141 @@ class expr_prop_fail5_model final : public model_base_crtp{}); - nind = std::numeric_limits::min(); - current_statement__ = 46; - nind = context__.vals_i("nind")[(1 - 1)]; - current_statement__ = 46; - stan::math::check_greater_or_equal(function__, "nind", nind, 0); - current_statement__ = 47; - context__.validate_dims("data initialization", "n_occasions", "int", + current_statement__ = 6; + context__.validate_dims("data initialization", "J", "int", std::vector{}); - n_occasions = std::numeric_limits::min(); - current_statement__ = 47; - n_occasions = context__.vals_i("n_occasions")[(1 - 1)]; - current_statement__ = 47; - stan::math::check_greater_or_equal(function__, "n_occasions", - n_occasions, 2); - current_statement__ = 48; - stan::math::validate_non_negative_index("y", "nind", nind); - current_statement__ = 49; - stan::math::validate_non_negative_index("y", "n_occasions", n_occasions); - current_statement__ = 50; - context__.validate_dims("data initialization", "y", "int", - std::vector{static_cast(nind), - static_cast(n_occasions)}); - y = std::vector>(nind, - std::vector(n_occasions, std::numeric_limits::min())); + J = std::numeric_limits::min(); + current_statement__ = 6; + J = context__.vals_i("J")[(1 - 1)]; + current_statement__ = 6; + stan::math::check_greater_or_equal(function__, "J", J, 0); + current_statement__ = 7; + stan::math::validate_non_negative_index("y", "J", J); + current_statement__ = 8; + context__.validate_dims("data initialization", "y", "double", + std::vector{static_cast(J)}); + y = std::vector(J, std::numeric_limits::quiet_NaN()); + current_statement__ = 8; + y = context__.vals_r("y"); + current_statement__ = 9; + stan::math::validate_non_negative_index("sigma", "J", J); + current_statement__ = 10; + context__.validate_dims("data initialization", "sigma", "double", + std::vector{static_cast(J)}); + sigma = std::vector(J, + std::numeric_limits::quiet_NaN()); + current_statement__ = 10; + sigma = context__.vals_r("sigma"); + current_statement__ = 10; + stan::math::check_greater_or_equal(function__, "sigma", sigma, 0); + current_statement__ = 11; + stan::math::validate_non_negative_index("theta", "J", J); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + num_params_r__ = 1 + J + 1; + } + inline std::string model_name() const final { + return "expr_prop_fail2_model"; + } + inline std::vector model_compile_info() const noexcept { + return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", + "stancflags = --O1 --print-cpp"}; + } + 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__; + stan::io::deserializer in__(params_r__, params_i__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + static constexpr const char* function__ = + "expr_prop_fail2_model_namespace::log_prob"; + // suppress unused var warning + (void) function__; + try { + local_scalar_t__ mu; + current_statement__ = 1; + mu = in__.template read(); + std::vector theta; + current_statement__ = 2; + theta = in__.template read>(J); + local_scalar_t__ tau; + current_statement__ = 3; + tau = in__.template read_constrain_lb(0, + lp__); { - std::vector y_flat__; - current_statement__ = 50; - y_flat__ = context__.vals_i("y"); - current_statement__ = 50; - pos__ = 1; - current_statement__ = 50; - for (int sym1__ = 1; sym1__ <= n_occasions; ++sym1__) { - current_statement__ = 50; - for (int sym2__ = 1; sym2__ <= nind; ++sym2__) { - current_statement__ = 50; - stan::model::assign(y, y_flat__[(pos__ - 1)], - "assigning variable y", stan::model::index_uni(sym2__), - stan::model::index_uni(sym1__)); - current_statement__ = 50; - pos__ = (pos__ + 1); - } - } - } - current_statement__ = 50; - stan::math::check_greater_or_equal(function__, "y", y, 0); - current_statement__ = 50; - stan::math::check_less_or_equal(function__, "y", y, 1); - current_statement__ = 51; - n_occ_minus_1 = std::numeric_limits::min(); - current_statement__ = 51; - n_occ_minus_1 = (n_occasions - 1); - current_statement__ = 52; - stan::math::validate_non_negative_index("first", "nind", nind); - current_statement__ = 53; - first = std::vector(nind, std::numeric_limits::min()); - current_statement__ = 54; - stan::math::validate_non_negative_index("last", "nind", nind); - current_statement__ = 55; - last = std::vector(nind, std::numeric_limits::min()); - current_statement__ = 57; - for (int i = 1; i <= nind; ++i) { - current_statement__ = 56; - stan::model::assign(first, - first_capture( - stan::model::rvalue(y, "y", stan::model::index_uni(i)), pstream__), - "assigning variable first", stan::model::index_uni(i)); - } - current_statement__ = 59; - for (int i = 1; i <= nind; ++i) { - current_statement__ = 58; - stan::model::assign(last, - last_capture( - stan::model::rvalue(y, "y", stan::model::index_uni(i)), pstream__), - "assigning variable last", stan::model::index_uni(i)); + current_statement__ = 4; + lp_accum__.add(stan::math::normal_lpdf(theta, mu, tau)); + current_statement__ = 5; + lp_accum__.add(stan::math::normal_lpdf(y, theta, sigma)); } - current_statement__ = 53; - stan::math::check_greater_or_equal(function__, "first", first, 0); - current_statement__ = 53; - stan::math::check_less_or_equal(function__, "first", first, n_occasions); - current_statement__ = 55; - stan::math::check_greater_or_equal(function__, "last", last, 0); - current_statement__ = 55; - stan::math::check_less_or_equal(function__, "last", last, n_occasions); - current_statement__ = 60; - stan::math::validate_non_negative_index("epsilon", "nind", nind); - current_statement__ = 61; - stan::math::validate_non_negative_index("phi", "nind", nind); - current_statement__ = 62; - stan::math::validate_non_negative_index("phi", "n_occ_minus_1", - n_occ_minus_1); - current_statement__ = 63; - stan::math::validate_non_negative_index("p", "nind", nind); - current_statement__ = 64; - stan::math::validate_non_negative_index("p", "n_occ_minus_1", - n_occ_minus_1); - current_statement__ = 65; - stan::math::validate_non_negative_index("chi", "nind", nind); - current_statement__ = 66; - stan::math::validate_non_negative_index("chi", "n_occasions", - n_occasions); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } - num_params_r__ = 1 + 1 + nind + 1; - } - inline std::string model_name() const final { - return "expr_prop_fail5_model"; - } - inline std::vector model_compile_info() const noexcept { - return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", - "stancflags = --O1 --print-cpp"}; + lp_accum__.add(lp__); + return lp_accum__.sum(); } - 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__; + 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; 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; + // 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()); // suppress unused var warning (void) DUMMY_VAR__; + constexpr bool jacobian__ = false; static constexpr const char* function__ = - "expr_prop_fail5_model_namespace::log_prob"; + "expr_prop_fail2_model_namespace::write_array"; // suppress unused var warning (void) function__; try { - local_scalar_t__ mean_phi; + double mu; current_statement__ = 1; - mean_phi = in__.template read_constrain_lub(0, 1, lp__); - local_scalar_t__ mean_p; + mu = in__.template read(); + std::vector theta; current_statement__ = 2; - mean_p = in__.template read_constrain_lub(0, 1, lp__); - Eigen::Matrix epsilon; + theta = in__.template read>(J); + double tau; current_statement__ = 3; - epsilon = in__.template read< - Eigen::Matrix>(nind); - local_scalar_t__ sigma; - current_statement__ = 4; - sigma = in__.template read_constrain_lub(0, 5, lp__); - Eigen::Matrix phi = - Eigen::Matrix::Constant(nind, n_occ_minus_1, - DUMMY_VAR__); - Eigen::Matrix p = - Eigen::Matrix::Constant(nind, n_occ_minus_1, - DUMMY_VAR__); - Eigen::Matrix chi = - Eigen::Matrix::Constant(nind, n_occasions, - DUMMY_VAR__); - local_scalar_t__ mu; - current_statement__ = 9; - mu = stan::math::logit(mean_phi); - current_statement__ = 19; - for (int i = 1; i <= nind; ++i) { - current_statement__ = 13; - for (int t = 1; t <= - (stan::model::rvalue(first, "first", stan::model::index_uni(i)) - - 1); ++t) { - current_statement__ = 10; - stan::model::assign(phi, 0, "assigning variable phi", - stan::model::index_uni(i), stan::model::index_uni(t)); - current_statement__ = 11; - stan::model::assign(p, 0, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(t)); - } - current_statement__ = 17; - for (int t = - stan::model::rvalue(first, "first", stan::model::index_uni(i)); t - <= n_occ_minus_1; ++t) { - current_statement__ = 14; - stan::model::assign(phi, - stan::math::inv_logit((mu + - stan::model::rvalue(epsilon, "epsilon", - stan::model::index_uni(i)))), "assigning variable phi", - stan::model::index_uni(i), stan::model::index_uni(t)); - current_statement__ = 15; - stan::model::assign(p, mean_p, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(t)); - } + tau = in__.template read_constrain_lb(0, + lp__); + out__.write(mu); + out__.write(theta); + out__.write(tau); + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { + return ; } - Eigen::Matrix - inline_prob_uncaptured_return_sym8__; - { - current_statement__ = 20; - stan::math::validate_non_negative_index("chi", "nind", nind); - current_statement__ = 21; - stan::math::validate_non_negative_index("chi", "n_occasions", - n_occasions); - Eigen::Matrix - inline_prob_uncaptured_chi_sym9__ = - Eigen::Matrix::Constant(nind, n_occasions, - DUMMY_VAR__); - current_statement__ = 32; - for (int inline_prob_uncaptured_i_sym13__ = 1; inline_prob_uncaptured_i_sym13__ - <= nind; ++inline_prob_uncaptured_i_sym13__) { - current_statement__ = 23; - stan::model::assign(inline_prob_uncaptured_chi_sym9__, 1.0, - "assigning variable inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni(n_occasions)); - current_statement__ = 30; - for (int inline_prob_uncaptured_t_sym12__ = 1; inline_prob_uncaptured_t_sym12__ - <= (n_occasions - 1); ++inline_prob_uncaptured_t_sym12__) { - int inline_prob_uncaptured_t_curr_sym10__ = - std::numeric_limits::min(); - int inline_prob_uncaptured_t_next_sym11__ = - std::numeric_limits::min(); - current_statement__ = 26; - inline_prob_uncaptured_t_curr_sym10__ = (n_occasions - - inline_prob_uncaptured_t_sym12__); - current_statement__ = 27; - inline_prob_uncaptured_t_next_sym11__ = (inline_prob_uncaptured_t_curr_sym10__ - + 1); - current_statement__ = 28; - stan::model::assign(inline_prob_uncaptured_chi_sym9__, - stan::math::fma( - (stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni( - inline_prob_uncaptured_t_curr_sym10__)) * (1 - - stan::model::rvalue(p, "p", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni( - (inline_prob_uncaptured_t_next_sym11__ - 1))))), - stan::model::rvalue(inline_prob_uncaptured_chi_sym9__, - "inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni( - inline_prob_uncaptured_t_next_sym11__)), (1 - - stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni( - inline_prob_uncaptured_t_curr_sym10__)))), - "assigning variable inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni(inline_prob_uncaptured_t_curr_sym10__)); - } - } - current_statement__ = 33; - stan::model::assign(inline_prob_uncaptured_return_sym8__, - inline_prob_uncaptured_chi_sym9__, - "assigning variable inline_prob_uncaptured_return_sym8__"); + if (stan::math::logical_negation(emit_generated_quantities__)) { + return ; } - stan::model::assign(chi, inline_prob_uncaptured_return_sym8__, - "assigning variable chi"); - current_statement__ = 5; - stan::math::check_greater_or_equal(function__, "phi", phi, 0); - current_statement__ = 5; - stan::math::check_less_or_equal(function__, "phi", phi, 1); - current_statement__ = 6; - stan::math::check_greater_or_equal(function__, "p", p, 0); - current_statement__ = 6; - stan::math::check_less_or_equal(function__, "p", p, 1); - current_statement__ = 7; - stan::math::check_greater_or_equal(function__, "chi", chi, 0); - current_statement__ = 7; - stan::math::check_less_or_equal(function__, "chi", chi, 1); - { - current_statement__ = 36; - lp_accum__.add(stan::math::normal_lpdf(epsilon, 0, sigma)); - current_statement__ = 45; - for (int i = 1; i <= nind; ++i) { - current_statement__ = 43; - if (stan::math::logical_gt( - stan::model::rvalue(first, "first", stan::model::index_uni(i)), - 0)) { - current_statement__ = 40; - for (int t = - (stan::model::rvalue(first, "first", - stan::model::index_uni(i)) + 1); t <= - stan::model::rvalue(last, "last", stan::model::index_uni(i)); ++t) { - current_statement__ = 37; - lp_accum__.add(stan::math::bernoulli_lpmf(1, - stan::model::rvalue(phi, "phi", - stan::model::index_uni(i), - stan::model::index_uni((t - 1))))); - current_statement__ = 38; - lp_accum__.add(stan::math::bernoulli_lpmf( - stan::model::rvalue(y, "y", - stan::model::index_uni(i), - stan::model::index_uni(t)), - stan::model::rvalue(p, "p", - stan::model::index_uni(i), - stan::model::index_uni((t - 1))))); - } - current_statement__ = 41; - lp_accum__.add(stan::math::bernoulli_lpmf(1, - stan::model::rvalue(chi, "chi", - stan::model::index_uni(i), - stan::model::index_uni( - stan::model::rvalue(last, "last", - stan::model::index_uni(i)))))); - } - } - } - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); - } - lp_accum__.add(lp__); - return lp_accum__.sum(); - } - 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; - 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; - // 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()); - // suppress unused var warning - (void) DUMMY_VAR__; - constexpr bool jacobian__ = false; - static constexpr const char* function__ = - "expr_prop_fail5_model_namespace::write_array"; - // suppress unused var warning - (void) function__; - try { - double mean_phi; - current_statement__ = 1; - mean_phi = in__.template read_constrain_lub(0, 1, lp__); - double mean_p; - current_statement__ = 2; - mean_p = in__.template read_constrain_lub(0, 1, lp__); - Eigen::Matrix epsilon; - current_statement__ = 3; - epsilon = in__.template read< - Eigen::Matrix>(nind); - double sigma; - current_statement__ = 4; - sigma = in__.template read_constrain_lub(0, 5, lp__); - Eigen::Matrix phi = - Eigen::Matrix::Constant(nind, n_occ_minus_1, - std::numeric_limits::quiet_NaN()); - Eigen::Matrix p = - Eigen::Matrix::Constant(nind, n_occ_minus_1, - std::numeric_limits::quiet_NaN()); - Eigen::Matrix chi = - Eigen::Matrix::Constant(nind, n_occasions, - std::numeric_limits::quiet_NaN()); - double mu = std::numeric_limits::quiet_NaN(); - out__.write(mean_phi); - out__.write(mean_p); - out__.write(epsilon); - out__.write(sigma); - if (stan::math::logical_negation( - (stan::math::primitive_value(emit_transformed_parameters__) || - stan::math::primitive_value(emit_generated_quantities__)))) { - return ; - } - current_statement__ = 9; - mu = stan::math::logit(mean_phi); - current_statement__ = 19; - for (int i = 1; i <= nind; ++i) { - current_statement__ = 13; - for (int t = 1; t <= - (stan::model::rvalue(first, "first", stan::model::index_uni(i)) - - 1); ++t) { - current_statement__ = 10; - stan::model::assign(phi, 0, "assigning variable phi", - stan::model::index_uni(i), stan::model::index_uni(t)); - current_statement__ = 11; - stan::model::assign(p, 0, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(t)); - } - current_statement__ = 17; - for (int t = - stan::model::rvalue(first, "first", stan::model::index_uni(i)); t - <= n_occ_minus_1; ++t) { - current_statement__ = 14; - stan::model::assign(phi, - stan::math::inv_logit((mu + - stan::model::rvalue(epsilon, "epsilon", - stan::model::index_uni(i)))), "assigning variable phi", - stan::model::index_uni(i), stan::model::index_uni(t)); - current_statement__ = 15; - stan::model::assign(p, mean_p, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(t)); - } - } - Eigen::Matrix inline_prob_uncaptured_return_sym1__; - { - current_statement__ = 20; - stan::math::validate_non_negative_index("chi", "nind", nind); - current_statement__ = 21; - stan::math::validate_non_negative_index("chi", "n_occasions", - n_occasions); - Eigen::Matrix - inline_prob_uncaptured_chi_sym2__ = - Eigen::Matrix::Constant(nind, n_occasions, - DUMMY_VAR__); - current_statement__ = 32; - for (int inline_prob_uncaptured_i_sym6__ = 1; inline_prob_uncaptured_i_sym6__ - <= nind; ++inline_prob_uncaptured_i_sym6__) { - current_statement__ = 23; - stan::model::assign(inline_prob_uncaptured_chi_sym2__, 1.0, - "assigning variable inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(n_occasions)); - current_statement__ = 30; - for (int inline_prob_uncaptured_t_sym5__ = 1; inline_prob_uncaptured_t_sym5__ - <= (n_occasions - 1); ++inline_prob_uncaptured_t_sym5__) { - int inline_prob_uncaptured_t_curr_sym3__ = - std::numeric_limits::min(); - int inline_prob_uncaptured_t_next_sym4__ = - std::numeric_limits::min(); - current_statement__ = 26; - inline_prob_uncaptured_t_curr_sym3__ = (n_occasions - - inline_prob_uncaptured_t_sym5__); - current_statement__ = 27; - inline_prob_uncaptured_t_next_sym4__ = (inline_prob_uncaptured_t_curr_sym3__ - + 1); - current_statement__ = 28; - stan::model::assign(inline_prob_uncaptured_chi_sym2__, - stan::math::fma( - (stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni( - inline_prob_uncaptured_t_curr_sym3__)) * (1 - - stan::model::rvalue(p, "p", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni( - (inline_prob_uncaptured_t_next_sym4__ - 1))))), - stan::model::rvalue(inline_prob_uncaptured_chi_sym2__, - "inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(inline_prob_uncaptured_t_next_sym4__)), - (1 - - stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(inline_prob_uncaptured_t_curr_sym3__)))), - "assigning variable inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(inline_prob_uncaptured_t_curr_sym3__)); - } - } - current_statement__ = 33; - stan::model::assign(inline_prob_uncaptured_return_sym1__, - inline_prob_uncaptured_chi_sym2__, - "assigning variable inline_prob_uncaptured_return_sym1__"); - } - stan::model::assign(chi, inline_prob_uncaptured_return_sym1__, - "assigning variable chi"); - current_statement__ = 5; - stan::math::check_greater_or_equal(function__, "phi", phi, 0); - current_statement__ = 5; - stan::math::check_less_or_equal(function__, "phi", phi, 1); - current_statement__ = 6; - stan::math::check_greater_or_equal(function__, "p", p, 0); - current_statement__ = 6; - stan::math::check_less_or_equal(function__, "p", p, 1); - current_statement__ = 7; - stan::math::check_greater_or_equal(function__, "chi", chi, 0); - current_statement__ = 7; - stan::math::check_less_or_equal(function__, "chi", chi, 1); - if (emit_transformed_parameters__) { - out__.write(phi); - out__.write(p); - out__.write(chi); - out__.write(mu); - } - if (stan::math::logical_negation(emit_generated_quantities__)) { - return ; - } - double sigma2; - current_statement__ = 35; - sigma2 = stan::math::square(sigma); - current_statement__ = 34; - stan::math::check_greater_or_equal(function__, "sigma2", sigma2, 0); - out__.write(sigma2); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } @@ -6522,120 +4480,61 @@ class expr_prop_fail5_model final : public model_base_crtp(); - out__.write_free_lub(0, 1, mean_phi); - local_scalar_t__ mean_p; - mean_p = in__.read(); - out__.write_free_lub(0, 1, mean_p); - Eigen::Matrix epsilon = - Eigen::Matrix::Constant(nind, DUMMY_VAR__); - for (int sym1__ = 1; sym1__ <= nind; ++sym1__) { - stan::model::assign(epsilon, in__.read(), - "assigning variable epsilon", stan::model::index_uni(sym1__)); + local_scalar_t__ mu; + mu = in__.read(); + out__.write(mu); + std::vector theta = + std::vector(J, DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= J; ++sym1__) { + theta[(sym1__ - 1)] = in__.read(); } - out__.write(epsilon); - local_scalar_t__ sigma; - sigma = in__.read(); - out__.write_free_lub(0, 5, sigma); + out__.write(theta); + local_scalar_t__ tau; + tau = in__.read(); + out__.write_free_lb(0, tau); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } inline void get_param_names(std::vector& names__) const { - names__ = std::vector{"mean_phi", "mean_p", "epsilon", - "sigma", "phi", "p", "chi", "mu", "sigma2"}; + names__ = std::vector{"mu", "theta", "tau"}; } inline void get_dims(std::vector>& dimss__) const { dimss__ = std::vector>{std::vector{}, - std::vector{}, - std::vector{static_cast(nind)}, - std::vector{}, - std::vector{static_cast(nind), - static_cast(n_occ_minus_1)}, - std::vector{static_cast(nind), - static_cast(n_occ_minus_1)}, - std::vector{static_cast(nind), - static_cast(n_occasions)}, std::vector{}, + std::vector{static_cast(J)}, std::vector{}}; } inline void constrained_param_names(std::vector& param_names__, bool emit_transformed_parameters__ = true, bool emit_generated_quantities__ = true) const final { - param_names__.emplace_back(std::string() + "mean_phi"); - param_names__.emplace_back(std::string() + "mean_p"); - for (int sym15__ = 1; sym15__ <= nind; ++sym15__) { - param_names__.emplace_back(std::string() + "epsilon" + '.' + - std::to_string(sym15__)); - } - param_names__.emplace_back(std::string() + "sigma"); - if (emit_transformed_parameters__) { - for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { - for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { - param_names__.emplace_back(std::string() + "phi" + '.' + - std::to_string(sym16__) + '.' + std::to_string(sym15__)); - } - } - for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { - for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { - param_names__.emplace_back(std::string() + "p" + '.' + - std::to_string(sym16__) + '.' + std::to_string(sym15__)); - } - } - for (int sym15__ = 1; sym15__ <= n_occasions; ++sym15__) { - for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { - param_names__.emplace_back(std::string() + "chi" + '.' + - std::to_string(sym16__) + '.' + std::to_string(sym15__)); - } - } - param_names__.emplace_back(std::string() + "mu"); - } - if (emit_generated_quantities__) { - param_names__.emplace_back(std::string() + "sigma2"); + param_names__.emplace_back(std::string() + "mu"); + for (int sym1__ = 1; sym1__ <= J; ++sym1__) { + param_names__.emplace_back(std::string() + "theta" + '.' + + std::to_string(sym1__)); } + param_names__.emplace_back(std::string() + "tau"); + if (emit_transformed_parameters__) {} + 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 { - param_names__.emplace_back(std::string() + "mean_phi"); - param_names__.emplace_back(std::string() + "mean_p"); - for (int sym15__ = 1; sym15__ <= nind; ++sym15__) { - param_names__.emplace_back(std::string() + "epsilon" + '.' + - std::to_string(sym15__)); - } - param_names__.emplace_back(std::string() + "sigma"); - if (emit_transformed_parameters__) { - for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { - for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { - param_names__.emplace_back(std::string() + "phi" + '.' + - std::to_string(sym16__) + '.' + std::to_string(sym15__)); - } - } - for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { - for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { - param_names__.emplace_back(std::string() + "p" + '.' + - std::to_string(sym16__) + '.' + std::to_string(sym15__)); - } - } - for (int sym15__ = 1; sym15__ <= n_occasions; ++sym15__) { - for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { - param_names__.emplace_back(std::string() + "chi" + '.' + - std::to_string(sym16__) + '.' + std::to_string(sym15__)); - } - } - param_names__.emplace_back(std::string() + "mu"); - } - if (emit_generated_quantities__) { - param_names__.emplace_back(std::string() + "sigma2"); + param_names__.emplace_back(std::string() + "mu"); + for (int sym1__ = 1; sym1__ <= J; ++sym1__) { + param_names__.emplace_back(std::string() + "theta" + '.' + + std::to_string(sym1__)); } + param_names__.emplace_back(std::string() + "tau"); + if (emit_transformed_parameters__) {} + if (emit_generated_quantities__) {} } inline std::string get_constrained_sizedtypes() const { - return std::string("[{\"name\":\"mean_phi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"epsilon\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(nind) + "},\"block\":\"parameters\"},{\"name\":\"sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"},{\"name\":\"mu\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"sigma2\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"}]"); + return std::string("[{\"name\":\"mu\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"theta\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(J) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"tau\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"}]"); } inline std::string get_unconstrained_sizedtypes() const { - return std::string("[{\"name\":\"mean_phi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"epsilon\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(nind) + "},\"block\":\"parameters\"},{\"name\":\"sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"},{\"name\":\"mu\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"sigma2\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"}]"); + return std::string("[{\"name\":\"mu\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"theta\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(J) + ",\"element_type\":{\"name\":\"real\"}},\"block\":\"parameters\"},{\"name\":\"tau\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"}]"); } // Begin method overload boilerplate template inline void @@ -6644,10 +4543,9 @@ class expr_prop_fail5_model final : public model_base_crtp params_i; @@ -6662,10 +4560,9 @@ class expr_prop_fail5_model final : public model_base_crtp(num_to_write, @@ -6697,9 +4594,8 @@ class expr_prop_fail5_model final : public model_base_crtp& params_i, std::vector& vars, std::ostream* pstream__ = nullptr) const { - constexpr std::array - names__{"mean_phi", "mean_p", "epsilon", "sigma"}; - const std::array constrain_param_sizes__{1, 1, nind, 1}; + constexpr std::array names__{"mu", "theta", "tau"}; + const std::array constrain_param_sizes__{1, J, 1}; const auto num_constrained_params__ = std::accumulate(constrain_param_sizes__.begin(), constrain_param_sizes__.end(), 0); @@ -6719,7 +4615,7 @@ class expr_prop_fail5_model final : public model_base_crtp -namespace expr_prop_fail6_model_namespace { +namespace expr_prop_fail3_model_namespace { using stan::model::model_base_crtp; using namespace stan::math; stan::math::profile_map profiles__; -static constexpr std::array locations_array__ = +static constexpr std::array locations_array__ = {" (found before start of program)", - " (in 'expr-prop-fail6.stan', line 160, column 2 to column 34)", - " (in 'expr-prop-fail6.stan', line 161, column 2 to column 32)", - " (in 'expr-prop-fail6.stan', line 162, column 2 to column 29)", - " (in 'expr-prop-fail6.stan', line 163, column 2 to column 36)", - " (in 'expr-prop-fail6.stan', line 164, column 2 to column 20)", - " (in 'expr-prop-fail6.stan', line 165, column 2 to column 31)", - " (in 'expr-prop-fail6.stan', line 170, column 2 to column 51)", - " (in 'expr-prop-fail6.stan', line 171, column 2 to column 45)", - " (in 'expr-prop-fail6.stan', line 172, column 2 to column 25)", - " (in 'expr-prop-fail6.stan', line 173, column 2 to column 43)", - " (in 'expr-prop-fail6.stan', line 174, column 2 to column 47)", - " (in 'expr-prop-fail6.stan', line 177, column 2 to column 49)", - " (in 'expr-prop-fail6.stan', line 179, column 4 to column 51)", - " (in 'expr-prop-fail6.stan', line 178, column 2 to line 179, column 51)", - " (in 'expr-prop-fail6.stan', line 183, column 2 to column 23)", - " (in 'expr-prop-fail6.stan', line 187, column 4 to column 22)", - " (in 'expr-prop-fail6.stan', line 189, column 4 to column 17)", - " (in 'expr-prop-fail6.stan', line 191, column 6 to column 35)", - " (in 'expr-prop-fail6.stan', line 192, column 6 to column 27)", - " (in 'expr-prop-fail6.stan', line 190, column 37 to line 193, column 5)", - " (in 'expr-prop-fail6.stan', line 190, column 4 to line 193, column 5)", - " (in 'expr-prop-fail6.stan', line 194, column 4 to column 26)", - " (in 'expr-prop-fail6.stan', line 186, column 2 to line 195, column 3)", - " (in 'expr-prop-fail6.stan', line 49, column 4 to column 24)", - " (in 'expr-prop-fail6.stan', line 50, column 4 to column 30)", - " (in 'expr-prop-fail6.stan', line 51, column 11 to column 16)", - " (in 'expr-prop-fail6.stan', line 51, column 18 to column 29)", - " (in 'expr-prop-fail6.stan', line 51, column 4 to column 35)", - " (in 'expr-prop-fail6.stan', line 54, column 6 to column 32)", - " (in 'expr-prop-fail6.stan', line 56, column 8 to column 37)", - " (in 'expr-prop-fail6.stan', line 57, column 8 to column 32)", - " (in 'expr-prop-fail6.stan', line 59, column 8 to line 61, column 44)", - " (in 'expr-prop-fail6.stan', line 55, column 39 to line 62, column 7)", - " (in 'expr-prop-fail6.stan', line 55, column 6 to line 62, column 7)", - " (in 'expr-prop-fail6.stan', line 53, column 25 to line 63, column 5)", - " (in 'expr-prop-fail6.stan', line 53, column 4 to line 63, column 5)", - " (in 'expr-prop-fail6.stan', line 64, column 4 to column 15)", - " (in 'expr-prop-fail6.stan', line 212, column 2 to column 23)", - " (in 'expr-prop-fail6.stan', line 213, column 2 to column 22)", - " (in 'expr-prop-fail6.stan', line 214, column 2 to column 36)", - " (in 'expr-prop-fail6.stan', line 215, column 2 to column 36)", - " (in 'expr-prop-fail6.stan', line 216, column 2 to column 48)", - " (in 'expr-prop-fail6.stan', line 218, column 2 to column 25)", - " (in 'expr-prop-fail6.stan', line 222, column 4 to column 14)", - " (in 'expr-prop-fail6.stan', line 232, column 6 to column 44)", - " (in 'expr-prop-fail6.stan', line 230, column 11 to line 233, column 5)", - " (in 'expr-prop-fail6.stan', line 225, column 6 to column 37)", - " (in 'expr-prop-fail6.stan', line 227, column 8 to column 34)", - " (in 'expr-prop-fail6.stan', line 228, column 8 to column 73)", - " (in 'expr-prop-fail6.stan', line 226, column 33 to line 229, column 7)", - " (in 'expr-prop-fail6.stan', line 226, column 6 to line 229, column 7)", - " (in 'expr-prop-fail6.stan', line 223, column 28 to line 230, column 5)", - " (in 'expr-prop-fail6.stan', line 223, column 4 to line 233, column 5)", - " (in 'expr-prop-fail6.stan', line 221, column 19 to line 234, column 3)", - " (in 'expr-prop-fail6.stan', line 221, column 2 to line 234, column 3)", - " (in 'expr-prop-fail6.stan', line 238, column 10 to column 11)", - " (in 'expr-prop-fail6.stan', line 238, column 13 to column 24)", - " (in 'expr-prop-fail6.stan', line 238, column 4 to column 69)", - " (in 'expr-prop-fail6.stan', line 239, column 10 to column 11)", - " (in 'expr-prop-fail6.stan', line 239, column 4 to column 22)", - " (in 'expr-prop-fail6.stan', line 240, column 10 to column 11)", - " (in 'expr-prop-fail6.stan', line 240, column 4 to column 24)", - " (in 'expr-prop-fail6.stan', line 243, column 6 to column 39)", - " (in 'expr-prop-fail6.stan', line 17, column 8 to column 17)", - " (in 'expr-prop-fail6.stan', line 16, column 6 to line 17, column 17)", - " (in 'expr-prop-fail6.stan', line 14, column 37 to line 19, column 3)", - " (in 'expr-prop-fail6.stan', line 246, column 8 to column 26)", - " (in 'expr-prop-fail6.stan', line 245, column 6 to line 246, column 26)", - " (in 'expr-prop-fail6.stan', line 242, column 21 to line 247, column 5)", - " (in 'expr-prop-fail6.stan', line 242, column 4 to line 247, column 5)", - " (in 'expr-prop-fail6.stan', line 249, column 6 to column 28)", - " (in 'expr-prop-fail6.stan', line 250, column 6 to column 34)", - " (in 'expr-prop-fail6.stan', line 248, column 31 to line 251, column 5)", - " (in 'expr-prop-fail6.stan', line 248, column 4 to line 251, column 5)", - " (in 'expr-prop-fail6.stan', line 253, column 6 to column 26)", - " (in 'expr-prop-fail6.stan', line 254, column 6 to column 32)", - " (in 'expr-prop-fail6.stan', line 252, column 21 to line 255, column 5)", - " (in 'expr-prop-fail6.stan', line 252, column 4 to line 255, column 5)", - " (in 'expr-prop-fail6.stan', line 256, column 4 to column 25)", - " (in 'expr-prop-fail6.stan', line 237, column 2 to line 257, column 3)", - " (in 'expr-prop-fail6.stan', line 205, column 2 to column 29)", - " (in 'expr-prop-fail6.stan', line 206, column 2 to column 21)", - " (in 'expr-prop-fail6.stan', line 82, column 4 to column 27)", - " (in 'expr-prop-fail6.stan', line 83, column 4 to column 33)", - " (in 'expr-prop-fail6.stan', line 84, column 11 to column 22)", - " (in 'expr-prop-fail6.stan', line 84, column 4 to column 39)", - " (in 'expr-prop-fail6.stan', line 87, column 13 to column 24)", - " (in 'expr-prop-fail6.stan', line 87, column 6 to column 43)", - " (in 'expr-prop-fail6.stan', line 127, column 15 to column 30)", - " (in 'expr-prop-fail6.stan', line 127, column 8 to column 35)", - " (in 'expr-prop-fail6.stan', line 130, column 8 to line 131, column 78)", - " (in 'expr-prop-fail6.stan', line 134, column 10 to line 137, column 50)", - " (in 'expr-prop-fail6.stan', line 133, column 8 to line 137, column 50)", - " (in 'expr-prop-fail6.stan', line 139, column 8 to column 54)", - " (in 'expr-prop-fail6.stan', line 140, column 8 to column 34)", - " (in 'expr-prop-fail6.stan', line 125, column 13 to line 141, column 7)", - " (in 'expr-prop-fail6.stan', line 92, column 8 to column 27)", - " (in 'expr-prop-fail6.stan', line 99, column 17 to column 25)", - " (in 'expr-prop-fail6.stan', line 99, column 10 to column 30)", - " (in 'expr-prop-fail6.stan', line 102, column 10 to line 105, column 55)", - " (in 'expr-prop-fail6.stan', line 108, column 12 to line 112, column 57)", - " (in 'expr-prop-fail6.stan', line 107, column 10 to line 112, column 57)", - " (in 'expr-prop-fail6.stan', line 113, column 10 to line 115, column 62)", - " (in 'expr-prop-fail6.stan', line 116, column 10 to column 36)", - " (in 'expr-prop-fail6.stan', line 97, column 15 to line 117, column 9)", - " (in 'expr-prop-fail6.stan', line 96, column 10 to column 41)", - " (in 'expr-prop-fail6.stan', line 95, column 27 to line 97, column 9)", - " (in 'expr-prop-fail6.stan', line 95, column 8 to line 117, column 9)", - " (in 'expr-prop-fail6.stan', line 120, column 10 to column 39)", - " (in 'expr-prop-fail6.stan', line 121, column 10 to column 39)", - " (in 'expr-prop-fail6.stan', line 119, column 44 to line 122, column 9)", - " (in 'expr-prop-fail6.stan', line 119, column 8 to line 122, column 9)", - " (in 'expr-prop-fail6.stan', line 124, column 8 to column 39)", - " (in 'expr-prop-fail6.stan', line 89, column 20 to line 125, column 7)", - " (in 'expr-prop-fail6.stan', line 89, column 6 to line 141, column 7)", - " (in 'expr-prop-fail6.stan', line 86, column 25 to line 142, column 5)", - " (in 'expr-prop-fail6.stan', line 86, column 4 to line 142, column 5)", - " (in 'expr-prop-fail6.stan', line 209, column 2 to column 52)", - " (in 'expr-prop-fail6.stan', line 146, column 2 to column 17)", - " (in 'expr-prop-fail6.stan', line 147, column 2 to column 27)", - " (in 'expr-prop-fail6.stan', line 148, column 8 to column 9)", - " (in 'expr-prop-fail6.stan', line 148, column 11 to column 22)", - " (in 'expr-prop-fail6.stan', line 148, column 2 to column 48)", - " (in 'expr-prop-fail6.stan', line 151, column 8 to column 9)", - " (in 'expr-prop-fail6.stan', line 151, column 2 to column 49)", - " (in 'expr-prop-fail6.stan', line 152, column 8 to column 9)", - " (in 'expr-prop-fail6.stan', line 152, column 2 to column 48)", - " (in 'expr-prop-fail6.stan', line 155, column 4 to column 35)", - " (in 'expr-prop-fail6.stan', line 154, column 2 to line 155, column 35)", - " (in 'expr-prop-fail6.stan', line 157, column 4 to column 33)", - " (in 'expr-prop-fail6.stan', line 156, column 2 to line 157, column 33)", - " (in 'expr-prop-fail6.stan', line 163, column 18 to column 29)", + " (in 'expr-prop-fail3.stan', line 19, column 2 to column 18)", + " (in 'expr-prop-fail3.stan', line 20, column 2 to column 18)", + " (in 'expr-prop-fail3.stan', line 21, column 2 to column 22)", + " (in 'expr-prop-fail3.stan', line 22, column 2 to column 20)", + " (in 'expr-prop-fail3.stan', line 23, column 2 to column 26)", + " (in 'expr-prop-fail3.stan', line 24, column 2 to column 17)", + " (in 'expr-prop-fail3.stan', line 25, column 2 to column 35)", + " (in 'expr-prop-fail3.stan', line 26, column 2 to column 35)", + " (in 'expr-prop-fail3.stan', line 27, column 2 to column 35)", + " (in 'expr-prop-fail3.stan', line 28, column 2 to column 35)", + " (in 'expr-prop-fail3.stan', line 29, column 2 to column 35)", + " (in 'expr-prop-fail3.stan', line 32, column 2 to column 18)", + " (in 'expr-prop-fail3.stan', line 35, column 4 to line 38, column 35)", + " (in 'expr-prop-fail3.stan', line 34, column 2 to line 38, column 35)", + " (in 'expr-prop-fail3.stan', line 41, column 2 to column 25)", + " (in 'expr-prop-fail3.stan', line 42, column 2 to column 25)", + " (in 'expr-prop-fail3.stan', line 43, column 2 to column 25)", + " (in 'expr-prop-fail3.stan', line 44, column 2 to column 25)", + " (in 'expr-prop-fail3.stan', line 45, column 2 to column 25)", + " (in 'expr-prop-fail3.stan', line 46, column 2 to column 24)", + " (in 'expr-prop-fail3.stan', line 47, column 2 to column 29)", + " (in 'expr-prop-fail3.stan', line 2, column 2 to column 17)", + " (in 'expr-prop-fail3.stan', line 3, column 2 to column 21)", + " (in 'expr-prop-fail3.stan', line 4, column 2 to column 25)", + " (in 'expr-prop-fail3.stan', line 5, column 2 to column 21)", + " (in 'expr-prop-fail3.stan', line 6, column 2 to column 29)", + " (in 'expr-prop-fail3.stan', line 7, column 2 to column 23)", + " (in 'expr-prop-fail3.stan', line 8, column 8 to column 9)", + " (in 'expr-prop-fail3.stan', line 8, column 2 to column 41)", + " (in 'expr-prop-fail3.stan', line 9, column 8 to column 9)", + " (in 'expr-prop-fail3.stan', line 9, column 2 to column 49)", + " (in 'expr-prop-fail3.stan', line 10, column 27 to column 28)", + " (in 'expr-prop-fail3.stan', line 10, column 2 to column 36)", + " (in 'expr-prop-fail3.stan', line 11, column 8 to column 9)", + " (in 'expr-prop-fail3.stan', line 11, column 2 to column 41)", + " (in 'expr-prop-fail3.stan', line 12, column 27 to column 28)", + " (in 'expr-prop-fail3.stan', line 12, column 2 to column 37)", + " (in 'expr-prop-fail3.stan', line 13, column 8 to column 9)", + " (in 'expr-prop-fail3.stan', line 13, column 2 to column 57)", + " (in 'expr-prop-fail3.stan', line 14, column 8 to column 9)", + " (in 'expr-prop-fail3.stan', line 14, column 2 to column 45)", + " (in 'expr-prop-fail3.stan', line 15, column 9 to column 10)", + " (in 'expr-prop-fail3.stan', line 15, column 2 to column 24)", + " (in 'expr-prop-fail3.stan', line 16, column 8 to column 9)", + " (in 'expr-prop-fail3.stan', line 16, column 2 to column 35)", + " (in 'expr-prop-fail3.stan', line 19, column 9 to column 14)", + " (in 'expr-prop-fail3.stan', line 20, column 9 to column 14)", + " (in 'expr-prop-fail3.stan', line 21, column 9 to column 18)", + " (in 'expr-prop-fail3.stan', line 22, column 9 to column 16)", + " (in 'expr-prop-fail3.stan', line 23, column 9 to column 22)", + " (in 'expr-prop-fail3.stan', line 32, column 9 to column 10)"}; +class expr_prop_fail3_model final : public model_base_crtp { + private: + int N; + int n_age; + int n_age_edu; + int n_edu; + int n_region_full; + int n_state; + std::vector age; + std::vector age_edu; + Eigen::Matrix black_data__; + std::vector edu; + Eigen::Matrix female_data__; + std::vector region_full; + std::vector state; + Eigen::Matrix v_prev_full_data__; + std::vector y; + Eigen::Map> black{nullptr, 0}; + Eigen::Map> female{nullptr, 0}; + Eigen::Map> v_prev_full{nullptr, 0}; + public: + ~expr_prop_fail3_model() {} + expr_prop_fail3_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__ = + "expr_prop_fail3_model_namespace::expr_prop_fail3_model"; + // suppress unused var warning + (void) function__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + int pos__; + pos__ = 1; + current_statement__ = 22; + context__.validate_dims("data initialization", "N", "int", + std::vector{}); + N = std::numeric_limits::min(); + current_statement__ = 22; + N = context__.vals_i("N")[(1 - 1)]; + current_statement__ = 22; + stan::math::check_greater_or_equal(function__, "N", N, 0); + current_statement__ = 23; + context__.validate_dims("data initialization", "n_age", "int", + std::vector{}); + n_age = std::numeric_limits::min(); + current_statement__ = 23; + n_age = context__.vals_i("n_age")[(1 - 1)]; + current_statement__ = 23; + stan::math::check_greater_or_equal(function__, "n_age", n_age, 0); + current_statement__ = 24; + context__.validate_dims("data initialization", "n_age_edu", "int", + std::vector{}); + n_age_edu = std::numeric_limits::min(); + current_statement__ = 24; + n_age_edu = context__.vals_i("n_age_edu")[(1 - 1)]; + current_statement__ = 24; + stan::math::check_greater_or_equal(function__, "n_age_edu", n_age_edu, + 0); + current_statement__ = 25; + context__.validate_dims("data initialization", "n_edu", "int", + std::vector{}); + n_edu = std::numeric_limits::min(); + current_statement__ = 25; + n_edu = context__.vals_i("n_edu")[(1 - 1)]; + current_statement__ = 25; + stan::math::check_greater_or_equal(function__, "n_edu", n_edu, 0); + current_statement__ = 26; + context__.validate_dims("data initialization", "n_region_full", "int", + std::vector{}); + n_region_full = std::numeric_limits::min(); + current_statement__ = 26; + n_region_full = context__.vals_i("n_region_full")[(1 - 1)]; + current_statement__ = 26; + stan::math::check_greater_or_equal(function__, "n_region_full", + n_region_full, 0); + current_statement__ = 27; + context__.validate_dims("data initialization", "n_state", "int", + std::vector{}); + n_state = std::numeric_limits::min(); + current_statement__ = 27; + n_state = context__.vals_i("n_state")[(1 - 1)]; + current_statement__ = 27; + stan::math::check_greater_or_equal(function__, "n_state", n_state, 0); + current_statement__ = 28; + stan::math::validate_non_negative_index("age", "N", N); + current_statement__ = 29; + context__.validate_dims("data initialization", "age", "int", + std::vector{static_cast(N)}); + age = std::vector(N, std::numeric_limits::min()); + current_statement__ = 29; + age = context__.vals_i("age"); + current_statement__ = 29; + stan::math::check_greater_or_equal(function__, "age", age, 0); + current_statement__ = 29; + stan::math::check_less_or_equal(function__, "age", age, n_age); + current_statement__ = 30; + stan::math::validate_non_negative_index("age_edu", "N", N); + current_statement__ = 31; + context__.validate_dims("data initialization", "age_edu", "int", + std::vector{static_cast(N)}); + age_edu = std::vector(N, std::numeric_limits::min()); + current_statement__ = 31; + age_edu = context__.vals_i("age_edu"); + current_statement__ = 31; + stan::math::check_greater_or_equal(function__, "age_edu", age_edu, 0); + current_statement__ = 31; + stan::math::check_less_or_equal(function__, "age_edu", age_edu, + n_age_edu); + current_statement__ = 32; + stan::math::validate_non_negative_index("black", "N", N); + current_statement__ = 33; + context__.validate_dims("data initialization", "black", "double", + std::vector{static_cast(N)}); + black_data__ = Eigen::Matrix::Constant(N, + std::numeric_limits::quiet_NaN()); + new (&black) + Eigen::Map>(black_data__.data(), N); + { + std::vector black_flat__; + current_statement__ = 33; + black_flat__ = context__.vals_r("black"); + current_statement__ = 33; + pos__ = 1; + current_statement__ = 33; + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + current_statement__ = 33; + stan::model::assign(black, black_flat__[(pos__ - 1)], + "assigning variable black", stan::model::index_uni(sym1__)); + current_statement__ = 33; + pos__ = (pos__ + 1); + } + } + current_statement__ = 33; + stan::math::check_greater_or_equal(function__, "black", black, 0); + current_statement__ = 33; + stan::math::check_less_or_equal(function__, "black", black, 1); + current_statement__ = 34; + stan::math::validate_non_negative_index("edu", "N", N); + current_statement__ = 35; + context__.validate_dims("data initialization", "edu", "int", + std::vector{static_cast(N)}); + edu = std::vector(N, std::numeric_limits::min()); + current_statement__ = 35; + edu = context__.vals_i("edu"); + current_statement__ = 35; + stan::math::check_greater_or_equal(function__, "edu", edu, 0); + current_statement__ = 35; + stan::math::check_less_or_equal(function__, "edu", edu, n_edu); + current_statement__ = 36; + stan::math::validate_non_negative_index("female", "N", N); + current_statement__ = 37; + context__.validate_dims("data initialization", "female", "double", + std::vector{static_cast(N)}); + female_data__ = Eigen::Matrix::Constant(N, + std::numeric_limits::quiet_NaN()); + new (&female) + Eigen::Map>(female_data__.data(), N); + { + std::vector female_flat__; + current_statement__ = 37; + female_flat__ = context__.vals_r("female"); + current_statement__ = 37; + pos__ = 1; + current_statement__ = 37; + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + current_statement__ = 37; + stan::model::assign(female, female_flat__[(pos__ - 1)], + "assigning variable female", stan::model::index_uni(sym1__)); + current_statement__ = 37; + pos__ = (pos__ + 1); + } + } + current_statement__ = 37; + stan::math::check_greater_or_equal(function__, "female", female, 0); + current_statement__ = 37; + stan::math::check_less_or_equal(function__, "female", female, 1); + current_statement__ = 38; + stan::math::validate_non_negative_index("region_full", "N", N); + current_statement__ = 39; + context__.validate_dims("data initialization", "region_full", "int", + std::vector{static_cast(N)}); + region_full = std::vector(N, std::numeric_limits::min()); + current_statement__ = 39; + region_full = context__.vals_i("region_full"); + current_statement__ = 39; + stan::math::check_greater_or_equal(function__, "region_full", + region_full, 0); + current_statement__ = 39; + stan::math::check_less_or_equal(function__, "region_full", region_full, + n_region_full); + current_statement__ = 40; + stan::math::validate_non_negative_index("state", "N", N); + current_statement__ = 41; + context__.validate_dims("data initialization", "state", "int", + std::vector{static_cast(N)}); + state = std::vector(N, std::numeric_limits::min()); + current_statement__ = 41; + state = context__.vals_i("state"); + current_statement__ = 41; + stan::math::check_greater_or_equal(function__, "state", state, 0); + current_statement__ = 41; + stan::math::check_less_or_equal(function__, "state", state, n_state); + current_statement__ = 42; + stan::math::validate_non_negative_index("v_prev_full", "N", N); + current_statement__ = 43; + context__.validate_dims("data initialization", "v_prev_full", "double", + std::vector{static_cast(N)}); + v_prev_full_data__ = Eigen::Matrix::Constant(N, + std::numeric_limits::quiet_NaN()); + new (&v_prev_full) + Eigen::Map>(v_prev_full_data__.data(), N); + { + std::vector v_prev_full_flat__; + current_statement__ = 43; + v_prev_full_flat__ = context__.vals_r("v_prev_full"); + current_statement__ = 43; + pos__ = 1; + current_statement__ = 43; + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + current_statement__ = 43; + stan::model::assign(v_prev_full, v_prev_full_flat__[(pos__ - 1)], + "assigning variable v_prev_full", stan::model::index_uni(sym1__)); + current_statement__ = 43; + pos__ = (pos__ + 1); + } + } + current_statement__ = 44; + stan::math::validate_non_negative_index("y", "N", N); + current_statement__ = 45; + context__.validate_dims("data initialization", "y", "int", + std::vector{static_cast(N)}); + y = std::vector(N, std::numeric_limits::min()); + current_statement__ = 45; + y = context__.vals_i("y"); + current_statement__ = 45; + stan::math::check_greater_or_equal(function__, "y", y, 0); + current_statement__ = 45; + stan::math::check_less_or_equal(function__, "y", y, 1); + current_statement__ = 46; + stan::math::validate_non_negative_index("a", "n_age", n_age); + current_statement__ = 47; + stan::math::validate_non_negative_index("b", "n_edu", n_edu); + current_statement__ = 48; + stan::math::validate_non_negative_index("c", "n_age_edu", n_age_edu); + current_statement__ = 49; + stan::math::validate_non_negative_index("d", "n_state", n_state); + current_statement__ = 50; + stan::math::validate_non_negative_index("e", "n_region_full", + n_region_full); + current_statement__ = 51; + stan::math::validate_non_negative_index("y_hat", "N", N); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + num_params_r__ = n_age + n_edu + n_age_edu + n_state + n_region_full + 5 + + 1 + 1 + 1 + 1 + 1; + } + inline std::string model_name() const final { + return "expr_prop_fail3_model"; + } + inline std::vector model_compile_info() const noexcept { + return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", + "stancflags = --O1 --print-cpp"}; + } + 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__; + stan::io::deserializer in__(params_r__, params_i__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + static constexpr const char* function__ = + "expr_prop_fail3_model_namespace::log_prob"; + // suppress unused var warning + (void) function__; + try { + Eigen::Matrix a; + current_statement__ = 1; + a = in__.template read>(n_age); + Eigen::Matrix b; + current_statement__ = 2; + b = in__.template read>(n_edu); + Eigen::Matrix c; + current_statement__ = 3; + c = in__.template read>(n_age_edu); + Eigen::Matrix d; + current_statement__ = 4; + d = in__.template read>(n_state); + Eigen::Matrix e; + current_statement__ = 5; + e = in__.template read< + Eigen::Matrix>(n_region_full); + Eigen::Matrix beta; + current_statement__ = 6; + beta = in__.template read>(5); + local_scalar_t__ sigma_a; + current_statement__ = 7; + sigma_a = in__.template read_constrain_lub(0, 100, lp__); + local_scalar_t__ sigma_b; + current_statement__ = 8; + sigma_b = in__.template read_constrain_lub(0, 100, lp__); + local_scalar_t__ sigma_c; + current_statement__ = 9; + sigma_c = in__.template read_constrain_lub(0, 100, lp__); + local_scalar_t__ sigma_d; + current_statement__ = 10; + sigma_d = in__.template read_constrain_lub(0, 100, lp__); + local_scalar_t__ sigma_e; + current_statement__ = 11; + sigma_e = in__.template read_constrain_lub(0, 100, lp__); + Eigen::Matrix y_hat = + Eigen::Matrix::Constant(N, DUMMY_VAR__); + current_statement__ = 14; + for (int i = 1; i <= N; ++i) { + current_statement__ = 13; + stan::model::assign(y_hat, + (((((stan::math::fma( + stan::model::rvalue(beta, "beta", stan::model::index_uni(4)), + stan::model::rvalue(v_prev_full, "v_prev_full", + stan::model::index_uni(i)), + stan::math::fma( + (stan::model::rvalue(beta, "beta", + stan::model::index_uni(5)) * + stan::model::rvalue(female, "female", + stan::model::index_uni(i))), + stan::model::rvalue(black, "black", + stan::model::index_uni(i)), + stan::math::fma( + stan::model::rvalue(beta, "beta", + stan::model::index_uni(3)), + stan::model::rvalue(female, "female", + stan::model::index_uni(i)), + stan::math::fma( + stan::model::rvalue(beta, "beta", + stan::model::index_uni(2)), + stan::model::rvalue(black, "black", + stan::model::index_uni(i)), + stan::model::rvalue(beta, "beta", + stan::model::index_uni(1)))))) + + stan::model::rvalue(a, "a", + stan::model::index_uni( + stan::model::rvalue(age, "age", stan::model::index_uni(i))))) + + stan::model::rvalue(b, "b", + stan::model::index_uni( + stan::model::rvalue(edu, "edu", stan::model::index_uni(i))))) + + stan::model::rvalue(c, "c", + stan::model::index_uni( + stan::model::rvalue(age_edu, "age_edu", + stan::model::index_uni(i))))) + + stan::model::rvalue(d, "d", + stan::model::index_uni( + stan::model::rvalue(state, "state", stan::model::index_uni(i))))) + + + stan::model::rvalue(e, "e", + stan::model::index_uni( + stan::model::rvalue(region_full, "region_full", + stan::model::index_uni(i))))), "assigning variable y_hat", + stan::model::index_uni(i)); + } + { + current_statement__ = 15; + lp_accum__.add(stan::math::normal_lpdf(a, 0, sigma_a)); + current_statement__ = 16; + lp_accum__.add(stan::math::normal_lpdf(b, 0, sigma_b)); + current_statement__ = 17; + lp_accum__.add(stan::math::normal_lpdf(c, 0, sigma_c)); + current_statement__ = 18; + lp_accum__.add(stan::math::normal_lpdf(d, 0, sigma_d)); + current_statement__ = 19; + lp_accum__.add(stan::math::normal_lpdf(e, 0, sigma_e)); + current_statement__ = 20; + lp_accum__.add(stan::math::normal_lpdf(beta, 0, 100)); + current_statement__ = 21; + lp_accum__.add(stan::math::bernoulli_logit_lpmf(y, y_hat)); + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + lp_accum__.add(lp__); + return lp_accum__.sum(); + } + 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; + 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; + // 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()); + // suppress unused var warning + (void) DUMMY_VAR__; + constexpr bool jacobian__ = false; + static constexpr const char* function__ = + "expr_prop_fail3_model_namespace::write_array"; + // suppress unused var warning + (void) function__; + try { + Eigen::Matrix a; + current_statement__ = 1; + a = in__.template read>(n_age); + Eigen::Matrix b; + current_statement__ = 2; + b = in__.template read>(n_edu); + Eigen::Matrix c; + current_statement__ = 3; + c = in__.template read>(n_age_edu); + Eigen::Matrix d; + current_statement__ = 4; + d = in__.template read>(n_state); + Eigen::Matrix e; + current_statement__ = 5; + e = in__.template read< + Eigen::Matrix>(n_region_full); + Eigen::Matrix beta; + current_statement__ = 6; + beta = in__.template read>(5); + double sigma_a; + current_statement__ = 7; + sigma_a = in__.template read_constrain_lub(0, 100, lp__); + double sigma_b; + current_statement__ = 8; + sigma_b = in__.template read_constrain_lub(0, 100, lp__); + double sigma_c; + current_statement__ = 9; + sigma_c = in__.template read_constrain_lub(0, 100, lp__); + double sigma_d; + current_statement__ = 10; + sigma_d = in__.template read_constrain_lub(0, 100, lp__); + double sigma_e; + current_statement__ = 11; + sigma_e = in__.template read_constrain_lub(0, 100, lp__); + Eigen::Matrix y_hat = + Eigen::Matrix::Constant(N, + std::numeric_limits::quiet_NaN()); + out__.write(a); + out__.write(b); + out__.write(c); + out__.write(d); + out__.write(e); + out__.write(beta); + out__.write(sigma_a); + out__.write(sigma_b); + out__.write(sigma_c); + out__.write(sigma_d); + out__.write(sigma_e); + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { + return ; + } + current_statement__ = 14; + for (int i = 1; i <= N; ++i) { + current_statement__ = 13; + stan::model::assign(y_hat, + (((((stan::math::fma( + stan::model::rvalue(beta, "beta", stan::model::index_uni(4)), + stan::model::rvalue(v_prev_full, "v_prev_full", + stan::model::index_uni(i)), + stan::math::fma( + (stan::model::rvalue(beta, "beta", + stan::model::index_uni(5)) * + stan::model::rvalue(female, "female", + stan::model::index_uni(i))), + stan::model::rvalue(black, "black", + stan::model::index_uni(i)), + stan::math::fma( + stan::model::rvalue(beta, "beta", + stan::model::index_uni(3)), + stan::model::rvalue(female, "female", + stan::model::index_uni(i)), + stan::math::fma( + stan::model::rvalue(beta, "beta", + stan::model::index_uni(2)), + stan::model::rvalue(black, "black", + stan::model::index_uni(i)), + stan::model::rvalue(beta, "beta", + stan::model::index_uni(1)))))) + + stan::model::rvalue(a, "a", + stan::model::index_uni( + stan::model::rvalue(age, "age", stan::model::index_uni(i))))) + + stan::model::rvalue(b, "b", + stan::model::index_uni( + stan::model::rvalue(edu, "edu", stan::model::index_uni(i))))) + + stan::model::rvalue(c, "c", + stan::model::index_uni( + stan::model::rvalue(age_edu, "age_edu", + stan::model::index_uni(i))))) + + stan::model::rvalue(d, "d", + stan::model::index_uni( + stan::model::rvalue(state, "state", stan::model::index_uni(i))))) + + + stan::model::rvalue(e, "e", + stan::model::index_uni( + stan::model::rvalue(region_full, "region_full", + stan::model::index_uni(i))))), "assigning variable y_hat", + stan::model::index_uni(i)); + } + if (emit_transformed_parameters__) { + out__.write(y_hat); + } + if (stan::math::logical_negation(emit_generated_quantities__)) { + return ; + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline void + transform_inits_impl(VecVar& params_r__, 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__; + pos__ = 1; + Eigen::Matrix a = + Eigen::Matrix::Constant(n_age, DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= n_age; ++sym1__) { + stan::model::assign(a, in__.read(), + "assigning variable a", stan::model::index_uni(sym1__)); + } + out__.write(a); + Eigen::Matrix b = + Eigen::Matrix::Constant(n_edu, DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= n_edu; ++sym1__) { + stan::model::assign(b, in__.read(), + "assigning variable b", stan::model::index_uni(sym1__)); + } + out__.write(b); + Eigen::Matrix c = + Eigen::Matrix::Constant(n_age_edu, + DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= n_age_edu; ++sym1__) { + stan::model::assign(c, in__.read(), + "assigning variable c", stan::model::index_uni(sym1__)); + } + out__.write(c); + Eigen::Matrix d = + Eigen::Matrix::Constant(n_state, DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= n_state; ++sym1__) { + stan::model::assign(d, in__.read(), + "assigning variable d", stan::model::index_uni(sym1__)); + } + out__.write(d); + Eigen::Matrix e = + Eigen::Matrix::Constant(n_region_full, + DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= n_region_full; ++sym1__) { + stan::model::assign(e, in__.read(), + "assigning variable e", stan::model::index_uni(sym1__)); + } + out__.write(e); + Eigen::Matrix beta = + Eigen::Matrix::Constant(5, DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= 5; ++sym1__) { + stan::model::assign(beta, in__.read(), + "assigning variable beta", stan::model::index_uni(sym1__)); + } + out__.write(beta); + local_scalar_t__ sigma_a; + sigma_a = in__.read(); + out__.write_free_lub(0, 100, sigma_a); + local_scalar_t__ sigma_b; + sigma_b = in__.read(); + out__.write_free_lub(0, 100, sigma_b); + local_scalar_t__ sigma_c; + sigma_c = in__.read(); + out__.write_free_lub(0, 100, sigma_c); + local_scalar_t__ sigma_d; + sigma_d = in__.read(); + out__.write_free_lub(0, 100, sigma_d); + local_scalar_t__ sigma_e; + sigma_e = in__.read(); + out__.write_free_lub(0, 100, sigma_e); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + inline void get_param_names(std::vector& names__) const { + names__ = std::vector{"a", "b", "c", "d", "e", "beta", + "sigma_a", "sigma_b", "sigma_c", "sigma_d", "sigma_e", + "y_hat"}; + } + inline void get_dims(std::vector>& dimss__) const { + dimss__ = std::vector>{std::vector{static_cast< + size_t>( + n_age)}, + std::vector{static_cast(n_edu)}, + std::vector{static_cast(n_age_edu)}, + std::vector{static_cast(n_state)}, + std::vector{static_cast(n_region_full)}, + std::vector{static_cast(5)}, + std::vector{}, std::vector{}, + std::vector{}, std::vector{}, + std::vector{}, + std::vector{static_cast(N)}}; + } + 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__ <= n_age; ++sym1__) { + param_names__.emplace_back(std::string() + "a" + '.' + + std::to_string(sym1__)); + } + for (int sym1__ = 1; sym1__ <= n_edu; ++sym1__) { + param_names__.emplace_back(std::string() + "b" + '.' + + std::to_string(sym1__)); + } + for (int sym1__ = 1; sym1__ <= n_age_edu; ++sym1__) { + param_names__.emplace_back(std::string() + "c" + '.' + + std::to_string(sym1__)); + } + for (int sym1__ = 1; sym1__ <= n_state; ++sym1__) { + param_names__.emplace_back(std::string() + "d" + '.' + + std::to_string(sym1__)); + } + for (int sym1__ = 1; sym1__ <= n_region_full; ++sym1__) { + param_names__.emplace_back(std::string() + "e" + '.' + + std::to_string(sym1__)); + } + for (int sym1__ = 1; sym1__ <= 5; ++sym1__) { + param_names__.emplace_back(std::string() + "beta" + '.' + + std::to_string(sym1__)); + } + param_names__.emplace_back(std::string() + "sigma_a"); + param_names__.emplace_back(std::string() + "sigma_b"); + param_names__.emplace_back(std::string() + "sigma_c"); + param_names__.emplace_back(std::string() + "sigma_d"); + param_names__.emplace_back(std::string() + "sigma_e"); + if (emit_transformed_parameters__) { + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + param_names__.emplace_back(std::string() + "y_hat" + '.' + + std::to_string(sym1__)); + } + } + 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__ <= n_age; ++sym1__) { + param_names__.emplace_back(std::string() + "a" + '.' + + std::to_string(sym1__)); + } + for (int sym1__ = 1; sym1__ <= n_edu; ++sym1__) { + param_names__.emplace_back(std::string() + "b" + '.' + + std::to_string(sym1__)); + } + for (int sym1__ = 1; sym1__ <= n_age_edu; ++sym1__) { + param_names__.emplace_back(std::string() + "c" + '.' + + std::to_string(sym1__)); + } + for (int sym1__ = 1; sym1__ <= n_state; ++sym1__) { + param_names__.emplace_back(std::string() + "d" + '.' + + std::to_string(sym1__)); + } + for (int sym1__ = 1; sym1__ <= n_region_full; ++sym1__) { + param_names__.emplace_back(std::string() + "e" + '.' + + std::to_string(sym1__)); + } + for (int sym1__ = 1; sym1__ <= 5; ++sym1__) { + param_names__.emplace_back(std::string() + "beta" + '.' + + std::to_string(sym1__)); + } + param_names__.emplace_back(std::string() + "sigma_a"); + param_names__.emplace_back(std::string() + "sigma_b"); + param_names__.emplace_back(std::string() + "sigma_c"); + param_names__.emplace_back(std::string() + "sigma_d"); + param_names__.emplace_back(std::string() + "sigma_e"); + if (emit_transformed_parameters__) { + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + param_names__.emplace_back(std::string() + "y_hat" + '.' + + std::to_string(sym1__)); + } + } + if (emit_generated_quantities__) {} + } + inline std::string get_constrained_sizedtypes() const { + return std::string("[{\"name\":\"a\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_age) + "},\"block\":\"parameters\"},{\"name\":\"b\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_edu) + "},\"block\":\"parameters\"},{\"name\":\"c\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_age_edu) + "},\"block\":\"parameters\"},{\"name\":\"d\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_state) + "},\"block\":\"parameters\"},{\"name\":\"e\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_region_full) + "},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(5) + "},\"block\":\"parameters\"},{\"name\":\"sigma_a\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_b\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_c\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_d\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_e\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"y_hat\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"transformed_parameters\"}]"); + } + inline std::string get_unconstrained_sizedtypes() const { + return std::string("[{\"name\":\"a\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_age) + "},\"block\":\"parameters\"},{\"name\":\"b\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_edu) + "},\"block\":\"parameters\"},{\"name\":\"c\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_age_edu) + "},\"block\":\"parameters\"},{\"name\":\"d\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_state) + "},\"block\":\"parameters\"},{\"name\":\"e\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_region_full) + "},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(5) + "},\"block\":\"parameters\"},{\"name\":\"sigma_a\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_b\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_c\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_d\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"sigma_e\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"y_hat\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"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__ = ((((((((((n_age + n_edu) + n_age_edu) + + n_state) + n_region_full) + 5) + 1) + 1) + 1) + 1) + 1); + const size_t num_transformed = emit_transformed_parameters * (N); + 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__ = ((((((((((n_age + n_edu) + n_age_edu) + + n_state) + n_region_full) + 5) + 1) + 1) + 1) + 1) + 1); + const size_t num_transformed = emit_transformed_parameters * (N); + 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 { + constexpr std::array + names__{"a", "b", "c", "d", "e", "beta", "sigma_a", "sigma_b", + "sigma_c", "sigma_d", "sigma_e"}; + const std::array + constrain_param_sizes__{n_age, n_edu, n_age_edu, n_state, + n_region_full, 5, 1, 1, 1, 1, 1}; + const auto num_constrained_params__ = + std::accumulate(constrain_param_sizes__.begin(), + constrain_param_sizes__.end(), 0); + std::vector params_r_flat__(num_constrained_params__); + Eigen::Index size_iter__ = 0; + Eigen::Index flat_iter__ = 0; + for (auto&& param_name__: names__) { + const auto param_vec__ = context.vals_r(param_name__); + for (Eigen::Index i = 0; i < constrain_param_sizes__[size_iter__]; ++i) { + params_r_flat__[flat_iter__] = param_vec__[i]; + ++flat_iter__; + } + ++size_iter__; + } + vars.resize(num_params_r__); + transform_inits_impl(params_r_flat__, params_i, vars, pstream__); + } +}; +} +using stan_model = expr_prop_fail3_model_namespace::expr_prop_fail3_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* m = new stan_model(data_context, seed, msg_stream); + return *m; +} +stan::math::profile_map& get_stan_profile_data() { + return expr_prop_fail3_model_namespace::profiles__; +} +#endif + $ ../../../../../install/default/bin/stanc --O1 --print-cpp expr-prop-fail4.stan +// Code generated by %%NAME%% %%VERSION%% +#include +namespace expr_prop_fail4_model_namespace { +using stan::model::model_base_crtp; +using namespace stan::math; +stan::math::profile_map profiles__; +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'expr-prop-fail4.stan', line 12, column 2 to column 24)", + " (in 'expr-prop-fail4.stan', line 13, column 2 to column 28)", + " (in 'expr-prop-fail4.stan', line 16, column 2 to column 47)", + " (in 'expr-prop-fail4.stan', line 17, column 2 to column 16)", + " (in 'expr-prop-fail4.stan', line 18, column 2 to column 33)", + " (in 'expr-prop-fail4.stan', line 19, column 2 to column 29)", + " (in 'expr-prop-fail4.stan', line 20, column 2 to column 24)", + " (in 'expr-prop-fail4.stan', line 27, column 2 to column 13)", + " (in 'expr-prop-fail4.stan', line 28, column 2 to column 13)", + " (in 'expr-prop-fail4.stan', line 29, column 2 to column 26)", + " (in 'expr-prop-fail4.stan', line 30, column 2 to column 28)", + " (in 'expr-prop-fail4.stan', line 31, column 2 to column 18)", + " (in 'expr-prop-fail4.stan', line 32, column 2 to column 22)", + " (in 'expr-prop-fail4.stan', line 34, column 2 to column 14)", + " (in 'expr-prop-fail4.stan', line 35, column 2 to column 17)", + " (in 'expr-prop-fail4.stan', line 37, column 2 to column 27)", + " (in 'expr-prop-fail4.stan', line 38, column 2 to column 27)", + " (in 'expr-prop-fail4.stan', line 40, column 4 to column 36)", + " (in 'expr-prop-fail4.stan', line 39, column 19 to line 41, column 3)", + " (in 'expr-prop-fail4.stan', line 39, column 2 to line 41, column 3)", + " (in 'expr-prop-fail4.stan', line 42, column 2 to column 38)", + " (in 'expr-prop-fail4.stan', line 43, column 2 to column 37)", + " (in 'expr-prop-fail4.stan', line 44, column 2 to column 34)", + " (in 'expr-prop-fail4.stan', line 47, column 4 to column 28)", + " (in 'expr-prop-fail4.stan', line 48, column 4 to line 49, column 39)", + " (in 'expr-prop-fail4.stan', line 46, column 19 to line 50, column 3)", + " (in 'expr-prop-fail4.stan', line 46, column 2 to line 50, column 3)", + " (in 'expr-prop-fail4.stan', line 23, column 2 to column 53)", + " (in 'expr-prop-fail4.stan', line 24, column 2 to column 24)", + " (in 'expr-prop-fail4.stan', line 2, column 2 to column 17)", + " (in 'expr-prop-fail4.stan', line 3, column 2 to column 23)", + " (in 'expr-prop-fail4.stan', line 4, column 8 to column 15)", + " (in 'expr-prop-fail4.stan', line 4, column 2 to column 45)", + " (in 'expr-prop-fail4.stan', line 5, column 8 to column 15)", + " (in 'expr-prop-fail4.stan', line 5, column 2 to column 45)", + " (in 'expr-prop-fail4.stan', line 6, column 18 to column 19)", + " (in 'expr-prop-fail4.stan', line 6, column 2 to column 23)", + " (in 'expr-prop-fail4.stan', line 9, column 9 to column 10)", + " (in 'expr-prop-fail4.stan', line 9, column 2 to column 27)", + " (in 'expr-prop-fail4.stan', line 13, column 9 to column 14)", + " (in 'expr-prop-fail4.stan', line 17, column 9 to column 10)", + " (in 'expr-prop-fail4.stan', line 31, column 9 to column 10)", + " (in 'expr-prop-fail4.stan', line 32, column 9 to column 10)", + " (in 'expr-prop-fail4.stan', line 34, column 9 to column 10)", + " (in 'expr-prop-fail4.stan', line 35, column 8 to column 9)"}; +class expr_prop_fail4_model final : public model_base_crtp { + private: + int N; + int N_edges; + std::vector node1; + std::vector node2; + Eigen::Matrix E_data__; + Eigen::Matrix log_E_data__; + int phi_std_raw_1dim__; + Eigen::Map> E{nullptr, 0}; + Eigen::Map> log_E{nullptr, 0}; + public: + ~expr_prop_fail4_model() {} + expr_prop_fail4_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__ = + "expr_prop_fail4_model_namespace::expr_prop_fail4_model"; + // suppress unused var warning + (void) function__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + int pos__; + pos__ = 1; + current_statement__ = 30; + context__.validate_dims("data initialization", "N", "int", + std::vector{}); + N = std::numeric_limits::min(); + current_statement__ = 30; + N = context__.vals_i("N")[(1 - 1)]; + current_statement__ = 30; + stan::math::check_greater_or_equal(function__, "N", N, 0); + current_statement__ = 31; + context__.validate_dims("data initialization", "N_edges", "int", + std::vector{}); + N_edges = std::numeric_limits::min(); + current_statement__ = 31; + N_edges = context__.vals_i("N_edges")[(1 - 1)]; + current_statement__ = 31; + stan::math::check_greater_or_equal(function__, "N_edges", N_edges, 0); + current_statement__ = 32; + stan::math::validate_non_negative_index("node1", "N_edges", N_edges); + current_statement__ = 33; + context__.validate_dims("data initialization", "node1", "int", + std::vector{static_cast(N_edges)}); + node1 = std::vector(N_edges, std::numeric_limits::min()); + current_statement__ = 33; + node1 = context__.vals_i("node1"); + current_statement__ = 33; + stan::math::check_greater_or_equal(function__, "node1", node1, 1); + current_statement__ = 33; + stan::math::check_less_or_equal(function__, "node1", node1, N); + current_statement__ = 34; + stan::math::validate_non_negative_index("node2", "N_edges", N_edges); + current_statement__ = 35; + context__.validate_dims("data initialization", "node2", "int", + std::vector{static_cast(N_edges)}); + node2 = std::vector(N_edges, std::numeric_limits::min()); + current_statement__ = 35; + node2 = context__.vals_i("node2"); + current_statement__ = 35; + stan::math::check_greater_or_equal(function__, "node2", node2, 1); + current_statement__ = 35; + stan::math::check_less_or_equal(function__, "node2", node2, N); + current_statement__ = 36; + stan::math::validate_non_negative_index("E", "N", N); + current_statement__ = 37; + context__.validate_dims("data initialization", "E", "double", + std::vector{static_cast(N)}); + E_data__ = Eigen::Matrix::Constant(N, + std::numeric_limits::quiet_NaN()); + new (&E) Eigen::Map>(E_data__.data(), N); + { + std::vector E_flat__; + current_statement__ = 37; + E_flat__ = context__.vals_r("E"); + current_statement__ = 37; + pos__ = 1; + current_statement__ = 37; + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + current_statement__ = 37; + stan::model::assign(E, E_flat__[(pos__ - 1)], + "assigning variable E", stan::model::index_uni(sym1__)); + current_statement__ = 37; + pos__ = (pos__ + 1); + } + } + current_statement__ = 37; + stan::math::check_greater_or_equal(function__, "E", E, 0); + current_statement__ = 38; + stan::math::validate_non_negative_index("log_E", "N", N); + current_statement__ = 39; + log_E_data__ = Eigen::Matrix::Constant(N, + std::numeric_limits::quiet_NaN()); + new (&log_E) + Eigen::Map>(log_E_data__.data(), N); + current_statement__ = 39; + stan::model::assign(log_E, stan::math::log(E), + "assigning variable log_E"); + current_statement__ = 40; + phi_std_raw_1dim__ = std::numeric_limits::min(); + current_statement__ = 40; + phi_std_raw_1dim__ = (N - 1); + current_statement__ = 40; + stan::math::validate_non_negative_index("phi_std_raw", "N - 1", + phi_std_raw_1dim__); + current_statement__ = 41; + stan::math::validate_non_negative_index("phi", "N", N); + current_statement__ = 42; + stan::math::validate_non_negative_index("theta", "N", N); + current_statement__ = 43; + stan::math::validate_non_negative_index("theta_std", "N", N); + current_statement__ = 44; + stan::math::validate_non_negative_index("x", "N", N); + current_statement__ = 45; + stan::math::validate_non_negative_index("y", "N", N); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + num_params_r__ = 1 + phi_std_raw_1dim__; + } + inline std::string model_name() const final { + return "expr_prop_fail4_model"; + } + inline std::vector model_compile_info() const noexcept { + return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", + "stancflags = --O1 --print-cpp"}; + } + 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__; + stan::io::deserializer in__(params_r__, params_i__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + static constexpr const char* function__ = + "expr_prop_fail4_model_namespace::log_prob"; + // suppress unused var warning + (void) function__; + try { + local_scalar_t__ tau_phi; + current_statement__ = 1; + tau_phi = in__.template read_constrain_lb(0, lp__); + stan::conditional_var_value_t> phi_std_raw; + current_statement__ = 2; + phi_std_raw = in__.template read< + stan::conditional_var_value_t>>(phi_std_raw_1dim__); + local_scalar_t__ sigma_phi; + current_statement__ = 3; + sigma_phi = stan::math::inv_sqrt(tau_phi); + stan::conditional_var_value_t> phi = + stan::conditional_var_value_t>(Eigen::Matrix::Constant(N, + std::numeric_limits::quiet_NaN( + ))); + current_statement__ = 5; + stan::model::assign(phi, phi_std_raw, "assigning variable phi", + stan::model::index_min_max(1, (N - 1))); + current_statement__ = 6; + stan::model::assign(phi, -stan::math::sum(phi_std_raw), + "assigning variable phi", stan::model::index_uni(N)); + current_statement__ = 7; + stan::model::assign(phi, + stan::math::multiply(stan::model::deep_copy(phi), sigma_phi), + "assigning variable phi"); + current_statement__ = 3; + stan::math::check_greater_or_equal(function__, "sigma_phi", sigma_phi, + 0); + { + current_statement__ = 28; + lp_accum__.add((-0.5 * + stan::math::dot_self( + stan::math::subtract( + stan::model::rvalue(phi, "phi", stan::model::index_multi(node1)), + stan::model::rvalue(phi, "phi", stan::model::index_multi(node2)))))); + current_statement__ = 29; + lp_accum__.add(stan::math::gamma_lpdf(tau_phi, 1, 1)); + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + lp_accum__.add(lp__); + return lp_accum__.sum(); + } + 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; + 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; + // 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()); + // suppress unused var warning + (void) DUMMY_VAR__; + constexpr bool jacobian__ = false; + static constexpr const char* function__ = + "expr_prop_fail4_model_namespace::write_array"; + // suppress unused var warning + (void) function__; + try { + double tau_phi; + current_statement__ = 1; + tau_phi = in__.template read_constrain_lb(0, lp__); + Eigen::Matrix phi_std_raw; + current_statement__ = 2; + phi_std_raw = in__.template read< + Eigen::Matrix>(phi_std_raw_1dim__); + double sigma_phi = std::numeric_limits::quiet_NaN(); + Eigen::Matrix phi = + Eigen::Matrix::Constant(N, + std::numeric_limits::quiet_NaN()); + out__.write(tau_phi); + out__.write(phi_std_raw); + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { + return ; + } + current_statement__ = 3; + sigma_phi = stan::math::inv_sqrt(tau_phi); + current_statement__ = 5; + stan::model::assign(phi, phi_std_raw, "assigning variable phi", + stan::model::index_min_max(1, (N - 1))); + current_statement__ = 6; + stan::model::assign(phi, -stan::math::sum(phi_std_raw), + "assigning variable phi", stan::model::index_uni(N)); + current_statement__ = 7; + stan::model::assign(phi, + stan::math::multiply(stan::model::deep_copy(phi), sigma_phi), + "assigning variable phi"); + current_statement__ = 3; + stan::math::check_greater_or_equal(function__, "sigma_phi", sigma_phi, + 0); + if (emit_transformed_parameters__) { + out__.write(sigma_phi); + out__.write(phi); + } + if (stan::math::logical_negation(emit_generated_quantities__)) { + return ; + } + double beta0 = std::numeric_limits::quiet_NaN(); + double beta1 = std::numeric_limits::quiet_NaN(); + double tau_theta = std::numeric_limits::quiet_NaN(); + double sigma_theta = std::numeric_limits::quiet_NaN(); + Eigen::Matrix theta = + Eigen::Matrix::Constant(N, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix theta_std = + Eigen::Matrix::Constant(N, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix x = + Eigen::Matrix::Constant(N, + std::numeric_limits::quiet_NaN()); + std::vector y = + std::vector(N, std::numeric_limits::min()); + current_statement__ = 16; + beta0 = stan::math::normal_rng(0, 1, base_rng__); + current_statement__ = 17; + beta1 = stan::math::normal_rng(0, 1, base_rng__); + current_statement__ = 20; + for (int i = 1; i <= N; ++i) { + current_statement__ = 18; + stan::model::assign(theta_std, + stan::math::normal_rng(0, 1, base_rng__), + "assigning variable theta_std", stan::model::index_uni(i)); + } + current_statement__ = 21; + tau_theta = stan::math::gamma_rng(3.2761, 1.81, base_rng__); + current_statement__ = 22; + sigma_theta = stan::math::inv_sqrt(tau_theta); + current_statement__ = 23; + stan::model::assign(theta, + stan::math::multiply(theta_std, sigma_theta), + "assigning variable theta"); + current_statement__ = 27; + for (int i = 1; i <= N; ++i) { + current_statement__ = 24; + stan::model::assign(x, stan::math::normal_rng(0, 1, base_rng__), + "assigning variable x", stan::model::index_uni(i)); + current_statement__ = 25; + stan::model::assign(y, + stan::math::poisson_log_rng( + ((stan::math::fma(beta1, + stan::model::rvalue(x, "x", stan::model::index_uni(i)), + (stan::model::rvalue(log_E, "log_E", + stan::model::index_uni(i)) + beta0)) + + stan::model::rvalue(phi, "phi", stan::model::index_uni(i))) + + stan::model::rvalue(theta, "theta", stan::model::index_uni(i))), + base_rng__), "assigning variable y", stan::model::index_uni(i)); + } + current_statement__ = 10; + stan::math::check_greater_or_equal(function__, "tau_theta", tau_theta, + 0); + current_statement__ = 11; + stan::math::check_greater_or_equal(function__, "sigma_theta", + sigma_theta, 0); + out__.write(beta0); + out__.write(beta1); + out__.write(tau_theta); + out__.write(sigma_theta); + out__.write(theta); + out__.write(theta_std); + out__.write(x); + out__.write(y); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline void + transform_inits_impl(VecVar& params_r__, 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__; + pos__ = 1; + local_scalar_t__ tau_phi; + tau_phi = in__.read(); + out__.write_free_lb(0, tau_phi); + Eigen::Matrix phi_std_raw = + Eigen::Matrix::Constant(phi_std_raw_1dim__, + DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= phi_std_raw_1dim__; ++sym1__) { + stan::model::assign(phi_std_raw, in__.read(), + "assigning variable phi_std_raw", stan::model::index_uni(sym1__)); + } + out__.write(phi_std_raw); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + inline void get_param_names(std::vector& names__) const { + names__ = std::vector{"tau_phi", "phi_std_raw", "sigma_phi", + "phi", "beta0", "beta1", "tau_theta", "sigma_theta", "theta", + "theta_std", "x", "y"}; + } + inline void get_dims(std::vector>& dimss__) const { + dimss__ = std::vector>{std::vector{}, + std::vector{static_cast(phi_std_raw_1dim__)}, + std::vector{}, + std::vector{static_cast(N)}, + std::vector{}, std::vector{}, + std::vector{}, std::vector{}, + std::vector{static_cast(N)}, + std::vector{static_cast(N)}, + std::vector{static_cast(N)}, + std::vector{static_cast(N)}}; + } + inline void + constrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { + param_names__.emplace_back(std::string() + "tau_phi"); + for (int sym1__ = 1; sym1__ <= phi_std_raw_1dim__; ++sym1__) { + param_names__.emplace_back(std::string() + "phi_std_raw" + '.' + + std::to_string(sym1__)); + } + if (emit_transformed_parameters__) { + param_names__.emplace_back(std::string() + "sigma_phi"); + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + param_names__.emplace_back(std::string() + "phi" + '.' + + std::to_string(sym1__)); + } + } + if (emit_generated_quantities__) { + param_names__.emplace_back(std::string() + "beta0"); + param_names__.emplace_back(std::string() + "beta1"); + param_names__.emplace_back(std::string() + "tau_theta"); + param_names__.emplace_back(std::string() + "sigma_theta"); + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + param_names__.emplace_back(std::string() + "theta" + '.' + + std::to_string(sym1__)); + } + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + param_names__.emplace_back(std::string() + "theta_std" + '.' + + std::to_string(sym1__)); + } + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + param_names__.emplace_back(std::string() + "x" + '.' + + std::to_string(sym1__)); + } + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + param_names__.emplace_back(std::string() + "y" + '.' + + std::to_string(sym1__)); + } + } + } + inline void + unconstrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { + param_names__.emplace_back(std::string() + "tau_phi"); + for (int sym1__ = 1; sym1__ <= phi_std_raw_1dim__; ++sym1__) { + param_names__.emplace_back(std::string() + "phi_std_raw" + '.' + + std::to_string(sym1__)); + } + if (emit_transformed_parameters__) { + param_names__.emplace_back(std::string() + "sigma_phi"); + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + param_names__.emplace_back(std::string() + "phi" + '.' + + std::to_string(sym1__)); + } + } + if (emit_generated_quantities__) { + param_names__.emplace_back(std::string() + "beta0"); + param_names__.emplace_back(std::string() + "beta1"); + param_names__.emplace_back(std::string() + "tau_theta"); + param_names__.emplace_back(std::string() + "sigma_theta"); + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + param_names__.emplace_back(std::string() + "theta" + '.' + + std::to_string(sym1__)); + } + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + param_names__.emplace_back(std::string() + "theta_std" + '.' + + std::to_string(sym1__)); + } + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + param_names__.emplace_back(std::string() + "x" + '.' + + std::to_string(sym1__)); + } + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + param_names__.emplace_back(std::string() + "y" + '.' + + std::to_string(sym1__)); + } + } + } + inline std::string get_constrained_sizedtypes() const { + return std::string("[{\"name\":\"tau_phi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"phi_std_raw\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(phi_std_raw_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"sigma_phi\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"transformed_parameters\"},{\"name\":\"beta0\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"beta1\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"tau_theta\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"sigma_theta\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"theta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"generated_quantities\"},{\"name\":\"theta_std\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"generated_quantities\"},{\"name\":\"x\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"generated_quantities\"},{\"name\":\"y\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(N) + ",\"element_type\":{\"name\":\"int\"}},\"block\":\"generated_quantities\"}]"); + } + inline std::string get_unconstrained_sizedtypes() const { + return std::string("[{\"name\":\"tau_phi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"phi_std_raw\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(phi_std_raw_1dim__) + "},\"block\":\"parameters\"},{\"name\":\"sigma_phi\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"transformed_parameters\"},{\"name\":\"beta0\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"beta1\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"tau_theta\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"sigma_theta\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"theta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"generated_quantities\"},{\"name\":\"theta_std\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"generated_quantities\"},{\"name\":\"x\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"generated_quantities\"},{\"name\":\"y\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(N) + ",\"element_type\":{\"name\":\"int\"}},\"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__ = (1 + phi_std_raw_1dim__); + const size_t num_transformed = emit_transformed_parameters * ((1 + N)); + const size_t num_gen_quantities = emit_generated_quantities * ((((((((1 + + 1) + 1) + 1) + N) + N) + N) + 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__ = (1 + phi_std_raw_1dim__); + const size_t num_transformed = emit_transformed_parameters * ((1 + N)); + const size_t num_gen_quantities = emit_generated_quantities * ((((((((1 + + 1) + 1) + 1) + N) + N) + N) + 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 { + constexpr std::array names__{"tau_phi", "phi_std_raw"}; + const std::array + constrain_param_sizes__{1, phi_std_raw_1dim__}; + const auto num_constrained_params__ = + std::accumulate(constrain_param_sizes__.begin(), + constrain_param_sizes__.end(), 0); + std::vector params_r_flat__(num_constrained_params__); + Eigen::Index size_iter__ = 0; + Eigen::Index flat_iter__ = 0; + for (auto&& param_name__: names__) { + const auto param_vec__ = context.vals_r(param_name__); + for (Eigen::Index i = 0; i < constrain_param_sizes__[size_iter__]; ++i) { + params_r_flat__[flat_iter__] = param_vec__[i]; + ++flat_iter__; + } + ++size_iter__; + } + vars.resize(num_params_r__); + transform_inits_impl(params_r_flat__, params_i, vars, pstream__); + } +}; +} +using stan_model = expr_prop_fail4_model_namespace::expr_prop_fail4_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* m = new stan_model(data_context, seed, msg_stream); + return *m; +} +stan::math::profile_map& get_stan_profile_data() { + return expr_prop_fail4_model_namespace::profiles__; +} +#endif + $ ../../../../../install/default/bin/stanc --O1 --print-cpp expr-prop-fail5.stan +// Code generated by %%NAME%% %%VERSION%% +#include +namespace expr_prop_fail5_model_namespace { +using stan::model::model_base_crtp; +using namespace stan::math; +stan::math::profile_map profiles__; +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'expr-prop-fail5.stan', line 68, column 2 to column 34)", + " (in 'expr-prop-fail5.stan', line 69, column 2 to column 32)", + " (in 'expr-prop-fail5.stan', line 70, column 2 to column 23)", + " (in 'expr-prop-fail5.stan', line 71, column 2 to column 31)", + " (in 'expr-prop-fail5.stan', line 76, column 2 to column 52)", + " (in 'expr-prop-fail5.stan', line 77, column 2 to column 50)", + " (in 'expr-prop-fail5.stan', line 78, column 2 to column 50)", + " (in 'expr-prop-fail5.stan', line 79, column 2 to column 10)", + " (in 'expr-prop-fail5.stan', line 82, column 2 to column 23)", + " (in 'expr-prop-fail5.stan', line 85, column 6 to column 20)", + " (in 'expr-prop-fail5.stan', line 86, column 6 to column 18)", + " (in 'expr-prop-fail5.stan', line 84, column 34 to line 87, column 5)", + " (in 'expr-prop-fail5.stan', line 84, column 4 to line 87, column 5)", + " (in 'expr-prop-fail5.stan', line 89, column 6 to column 45)", + " (in 'expr-prop-fail5.stan', line 90, column 6 to column 23)", + " (in 'expr-prop-fail5.stan', line 88, column 40 to line 91, column 5)", + " (in 'expr-prop-fail5.stan', line 88, column 4 to line 91, column 5)", + " (in 'expr-prop-fail5.stan', line 83, column 22 to line 92, column 3)", + " (in 'expr-prop-fail5.stan', line 83, column 2 to line 92, column 3)", + " (in 'expr-prop-fail5.stan', line 25, column 11 to column 15)", + " (in 'expr-prop-fail5.stan', line 25, column 17 to column 28)", + " (in 'expr-prop-fail5.stan', line 25, column 4 to column 34)", + " (in 'expr-prop-fail5.stan', line 28, column 6 to column 32)", + " (in 'expr-prop-fail5.stan', line 31, column 8 to column 37)", + " (in 'expr-prop-fail5.stan', line 32, column 8 to column 32)", + " (in 'expr-prop-fail5.stan', line 40, column 8 to column 33)", + " (in 'expr-prop-fail5.stan', line 41, column 8 to column 28)", + " (in 'expr-prop-fail5.stan', line 42, column 8 to line 44, column 44)", + " (in 'expr-prop-fail5.stan', line 29, column 39 to line 45, column 7)", + " (in 'expr-prop-fail5.stan', line 29, column 6 to line 45, column 7)", + " (in 'expr-prop-fail5.stan', line 27, column 24 to line 46, column 5)", + " (in 'expr-prop-fail5.stan', line 27, column 4 to line 46, column 5)", + " (in 'expr-prop-fail5.stan', line 47, column 4 to column 15)", + " (in 'expr-prop-fail5.stan', line 118, column 2 to column 23)", + " (in 'expr-prop-fail5.stan', line 120, column 2 to column 25)", + " (in 'expr-prop-fail5.stan', line 104, column 2 to column 29)", + " (in 'expr-prop-fail5.stan', line 110, column 8 to column 37)", + " (in 'expr-prop-fail5.stan', line 111, column 8 to column 41)", + " (in 'expr-prop-fail5.stan', line 109, column 42 to line 112, column 7)", + " (in 'expr-prop-fail5.stan', line 109, column 6 to line 112, column 7)", + " (in 'expr-prop-fail5.stan', line 113, column 6 to column 37)", + " (in 'expr-prop-fail5.stan', line 108, column 22 to line 114, column 5)", + " (in 'expr-prop-fail5.stan', line 108, column 4 to line 114, column 5)", + " (in 'expr-prop-fail5.stan', line 107, column 22 to line 115, column 3)", + " (in 'expr-prop-fail5.stan', line 107, column 2 to line 115, column 3)", + " (in 'expr-prop-fail5.stan', line 51, column 2 to column 20)", + " (in 'expr-prop-fail5.stan', line 52, column 2 to column 27)", + " (in 'expr-prop-fail5.stan', line 53, column 8 to column 12)", + " (in 'expr-prop-fail5.stan', line 53, column 14 to column 25)", + " (in 'expr-prop-fail5.stan', line 53, column 2 to column 51)", + " (in 'expr-prop-fail5.stan', line 56, column 2 to column 38)", + " (in 'expr-prop-fail5.stan', line 58, column 8 to column 12)", + " (in 'expr-prop-fail5.stan', line 58, column 2 to column 52)", + " (in 'expr-prop-fail5.stan', line 59, column 8 to column 12)", + " (in 'expr-prop-fail5.stan', line 59, column 2 to column 51)", + " (in 'expr-prop-fail5.stan', line 63, column 4 to column 35)", + " (in 'expr-prop-fail5.stan', line 62, column 2 to line 63, column 35)", + " (in 'expr-prop-fail5.stan', line 65, column 4 to column 33)", + " (in 'expr-prop-fail5.stan', line 64, column 2 to line 65, column 33)", + " (in 'expr-prop-fail5.stan', line 70, column 9 to column 13)", + " (in 'expr-prop-fail5.stan', line 76, column 27 to column 31)", + " (in 'expr-prop-fail5.stan', line 76, column 33 to column 46)", + " (in 'expr-prop-fail5.stan', line 77, column 27 to column 31)", + " (in 'expr-prop-fail5.stan', line 77, column 33 to column 46)", + " (in 'expr-prop-fail5.stan', line 78, column 27 to column 31)", + " (in 'expr-prop-fail5.stan', line 78, column 33 to column 44)", + " (in 'expr-prop-fail5.stan', line 8, column 8 to column 17)", + " (in 'expr-prop-fail5.stan', line 7, column 6 to line 8, column 17)", + " (in 'expr-prop-fail5.stan', line 6, column 4 to line 8, column 17)", + " (in 'expr-prop-fail5.stan', line 9, column 4 to column 13)", + " (in 'expr-prop-fail5.stan', line 5, column 37 to line 10, column 3)", + " (in 'expr-prop-fail5.stan', line 15, column 6 to column 32)", + " (in 'expr-prop-fail5.stan', line 19, column 8 to column 17)", + " (in 'expr-prop-fail5.stan', line 18, column 6 to line 19, column 17)", + " (in 'expr-prop-fail5.stan', line 13, column 39 to line 20, column 5)", + " (in 'expr-prop-fail5.stan', line 13, column 4 to line 20, column 5)", + " (in 'expr-prop-fail5.stan', line 21, column 4 to column 13)", + " (in 'expr-prop-fail5.stan', line 12, column 36 to line 22, column 3)", + " (in 'expr-prop-fail5.stan', line 24, column 74 to line 48, column 3)"}; +int first_capture(const std::vector& y_i, std::ostream* pstream__); +int last_capture(const std::vector& y_i, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, + const T3__& phi_arg__, std::ostream* pstream__); +int first_capture(const std::vector& y_i, std::ostream* pstream__) { + using local_scalar_t__ = double; + int current_statement__ = 0; + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 69; + for (int k = 1; k <= stan::math::size(y_i); ++k) { + current_statement__ = 68; + if (stan::model::rvalue(y_i, "y_i", stan::model::index_uni(k))) { + current_statement__ = 67; + return k; + } + } + current_statement__ = 70; + return 0; + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +int last_capture(const std::vector& y_i, std::ostream* pstream__) { + using local_scalar_t__ = double; + int current_statement__ = 0; + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 76; + for (int k_rev = 0; k_rev <= (stan::math::size(y_i) - 1); ++k_rev) { + int k; + current_statement__ = 72; + k = (stan::math::size(y_i) - k_rev); + current_statement__ = 74; + if (stan::model::rvalue(y_i, "y_i", stan::model::index_uni(k))) { + current_statement__ = 73; + return k; + } + } + current_statement__ = 77; + return 0; + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>*> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, + const T3__& phi_arg__, std::ostream* pstream__) { + using local_scalar_t__ = stan::promote_args_t, + stan::base_type_t>; + int current_statement__ = 0; + const auto& p = stan::math::to_ref(p_arg__); + const auto& phi = stan::math::to_ref(phi_arg__); + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 20; + stan::math::validate_non_negative_index("chi", "nind", nind); + current_statement__ = 21; + stan::math::validate_non_negative_index("chi", "n_occasions", n_occasions); + Eigen::Matrix chi = + Eigen::Matrix::Constant(nind, n_occasions, + DUMMY_VAR__); + current_statement__ = 32; + for (int i = 1; i <= nind; ++i) { + current_statement__ = 23; + stan::model::assign(chi, 1.0, "assigning variable chi", + stan::model::index_uni(i), stan::model::index_uni(n_occasions)); + current_statement__ = 30; + for (int t = 1; t <= (n_occasions - 1); ++t) { + int t_curr = std::numeric_limits::min(); + int t_next = std::numeric_limits::min(); + current_statement__ = 26; + t_curr = (n_occasions - t); + current_statement__ = 27; + t_next = (t_curr + 1); + current_statement__ = 28; + stan::model::assign(chi, + stan::math::fma( + (stan::model::rvalue(phi, "phi", stan::model::index_uni(i), + stan::model::index_uni(t_curr)) * (1 - + stan::model::rvalue(p, "p", stan::model::index_uni(i), + stan::model::index_uni((t_next - 1))))), + stan::model::rvalue(chi, "chi", stan::model::index_uni(i), + stan::model::index_uni(t_next)), (1 - + stan::model::rvalue(phi, "phi", stan::model::index_uni(i), + stan::model::index_uni(t_curr)))), "assigning variable chi", + stan::model::index_uni(i), stan::model::index_uni(t_curr)); + } + } + current_statement__ = 33; + return chi; + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +class expr_prop_fail5_model final : public model_base_crtp { + private: + int nind; + int n_occasions; + std::vector> y; + int n_occ_minus_1; + std::vector first; + std::vector last; + public: + ~expr_prop_fail5_model() {} + expr_prop_fail5_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__ = + "expr_prop_fail5_model_namespace::expr_prop_fail5_model"; + // suppress unused var warning + (void) function__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + int pos__; + pos__ = 1; + current_statement__ = 46; + context__.validate_dims("data initialization", "nind", "int", + std::vector{}); + nind = std::numeric_limits::min(); + current_statement__ = 46; + nind = context__.vals_i("nind")[(1 - 1)]; + current_statement__ = 46; + stan::math::check_greater_or_equal(function__, "nind", nind, 0); + current_statement__ = 47; + context__.validate_dims("data initialization", "n_occasions", "int", + std::vector{}); + n_occasions = std::numeric_limits::min(); + current_statement__ = 47; + n_occasions = context__.vals_i("n_occasions")[(1 - 1)]; + current_statement__ = 47; + stan::math::check_greater_or_equal(function__, "n_occasions", + n_occasions, 2); + current_statement__ = 48; + stan::math::validate_non_negative_index("y", "nind", nind); + current_statement__ = 49; + stan::math::validate_non_negative_index("y", "n_occasions", n_occasions); + current_statement__ = 50; + context__.validate_dims("data initialization", "y", "int", + std::vector{static_cast(nind), + static_cast(n_occasions)}); + y = std::vector>(nind, + std::vector(n_occasions, std::numeric_limits::min())); + { + std::vector y_flat__; + current_statement__ = 50; + y_flat__ = context__.vals_i("y"); + current_statement__ = 50; + pos__ = 1; + current_statement__ = 50; + for (int sym1__ = 1; sym1__ <= n_occasions; ++sym1__) { + current_statement__ = 50; + for (int sym2__ = 1; sym2__ <= nind; ++sym2__) { + current_statement__ = 50; + stan::model::assign(y, y_flat__[(pos__ - 1)], + "assigning variable y", stan::model::index_uni(sym2__), + stan::model::index_uni(sym1__)); + current_statement__ = 50; + pos__ = (pos__ + 1); + } + } + } + current_statement__ = 50; + stan::math::check_greater_or_equal(function__, "y", y, 0); + current_statement__ = 50; + stan::math::check_less_or_equal(function__, "y", y, 1); + current_statement__ = 51; + n_occ_minus_1 = std::numeric_limits::min(); + current_statement__ = 51; + n_occ_minus_1 = (n_occasions - 1); + current_statement__ = 52; + stan::math::validate_non_negative_index("first", "nind", nind); + current_statement__ = 53; + first = std::vector(nind, std::numeric_limits::min()); + current_statement__ = 54; + stan::math::validate_non_negative_index("last", "nind", nind); + current_statement__ = 55; + last = std::vector(nind, std::numeric_limits::min()); + current_statement__ = 57; + for (int i = 1; i <= nind; ++i) { + current_statement__ = 56; + stan::model::assign(first, + first_capture( + stan::model::rvalue(y, "y", stan::model::index_uni(i)), pstream__), + "assigning variable first", stan::model::index_uni(i)); + } + current_statement__ = 59; + for (int i = 1; i <= nind; ++i) { + current_statement__ = 58; + stan::model::assign(last, + last_capture( + stan::model::rvalue(y, "y", stan::model::index_uni(i)), pstream__), + "assigning variable last", stan::model::index_uni(i)); + } + current_statement__ = 53; + stan::math::check_greater_or_equal(function__, "first", first, 0); + current_statement__ = 53; + stan::math::check_less_or_equal(function__, "first", first, n_occasions); + current_statement__ = 55; + stan::math::check_greater_or_equal(function__, "last", last, 0); + current_statement__ = 55; + stan::math::check_less_or_equal(function__, "last", last, n_occasions); + current_statement__ = 60; + stan::math::validate_non_negative_index("epsilon", "nind", nind); + current_statement__ = 61; + stan::math::validate_non_negative_index("phi", "nind", nind); + current_statement__ = 62; + stan::math::validate_non_negative_index("phi", "n_occ_minus_1", + n_occ_minus_1); + current_statement__ = 63; + stan::math::validate_non_negative_index("p", "nind", nind); + current_statement__ = 64; + stan::math::validate_non_negative_index("p", "n_occ_minus_1", + n_occ_minus_1); + current_statement__ = 65; + stan::math::validate_non_negative_index("chi", "nind", nind); + current_statement__ = 66; + stan::math::validate_non_negative_index("chi", "n_occasions", + n_occasions); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + num_params_r__ = 1 + 1 + nind + 1; + } + inline std::string model_name() const final { + return "expr_prop_fail5_model"; + } + inline std::vector model_compile_info() const noexcept { + return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", + "stancflags = --O1 --print-cpp"}; + } + 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__; + stan::io::deserializer in__(params_r__, params_i__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + static constexpr const char* function__ = + "expr_prop_fail5_model_namespace::log_prob"; + // suppress unused var warning + (void) function__; + try { + local_scalar_t__ mean_phi; + current_statement__ = 1; + mean_phi = in__.template read_constrain_lub(0, 1, lp__); + local_scalar_t__ mean_p; + current_statement__ = 2; + mean_p = in__.template read_constrain_lub(0, 1, lp__); + Eigen::Matrix epsilon; + current_statement__ = 3; + epsilon = in__.template read< + Eigen::Matrix>(nind); + local_scalar_t__ sigma; + current_statement__ = 4; + sigma = in__.template read_constrain_lub(0, 5, lp__); + Eigen::Matrix phi = + Eigen::Matrix::Constant(nind, n_occ_minus_1, + DUMMY_VAR__); + Eigen::Matrix p = + Eigen::Matrix::Constant(nind, n_occ_minus_1, + DUMMY_VAR__); + Eigen::Matrix chi = + Eigen::Matrix::Constant(nind, n_occasions, + DUMMY_VAR__); + local_scalar_t__ mu; + current_statement__ = 9; + mu = stan::math::logit(mean_phi); + current_statement__ = 19; + for (int i = 1; i <= nind; ++i) { + current_statement__ = 13; + for (int t = 1; t <= + (stan::model::rvalue(first, "first", stan::model::index_uni(i)) + - 1); ++t) { + current_statement__ = 10; + stan::model::assign(phi, 0, "assigning variable phi", + stan::model::index_uni(i), stan::model::index_uni(t)); + current_statement__ = 11; + stan::model::assign(p, 0, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(t)); + } + current_statement__ = 17; + for (int t = + stan::model::rvalue(first, "first", stan::model::index_uni(i)); t + <= n_occ_minus_1; ++t) { + current_statement__ = 14; + stan::model::assign(phi, + stan::math::inv_logit((mu + + stan::model::rvalue(epsilon, "epsilon", + stan::model::index_uni(i)))), "assigning variable phi", + stan::model::index_uni(i), stan::model::index_uni(t)); + current_statement__ = 15; + stan::model::assign(p, mean_p, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(t)); + } + } + Eigen::Matrix + inline_prob_uncaptured_return_sym8__; + { + current_statement__ = 20; + stan::math::validate_non_negative_index("chi", "nind", nind); + current_statement__ = 21; + stan::math::validate_non_negative_index("chi", "n_occasions", + n_occasions); + Eigen::Matrix + inline_prob_uncaptured_chi_sym9__ = + Eigen::Matrix::Constant(nind, n_occasions, + DUMMY_VAR__); + current_statement__ = 32; + for (int inline_prob_uncaptured_i_sym13__ = 1; inline_prob_uncaptured_i_sym13__ + <= nind; ++inline_prob_uncaptured_i_sym13__) { + current_statement__ = 23; + stan::model::assign(inline_prob_uncaptured_chi_sym9__, 1.0, + "assigning variable inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(n_occasions)); + current_statement__ = 30; + for (int inline_prob_uncaptured_t_sym12__ = 1; inline_prob_uncaptured_t_sym12__ + <= (n_occasions - 1); ++inline_prob_uncaptured_t_sym12__) { + int inline_prob_uncaptured_t_curr_sym10__ = + std::numeric_limits::min(); + int inline_prob_uncaptured_t_next_sym11__ = + std::numeric_limits::min(); + current_statement__ = 26; + inline_prob_uncaptured_t_curr_sym10__ = (n_occasions - + inline_prob_uncaptured_t_sym12__); + current_statement__ = 27; + inline_prob_uncaptured_t_next_sym11__ = (inline_prob_uncaptured_t_curr_sym10__ + + 1); + current_statement__ = 28; + stan::model::assign(inline_prob_uncaptured_chi_sym9__, + stan::math::fma( + (stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni( + inline_prob_uncaptured_t_curr_sym10__)) * (1 - + stan::model::rvalue(p, "p", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni( + (inline_prob_uncaptured_t_next_sym11__ - 1))))), + stan::model::rvalue(inline_prob_uncaptured_chi_sym9__, + "inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni( + inline_prob_uncaptured_t_next_sym11__)), (1 - + stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni( + inline_prob_uncaptured_t_curr_sym10__)))), + "assigning variable inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(inline_prob_uncaptured_t_curr_sym10__)); + } + } + current_statement__ = 33; + stan::model::assign(inline_prob_uncaptured_return_sym8__, + inline_prob_uncaptured_chi_sym9__, + "assigning variable inline_prob_uncaptured_return_sym8__"); + } + stan::model::assign(chi, inline_prob_uncaptured_return_sym8__, + "assigning variable chi"); + current_statement__ = 5; + stan::math::check_greater_or_equal(function__, "phi", phi, 0); + current_statement__ = 5; + stan::math::check_less_or_equal(function__, "phi", phi, 1); + current_statement__ = 6; + stan::math::check_greater_or_equal(function__, "p", p, 0); + current_statement__ = 6; + stan::math::check_less_or_equal(function__, "p", p, 1); + current_statement__ = 7; + stan::math::check_greater_or_equal(function__, "chi", chi, 0); + current_statement__ = 7; + stan::math::check_less_or_equal(function__, "chi", chi, 1); + { + current_statement__ = 36; + lp_accum__.add(stan::math::normal_lpdf(epsilon, 0, sigma)); + current_statement__ = 45; + for (int i = 1; i <= nind; ++i) { + current_statement__ = 43; + if (stan::math::logical_gt( + stan::model::rvalue(first, "first", stan::model::index_uni(i)), + 0)) { + current_statement__ = 40; + for (int t = + (stan::model::rvalue(first, "first", + stan::model::index_uni(i)) + 1); t <= + stan::model::rvalue(last, "last", stan::model::index_uni(i)); ++t) { + current_statement__ = 37; + lp_accum__.add(stan::math::bernoulli_lpmf(1, + stan::model::rvalue(phi, "phi", + stan::model::index_uni(i), + stan::model::index_uni((t - 1))))); + current_statement__ = 38; + lp_accum__.add(stan::math::bernoulli_lpmf( + stan::model::rvalue(y, "y", + stan::model::index_uni(i), + stan::model::index_uni(t)), + stan::model::rvalue(p, "p", + stan::model::index_uni(i), + stan::model::index_uni((t - 1))))); + } + current_statement__ = 41; + lp_accum__.add(stan::math::bernoulli_lpmf(1, + stan::model::rvalue(chi, "chi", + stan::model::index_uni(i), + stan::model::index_uni( + stan::model::rvalue(last, "last", + stan::model::index_uni(i)))))); + } + } + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + lp_accum__.add(lp__); + return lp_accum__.sum(); + } + 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; + 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; + // 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()); + // suppress unused var warning + (void) DUMMY_VAR__; + constexpr bool jacobian__ = false; + static constexpr const char* function__ = + "expr_prop_fail5_model_namespace::write_array"; + // suppress unused var warning + (void) function__; + try { + double mean_phi; + current_statement__ = 1; + mean_phi = in__.template read_constrain_lub(0, 1, lp__); + double mean_p; + current_statement__ = 2; + mean_p = in__.template read_constrain_lub(0, 1, lp__); + Eigen::Matrix epsilon; + current_statement__ = 3; + epsilon = in__.template read< + Eigen::Matrix>(nind); + double sigma; + current_statement__ = 4; + sigma = in__.template read_constrain_lub(0, 5, lp__); + Eigen::Matrix phi = + Eigen::Matrix::Constant(nind, n_occ_minus_1, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix p = + Eigen::Matrix::Constant(nind, n_occ_minus_1, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix chi = + Eigen::Matrix::Constant(nind, n_occasions, + std::numeric_limits::quiet_NaN()); + double mu = std::numeric_limits::quiet_NaN(); + out__.write(mean_phi); + out__.write(mean_p); + out__.write(epsilon); + out__.write(sigma); + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { + return ; + } + current_statement__ = 9; + mu = stan::math::logit(mean_phi); + current_statement__ = 19; + for (int i = 1; i <= nind; ++i) { + current_statement__ = 13; + for (int t = 1; t <= + (stan::model::rvalue(first, "first", stan::model::index_uni(i)) + - 1); ++t) { + current_statement__ = 10; + stan::model::assign(phi, 0, "assigning variable phi", + stan::model::index_uni(i), stan::model::index_uni(t)); + current_statement__ = 11; + stan::model::assign(p, 0, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(t)); + } + current_statement__ = 17; + for (int t = + stan::model::rvalue(first, "first", stan::model::index_uni(i)); t + <= n_occ_minus_1; ++t) { + current_statement__ = 14; + stan::model::assign(phi, + stan::math::inv_logit((mu + + stan::model::rvalue(epsilon, "epsilon", + stan::model::index_uni(i)))), "assigning variable phi", + stan::model::index_uni(i), stan::model::index_uni(t)); + current_statement__ = 15; + stan::model::assign(p, mean_p, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(t)); + } + } + Eigen::Matrix inline_prob_uncaptured_return_sym1__; + { + current_statement__ = 20; + stan::math::validate_non_negative_index("chi", "nind", nind); + current_statement__ = 21; + stan::math::validate_non_negative_index("chi", "n_occasions", + n_occasions); + Eigen::Matrix + inline_prob_uncaptured_chi_sym2__ = + Eigen::Matrix::Constant(nind, n_occasions, + DUMMY_VAR__); + current_statement__ = 32; + for (int inline_prob_uncaptured_i_sym6__ = 1; inline_prob_uncaptured_i_sym6__ + <= nind; ++inline_prob_uncaptured_i_sym6__) { + current_statement__ = 23; + stan::model::assign(inline_prob_uncaptured_chi_sym2__, 1.0, + "assigning variable inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(n_occasions)); + current_statement__ = 30; + for (int inline_prob_uncaptured_t_sym5__ = 1; inline_prob_uncaptured_t_sym5__ + <= (n_occasions - 1); ++inline_prob_uncaptured_t_sym5__) { + int inline_prob_uncaptured_t_curr_sym3__ = + std::numeric_limits::min(); + int inline_prob_uncaptured_t_next_sym4__ = + std::numeric_limits::min(); + current_statement__ = 26; + inline_prob_uncaptured_t_curr_sym3__ = (n_occasions - + inline_prob_uncaptured_t_sym5__); + current_statement__ = 27; + inline_prob_uncaptured_t_next_sym4__ = (inline_prob_uncaptured_t_curr_sym3__ + + 1); + current_statement__ = 28; + stan::model::assign(inline_prob_uncaptured_chi_sym2__, + stan::math::fma( + (stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni( + inline_prob_uncaptured_t_curr_sym3__)) * (1 - + stan::model::rvalue(p, "p", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni( + (inline_prob_uncaptured_t_next_sym4__ - 1))))), + stan::model::rvalue(inline_prob_uncaptured_chi_sym2__, + "inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(inline_prob_uncaptured_t_next_sym4__)), + (1 - + stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(inline_prob_uncaptured_t_curr_sym3__)))), + "assigning variable inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(inline_prob_uncaptured_t_curr_sym3__)); + } + } + current_statement__ = 33; + stan::model::assign(inline_prob_uncaptured_return_sym1__, + inline_prob_uncaptured_chi_sym2__, + "assigning variable inline_prob_uncaptured_return_sym1__"); + } + stan::model::assign(chi, inline_prob_uncaptured_return_sym1__, + "assigning variable chi"); + current_statement__ = 5; + stan::math::check_greater_or_equal(function__, "phi", phi, 0); + current_statement__ = 5; + stan::math::check_less_or_equal(function__, "phi", phi, 1); + current_statement__ = 6; + stan::math::check_greater_or_equal(function__, "p", p, 0); + current_statement__ = 6; + stan::math::check_less_or_equal(function__, "p", p, 1); + current_statement__ = 7; + stan::math::check_greater_or_equal(function__, "chi", chi, 0); + current_statement__ = 7; + stan::math::check_less_or_equal(function__, "chi", chi, 1); + if (emit_transformed_parameters__) { + out__.write(phi); + out__.write(p); + out__.write(chi); + out__.write(mu); + } + if (stan::math::logical_negation(emit_generated_quantities__)) { + return ; + } + double sigma2; + current_statement__ = 35; + sigma2 = stan::math::square(sigma); + current_statement__ = 34; + stan::math::check_greater_or_equal(function__, "sigma2", sigma2, 0); + out__.write(sigma2); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline void + transform_inits_impl(VecVar& params_r__, 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__; + pos__ = 1; + local_scalar_t__ mean_phi; + mean_phi = in__.read(); + out__.write_free_lub(0, 1, mean_phi); + local_scalar_t__ mean_p; + mean_p = in__.read(); + out__.write_free_lub(0, 1, mean_p); + Eigen::Matrix epsilon = + Eigen::Matrix::Constant(nind, DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= nind; ++sym1__) { + stan::model::assign(epsilon, in__.read(), + "assigning variable epsilon", stan::model::index_uni(sym1__)); + } + out__.write(epsilon); + local_scalar_t__ sigma; + sigma = in__.read(); + out__.write_free_lub(0, 5, sigma); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + inline void get_param_names(std::vector& names__) const { + names__ = std::vector{"mean_phi", "mean_p", "epsilon", + "sigma", "phi", "p", "chi", "mu", "sigma2"}; + } + inline void get_dims(std::vector>& dimss__) const { + dimss__ = std::vector>{std::vector{}, + std::vector{}, + std::vector{static_cast(nind)}, + std::vector{}, + std::vector{static_cast(nind), + static_cast(n_occ_minus_1)}, + std::vector{static_cast(nind), + static_cast(n_occ_minus_1)}, + std::vector{static_cast(nind), + static_cast(n_occasions)}, std::vector{}, + std::vector{}}; + } + inline void + constrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { + param_names__.emplace_back(std::string() + "mean_phi"); + param_names__.emplace_back(std::string() + "mean_p"); + for (int sym15__ = 1; sym15__ <= nind; ++sym15__) { + param_names__.emplace_back(std::string() + "epsilon" + '.' + + std::to_string(sym15__)); + } + param_names__.emplace_back(std::string() + "sigma"); + if (emit_transformed_parameters__) { + for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { + for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { + param_names__.emplace_back(std::string() + "phi" + '.' + + std::to_string(sym16__) + '.' + std::to_string(sym15__)); + } + } + for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { + for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { + param_names__.emplace_back(std::string() + "p" + '.' + + std::to_string(sym16__) + '.' + std::to_string(sym15__)); + } + } + for (int sym15__ = 1; sym15__ <= n_occasions; ++sym15__) { + for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { + param_names__.emplace_back(std::string() + "chi" + '.' + + std::to_string(sym16__) + '.' + std::to_string(sym15__)); + } + } + param_names__.emplace_back(std::string() + "mu"); + } + if (emit_generated_quantities__) { + param_names__.emplace_back(std::string() + "sigma2"); + } + } + inline void + unconstrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { + param_names__.emplace_back(std::string() + "mean_phi"); + param_names__.emplace_back(std::string() + "mean_p"); + for (int sym15__ = 1; sym15__ <= nind; ++sym15__) { + param_names__.emplace_back(std::string() + "epsilon" + '.' + + std::to_string(sym15__)); + } + param_names__.emplace_back(std::string() + "sigma"); + if (emit_transformed_parameters__) { + for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { + for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { + param_names__.emplace_back(std::string() + "phi" + '.' + + std::to_string(sym16__) + '.' + std::to_string(sym15__)); + } + } + for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { + for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { + param_names__.emplace_back(std::string() + "p" + '.' + + std::to_string(sym16__) + '.' + std::to_string(sym15__)); + } + } + for (int sym15__ = 1; sym15__ <= n_occasions; ++sym15__) { + for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { + param_names__.emplace_back(std::string() + "chi" + '.' + + std::to_string(sym16__) + '.' + std::to_string(sym15__)); + } + } + param_names__.emplace_back(std::string() + "mu"); + } + if (emit_generated_quantities__) { + param_names__.emplace_back(std::string() + "sigma2"); + } + } + inline std::string get_constrained_sizedtypes() const { + return std::string("[{\"name\":\"mean_phi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"epsilon\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(nind) + "},\"block\":\"parameters\"},{\"name\":\"sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"},{\"name\":\"mu\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"sigma2\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"}]"); + } + inline std::string get_unconstrained_sizedtypes() const { + return std::string("[{\"name\":\"mean_phi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"epsilon\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(nind) + "},\"block\":\"parameters\"},{\"name\":\"sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"},{\"name\":\"mu\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"sigma2\",\"type\":{\"name\":\"real\"},\"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__ = (((1 + 1) + nind) + 1); + const size_t num_transformed = emit_transformed_parameters * (((((nind * + n_occ_minus_1) + (nind * n_occ_minus_1)) + (nind * n_occasions)) + 1)); + const size_t num_gen_quantities = emit_generated_quantities * (1); + 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__ = (((1 + 1) + nind) + 1); + const size_t num_transformed = emit_transformed_parameters * (((((nind * + n_occ_minus_1) + (nind * n_occ_minus_1)) + (nind * n_occasions)) + 1)); + const size_t num_gen_quantities = emit_generated_quantities * (1); + 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 { + constexpr std::array + names__{"mean_phi", "mean_p", "epsilon", "sigma"}; + const std::array constrain_param_sizes__{1, 1, nind, 1}; + const auto num_constrained_params__ = + std::accumulate(constrain_param_sizes__.begin(), + constrain_param_sizes__.end(), 0); + std::vector params_r_flat__(num_constrained_params__); + Eigen::Index size_iter__ = 0; + Eigen::Index flat_iter__ = 0; + for (auto&& param_name__: names__) { + const auto param_vec__ = context.vals_r(param_name__); + for (Eigen::Index i = 0; i < constrain_param_sizes__[size_iter__]; ++i) { + params_r_flat__[flat_iter__] = param_vec__[i]; + ++flat_iter__; + } + ++size_iter__; + } + vars.resize(num_params_r__); + transform_inits_impl(params_r_flat__, params_i, vars, pstream__); + } +}; +} +using stan_model = expr_prop_fail5_model_namespace::expr_prop_fail5_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* m = new stan_model(data_context, seed, msg_stream); + return *m; +} +stan::math::profile_map& get_stan_profile_data() { + return expr_prop_fail5_model_namespace::profiles__; +} +#endif + $ ../../../../../install/default/bin/stanc --O1 --print-cpp expr-prop-fail6.stan +// Code generated by %%NAME%% %%VERSION%% +#include +namespace expr_prop_fail6_model_namespace { +using stan::model::model_base_crtp; +using namespace stan::math; +stan::math::profile_map profiles__; +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'expr-prop-fail6.stan', line 160, column 2 to column 34)", + " (in 'expr-prop-fail6.stan', line 161, column 2 to column 32)", + " (in 'expr-prop-fail6.stan', line 162, column 2 to column 29)", + " (in 'expr-prop-fail6.stan', line 163, column 2 to column 36)", + " (in 'expr-prop-fail6.stan', line 164, column 2 to column 20)", + " (in 'expr-prop-fail6.stan', line 165, column 2 to column 31)", + " (in 'expr-prop-fail6.stan', line 170, column 2 to column 51)", + " (in 'expr-prop-fail6.stan', line 171, column 2 to column 45)", + " (in 'expr-prop-fail6.stan', line 172, column 2 to column 25)", + " (in 'expr-prop-fail6.stan', line 173, column 2 to column 43)", + " (in 'expr-prop-fail6.stan', line 174, column 2 to column 47)", + " (in 'expr-prop-fail6.stan', line 177, column 2 to column 49)", + " (in 'expr-prop-fail6.stan', line 179, column 4 to column 51)", + " (in 'expr-prop-fail6.stan', line 178, column 2 to line 179, column 51)", + " (in 'expr-prop-fail6.stan', line 183, column 2 to column 23)", + " (in 'expr-prop-fail6.stan', line 187, column 4 to column 22)", + " (in 'expr-prop-fail6.stan', line 189, column 4 to column 17)", + " (in 'expr-prop-fail6.stan', line 191, column 6 to column 35)", + " (in 'expr-prop-fail6.stan', line 192, column 6 to column 27)", + " (in 'expr-prop-fail6.stan', line 190, column 37 to line 193, column 5)", + " (in 'expr-prop-fail6.stan', line 190, column 4 to line 193, column 5)", + " (in 'expr-prop-fail6.stan', line 194, column 4 to column 26)", + " (in 'expr-prop-fail6.stan', line 186, column 2 to line 195, column 3)", + " (in 'expr-prop-fail6.stan', line 49, column 4 to column 24)", + " (in 'expr-prop-fail6.stan', line 50, column 4 to column 30)", + " (in 'expr-prop-fail6.stan', line 51, column 11 to column 16)", + " (in 'expr-prop-fail6.stan', line 51, column 18 to column 29)", + " (in 'expr-prop-fail6.stan', line 51, column 4 to column 35)", + " (in 'expr-prop-fail6.stan', line 54, column 6 to column 32)", + " (in 'expr-prop-fail6.stan', line 56, column 8 to column 37)", + " (in 'expr-prop-fail6.stan', line 57, column 8 to column 32)", + " (in 'expr-prop-fail6.stan', line 59, column 8 to line 61, column 44)", + " (in 'expr-prop-fail6.stan', line 55, column 39 to line 62, column 7)", + " (in 'expr-prop-fail6.stan', line 55, column 6 to line 62, column 7)", + " (in 'expr-prop-fail6.stan', line 53, column 25 to line 63, column 5)", + " (in 'expr-prop-fail6.stan', line 53, column 4 to line 63, column 5)", + " (in 'expr-prop-fail6.stan', line 64, column 4 to column 15)", + " (in 'expr-prop-fail6.stan', line 212, column 2 to column 23)", + " (in 'expr-prop-fail6.stan', line 213, column 2 to column 22)", + " (in 'expr-prop-fail6.stan', line 214, column 2 to column 36)", + " (in 'expr-prop-fail6.stan', line 215, column 2 to column 36)", + " (in 'expr-prop-fail6.stan', line 216, column 2 to column 48)", + " (in 'expr-prop-fail6.stan', line 218, column 2 to column 25)", + " (in 'expr-prop-fail6.stan', line 222, column 4 to column 14)", + " (in 'expr-prop-fail6.stan', line 232, column 6 to column 44)", + " (in 'expr-prop-fail6.stan', line 230, column 11 to line 233, column 5)", + " (in 'expr-prop-fail6.stan', line 225, column 6 to column 37)", + " (in 'expr-prop-fail6.stan', line 227, column 8 to column 34)", + " (in 'expr-prop-fail6.stan', line 228, column 8 to column 73)", + " (in 'expr-prop-fail6.stan', line 226, column 33 to line 229, column 7)", + " (in 'expr-prop-fail6.stan', line 226, column 6 to line 229, column 7)", + " (in 'expr-prop-fail6.stan', line 223, column 28 to line 230, column 5)", + " (in 'expr-prop-fail6.stan', line 223, column 4 to line 233, column 5)", + " (in 'expr-prop-fail6.stan', line 221, column 19 to line 234, column 3)", + " (in 'expr-prop-fail6.stan', line 221, column 2 to line 234, column 3)", + " (in 'expr-prop-fail6.stan', line 238, column 10 to column 11)", + " (in 'expr-prop-fail6.stan', line 238, column 13 to column 24)", + " (in 'expr-prop-fail6.stan', line 238, column 4 to column 69)", + " (in 'expr-prop-fail6.stan', line 239, column 10 to column 11)", + " (in 'expr-prop-fail6.stan', line 239, column 4 to column 22)", + " (in 'expr-prop-fail6.stan', line 240, column 10 to column 11)", + " (in 'expr-prop-fail6.stan', line 240, column 4 to column 24)", + " (in 'expr-prop-fail6.stan', line 243, column 6 to column 39)", + " (in 'expr-prop-fail6.stan', line 17, column 8 to column 17)", + " (in 'expr-prop-fail6.stan', line 16, column 6 to line 17, column 17)", + " (in 'expr-prop-fail6.stan', line 14, column 37 to line 19, column 3)", + " (in 'expr-prop-fail6.stan', line 246, column 8 to column 26)", + " (in 'expr-prop-fail6.stan', line 245, column 6 to line 246, column 26)", + " (in 'expr-prop-fail6.stan', line 242, column 21 to line 247, column 5)", + " (in 'expr-prop-fail6.stan', line 242, column 4 to line 247, column 5)", + " (in 'expr-prop-fail6.stan', line 249, column 6 to column 28)", + " (in 'expr-prop-fail6.stan', line 250, column 6 to column 34)", + " (in 'expr-prop-fail6.stan', line 248, column 31 to line 251, column 5)", + " (in 'expr-prop-fail6.stan', line 248, column 4 to line 251, column 5)", + " (in 'expr-prop-fail6.stan', line 253, column 6 to column 26)", + " (in 'expr-prop-fail6.stan', line 254, column 6 to column 32)", + " (in 'expr-prop-fail6.stan', line 252, column 21 to line 255, column 5)", + " (in 'expr-prop-fail6.stan', line 252, column 4 to line 255, column 5)", + " (in 'expr-prop-fail6.stan', line 256, column 4 to column 25)", + " (in 'expr-prop-fail6.stan', line 237, column 2 to line 257, column 3)", + " (in 'expr-prop-fail6.stan', line 205, column 2 to column 29)", + " (in 'expr-prop-fail6.stan', line 206, column 2 to column 21)", + " (in 'expr-prop-fail6.stan', line 82, column 4 to column 27)", + " (in 'expr-prop-fail6.stan', line 83, column 4 to column 33)", + " (in 'expr-prop-fail6.stan', line 84, column 11 to column 22)", + " (in 'expr-prop-fail6.stan', line 84, column 4 to column 39)", + " (in 'expr-prop-fail6.stan', line 87, column 13 to column 24)", + " (in 'expr-prop-fail6.stan', line 87, column 6 to column 43)", + " (in 'expr-prop-fail6.stan', line 127, column 15 to column 30)", + " (in 'expr-prop-fail6.stan', line 127, column 8 to column 35)", + " (in 'expr-prop-fail6.stan', line 130, column 8 to line 131, column 78)", + " (in 'expr-prop-fail6.stan', line 134, column 10 to line 137, column 50)", + " (in 'expr-prop-fail6.stan', line 133, column 8 to line 137, column 50)", + " (in 'expr-prop-fail6.stan', line 139, column 8 to column 54)", + " (in 'expr-prop-fail6.stan', line 140, column 8 to column 34)", + " (in 'expr-prop-fail6.stan', line 125, column 13 to line 141, column 7)", + " (in 'expr-prop-fail6.stan', line 92, column 8 to column 27)", + " (in 'expr-prop-fail6.stan', line 99, column 17 to column 25)", + " (in 'expr-prop-fail6.stan', line 99, column 10 to column 30)", + " (in 'expr-prop-fail6.stan', line 102, column 10 to line 105, column 55)", + " (in 'expr-prop-fail6.stan', line 108, column 12 to line 112, column 57)", + " (in 'expr-prop-fail6.stan', line 107, column 10 to line 112, column 57)", + " (in 'expr-prop-fail6.stan', line 113, column 10 to line 115, column 62)", + " (in 'expr-prop-fail6.stan', line 116, column 10 to column 36)", + " (in 'expr-prop-fail6.stan', line 97, column 15 to line 117, column 9)", + " (in 'expr-prop-fail6.stan', line 96, column 10 to column 41)", + " (in 'expr-prop-fail6.stan', line 95, column 27 to line 97, column 9)", + " (in 'expr-prop-fail6.stan', line 95, column 8 to line 117, column 9)", + " (in 'expr-prop-fail6.stan', line 120, column 10 to column 39)", + " (in 'expr-prop-fail6.stan', line 121, column 10 to column 39)", + " (in 'expr-prop-fail6.stan', line 119, column 44 to line 122, column 9)", + " (in 'expr-prop-fail6.stan', line 119, column 8 to line 122, column 9)", + " (in 'expr-prop-fail6.stan', line 124, column 8 to column 39)", + " (in 'expr-prop-fail6.stan', line 89, column 20 to line 125, column 7)", + " (in 'expr-prop-fail6.stan', line 89, column 6 to line 141, column 7)", + " (in 'expr-prop-fail6.stan', line 86, column 25 to line 142, column 5)", + " (in 'expr-prop-fail6.stan', line 86, column 4 to line 142, column 5)", + " (in 'expr-prop-fail6.stan', line 209, column 2 to column 52)", + " (in 'expr-prop-fail6.stan', line 146, column 2 to column 17)", + " (in 'expr-prop-fail6.stan', line 147, column 2 to column 27)", + " (in 'expr-prop-fail6.stan', line 148, column 8 to column 9)", + " (in 'expr-prop-fail6.stan', line 148, column 11 to column 22)", + " (in 'expr-prop-fail6.stan', line 148, column 2 to column 48)", + " (in 'expr-prop-fail6.stan', line 151, column 8 to column 9)", + " (in 'expr-prop-fail6.stan', line 151, column 2 to column 49)", + " (in 'expr-prop-fail6.stan', line 152, column 8 to column 9)", + " (in 'expr-prop-fail6.stan', line 152, column 2 to column 48)", + " (in 'expr-prop-fail6.stan', line 155, column 4 to column 35)", + " (in 'expr-prop-fail6.stan', line 154, column 2 to line 155, column 35)", + " (in 'expr-prop-fail6.stan', line 157, column 4 to column 33)", + " (in 'expr-prop-fail6.stan', line 156, column 2 to line 157, column 33)", + " (in 'expr-prop-fail6.stan', line 163, column 18 to column 29)", " (in 'expr-prop-fail6.stan', line 164, column 9 to column 10)", " (in 'expr-prop-fail6.stan', line 170, column 27 to column 28)", " (in 'expr-prop-fail6.stan', line 170, column 30 to column 45)", @@ -7859,17 +8240,994 @@ class expr_prop_fail6_model final : public model_base_crtp(0, psi), - "assigning variable inline_js_super_lp_lp_sym27__", - stan::model::index_uni( - (inline_js_super_lp_n_occasions_sym24__ + 1))); - current_statement__ = 95; - lp_accum__.add(stan::math::log_sum_exp( - inline_js_super_lp_lp_sym27__)); + current_statement__ = 94; + stan::model::assign(inline_js_super_lp_lp_sym27__, + stan::math::bernoulli_lpmf(0, psi), + "assigning variable inline_js_super_lp_lp_sym27__", + stan::model::index_uni( + (inline_js_super_lp_n_occasions_sym24__ + 1))); + current_statement__ = 95; + lp_accum__.add(stan::math::log_sum_exp( + inline_js_super_lp_lp_sym27__)); + } + } + } + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + lp_accum__.add(lp__); + return lp_accum__.sum(); + } + 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; + 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; + // 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()); + // suppress unused var warning + (void) DUMMY_VAR__; + constexpr bool jacobian__ = false; + static constexpr const char* function__ = + "expr_prop_fail6_model_namespace::write_array"; + // suppress unused var warning + (void) function__; + try { + double mean_phi; + current_statement__ = 1; + mean_phi = in__.template read_constrain_lub(0, 1, lp__); + double mean_p; + current_statement__ = 2; + mean_p = in__.template read_constrain_lub(0, 1, lp__); + double psi; + current_statement__ = 3; + psi = in__.template read_constrain_lub(0, + 1, lp__); + Eigen::Matrix beta; + current_statement__ = 4; + beta = in__.template read_constrain_lb< + Eigen::Matrix, jacobian__>(0, lp__, + n_occasions); + Eigen::Matrix epsilon; + current_statement__ = 5; + epsilon = in__.template read>(M); + double sigma; + current_statement__ = 6; + sigma = in__.template read_constrain_lub(0, 5, lp__); + Eigen::Matrix phi = + Eigen::Matrix::Constant(M, phi_2dim__, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix p = + Eigen::Matrix::Constant(M, n_occasions, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix b = + Eigen::Matrix::Constant(n_occasions, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix nu = + Eigen::Matrix::Constant(n_occasions, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix chi = + Eigen::Matrix::Constant(M, n_occasions, + std::numeric_limits::quiet_NaN()); + out__.write(mean_phi); + out__.write(mean_p); + out__.write(psi); + out__.write(beta); + out__.write(epsilon); + out__.write(sigma); + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { + return ; + } + current_statement__ = 12; + stan::model::assign(phi, + stan::math::rep_matrix(mean_phi, M, (n_occasions - 1)), + "assigning variable phi"); + current_statement__ = 14; + for (int t = 1; t <= n_occasions; ++t) { + current_statement__ = 13; + stan::model::assign(p, + stan::math::inv_logit( + stan::math::add(stan::math::logit(mean_p), epsilon)), + "assigning variable p", stan::model::index_omni(), + stan::model::index_uni(t)); + } + current_statement__ = 15; + stan::model::assign(b, stan::math::divide(beta, stan::math::sum(beta)), + "assigning variable b"); + { + double cum_b; + current_statement__ = 16; + cum_b = stan::model::rvalue(b, "b", stan::model::index_uni(1)); + current_statement__ = 17; + stan::model::assign(nu, + stan::model::rvalue(b, "b", stan::model::index_uni(1)), + "assigning variable nu", stan::model::index_uni(1)); + current_statement__ = 21; + for (int t = 2; t <= (n_occasions - 1); ++t) { + current_statement__ = 18; + stan::model::assign(nu, + (stan::model::rvalue(b, "b", stan::model::index_uni(t)) / (1.0 - + cum_b)), "assigning variable nu", stan::model::index_uni(t)); + current_statement__ = 19; + cum_b = (cum_b + + stan::model::rvalue(b, "b", stan::model::index_uni(t))); + } + current_statement__ = 22; + stan::model::assign(nu, 1.0, "assigning variable nu", + stan::model::index_uni(n_occasions)); + } + Eigen::Matrix inline_prob_uncaptured_return_sym1__; + { + int inline_prob_uncaptured_n_ind_sym2__; + current_statement__ = 24; + inline_prob_uncaptured_n_ind_sym2__ = stan::math::rows(p); + int inline_prob_uncaptured_n_occasions_sym3__; + current_statement__ = 25; + inline_prob_uncaptured_n_occasions_sym3__ = stan::math::cols(p); + current_statement__ = 26; + stan::math::validate_non_negative_index("chi", "n_ind", + inline_prob_uncaptured_n_ind_sym2__); + current_statement__ = 27; + stan::math::validate_non_negative_index("chi", "n_occasions", + inline_prob_uncaptured_n_occasions_sym3__); + Eigen::Matrix + inline_prob_uncaptured_chi_sym4__ = + Eigen::Matrix::Constant(inline_prob_uncaptured_n_ind_sym2__, + inline_prob_uncaptured_n_occasions_sym3__, DUMMY_VAR__); + current_statement__ = 36; + for (int inline_prob_uncaptured_i_sym8__ = 1; inline_prob_uncaptured_i_sym8__ + <= + inline_prob_uncaptured_n_ind_sym2__; ++inline_prob_uncaptured_i_sym8__) { + current_statement__ = 29; + stan::model::assign(inline_prob_uncaptured_chi_sym4__, 1.0, + "assigning variable inline_prob_uncaptured_chi_sym4__", + stan::model::index_uni(inline_prob_uncaptured_i_sym8__), + stan::model::index_uni(inline_prob_uncaptured_n_occasions_sym3__)); + current_statement__ = 34; + for (int inline_prob_uncaptured_t_sym7__ = 1; inline_prob_uncaptured_t_sym7__ + <= (inline_prob_uncaptured_n_occasions_sym3__ - + 1); ++inline_prob_uncaptured_t_sym7__) { + int inline_prob_uncaptured_t_curr_sym5__; + current_statement__ = 30; + inline_prob_uncaptured_t_curr_sym5__ = (inline_prob_uncaptured_n_occasions_sym3__ + - inline_prob_uncaptured_t_sym7__); + int inline_prob_uncaptured_t_next_sym6__; + current_statement__ = 31; + inline_prob_uncaptured_t_next_sym6__ = (inline_prob_uncaptured_t_curr_sym5__ + + 1); + current_statement__ = 32; + stan::model::assign(inline_prob_uncaptured_chi_sym4__, + stan::math::fma( + (stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym8__), + stan::model::index_uni( + inline_prob_uncaptured_t_curr_sym5__)) * (1 - + stan::model::rvalue(p, "p", + stan::model::index_uni(inline_prob_uncaptured_i_sym8__), + stan::model::index_uni(inline_prob_uncaptured_t_next_sym6__)))), + stan::model::rvalue(inline_prob_uncaptured_chi_sym4__, + "inline_prob_uncaptured_chi_sym4__", + stan::model::index_uni(inline_prob_uncaptured_i_sym8__), + stan::model::index_uni(inline_prob_uncaptured_t_next_sym6__)), + (1 - + stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym8__), + stan::model::index_uni(inline_prob_uncaptured_t_curr_sym5__)))), + "assigning variable inline_prob_uncaptured_chi_sym4__", + stan::model::index_uni(inline_prob_uncaptured_i_sym8__), + stan::model::index_uni(inline_prob_uncaptured_t_curr_sym5__)); + } + } + current_statement__ = 37; + stan::model::assign(inline_prob_uncaptured_return_sym1__, + inline_prob_uncaptured_chi_sym4__, + "assigning variable inline_prob_uncaptured_return_sym1__"); + } + stan::model::assign(chi, inline_prob_uncaptured_return_sym1__, + "assigning variable chi"); + current_statement__ = 7; + stan::math::check_greater_or_equal(function__, "phi", phi, 0); + current_statement__ = 7; + stan::math::check_less_or_equal(function__, "phi", phi, 1); + current_statement__ = 8; + stan::math::check_greater_or_equal(function__, "p", p, 0); + current_statement__ = 8; + stan::math::check_less_or_equal(function__, "p", p, 1); + current_statement__ = 9; + stan::math::check_simplex(function__, "b", b); + current_statement__ = 10; + stan::math::check_greater_or_equal(function__, "nu", nu, 0); + current_statement__ = 10; + stan::math::check_less_or_equal(function__, "nu", nu, 1); + current_statement__ = 11; + stan::math::check_greater_or_equal(function__, "chi", chi, 0); + current_statement__ = 11; + stan::math::check_less_or_equal(function__, "chi", chi, 1); + if (emit_transformed_parameters__) { + out__.write(phi); + out__.write(p); + out__.write(b); + out__.write(nu); + out__.write(chi); + } + if (stan::math::logical_negation(emit_generated_quantities__)) { + return ; + } + double sigma2 = std::numeric_limits::quiet_NaN(); + int Nsuper = std::numeric_limits::min(); + std::vector N = + std::vector(n_occasions, std::numeric_limits::min()); + std::vector B = + std::vector(n_occasions, std::numeric_limits::min()); + std::vector> z = + std::vector>(M, + std::vector(n_occasions, std::numeric_limits::min())); + current_statement__ = 43; + sigma2 = stan::math::square(sigma); + current_statement__ = 55; + for (int i = 1; i <= M; ++i) { + int q; + current_statement__ = 44; + q = 1; + current_statement__ = 53; + if (stan::math::bernoulli_rng(psi, base_rng__)) { + current_statement__ = 47; + stan::model::assign(z, + stan::math::bernoulli_rng( + stan::model::rvalue(nu, "nu", stan::model::index_uni(1)), + base_rng__), "assigning variable z", stan::model::index_uni(i), + stan::model::index_uni(1)); + current_statement__ = 51; + for (int t = 2; t <= n_occasions; ++t) { + current_statement__ = 48; + q = (q * (1 - + stan::model::rvalue(z, "z", stan::model::index_uni(i), + stan::model::index_uni((t - 1))))); + current_statement__ = 49; + stan::model::assign(z, + stan::math::bernoulli_rng( + stan::math::fma( + stan::model::rvalue(z, "z", stan::model::index_uni(i), + stan::model::index_uni((t - 1))), + stan::model::rvalue(phi, "phi", stan::model::index_uni(i), + stan::model::index_uni((t - 1))), (q * + stan::model::rvalue(nu, "nu", stan::model::index_uni(t)))), + base_rng__), "assigning variable z", + stan::model::index_uni(i), stan::model::index_uni(t)); + } + } else { + current_statement__ = 45; + stan::model::assign(z, stan::math::rep_array(0, n_occasions), + "assigning variable z", stan::model::index_uni(i), + stan::model::index_omni()); + } + } + { + current_statement__ = 56; + stan::math::validate_non_negative_index("recruit", "M", M); + current_statement__ = 57; + stan::math::validate_non_negative_index("recruit", "n_occasions", + n_occasions); + std::vector> recruit = + std::vector>(M, + std::vector(n_occasions, std::numeric_limits::min())); + current_statement__ = 58; + stan::model::assign(recruit, + stan::math::rep_array(0, M, n_occasions), + "assigning variable recruit"); + current_statement__ = 59; + stan::math::validate_non_negative_index("Nind", "M", M); + std::vector Nind = + std::vector(M, std::numeric_limits::min()); + current_statement__ = 61; + stan::math::validate_non_negative_index("Nalive", "M", M); + std::vector Nalive = + std::vector(M, std::numeric_limits::min()); + current_statement__ = 70; + for (int i = 1; i <= M; ++i) { + int f = std::numeric_limits::min(); + int inline_first_capture_return_sym10__; + int inline_first_capture_early_ret_check_sym12__; + inline_first_capture_early_ret_check_sym12__ = 0; + for (int inline_first_capture_iterator_sym13__ = 1; inline_first_capture_iterator_sym13__ + <= 1; ++inline_first_capture_iterator_sym13__) { + for (int inline_first_capture_k_sym11__ = 1; inline_first_capture_k_sym11__ + <= + stan::math::size( + stan::model::rvalue(z, "z", stan::model::index_uni(i))); ++inline_first_capture_k_sym11__) { + current_statement__ = 65; + if (stan::model::rvalue(z, "z", stan::model::index_uni(i), + stan::model::index_uni(inline_first_capture_k_sym11__))) { + inline_first_capture_early_ret_check_sym12__ = 1; + inline_first_capture_return_sym10__ = inline_first_capture_k_sym11__; + break; + } } + if (inline_first_capture_early_ret_check_sym12__) { + break; + } + inline_first_capture_early_ret_check_sym12__ = 1; + inline_first_capture_return_sym10__ = 0; + break; + } + current_statement__ = 68; + if (stan::math::logical_gt(inline_first_capture_return_sym10__, 0)) { + current_statement__ = 67; + stan::model::assign(recruit, 1, "assigning variable recruit", + stan::model::index_uni(i), + stan::model::index_uni(inline_first_capture_return_sym10__)); + } + } + current_statement__ = 74; + for (int t = 1; t <= n_occasions; ++t) { + current_statement__ = 71; + stan::model::assign(N, + stan::math::sum( + stan::model::rvalue(z, "z", stan::model::index_omni(), + stan::model::index_uni(t))), "assigning variable N", + stan::model::index_uni(t)); + current_statement__ = 72; + stan::model::assign(B, + stan::math::sum( + stan::model::rvalue(recruit, "recruit", + stan::model::index_omni(), stan::model::index_uni(t))), + "assigning variable B", stan::model::index_uni(t)); + } + current_statement__ = 78; + for (int i = 1; i <= M; ++i) { + current_statement__ = 75; + stan::model::assign(Nind, + stan::math::sum( + stan::model::rvalue(z, "z", stan::model::index_uni(i))), + "assigning variable Nind", stan::model::index_uni(i)); + current_statement__ = 76; + stan::model::assign(Nalive, + stan::math::logical_gt( + stan::model::rvalue(Nind, "Nind", stan::model::index_uni(i)), 0), + "assigning variable Nalive", stan::model::index_uni(i)); + } + current_statement__ = 79; + Nsuper = stan::math::sum(Nalive); + } + current_statement__ = 38; + stan::math::check_greater_or_equal(function__, "sigma2", sigma2, 0); + current_statement__ = 39; + stan::math::check_greater_or_equal(function__, "Nsuper", Nsuper, 0); + current_statement__ = 40; + stan::math::check_greater_or_equal(function__, "N", N, 0); + current_statement__ = 41; + stan::math::check_greater_or_equal(function__, "B", B, 0); + current_statement__ = 42; + stan::math::check_greater_or_equal(function__, "z", z, 0); + current_statement__ = 42; + stan::math::check_less_or_equal(function__, "z", z, 1); + out__.write(sigma2); + out__.write(Nsuper); + out__.write(N); + out__.write(B); + for (int sym1__ = 1; sym1__ <= n_occasions; ++sym1__) { + for (int sym2__ = 1; sym2__ <= M; ++sym2__) { + out__.write(z[(sym2__ - 1)][(sym1__ - 1)]); + } + } + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + template * = nullptr, + stan::require_vector_like_vt* = nullptr> + inline void + transform_inits_impl(VecVar& params_r__, 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__; + pos__ = 1; + local_scalar_t__ mean_phi; + mean_phi = in__.read(); + out__.write_free_lub(0, 1, mean_phi); + local_scalar_t__ mean_p; + mean_p = in__.read(); + out__.write_free_lub(0, 1, mean_p); + local_scalar_t__ psi; + psi = in__.read(); + out__.write_free_lub(0, 1, psi); + Eigen::Matrix beta = + Eigen::Matrix::Constant(n_occasions, + DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= n_occasions; ++sym1__) { + stan::model::assign(beta, in__.read(), + "assigning variable beta", stan::model::index_uni(sym1__)); + } + out__.write_free_lb(0, beta); + Eigen::Matrix epsilon = + Eigen::Matrix::Constant(M, DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= M; ++sym1__) { + stan::model::assign(epsilon, in__.read(), + "assigning variable epsilon", stan::model::index_uni(sym1__)); + } + out__.write(epsilon); + local_scalar_t__ sigma; + sigma = in__.read(); + out__.write_free_lub(0, 5, sigma); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + } + inline void get_param_names(std::vector& names__) const { + names__ = std::vector{"mean_phi", "mean_p", "psi", "beta", + "epsilon", "sigma", "phi", "p", "b", "nu", "chi", "sigma2", + "Nsuper", "N", "B", "z"}; + } + inline void get_dims(std::vector>& dimss__) const { + dimss__ = std::vector>{std::vector{}, + std::vector{}, std::vector{}, + std::vector{static_cast(n_occasions)}, + std::vector{static_cast(M)}, + std::vector{}, + std::vector{static_cast(M), + static_cast(phi_2dim__)}, + std::vector{static_cast(M), + static_cast(n_occasions)}, + std::vector{static_cast(n_occasions)}, + std::vector{static_cast(n_occasions)}, + std::vector{static_cast(M), + static_cast(n_occasions)}, std::vector{}, + std::vector{}, + std::vector{static_cast(n_occasions)}, + std::vector{static_cast(n_occasions)}, + std::vector{static_cast(M), + static_cast(n_occasions)}}; + } + inline void + constrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { + param_names__.emplace_back(std::string() + "mean_phi"); + param_names__.emplace_back(std::string() + "mean_p"); + param_names__.emplace_back(std::string() + "psi"); + for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { + param_names__.emplace_back(std::string() + "beta" + '.' + + std::to_string(sym31__)); + } + for (int sym31__ = 1; sym31__ <= M; ++sym31__) { + param_names__.emplace_back(std::string() + "epsilon" + '.' + + std::to_string(sym31__)); + } + param_names__.emplace_back(std::string() + "sigma"); + if (emit_transformed_parameters__) { + for (int sym31__ = 1; sym31__ <= phi_2dim__; ++sym31__) { + for (int sym32__ = 1; sym32__ <= M; ++sym32__) { + param_names__.emplace_back(std::string() + "phi" + '.' + + std::to_string(sym32__) + '.' + std::to_string(sym31__)); + } + } + for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { + for (int sym32__ = 1; sym32__ <= M; ++sym32__) { + param_names__.emplace_back(std::string() + "p" + '.' + + std::to_string(sym32__) + '.' + std::to_string(sym31__)); + } + } + for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { + param_names__.emplace_back(std::string() + "b" + '.' + + std::to_string(sym31__)); + } + for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { + param_names__.emplace_back(std::string() + "nu" + '.' + + std::to_string(sym31__)); + } + for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { + for (int sym32__ = 1; sym32__ <= M; ++sym32__) { + param_names__.emplace_back(std::string() + "chi" + '.' + + std::to_string(sym32__) + '.' + std::to_string(sym31__)); + } + } + } + if (emit_generated_quantities__) { + param_names__.emplace_back(std::string() + "sigma2"); + param_names__.emplace_back(std::string() + "Nsuper"); + for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { + param_names__.emplace_back(std::string() + "N" + '.' + + std::to_string(sym31__)); + } + for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { + param_names__.emplace_back(std::string() + "B" + '.' + + std::to_string(sym31__)); + } + for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { + for (int sym32__ = 1; sym32__ <= M; ++sym32__) { + param_names__.emplace_back(std::string() + "z" + '.' + + std::to_string(sym32__) + '.' + std::to_string(sym31__)); + } + } + } + } + inline void + unconstrained_param_names(std::vector& param_names__, bool + emit_transformed_parameters__ = true, bool + emit_generated_quantities__ = true) const final { + param_names__.emplace_back(std::string() + "mean_phi"); + param_names__.emplace_back(std::string() + "mean_p"); + param_names__.emplace_back(std::string() + "psi"); + for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { + param_names__.emplace_back(std::string() + "beta" + '.' + + std::to_string(sym31__)); + } + for (int sym31__ = 1; sym31__ <= M; ++sym31__) { + param_names__.emplace_back(std::string() + "epsilon" + '.' + + std::to_string(sym31__)); + } + param_names__.emplace_back(std::string() + "sigma"); + if (emit_transformed_parameters__) { + for (int sym31__ = 1; sym31__ <= phi_2dim__; ++sym31__) { + for (int sym32__ = 1; sym32__ <= M; ++sym32__) { + param_names__.emplace_back(std::string() + "phi" + '.' + + std::to_string(sym32__) + '.' + std::to_string(sym31__)); + } + } + for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { + for (int sym32__ = 1; sym32__ <= M; ++sym32__) { + param_names__.emplace_back(std::string() + "p" + '.' + + std::to_string(sym32__) + '.' + std::to_string(sym31__)); + } + } + for (int sym31__ = 1; sym31__ <= (n_occasions - 1); ++sym31__) { + param_names__.emplace_back(std::string() + "b" + '.' + + std::to_string(sym31__)); + } + for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { + param_names__.emplace_back(std::string() + "nu" + '.' + + std::to_string(sym31__)); + } + for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { + for (int sym32__ = 1; sym32__ <= M; ++sym32__) { + param_names__.emplace_back(std::string() + "chi" + '.' + + std::to_string(sym32__) + '.' + std::to_string(sym31__)); + } + } + } + if (emit_generated_quantities__) { + param_names__.emplace_back(std::string() + "sigma2"); + param_names__.emplace_back(std::string() + "Nsuper"); + for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { + param_names__.emplace_back(std::string() + "N" + '.' + + std::to_string(sym31__)); + } + for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { + param_names__.emplace_back(std::string() + "B" + '.' + + std::to_string(sym31__)); + } + for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { + for (int sym32__ = 1; sym32__ <= M; ++sym32__) { + param_names__.emplace_back(std::string() + "z" + '.' + + std::to_string(sym32__) + '.' + std::to_string(sym31__)); + } + } + } + } + inline std::string get_constrained_sizedtypes() const { + return std::string("[{\"name\":\"mean_phi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"psi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_occasions) + "},\"block\":\"parameters\"},{\"name\":\"epsilon\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(M) + "},\"block\":\"parameters\"},{\"name\":\"sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(M) + ",\"cols\":" + std::to_string(phi_2dim__) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(M) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"},{\"name\":\"b\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"},{\"name\":\"nu\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(M) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"},{\"name\":\"sigma2\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"Nsuper\",\"type\":{\"name\":\"int\"},\"block\":\"generated_quantities\"},{\"name\":\"N\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(n_occasions) + ",\"element_type\":{\"name\":\"int\"}},\"block\":\"generated_quantities\"},{\"name\":\"B\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(n_occasions) + ",\"element_type\":{\"name\":\"int\"}},\"block\":\"generated_quantities\"},{\"name\":\"z\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(M) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(n_occasions) + ",\"element_type\":{\"name\":\"int\"}}},\"block\":\"generated_quantities\"}]"); + } + inline std::string get_unconstrained_sizedtypes() const { + return std::string("[{\"name\":\"mean_phi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"psi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_occasions) + "},\"block\":\"parameters\"},{\"name\":\"epsilon\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(M) + "},\"block\":\"parameters\"},{\"name\":\"sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(M) + ",\"cols\":" + std::to_string(phi_2dim__) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(M) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"},{\"name\":\"b\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string((n_occasions -1)) + "},\"block\":\"transformed_parameters\"},{\"name\":\"nu\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(M) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"},{\"name\":\"sigma2\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"Nsuper\",\"type\":{\"name\":\"int\"},\"block\":\"generated_quantities\"},{\"name\":\"N\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(n_occasions) + ",\"element_type\":{\"name\":\"int\"}},\"block\":\"generated_quantities\"},{\"name\":\"B\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(n_occasions) + ",\"element_type\":{\"name\":\"int\"}},\"block\":\"generated_quantities\"},{\"name\":\"z\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(M) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(n_occasions) + ",\"element_type\":{\"name\":\"int\"}}},\"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__ = (((((1 + 1) + 1) + n_occasions) + M) + 1); + const size_t num_transformed = emit_transformed_parameters * ((((((M * + phi_2dim__) + (M * n_occasions)) + n_occasions) + n_occasions) + (M * + n_occasions))); + const size_t num_gen_quantities = emit_generated_quantities * (((((1 + 1) + + n_occasions) + n_occasions) + (M * n_occasions))); + 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__ = (((((1 + 1) + 1) + n_occasions) + M) + 1); + const size_t num_transformed = emit_transformed_parameters * ((((((M * + phi_2dim__) + (M * n_occasions)) + n_occasions) + n_occasions) + (M * + n_occasions))); + const size_t num_gen_quantities = emit_generated_quantities * (((((1 + 1) + + n_occasions) + n_occasions) + (M * n_occasions))); + 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 { + constexpr std::array + names__{"mean_phi", "mean_p", "psi", "beta", "epsilon", "sigma"}; + const std::array + constrain_param_sizes__{1, 1, 1, n_occasions, M, 1}; + const auto num_constrained_params__ = + std::accumulate(constrain_param_sizes__.begin(), + constrain_param_sizes__.end(), 0); + std::vector params_r_flat__(num_constrained_params__); + Eigen::Index size_iter__ = 0; + Eigen::Index flat_iter__ = 0; + for (auto&& param_name__: names__) { + const auto param_vec__ = context.vals_r(param_name__); + for (Eigen::Index i = 0; i < constrain_param_sizes__[size_iter__]; ++i) { + params_r_flat__[flat_iter__] = param_vec__[i]; + ++flat_iter__; + } + ++size_iter__; + } + vars.resize(num_params_r__); + transform_inits_impl(params_r_flat__, params_i, vars, pstream__); + } +}; +} +using stan_model = expr_prop_fail6_model_namespace::expr_prop_fail6_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* m = new stan_model(data_context, seed, msg_stream); + return *m; +} +stan::math::profile_map& get_stan_profile_data() { + return expr_prop_fail6_model_namespace::profiles__; +} +#endif + $ ../../../../../install/default/bin/stanc --O1 --print-cpp expr-prop-fail7.stan +// Code generated by %%NAME%% %%VERSION%% +#include +namespace expr_prop_fail7_model_namespace { +using stan::model::model_base_crtp; +using namespace stan::math; +stan::math::profile_map profiles__; +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'expr-prop-fail7.stan', line 20, column 2 to column 16)", + " (in 'expr-prop-fail7.stan', line 21, column 2 to column 31)", + " (in 'expr-prop-fail7.stan', line 40, column 2 to column 30)", + " (in 'expr-prop-fail7.stan', line 42, column 11 to column 12)", + " (in 'expr-prop-fail7.stan', line 42, column 4 to column 30)", + " (in 'expr-prop-fail7.stan', line 44, column 6 to column 52)", + " (in 'expr-prop-fail7.stan', line 43, column 4 to line 44, column 52)", + " (in 'expr-prop-fail7.stan', line 45, column 4 to column 45)", + " (in 'expr-prop-fail7.stan', line 41, column 19 to line 46, column 3)", + " (in 'expr-prop-fail7.stan', line 41, column 2 to line 46, column 3)", + " (in 'expr-prop-fail7.stan', line 25, column 2 to column 24)", + " (in 'expr-prop-fail7.stan', line 28, column 6 to column 39)", + " (in 'expr-prop-fail7.stan', line 27, column 4 to line 28, column 39)", + " (in 'expr-prop-fail7.stan', line 26, column 2 to line 28, column 39)", + " (in 'expr-prop-fail7.stan', line 32, column 11 to column 12)", + " (in 'expr-prop-fail7.stan', line 32, column 4 to column 30)", + " (in 'expr-prop-fail7.stan', line 34, column 6 to column 54)", + " (in 'expr-prop-fail7.stan', line 33, column 4 to line 34, column 54)", + " (in 'expr-prop-fail7.stan', line 35, column 4 to column 33)", + " (in 'expr-prop-fail7.stan', line 31, column 19 to line 36, column 3)", + " (in 'expr-prop-fail7.stan', line 31, column 2 to line 36, column 3)", + " (in 'expr-prop-fail7.stan', line 12, column 2 to column 17)", + " (in 'expr-prop-fail7.stan', line 13, column 2 to column 17)", + " (in 'expr-prop-fail7.stan', line 14, column 2 to column 17)", + " (in 'expr-prop-fail7.stan', line 15, column 8 to column 9)", + " (in 'expr-prop-fail7.stan', line 15, column 11 to column 12)", + " (in 'expr-prop-fail7.stan', line 15, column 2 to column 38)", + " (in 'expr-prop-fail7.stan', line 16, column 18 to column 19)", + " (in 'expr-prop-fail7.stan', line 16, column 2 to column 27)", + " (in 'expr-prop-fail7.stan', line 17, column 8 to column 9)", + " (in 'expr-prop-fail7.stan', line 17, column 27 to column 28)", + " (in 'expr-prop-fail7.stan', line 17, column 2 to column 35)", + " (in 'expr-prop-fail7.stan', line 20, column 10 to column 11)", + " (in 'expr-prop-fail7.stan', line 21, column 8 to column 9)", + " (in 'expr-prop-fail7.stan', line 21, column 11 to column 12)", + " (in 'expr-prop-fail7.stan', line 21, column 22 to column 23)", + " (in 'expr-prop-fail7.stan', line 40, column 8 to column 9)", + " (in 'expr-prop-fail7.stan', line 40, column 18 to column 19)"}; +class expr_prop_fail7_model final : public model_base_crtp { + private: + int K; + int I; + int J; + std::vector> y; + Eigen::Matrix alpha_data__; + std::vector> beta; + Eigen::Map> alpha{nullptr, 0}; + public: + ~expr_prop_fail7_model() {} + expr_prop_fail7_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__ = + "expr_prop_fail7_model_namespace::expr_prop_fail7_model"; + // suppress unused var warning + (void) function__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + int pos__; + pos__ = 1; + current_statement__ = 22; + context__.validate_dims("data initialization", "K", "int", + std::vector{}); + K = std::numeric_limits::min(); + current_statement__ = 22; + K = context__.vals_i("K")[(1 - 1)]; + current_statement__ = 22; + stan::math::check_greater_or_equal(function__, "K", K, 2); + current_statement__ = 23; + context__.validate_dims("data initialization", "I", "int", + std::vector{}); + I = std::numeric_limits::min(); + current_statement__ = 23; + I = context__.vals_i("I")[(1 - 1)]; + current_statement__ = 23; + stan::math::check_greater_or_equal(function__, "I", I, 1); + current_statement__ = 24; + context__.validate_dims("data initialization", "J", "int", + std::vector{}); + J = std::numeric_limits::min(); + current_statement__ = 24; + J = context__.vals_i("J")[(1 - 1)]; + current_statement__ = 24; + stan::math::check_greater_or_equal(function__, "J", J, 1); + current_statement__ = 25; + stan::math::validate_non_negative_index("y", "I", I); + current_statement__ = 26; + stan::math::validate_non_negative_index("y", "J", J); + current_statement__ = 27; + context__.validate_dims("data initialization", "y", "int", + std::vector{static_cast(I), static_cast(J)}); + y = std::vector>(I, + std::vector(J, std::numeric_limits::min())); + { + std::vector y_flat__; + current_statement__ = 27; + y_flat__ = context__.vals_i("y"); + current_statement__ = 27; + pos__ = 1; + current_statement__ = 27; + for (int sym1__ = 1; sym1__ <= J; ++sym1__) { + current_statement__ = 27; + for (int sym2__ = 1; sym2__ <= I; ++sym2__) { + current_statement__ = 27; + stan::model::assign(y, y_flat__[(pos__ - 1)], + "assigning variable y", stan::model::index_uni(sym2__), + stan::model::index_uni(sym1__)); + current_statement__ = 27; + pos__ = (pos__ + 1); + } + } + } + current_statement__ = 27; + stan::math::check_greater_or_equal(function__, "y", y, 1); + current_statement__ = 27; + stan::math::check_less_or_equal(function__, "y", y, K); + current_statement__ = 28; + stan::math::validate_non_negative_index("alpha", "K", K); + current_statement__ = 29; + context__.validate_dims("data initialization", "alpha", "double", + std::vector{static_cast(K)}); + alpha_data__ = Eigen::Matrix::Constant(K, + std::numeric_limits::quiet_NaN()); + new (&alpha) + Eigen::Map>(alpha_data__.data(), K); + { + std::vector alpha_flat__; + current_statement__ = 29; + alpha_flat__ = context__.vals_r("alpha"); + current_statement__ = 29; + pos__ = 1; + current_statement__ = 29; + for (int sym1__ = 1; sym1__ <= K; ++sym1__) { + current_statement__ = 29; + stan::model::assign(alpha, alpha_flat__[(pos__ - 1)], + "assigning variable alpha", stan::model::index_uni(sym1__)); + current_statement__ = 29; + pos__ = (pos__ + 1); + } + } + current_statement__ = 29; + stan::math::check_greater_or_equal(function__, "alpha", alpha, 0); + current_statement__ = 30; + stan::math::validate_non_negative_index("beta", "K", K); + current_statement__ = 31; + stan::math::validate_non_negative_index("beta", "K", K); + current_statement__ = 32; + context__.validate_dims("data initialization", "beta", "double", + std::vector{static_cast(K), static_cast(K)}); + beta = std::vector>(K, + Eigen::Matrix::Constant(K, + std::numeric_limits::quiet_NaN())); + { + std::vector beta_flat__; + current_statement__ = 32; + beta_flat__ = context__.vals_r("beta"); + current_statement__ = 32; + pos__ = 1; + current_statement__ = 32; + for (int sym1__ = 1; sym1__ <= K; ++sym1__) { + current_statement__ = 32; + for (int sym2__ = 1; sym2__ <= K; ++sym2__) { + current_statement__ = 32; + stan::model::assign(beta, beta_flat__[(pos__ - 1)], + "assigning variable beta", stan::model::index_uni(sym2__), + stan::model::index_uni(sym1__)); + current_statement__ = 32; + pos__ = (pos__ + 1); + } + } + } + current_statement__ = 32; + stan::math::check_greater_or_equal(function__, "beta", beta, 0); + current_statement__ = 33; + stan::math::validate_positive_index("pi", "K", K); + current_statement__ = 34; + stan::math::validate_non_negative_index("theta", "J", J); + current_statement__ = 35; + stan::math::validate_non_negative_index("theta", "K", K); + current_statement__ = 36; + stan::math::validate_positive_index("theta", "K", K); + current_statement__ = 37; + stan::math::validate_non_negative_index("log_Pr_z", "I", I); + current_statement__ = 38; + stan::math::validate_non_negative_index("log_Pr_z", "K", K); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } + num_params_r__ = (K - 1) + (J * K * (K - 1)); + } + inline std::string model_name() const final { + return "expr_prop_fail7_model"; + } + inline std::vector model_compile_info() const noexcept { + return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", + "stancflags = --O1 --print-cpp"}; + } + 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__; + stan::io::deserializer in__(params_r__, params_i__); + int current_statement__ = 0; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + static constexpr const char* function__ = + "expr_prop_fail7_model_namespace::log_prob"; + // suppress unused var warning + (void) function__; + try { + stan::conditional_var_value_t> pi; + current_statement__ = 1; + pi = in__.template read_constrain_simplex< + stan::conditional_var_value_t>, jacobian__>(lp__, K); + std::vector>> theta; + current_statement__ = 2; + theta = in__.template read_constrain_simplex< + std::vector< + std::vector>>, + jacobian__>(lp__, J, K, K); + { + current_statement__ = 11; + lp_accum__.add(stan::math::dirichlet_lpdf(pi, alpha)); + current_statement__ = 14; + for (int j = 1; j <= J; ++j) { + current_statement__ = 13; + for (int k = 1; k <= K; ++k) { + current_statement__ = 12; + lp_accum__.add(stan::math::dirichlet_lpdf( + stan::model::rvalue(theta, "theta", + stan::model::index_uni(j), + stan::model::index_uni(k)), + stan::model::rvalue(beta, "beta", + stan::model::index_uni(k)))); + } + } + current_statement__ = 21; + for (int i = 1; i <= I; ++i) { + current_statement__ = 15; + stan::math::validate_non_negative_index("log_q", "K", K); + stan::conditional_var_value_t> log_q; + current_statement__ = 16; + stan::model::assign(log_q, stan::math::log(pi), + "assigning variable log_q"); + current_statement__ = 18; + for (int j = 1; j <= J; ++j) { + current_statement__ = 17; + stan::model::assign(log_q, + stan::math::add(stan::model::deep_copy(log_q), + stan::math::to_vector( + stan::math::log( + stan::model::rvalue(theta, "theta", + stan::model::index_uni(j), stan::model::index_omni(), + stan::model::index_uni( + stan::model::rvalue(y, "y", + stan::model::index_uni(i), + stan::model::index_uni(j))))))), + "assigning variable log_q"); } + current_statement__ = 19; + lp_accum__.add(stan::math::log_sum_exp(log_q)); } } } catch (const std::exception& e) { @@ -7905,350 +9263,70 @@ class expr_prop_fail6_model final : public model_base_crtp pi; current_statement__ = 1; - mean_phi = in__.template read_constrain_lub(0, 1, lp__); - double mean_p; + pi = in__.template read_constrain_simplex< + Eigen::Matrix, jacobian__>(lp__, K); + std::vector>> theta; current_statement__ = 2; - mean_p = in__.template read_constrain_lub(0, 1, lp__); - double psi; - current_statement__ = 3; - psi = in__.template read_constrain_lub(0, - 1, lp__); - Eigen::Matrix beta; - current_statement__ = 4; - beta = in__.template read_constrain_lb< - Eigen::Matrix, jacobian__>(0, lp__, - n_occasions); - Eigen::Matrix epsilon; - current_statement__ = 5; - epsilon = in__.template read>(M); - double sigma; - current_statement__ = 6; - sigma = in__.template read_constrain_lub(0, 5, lp__); - Eigen::Matrix phi = - Eigen::Matrix::Constant(M, phi_2dim__, - std::numeric_limits::quiet_NaN()); - Eigen::Matrix p = - Eigen::Matrix::Constant(M, n_occasions, - std::numeric_limits::quiet_NaN()); - Eigen::Matrix b = - Eigen::Matrix::Constant(n_occasions, - std::numeric_limits::quiet_NaN()); - Eigen::Matrix nu = - Eigen::Matrix::Constant(n_occasions, - std::numeric_limits::quiet_NaN()); - Eigen::Matrix chi = - Eigen::Matrix::Constant(M, n_occasions, - std::numeric_limits::quiet_NaN()); - out__.write(mean_phi); - out__.write(mean_p); - out__.write(psi); - out__.write(beta); - out__.write(epsilon); - out__.write(sigma); - if (stan::math::logical_negation( - (stan::math::primitive_value(emit_transformed_parameters__) || - stan::math::primitive_value(emit_generated_quantities__)))) { - return ; - } - current_statement__ = 12; - stan::model::assign(phi, - stan::math::rep_matrix(mean_phi, M, (n_occasions - 1)), - "assigning variable phi"); - current_statement__ = 14; - for (int t = 1; t <= n_occasions; ++t) { - current_statement__ = 13; - stan::model::assign(p, - stan::math::inv_logit( - stan::math::add(stan::math::logit(mean_p), epsilon)), - "assigning variable p", stan::model::index_omni(), - stan::model::index_uni(t)); - } - current_statement__ = 15; - stan::model::assign(b, stan::math::divide(beta, stan::math::sum(beta)), - "assigning variable b"); - { - double cum_b; - current_statement__ = 16; - cum_b = stan::model::rvalue(b, "b", stan::model::index_uni(1)); - current_statement__ = 17; - stan::model::assign(nu, - stan::model::rvalue(b, "b", stan::model::index_uni(1)), - "assigning variable nu", stan::model::index_uni(1)); - current_statement__ = 21; - for (int t = 2; t <= (n_occasions - 1); ++t) { - current_statement__ = 18; - stan::model::assign(nu, - (stan::model::rvalue(b, "b", stan::model::index_uni(t)) / (1.0 - - cum_b)), "assigning variable nu", stan::model::index_uni(t)); - current_statement__ = 19; - cum_b = (cum_b + - stan::model::rvalue(b, "b", stan::model::index_uni(t))); - } - current_statement__ = 22; - stan::model::assign(nu, 1.0, "assigning variable nu", - stan::model::index_uni(n_occasions)); - } - Eigen::Matrix inline_prob_uncaptured_return_sym1__; - { - int inline_prob_uncaptured_n_ind_sym2__; - current_statement__ = 24; - inline_prob_uncaptured_n_ind_sym2__ = stan::math::rows(p); - int inline_prob_uncaptured_n_occasions_sym3__; - current_statement__ = 25; - inline_prob_uncaptured_n_occasions_sym3__ = stan::math::cols(p); - current_statement__ = 26; - stan::math::validate_non_negative_index("chi", "n_ind", - inline_prob_uncaptured_n_ind_sym2__); - current_statement__ = 27; - stan::math::validate_non_negative_index("chi", "n_occasions", - inline_prob_uncaptured_n_occasions_sym3__); - Eigen::Matrix - inline_prob_uncaptured_chi_sym4__ = - Eigen::Matrix::Constant(inline_prob_uncaptured_n_ind_sym2__, - inline_prob_uncaptured_n_occasions_sym3__, DUMMY_VAR__); - current_statement__ = 36; - for (int inline_prob_uncaptured_i_sym8__ = 1; inline_prob_uncaptured_i_sym8__ - <= - inline_prob_uncaptured_n_ind_sym2__; ++inline_prob_uncaptured_i_sym8__) { - current_statement__ = 29; - stan::model::assign(inline_prob_uncaptured_chi_sym4__, 1.0, - "assigning variable inline_prob_uncaptured_chi_sym4__", - stan::model::index_uni(inline_prob_uncaptured_i_sym8__), - stan::model::index_uni(inline_prob_uncaptured_n_occasions_sym3__)); - current_statement__ = 34; - for (int inline_prob_uncaptured_t_sym7__ = 1; inline_prob_uncaptured_t_sym7__ - <= (inline_prob_uncaptured_n_occasions_sym3__ - - 1); ++inline_prob_uncaptured_t_sym7__) { - int inline_prob_uncaptured_t_curr_sym5__; - current_statement__ = 30; - inline_prob_uncaptured_t_curr_sym5__ = (inline_prob_uncaptured_n_occasions_sym3__ - - inline_prob_uncaptured_t_sym7__); - int inline_prob_uncaptured_t_next_sym6__; - current_statement__ = 31; - inline_prob_uncaptured_t_next_sym6__ = (inline_prob_uncaptured_t_curr_sym5__ - + 1); - current_statement__ = 32; - stan::model::assign(inline_prob_uncaptured_chi_sym4__, - stan::math::fma( - (stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym8__), - stan::model::index_uni( - inline_prob_uncaptured_t_curr_sym5__)) * (1 - - stan::model::rvalue(p, "p", - stan::model::index_uni(inline_prob_uncaptured_i_sym8__), - stan::model::index_uni(inline_prob_uncaptured_t_next_sym6__)))), - stan::model::rvalue(inline_prob_uncaptured_chi_sym4__, - "inline_prob_uncaptured_chi_sym4__", - stan::model::index_uni(inline_prob_uncaptured_i_sym8__), - stan::model::index_uni(inline_prob_uncaptured_t_next_sym6__)), - (1 - - stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym8__), - stan::model::index_uni(inline_prob_uncaptured_t_curr_sym5__)))), - "assigning variable inline_prob_uncaptured_chi_sym4__", - stan::model::index_uni(inline_prob_uncaptured_i_sym8__), - stan::model::index_uni(inline_prob_uncaptured_t_curr_sym5__)); + theta = in__.template read_constrain_simplex< + std::vector< + std::vector>>, + jacobian__>(lp__, J, K, K); + out__.write(pi); + for (int sym1__ = 1; sym1__ <= K; ++sym1__) { + for (int sym2__ = 1; sym2__ <= K; ++sym2__) { + for (int sym3__ = 1; sym3__ <= J; ++sym3__) { + out__.write(theta[(sym3__ - 1)][(sym2__ - 1)][(sym1__ - 1)]); } } - current_statement__ = 37; - stan::model::assign(inline_prob_uncaptured_return_sym1__, - inline_prob_uncaptured_chi_sym4__, - "assigning variable inline_prob_uncaptured_return_sym1__"); } - stan::model::assign(chi, inline_prob_uncaptured_return_sym1__, - "assigning variable chi"); - current_statement__ = 7; - stan::math::check_greater_or_equal(function__, "phi", phi, 0); - current_statement__ = 7; - stan::math::check_less_or_equal(function__, "phi", phi, 1); - current_statement__ = 8; - stan::math::check_greater_or_equal(function__, "p", p, 0); - current_statement__ = 8; - stan::math::check_less_or_equal(function__, "p", p, 1); - current_statement__ = 9; - stan::math::check_simplex(function__, "b", b); - current_statement__ = 10; - stan::math::check_greater_or_equal(function__, "nu", nu, 0); - current_statement__ = 10; - stan::math::check_less_or_equal(function__, "nu", nu, 1); - current_statement__ = 11; - stan::math::check_greater_or_equal(function__, "chi", chi, 0); - current_statement__ = 11; - stan::math::check_less_or_equal(function__, "chi", chi, 1); - if (emit_transformed_parameters__) { - out__.write(phi); - out__.write(p); - out__.write(b); - out__.write(nu); - out__.write(chi); + if (stan::math::logical_negation( + (stan::math::primitive_value(emit_transformed_parameters__) || + stan::math::primitive_value(emit_generated_quantities__)))) { + return ; } if (stan::math::logical_negation(emit_generated_quantities__)) { return ; } - double sigma2 = std::numeric_limits::quiet_NaN(); - int Nsuper = std::numeric_limits::min(); - std::vector N = - std::vector(n_occasions, std::numeric_limits::min()); - std::vector B = - std::vector(n_occasions, std::numeric_limits::min()); - std::vector> z = - std::vector>(M, - std::vector(n_occasions, std::numeric_limits::min())); - current_statement__ = 43; - sigma2 = stan::math::square(sigma); - current_statement__ = 55; - for (int i = 1; i <= M; ++i) { - int q; - current_statement__ = 44; - q = 1; - current_statement__ = 53; - if (stan::math::bernoulli_rng(psi, base_rng__)) { - current_statement__ = 47; - stan::model::assign(z, - stan::math::bernoulli_rng( - stan::model::rvalue(nu, "nu", stan::model::index_uni(1)), - base_rng__), "assigning variable z", stan::model::index_uni(i), - stan::model::index_uni(1)); - current_statement__ = 51; - for (int t = 2; t <= n_occasions; ++t) { - current_statement__ = 48; - q = (q * (1 - - stan::model::rvalue(z, "z", stan::model::index_uni(i), - stan::model::index_uni((t - 1))))); - current_statement__ = 49; - stan::model::assign(z, - stan::math::bernoulli_rng( - stan::math::fma( - stan::model::rvalue(z, "z", stan::model::index_uni(i), - stan::model::index_uni((t - 1))), - stan::model::rvalue(phi, "phi", stan::model::index_uni(i), - stan::model::index_uni((t - 1))), (q * - stan::model::rvalue(nu, "nu", stan::model::index_uni(t)))), - base_rng__), "assigning variable z", - stan::model::index_uni(i), stan::model::index_uni(t)); - } - } else { - current_statement__ = 45; - stan::model::assign(z, stan::math::rep_array(0, n_occasions), - "assigning variable z", stan::model::index_uni(i), - stan::model::index_omni()); - } - } - { - current_statement__ = 56; - stan::math::validate_non_negative_index("recruit", "M", M); - current_statement__ = 57; - stan::math::validate_non_negative_index("recruit", "n_occasions", - n_occasions); - std::vector> recruit = - std::vector>(M, - std::vector(n_occasions, std::numeric_limits::min())); - current_statement__ = 58; - stan::model::assign(recruit, - stan::math::rep_array(0, M, n_occasions), - "assigning variable recruit"); - current_statement__ = 59; - stan::math::validate_non_negative_index("Nind", "M", M); - std::vector Nind = - std::vector(M, std::numeric_limits::min()); - current_statement__ = 61; - stan::math::validate_non_negative_index("Nalive", "M", M); - std::vector Nalive = - std::vector(M, std::numeric_limits::min()); - current_statement__ = 70; - for (int i = 1; i <= M; ++i) { - int f = std::numeric_limits::min(); - int inline_first_capture_return_sym10__; - int inline_first_capture_early_ret_check_sym12__; - inline_first_capture_early_ret_check_sym12__ = 0; - for (int inline_first_capture_iterator_sym13__ = 1; inline_first_capture_iterator_sym13__ - <= 1; ++inline_first_capture_iterator_sym13__) { - for (int inline_first_capture_k_sym11__ = 1; inline_first_capture_k_sym11__ - <= - stan::math::size( - stan::model::rvalue(z, "z", stan::model::index_uni(i))); ++inline_first_capture_k_sym11__) { - current_statement__ = 65; - if (stan::model::rvalue(z, "z", stan::model::index_uni(i), - stan::model::index_uni(inline_first_capture_k_sym11__))) { - inline_first_capture_early_ret_check_sym12__ = 1; - inline_first_capture_return_sym10__ = inline_first_capture_k_sym11__; - break; - } - } - if (inline_first_capture_early_ret_check_sym12__) { - break; - } - inline_first_capture_early_ret_check_sym12__ = 1; - inline_first_capture_return_sym10__ = 0; - break; - } - current_statement__ = 68; - if (stan::math::logical_gt(inline_first_capture_return_sym10__, 0)) { - current_statement__ = 67; - stan::model::assign(recruit, 1, "assigning variable recruit", - stan::model::index_uni(i), - stan::model::index_uni(inline_first_capture_return_sym10__)); - } - } - current_statement__ = 74; - for (int t = 1; t <= n_occasions; ++t) { - current_statement__ = 71; - stan::model::assign(N, - stan::math::sum( - stan::model::rvalue(z, "z", stan::model::index_omni(), - stan::model::index_uni(t))), "assigning variable N", - stan::model::index_uni(t)); - current_statement__ = 72; - stan::model::assign(B, - stan::math::sum( - stan::model::rvalue(recruit, "recruit", - stan::model::index_omni(), stan::model::index_uni(t))), - "assigning variable B", stan::model::index_uni(t)); - } - current_statement__ = 78; - for (int i = 1; i <= M; ++i) { - current_statement__ = 75; - stan::model::assign(Nind, - stan::math::sum( - stan::model::rvalue(z, "z", stan::model::index_uni(i))), - "assigning variable Nind", stan::model::index_uni(i)); - current_statement__ = 76; - stan::model::assign(Nalive, - stan::math::logical_gt( - stan::model::rvalue(Nind, "Nind", stan::model::index_uni(i)), 0), - "assigning variable Nalive", stan::model::index_uni(i)); + std::vector> log_Pr_z = + std::vector>(I, + Eigen::Matrix::Constant(K, + std::numeric_limits::quiet_NaN())); + current_statement__ = 10; + for (int i = 1; i <= I; ++i) { + current_statement__ = 4; + stan::math::validate_non_negative_index("log_q", "K", K); + Eigen::Matrix log_q; + current_statement__ = 5; + stan::model::assign(log_q, stan::math::log(pi), + "assigning variable log_q"); + current_statement__ = 7; + for (int j = 1; j <= J; ++j) { + current_statement__ = 6; + stan::model::assign(log_q, + stan::math::add(stan::model::deep_copy(log_q), + stan::math::to_vector( + stan::math::log( + stan::model::rvalue(theta, "theta", + stan::model::index_uni(j), stan::model::index_omni(), + stan::model::index_uni( + stan::model::rvalue(y, "y", stan::model::index_uni(i), + stan::model::index_uni(j))))))), + "assigning variable log_q"); } - current_statement__ = 79; - Nsuper = stan::math::sum(Nalive); + current_statement__ = 8; + stan::model::assign(log_Pr_z, + stan::math::subtract(log_q, stan::math::log_sum_exp(log_q)), + "assigning variable log_Pr_z", stan::model::index_uni(i)); } - current_statement__ = 38; - stan::math::check_greater_or_equal(function__, "sigma2", sigma2, 0); - current_statement__ = 39; - stan::math::check_greater_or_equal(function__, "Nsuper", Nsuper, 0); - current_statement__ = 40; - stan::math::check_greater_or_equal(function__, "N", N, 0); - current_statement__ = 41; - stan::math::check_greater_or_equal(function__, "B", B, 0); - current_statement__ = 42; - stan::math::check_greater_or_equal(function__, "z", z, 0); - current_statement__ = 42; - stan::math::check_less_or_equal(function__, "z", z, 1); - out__.write(sigma2); - out__.write(Nsuper); - out__.write(N); - out__.write(B); - for (int sym1__ = 1; sym1__ <= n_occasions; ++sym1__) { - for (int sym2__ = 1; sym2__ <= M; ++sym2__) { - out__.write(z[(sym2__ - 1)][(sym1__ - 1)]); + for (int sym1__ = 1; sym1__ <= K; ++sym1__) { + for (int sym2__ = 1; sym2__ <= I; ++sym2__) { + out__.write(log_Pr_z[(sym2__ - 1)][(sym1__ - 1)]); } } } catch (const std::exception& e) { @@ -8271,121 +9349,65 @@ class expr_prop_fail6_model final : public model_base_crtp(); - out__.write_free_lub(0, 1, mean_phi); - local_scalar_t__ mean_p; - mean_p = in__.read(); - out__.write_free_lub(0, 1, mean_p); - local_scalar_t__ psi; - psi = in__.read(); - out__.write_free_lub(0, 1, psi); - Eigen::Matrix beta = - Eigen::Matrix::Constant(n_occasions, - DUMMY_VAR__); - for (int sym1__ = 1; sym1__ <= n_occasions; ++sym1__) { - stan::model::assign(beta, in__.read(), - "assigning variable beta", stan::model::index_uni(sym1__)); + Eigen::Matrix pi = + Eigen::Matrix::Constant(K, DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= K; ++sym1__) { + stan::model::assign(pi, in__.read(), + "assigning variable pi", stan::model::index_uni(sym1__)); } - out__.write_free_lb(0, beta); - Eigen::Matrix epsilon = - Eigen::Matrix::Constant(M, DUMMY_VAR__); - for (int sym1__ = 1; sym1__ <= M; ++sym1__) { - stan::model::assign(epsilon, in__.read(), - "assigning variable epsilon", stan::model::index_uni(sym1__)); + out__.write_free_simplex(pi); + std::vector>> theta = + std::vector>>(J, + std::vector>(K, + Eigen::Matrix::Constant(K, DUMMY_VAR__))); + for (int sym1__ = 1; sym1__ <= K; ++sym1__) { + for (int sym2__ = 1; sym2__ <= K; ++sym2__) { + for (int sym3__ = 1; sym3__ <= J; ++sym3__) { + stan::model::assign(theta, in__.read(), + "assigning variable theta", stan::model::index_uni(sym3__), + stan::model::index_uni(sym2__), stan::model::index_uni(sym1__)); + } + } } - out__.write(epsilon); - local_scalar_t__ sigma; - sigma = in__.read(); - out__.write_free_lub(0, 5, sigma); + out__.write_free_simplex(theta); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } inline void get_param_names(std::vector& names__) const { - names__ = std::vector{"mean_phi", "mean_p", "psi", "beta", - "epsilon", "sigma", "phi", "p", "b", "nu", "chi", "sigma2", - "Nsuper", "N", "B", "z"}; + names__ = std::vector{"pi", "theta", "log_Pr_z"}; } inline void get_dims(std::vector>& dimss__) const { - dimss__ = std::vector>{std::vector{}, - std::vector{}, std::vector{}, - std::vector{static_cast(n_occasions)}, - std::vector{static_cast(M)}, - std::vector{}, - std::vector{static_cast(M), - static_cast(phi_2dim__)}, - std::vector{static_cast(M), - static_cast(n_occasions)}, - std::vector{static_cast(n_occasions)}, - std::vector{static_cast(n_occasions)}, - std::vector{static_cast(M), - static_cast(n_occasions)}, std::vector{}, - std::vector{}, - std::vector{static_cast(n_occasions)}, - std::vector{static_cast(n_occasions)}, - std::vector{static_cast(M), - static_cast(n_occasions)}}; + dimss__ = std::vector>{std::vector{static_cast< + size_t>(K)}, + std::vector{static_cast(J), + static_cast(K), static_cast(K)}, + std::vector{static_cast(I), + static_cast(K)}}; } inline void constrained_param_names(std::vector& param_names__, bool emit_transformed_parameters__ = true, bool emit_generated_quantities__ = true) const final { - param_names__.emplace_back(std::string() + "mean_phi"); - param_names__.emplace_back(std::string() + "mean_p"); - param_names__.emplace_back(std::string() + "psi"); - for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { - param_names__.emplace_back(std::string() + "beta" + '.' + - std::to_string(sym31__)); - } - for (int sym31__ = 1; sym31__ <= M; ++sym31__) { - param_names__.emplace_back(std::string() + "epsilon" + '.' + - std::to_string(sym31__)); + for (int sym1__ = 1; sym1__ <= K; ++sym1__) { + param_names__.emplace_back(std::string() + "pi" + '.' + + std::to_string(sym1__)); } - param_names__.emplace_back(std::string() + "sigma"); - if (emit_transformed_parameters__) { - for (int sym31__ = 1; sym31__ <= phi_2dim__; ++sym31__) { - for (int sym32__ = 1; sym32__ <= M; ++sym32__) { - param_names__.emplace_back(std::string() + "phi" + '.' + - std::to_string(sym32__) + '.' + std::to_string(sym31__)); - } - } - for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { - for (int sym32__ = 1; sym32__ <= M; ++sym32__) { - param_names__.emplace_back(std::string() + "p" + '.' + - std::to_string(sym32__) + '.' + std::to_string(sym31__)); - } - } - for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { - param_names__.emplace_back(std::string() + "b" + '.' + - std::to_string(sym31__)); - } - for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { - param_names__.emplace_back(std::string() + "nu" + '.' + - std::to_string(sym31__)); - } - for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { - for (int sym32__ = 1; sym32__ <= M; ++sym32__) { - param_names__.emplace_back(std::string() + "chi" + '.' + - std::to_string(sym32__) + '.' + std::to_string(sym31__)); + for (int sym1__ = 1; sym1__ <= K; ++sym1__) { + for (int sym2__ = 1; sym2__ <= K; ++sym2__) { + for (int sym3__ = 1; sym3__ <= J; ++sym3__) { + param_names__.emplace_back(std::string() + "theta" + '.' + + std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' + + std::to_string(sym1__)); } } } + if (emit_transformed_parameters__) {} if (emit_generated_quantities__) { - param_names__.emplace_back(std::string() + "sigma2"); - param_names__.emplace_back(std::string() + "Nsuper"); - for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { - param_names__.emplace_back(std::string() + "N" + '.' + - std::to_string(sym31__)); - } - for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { - param_names__.emplace_back(std::string() + "B" + '.' + - std::to_string(sym31__)); - } - for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { - for (int sym32__ = 1; sym32__ <= M; ++sym32__) { - param_names__.emplace_back(std::string() + "z" + '.' + - std::to_string(sym32__) + '.' + std::to_string(sym31__)); + for (int sym1__ = 1; sym1__ <= K; ++sym1__) { + for (int sym2__ = 1; sym2__ <= I; ++sym2__) { + param_names__.emplace_back(std::string() + "log_Pr_z" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); } } } @@ -8394,70 +9416,34 @@ class expr_prop_fail6_model final : public model_base_crtp& param_names__, bool emit_transformed_parameters__ = true, bool emit_generated_quantities__ = true) const final { - param_names__.emplace_back(std::string() + "mean_phi"); - param_names__.emplace_back(std::string() + "mean_p"); - param_names__.emplace_back(std::string() + "psi"); - for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { - param_names__.emplace_back(std::string() + "beta" + '.' + - std::to_string(sym31__)); - } - for (int sym31__ = 1; sym31__ <= M; ++sym31__) { - param_names__.emplace_back(std::string() + "epsilon" + '.' + - std::to_string(sym31__)); + for (int sym1__ = 1; sym1__ <= (K - 1); ++sym1__) { + param_names__.emplace_back(std::string() + "pi" + '.' + + std::to_string(sym1__)); } - param_names__.emplace_back(std::string() + "sigma"); - if (emit_transformed_parameters__) { - for (int sym31__ = 1; sym31__ <= phi_2dim__; ++sym31__) { - for (int sym32__ = 1; sym32__ <= M; ++sym32__) { - param_names__.emplace_back(std::string() + "phi" + '.' + - std::to_string(sym32__) + '.' + std::to_string(sym31__)); - } - } - for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { - for (int sym32__ = 1; sym32__ <= M; ++sym32__) { - param_names__.emplace_back(std::string() + "p" + '.' + - std::to_string(sym32__) + '.' + std::to_string(sym31__)); - } - } - for (int sym31__ = 1; sym31__ <= (n_occasions - 1); ++sym31__) { - param_names__.emplace_back(std::string() + "b" + '.' + - std::to_string(sym31__)); - } - for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { - param_names__.emplace_back(std::string() + "nu" + '.' + - std::to_string(sym31__)); - } - for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { - for (int sym32__ = 1; sym32__ <= M; ++sym32__) { - param_names__.emplace_back(std::string() + "chi" + '.' + - std::to_string(sym32__) + '.' + std::to_string(sym31__)); + for (int sym1__ = 1; sym1__ <= (K - 1); ++sym1__) { + for (int sym2__ = 1; sym2__ <= K; ++sym2__) { + for (int sym3__ = 1; sym3__ <= J; ++sym3__) { + param_names__.emplace_back(std::string() + "theta" + '.' + + std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' + + std::to_string(sym1__)); } } } + if (emit_transformed_parameters__) {} if (emit_generated_quantities__) { - param_names__.emplace_back(std::string() + "sigma2"); - param_names__.emplace_back(std::string() + "Nsuper"); - for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { - param_names__.emplace_back(std::string() + "N" + '.' + - std::to_string(sym31__)); - } - for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { - param_names__.emplace_back(std::string() + "B" + '.' + - std::to_string(sym31__)); - } - for (int sym31__ = 1; sym31__ <= n_occasions; ++sym31__) { - for (int sym32__ = 1; sym32__ <= M; ++sym32__) { - param_names__.emplace_back(std::string() + "z" + '.' + - std::to_string(sym32__) + '.' + std::to_string(sym31__)); + for (int sym1__ = 1; sym1__ <= K; ++sym1__) { + for (int sym2__ = 1; sym2__ <= I; ++sym2__) { + param_names__.emplace_back(std::string() + "log_Pr_z" + '.' + + std::to_string(sym2__) + '.' + std::to_string(sym1__)); } } } } inline std::string get_constrained_sizedtypes() const { - return std::string("[{\"name\":\"mean_phi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"psi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_occasions) + "},\"block\":\"parameters\"},{\"name\":\"epsilon\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(M) + "},\"block\":\"parameters\"},{\"name\":\"sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(M) + ",\"cols\":" + std::to_string(phi_2dim__) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(M) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"},{\"name\":\"b\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"},{\"name\":\"nu\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(M) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"},{\"name\":\"sigma2\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"Nsuper\",\"type\":{\"name\":\"int\"},\"block\":\"generated_quantities\"},{\"name\":\"N\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(n_occasions) + ",\"element_type\":{\"name\":\"int\"}},\"block\":\"generated_quantities\"},{\"name\":\"B\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(n_occasions) + ",\"element_type\":{\"name\":\"int\"}},\"block\":\"generated_quantities\"},{\"name\":\"z\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(M) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(n_occasions) + ",\"element_type\":{\"name\":\"int\"}}},\"block\":\"generated_quantities\"}]"); + return std::string("[{\"name\":\"pi\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(K) + "},\"block\":\"parameters\"},{\"name\":\"theta\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(J) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(K) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string(K) + "}}},\"block\":\"parameters\"},{\"name\":\"log_Pr_z\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(I) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string(K) + "}},\"block\":\"generated_quantities\"}]"); } inline std::string get_unconstrained_sizedtypes() const { - return std::string("[{\"name\":\"mean_phi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"psi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_occasions) + "},\"block\":\"parameters\"},{\"name\":\"epsilon\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(M) + "},\"block\":\"parameters\"},{\"name\":\"sigma\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(M) + ",\"cols\":" + std::to_string(phi_2dim__) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(M) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"},{\"name\":\"b\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string((n_occasions -1)) + "},\"block\":\"transformed_parameters\"},{\"name\":\"nu\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(M) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"},{\"name\":\"sigma2\",\"type\":{\"name\":\"real\"},\"block\":\"generated_quantities\"},{\"name\":\"Nsuper\",\"type\":{\"name\":\"int\"},\"block\":\"generated_quantities\"},{\"name\":\"N\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(n_occasions) + ",\"element_type\":{\"name\":\"int\"}},\"block\":\"generated_quantities\"},{\"name\":\"B\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(n_occasions) + ",\"element_type\":{\"name\":\"int\"}},\"block\":\"generated_quantities\"},{\"name\":\"z\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(M) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(n_occasions) + ",\"element_type\":{\"name\":\"int\"}}},\"block\":\"generated_quantities\"}]"); + return std::string("[{\"name\":\"pi\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string((K -1)) + "},\"block\":\"parameters\"},{\"name\":\"theta\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(J) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(K) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string((K -1)) + "}}},\"block\":\"parameters\"},{\"name\":\"log_Pr_z\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(I) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string(K) + "}},\"block\":\"generated_quantities\"}]"); } // Begin method overload boilerplate template inline void @@ -8466,12 +9452,9 @@ class expr_prop_fail6_model final : public model_base_crtp params_i; @@ -8486,12 +9469,9 @@ class expr_prop_fail6_model final : public model_base_crtp(num_to_write, @@ -8523,10 +9503,8 @@ class expr_prop_fail6_model final : public model_base_crtp& params_i, std::vector& vars, std::ostream* pstream__ = nullptr) const { - constexpr std::array - names__{"mean_phi", "mean_p", "psi", "beta", "epsilon", "sigma"}; - const std::array - constrain_param_sizes__{1, 1, 1, n_occasions, M, 1}; + constexpr std::array names__{"pi", "theta"}; + const std::array constrain_param_sizes__{K, (J * K * K)}; const auto num_constrained_params__ = std::accumulate(constrain_param_sizes__.begin(), constrain_param_sizes__.end(), 0); @@ -8546,78 +9524,64 @@ class expr_prop_fail6_model final : public model_base_crtp -namespace expr_prop_fail7_model_namespace { -using stan::model::model_base_crtp; -using namespace stan::math; -stan::math::profile_map profiles__; -static constexpr std::array locations_array__ = - {" (found before start of program)", - " (in 'expr-prop-fail7.stan', line 20, column 2 to column 16)", - " (in 'expr-prop-fail7.stan', line 21, column 2 to column 31)", - " (in 'expr-prop-fail7.stan', line 40, column 2 to column 30)", - " (in 'expr-prop-fail7.stan', line 42, column 11 to column 12)", - " (in 'expr-prop-fail7.stan', line 42, column 4 to column 30)", - " (in 'expr-prop-fail7.stan', line 44, column 6 to column 52)", - " (in 'expr-prop-fail7.stan', line 43, column 4 to line 44, column 52)", - " (in 'expr-prop-fail7.stan', line 45, column 4 to column 45)", - " (in 'expr-prop-fail7.stan', line 41, column 19 to line 46, column 3)", - " (in 'expr-prop-fail7.stan', line 41, column 2 to line 46, column 3)", - " (in 'expr-prop-fail7.stan', line 25, column 2 to column 24)", - " (in 'expr-prop-fail7.stan', line 28, column 6 to column 39)", - " (in 'expr-prop-fail7.stan', line 27, column 4 to line 28, column 39)", - " (in 'expr-prop-fail7.stan', line 26, column 2 to line 28, column 39)", - " (in 'expr-prop-fail7.stan', line 32, column 11 to column 12)", - " (in 'expr-prop-fail7.stan', line 32, column 4 to column 30)", - " (in 'expr-prop-fail7.stan', line 34, column 6 to column 54)", - " (in 'expr-prop-fail7.stan', line 33, column 4 to line 34, column 54)", - " (in 'expr-prop-fail7.stan', line 35, column 4 to column 33)", - " (in 'expr-prop-fail7.stan', line 31, column 19 to line 36, column 3)", - " (in 'expr-prop-fail7.stan', line 31, column 2 to line 36, column 3)", - " (in 'expr-prop-fail7.stan', line 12, column 2 to column 17)", - " (in 'expr-prop-fail7.stan', line 13, column 2 to column 17)", - " (in 'expr-prop-fail7.stan', line 14, column 2 to column 17)", - " (in 'expr-prop-fail7.stan', line 15, column 8 to column 9)", - " (in 'expr-prop-fail7.stan', line 15, column 11 to column 12)", - " (in 'expr-prop-fail7.stan', line 15, column 2 to column 38)", - " (in 'expr-prop-fail7.stan', line 16, column 18 to column 19)", - " (in 'expr-prop-fail7.stan', line 16, column 2 to column 27)", - " (in 'expr-prop-fail7.stan', line 17, column 8 to column 9)", - " (in 'expr-prop-fail7.stan', line 17, column 27 to column 28)", - " (in 'expr-prop-fail7.stan', line 17, column 2 to column 35)", - " (in 'expr-prop-fail7.stan', line 20, column 10 to column 11)", - " (in 'expr-prop-fail7.stan', line 21, column 8 to column 9)", - " (in 'expr-prop-fail7.stan', line 21, column 11 to column 12)", - " (in 'expr-prop-fail7.stan', line 21, column 22 to column 23)", - " (in 'expr-prop-fail7.stan', line 40, column 8 to column 9)", - " (in 'expr-prop-fail7.stan', line 40, column 18 to column 19)"}; -class expr_prop_fail7_model final : public model_base_crtp { +using stan_model = expr_prop_fail7_model_namespace::expr_prop_fail7_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* m = new stan_model(data_context, seed, msg_stream); + return *m; +} +stan::math::profile_map& get_stan_profile_data() { + return expr_prop_fail7_model_namespace::profiles__; +} +#endif + $ ../../../../../install/default/bin/stanc --O1 --print-cpp expr-prop-fail8.stan +// Code generated by %%NAME%% %%VERSION%% +#include +namespace expr_prop_fail8_model_namespace { +using stan::model::model_base_crtp; +using namespace stan::math; +stan::math::profile_map profiles__; +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'expr-prop-fail8.stan', line 11, column 2 to column 13)", + " (in 'expr-prop-fail8.stan', line 12, column 2 to column 13)", + " (in 'expr-prop-fail8.stan', line 14, column 2 to column 26)", + " (in 'expr-prop-fail8.stan', line 15, column 2 to column 24)", + " (in 'expr-prop-fail8.stan', line 17, column 2 to column 22)", + " (in 'expr-prop-fail8.stan', line 18, column 2 to column 24)", + " (in 'expr-prop-fail8.stan', line 21, column 2 to column 47)", + " (in 'expr-prop-fail8.stan', line 22, column 2 to column 16)", + " (in 'expr-prop-fail8.stan', line 23, column 2 to column 27)", + " (in 'expr-prop-fail8.stan', line 24, column 2 to column 24)", + " (in 'expr-prop-fail8.stan', line 27, column 2 to column 33)", + " (in 'expr-prop-fail8.stan', line 2, column 2 to column 17)", + " (in 'expr-prop-fail8.stan', line 3, column 2 to column 23)", + " (in 'expr-prop-fail8.stan', line 4, column 8 to column 15)", + " (in 'expr-prop-fail8.stan', line 4, column 2 to column 45)", + " (in 'expr-prop-fail8.stan', line 5, column 8 to column 15)", + " (in 'expr-prop-fail8.stan', line 5, column 2 to column 45)", + " (in 'expr-prop-fail8.stan', line 7, column 8 to column 9)", + " (in 'expr-prop-fail8.stan', line 7, column 2 to column 26)", + " (in 'expr-prop-fail8.stan', line 8, column 9 to column 10)", + " (in 'expr-prop-fail8.stan', line 8, column 2 to column 14)", + " (in 'expr-prop-fail8.stan', line 17, column 9 to column 10)", + " (in 'expr-prop-fail8.stan', line 18, column 9 to column 10)", + " (in 'expr-prop-fail8.stan', line 22, column 9 to column 10)"}; +class expr_prop_fail8_model final : public model_base_crtp { private: - int K; - int I; - int J; - std::vector> y; - Eigen::Matrix alpha_data__; - std::vector> beta; - Eigen::Map> alpha{nullptr, 0}; + int N; + int N_edges; + std::vector node1; + std::vector node2; + std::vector y; + Eigen::Matrix x_data__; + Eigen::Map> x{nullptr, 0}; public: - ~expr_prop_fail7_model() {} - expr_prop_fail7_model(stan::io::var_context& context__, unsigned int + ~expr_prop_fail8_model() {} + expr_prop_fail8_model(stan::io::var_context& context__, unsigned int random_seed__ = 0, std::ostream* pstream__ = nullptr) : model_base_crtp(0) { int current_statement__ = 0; @@ -8627,7 +9591,7 @@ class expr_prop_fail7_model final : public model_base_crtp::quiet_NaN()); @@ -8636,138 +9600,92 @@ class expr_prop_fail7_model final : public model_base_crtp{}); - K = std::numeric_limits::min(); - current_statement__ = 22; - K = context__.vals_i("K")[(1 - 1)]; - current_statement__ = 22; - stan::math::check_greater_or_equal(function__, "K", K, 2); - current_statement__ = 23; - context__.validate_dims("data initialization", "I", "int", + current_statement__ = 12; + context__.validate_dims("data initialization", "N", "int", std::vector{}); - I = std::numeric_limits::min(); - current_statement__ = 23; - I = context__.vals_i("I")[(1 - 1)]; - current_statement__ = 23; - stan::math::check_greater_or_equal(function__, "I", I, 1); - current_statement__ = 24; - context__.validate_dims("data initialization", "J", "int", + N = std::numeric_limits::min(); + current_statement__ = 12; + N = context__.vals_i("N")[(1 - 1)]; + current_statement__ = 12; + stan::math::check_greater_or_equal(function__, "N", N, 0); + current_statement__ = 13; + context__.validate_dims("data initialization", "N_edges", "int", std::vector{}); - J = std::numeric_limits::min(); - current_statement__ = 24; - J = context__.vals_i("J")[(1 - 1)]; - current_statement__ = 24; - stan::math::check_greater_or_equal(function__, "J", J, 1); - current_statement__ = 25; - stan::math::validate_non_negative_index("y", "I", I); - current_statement__ = 26; - stan::math::validate_non_negative_index("y", "J", J); - current_statement__ = 27; + N_edges = std::numeric_limits::min(); + current_statement__ = 13; + N_edges = context__.vals_i("N_edges")[(1 - 1)]; + current_statement__ = 13; + stan::math::check_greater_or_equal(function__, "N_edges", N_edges, 0); + current_statement__ = 14; + stan::math::validate_non_negative_index("node1", "N_edges", N_edges); + current_statement__ = 15; + context__.validate_dims("data initialization", "node1", "int", + std::vector{static_cast(N_edges)}); + node1 = std::vector(N_edges, std::numeric_limits::min()); + current_statement__ = 15; + node1 = context__.vals_i("node1"); + current_statement__ = 15; + stan::math::check_greater_or_equal(function__, "node1", node1, 1); + current_statement__ = 15; + stan::math::check_less_or_equal(function__, "node1", node1, N); + current_statement__ = 16; + stan::math::validate_non_negative_index("node2", "N_edges", N_edges); + current_statement__ = 17; + context__.validate_dims("data initialization", "node2", "int", + std::vector{static_cast(N_edges)}); + node2 = std::vector(N_edges, std::numeric_limits::min()); + current_statement__ = 17; + node2 = context__.vals_i("node2"); + current_statement__ = 17; + stan::math::check_greater_or_equal(function__, "node2", node2, 1); + current_statement__ = 17; + stan::math::check_less_or_equal(function__, "node2", node2, N); + current_statement__ = 18; + stan::math::validate_non_negative_index("y", "N", N); + current_statement__ = 19; context__.validate_dims("data initialization", "y", "int", - std::vector{static_cast(I), static_cast(J)}); - y = std::vector>(I, - std::vector(J, std::numeric_limits::min())); - { - std::vector y_flat__; - current_statement__ = 27; - y_flat__ = context__.vals_i("y"); - current_statement__ = 27; - pos__ = 1; - current_statement__ = 27; - for (int sym1__ = 1; sym1__ <= J; ++sym1__) { - current_statement__ = 27; - for (int sym2__ = 1; sym2__ <= I; ++sym2__) { - current_statement__ = 27; - stan::model::assign(y, y_flat__[(pos__ - 1)], - "assigning variable y", stan::model::index_uni(sym2__), - stan::model::index_uni(sym1__)); - current_statement__ = 27; - pos__ = (pos__ + 1); - } - } - } - current_statement__ = 27; - stan::math::check_greater_or_equal(function__, "y", y, 1); - current_statement__ = 27; - stan::math::check_less_or_equal(function__, "y", y, K); - current_statement__ = 28; - stan::math::validate_non_negative_index("alpha", "K", K); - current_statement__ = 29; - context__.validate_dims("data initialization", "alpha", "double", - std::vector{static_cast(K)}); - alpha_data__ = Eigen::Matrix::Constant(K, - std::numeric_limits::quiet_NaN()); - new (&alpha) - Eigen::Map>(alpha_data__.data(), K); + std::vector{static_cast(N)}); + y = std::vector(N, std::numeric_limits::min()); + current_statement__ = 19; + y = context__.vals_i("y"); + current_statement__ = 19; + stan::math::check_greater_or_equal(function__, "y", y, 0); + current_statement__ = 20; + stan::math::validate_non_negative_index("x", "N", N); + current_statement__ = 21; + context__.validate_dims("data initialization", "x", "double", + std::vector{static_cast(N)}); + x_data__ = Eigen::Matrix::Constant(N, + std::numeric_limits::quiet_NaN()); + new (&x) Eigen::Map>(x_data__.data(), N); { - std::vector alpha_flat__; - current_statement__ = 29; - alpha_flat__ = context__.vals_r("alpha"); - current_statement__ = 29; + std::vector x_flat__; + current_statement__ = 21; + x_flat__ = context__.vals_r("x"); + current_statement__ = 21; pos__ = 1; - current_statement__ = 29; - for (int sym1__ = 1; sym1__ <= K; ++sym1__) { - current_statement__ = 29; - stan::model::assign(alpha, alpha_flat__[(pos__ - 1)], - "assigning variable alpha", stan::model::index_uni(sym1__)); - current_statement__ = 29; + current_statement__ = 21; + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + current_statement__ = 21; + stan::model::assign(x, x_flat__[(pos__ - 1)], + "assigning variable x", stan::model::index_uni(sym1__)); + current_statement__ = 21; pos__ = (pos__ + 1); } } - current_statement__ = 29; - stan::math::check_greater_or_equal(function__, "alpha", alpha, 0); - current_statement__ = 30; - stan::math::validate_non_negative_index("beta", "K", K); - current_statement__ = 31; - stan::math::validate_non_negative_index("beta", "K", K); - current_statement__ = 32; - context__.validate_dims("data initialization", "beta", "double", - std::vector{static_cast(K), static_cast(K)}); - beta = std::vector>(K, - Eigen::Matrix::Constant(K, - std::numeric_limits::quiet_NaN())); - { - std::vector beta_flat__; - current_statement__ = 32; - beta_flat__ = context__.vals_r("beta"); - current_statement__ = 32; - pos__ = 1; - current_statement__ = 32; - for (int sym1__ = 1; sym1__ <= K; ++sym1__) { - current_statement__ = 32; - for (int sym2__ = 1; sym2__ <= K; ++sym2__) { - current_statement__ = 32; - stan::model::assign(beta, beta_flat__[(pos__ - 1)], - "assigning variable beta", stan::model::index_uni(sym2__), - stan::model::index_uni(sym1__)); - current_statement__ = 32; - pos__ = (pos__ + 1); - } - } - } - current_statement__ = 32; - stan::math::check_greater_or_equal(function__, "beta", beta, 0); - current_statement__ = 33; - stan::math::validate_positive_index("pi", "K", K); - current_statement__ = 34; - stan::math::validate_non_negative_index("theta", "J", J); - current_statement__ = 35; - stan::math::validate_non_negative_index("theta", "K", K); - current_statement__ = 36; - stan::math::validate_positive_index("theta", "K", K); - current_statement__ = 37; - stan::math::validate_non_negative_index("log_Pr_z", "I", I); - current_statement__ = 38; - stan::math::validate_non_negative_index("log_Pr_z", "K", K); + current_statement__ = 22; + stan::math::validate_non_negative_index("theta_std", "N", N); + current_statement__ = 23; + stan::math::validate_non_negative_index("phi_std_raw", "N", N); + current_statement__ = 24; + stan::math::validate_non_negative_index("phi", "N", N); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } - num_params_r__ = (K - 1) + (J * K * (K - 1)); + num_params_r__ = 1 + 1 + 1 + 1 + N + N; } inline std::string model_name() const final { - return "expr_prop_fail7_model"; + return "expr_prop_fail8_model"; } inline std::vector model_compile_info() const noexcept { return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", @@ -8789,65 +9707,60 @@ class expr_prop_fail7_model final : public model_base_crtp> pi; + local_scalar_t__ beta0; current_statement__ = 1; - pi = in__.template read_constrain_simplex< - stan::conditional_var_value_t>, jacobian__>(lp__, K); - std::vector>> theta; + beta0 = in__.template read(); + local_scalar_t__ beta1; current_statement__ = 2; - theta = in__.template read_constrain_simplex< - std::vector< - std::vector>>, - jacobian__>(lp__, J, K, K); + beta1 = in__.template read(); + local_scalar_t__ tau_theta; + current_statement__ = 3; + tau_theta = in__.template read_constrain_lb(0, lp__); + local_scalar_t__ tau_phi; + current_statement__ = 4; + tau_phi = in__.template read_constrain_lb(0, lp__); + stan::conditional_var_value_t> theta_std; + current_statement__ = 5; + theta_std = in__.template read< + stan::conditional_var_value_t>>(N); + stan::conditional_var_value_t> phi_std_raw; + current_statement__ = 6; + phi_std_raw = in__.template read< + stan::conditional_var_value_t>>(N); + local_scalar_t__ sigma_phi; + current_statement__ = 7; + sigma_phi = stan::math::inv_sqrt(tau_phi); + stan::conditional_var_value_t> phi = + stan::conditional_var_value_t>(Eigen::Matrix::Constant(N, + std::numeric_limits::quiet_NaN( + ))); + current_statement__ = 9; + stan::model::assign(phi, phi_std_raw, "assigning variable phi", + stan::model::index_min_max(1, N)); + current_statement__ = 10; + stan::model::assign(phi, + stan::math::multiply(stan::model::deep_copy(phi), sigma_phi), + "assigning variable phi"); + current_statement__ = 7; + stan::math::check_greater_or_equal(function__, "sigma_phi", sigma_phi, + 0); { current_statement__ = 11; - lp_accum__.add(stan::math::dirichlet_lpdf(pi, alpha)); - current_statement__ = 14; - for (int j = 1; j <= J; ++j) { - current_statement__ = 13; - for (int k = 1; k <= K; ++k) { - current_statement__ = 12; - lp_accum__.add(stan::math::dirichlet_lpdf( - stan::model::rvalue(theta, "theta", - stan::model::index_uni(j), - stan::model::index_uni(k)), - stan::model::rvalue(beta, "beta", - stan::model::index_uni(k)))); - } - } - current_statement__ = 21; - for (int i = 1; i <= I; ++i) { - current_statement__ = 15; - stan::math::validate_non_negative_index("log_q", "K", K); - stan::conditional_var_value_t> log_q; - current_statement__ = 16; - stan::model::assign(log_q, stan::math::log(pi), - "assigning variable log_q"); - current_statement__ = 18; - for (int j = 1; j <= J; ++j) { - current_statement__ = 17; - stan::model::assign(log_q, - stan::math::add(stan::model::deep_copy(log_q), - stan::math::to_vector( - stan::math::log( - stan::model::rvalue(theta, "theta", - stan::model::index_uni(j), stan::model::index_omni(), - stan::model::index_uni( - stan::model::rvalue(y, "y", - stan::model::index_uni(i), - stan::model::index_uni(j))))))), - "assigning variable log_q"); - } - current_statement__ = 19; - lp_accum__.add(stan::math::log_sum_exp(log_q)); - } + lp_accum__.add(stan::math::dot_self( + stan::model::rvalue(phi, "phi", + stan::model::index_multi(node1)))); } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); @@ -8882,71 +9795,64 @@ class expr_prop_fail7_model final : public model_base_crtp pi; + double beta0; current_statement__ = 1; - pi = in__.template read_constrain_simplex< - Eigen::Matrix, jacobian__>(lp__, K); - std::vector>> theta; + beta0 = in__.template read(); + double beta1; current_statement__ = 2; - theta = in__.template read_constrain_simplex< - std::vector< - std::vector>>, - jacobian__>(lp__, J, K, K); - out__.write(pi); - for (int sym1__ = 1; sym1__ <= K; ++sym1__) { - for (int sym2__ = 1; sym2__ <= K; ++sym2__) { - for (int sym3__ = 1; sym3__ <= J; ++sym3__) { - out__.write(theta[(sym3__ - 1)][(sym2__ - 1)][(sym1__ - 1)]); - } - } - } + beta1 = in__.template read(); + double tau_theta; + current_statement__ = 3; + tau_theta = in__.template read_constrain_lb(0, lp__); + double tau_phi; + current_statement__ = 4; + tau_phi = in__.template read_constrain_lb(0, lp__); + Eigen::Matrix theta_std; + current_statement__ = 5; + theta_std = in__.template read>(N); + Eigen::Matrix phi_std_raw; + current_statement__ = 6; + phi_std_raw = in__.template read< + Eigen::Matrix>(N); + double sigma_phi = std::numeric_limits::quiet_NaN(); + Eigen::Matrix phi = + Eigen::Matrix::Constant(N, + std::numeric_limits::quiet_NaN()); + out__.write(beta0); + out__.write(beta1); + out__.write(tau_theta); + out__.write(tau_phi); + out__.write(theta_std); + out__.write(phi_std_raw); if (stan::math::logical_negation( (stan::math::primitive_value(emit_transformed_parameters__) || stan::math::primitive_value(emit_generated_quantities__)))) { return ; } - if (stan::math::logical_negation(emit_generated_quantities__)) { - return ; - } - std::vector> log_Pr_z = - std::vector>(I, - Eigen::Matrix::Constant(K, - std::numeric_limits::quiet_NaN())); + current_statement__ = 7; + sigma_phi = stan::math::inv_sqrt(tau_phi); + current_statement__ = 9; + stan::model::assign(phi, phi_std_raw, "assigning variable phi", + stan::model::index_min_max(1, N)); current_statement__ = 10; - for (int i = 1; i <= I; ++i) { - current_statement__ = 4; - stan::math::validate_non_negative_index("log_q", "K", K); - Eigen::Matrix log_q; - current_statement__ = 5; - stan::model::assign(log_q, stan::math::log(pi), - "assigning variable log_q"); - current_statement__ = 7; - for (int j = 1; j <= J; ++j) { - current_statement__ = 6; - stan::model::assign(log_q, - stan::math::add(stan::model::deep_copy(log_q), - stan::math::to_vector( - stan::math::log( - stan::model::rvalue(theta, "theta", - stan::model::index_uni(j), stan::model::index_omni(), - stan::model::index_uni( - stan::model::rvalue(y, "y", stan::model::index_uni(i), - stan::model::index_uni(j))))))), - "assigning variable log_q"); - } - current_statement__ = 8; - stan::model::assign(log_Pr_z, - stan::math::subtract(log_q, stan::math::log_sum_exp(log_q)), - "assigning variable log_Pr_z", stan::model::index_uni(i)); + stan::model::assign(phi, + stan::math::multiply(stan::model::deep_copy(phi), sigma_phi), + "assigning variable phi"); + current_statement__ = 7; + stan::math::check_greater_or_equal(function__, "sigma_phi", sigma_phi, + 0); + if (emit_transformed_parameters__) { + out__.write(sigma_phi); + out__.write(phi); } - for (int sym1__ = 1; sym1__ <= K; ++sym1__) { - for (int sym2__ = 1; sym2__ <= I; ++sym2__) { - out__.write(log_Pr_z[(sym2__ - 1)][(sym1__ - 1)]); - } + if (stan::math::logical_negation(emit_generated_quantities__)) { + return ; } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); @@ -8968,101 +9874,104 @@ class expr_prop_fail7_model final : public model_base_crtp pi = - Eigen::Matrix::Constant(K, DUMMY_VAR__); - for (int sym1__ = 1; sym1__ <= K; ++sym1__) { - stan::model::assign(pi, in__.read(), - "assigning variable pi", stan::model::index_uni(sym1__)); + local_scalar_t__ beta0; + beta0 = in__.read(); + out__.write(beta0); + local_scalar_t__ beta1; + beta1 = in__.read(); + out__.write(beta1); + local_scalar_t__ tau_theta; + tau_theta = in__.read(); + out__.write_free_lb(0, tau_theta); + local_scalar_t__ tau_phi; + tau_phi = in__.read(); + out__.write_free_lb(0, tau_phi); + Eigen::Matrix theta_std = + Eigen::Matrix::Constant(N, DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + stan::model::assign(theta_std, in__.read(), + "assigning variable theta_std", stan::model::index_uni(sym1__)); } - out__.write_free_simplex(pi); - std::vector>> theta = - std::vector>>(J, - std::vector>(K, - Eigen::Matrix::Constant(K, DUMMY_VAR__))); - for (int sym1__ = 1; sym1__ <= K; ++sym1__) { - for (int sym2__ = 1; sym2__ <= K; ++sym2__) { - for (int sym3__ = 1; sym3__ <= J; ++sym3__) { - stan::model::assign(theta, in__.read(), - "assigning variable theta", stan::model::index_uni(sym3__), - stan::model::index_uni(sym2__), stan::model::index_uni(sym1__)); - } - } + out__.write(theta_std); + Eigen::Matrix phi_std_raw = + Eigen::Matrix::Constant(N, DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + stan::model::assign(phi_std_raw, in__.read(), + "assigning variable phi_std_raw", stan::model::index_uni(sym1__)); } - out__.write_free_simplex(theta); + out__.write(phi_std_raw); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } inline void get_param_names(std::vector& names__) const { - names__ = std::vector{"pi", "theta", "log_Pr_z"}; + names__ = std::vector{"beta0", "beta1", "tau_theta", + "tau_phi", "theta_std", "phi_std_raw", "sigma_phi", "phi"}; } inline void get_dims(std::vector>& dimss__) const { - dimss__ = std::vector>{std::vector{static_cast< - size_t>(K)}, - std::vector{static_cast(J), - static_cast(K), static_cast(K)}, - std::vector{static_cast(I), - static_cast(K)}}; + dimss__ = std::vector>{std::vector{}, + std::vector{}, std::vector{}, + std::vector{}, + std::vector{static_cast(N)}, + std::vector{static_cast(N)}, + std::vector{}, + std::vector{static_cast(N)}}; } 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() + "pi" + '.' + + param_names__.emplace_back(std::string() + "beta0"); + param_names__.emplace_back(std::string() + "beta1"); + param_names__.emplace_back(std::string() + "tau_theta"); + param_names__.emplace_back(std::string() + "tau_phi"); + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + param_names__.emplace_back(std::string() + "theta_std" + '.' + std::to_string(sym1__)); } - for (int sym1__ = 1; sym1__ <= K; ++sym1__) { - for (int sym2__ = 1; sym2__ <= K; ++sym2__) { - for (int sym3__ = 1; sym3__ <= J; ++sym3__) { - param_names__.emplace_back(std::string() + "theta" + '.' + - std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' + - std::to_string(sym1__)); - } - } + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + param_names__.emplace_back(std::string() + "phi_std_raw" + '.' + + std::to_string(sym1__)); } - if (emit_transformed_parameters__) {} - if (emit_generated_quantities__) { - for (int sym1__ = 1; sym1__ <= K; ++sym1__) { - for (int sym2__ = 1; sym2__ <= I; ++sym2__) { - param_names__.emplace_back(std::string() + "log_Pr_z" + '.' + - std::to_string(sym2__) + '.' + std::to_string(sym1__)); - } + if (emit_transformed_parameters__) { + param_names__.emplace_back(std::string() + "sigma_phi"); + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + param_names__.emplace_back(std::string() + "phi" + '.' + + std::to_string(sym1__)); } } + 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 - 1); ++sym1__) { - param_names__.emplace_back(std::string() + "pi" + '.' + + param_names__.emplace_back(std::string() + "beta0"); + param_names__.emplace_back(std::string() + "beta1"); + param_names__.emplace_back(std::string() + "tau_theta"); + param_names__.emplace_back(std::string() + "tau_phi"); + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + param_names__.emplace_back(std::string() + "theta_std" + '.' + std::to_string(sym1__)); } - for (int sym1__ = 1; sym1__ <= (K - 1); ++sym1__) { - for (int sym2__ = 1; sym2__ <= K; ++sym2__) { - for (int sym3__ = 1; sym3__ <= J; ++sym3__) { - param_names__.emplace_back(std::string() + "theta" + '.' + - std::to_string(sym3__) + '.' + std::to_string(sym2__) + '.' + - std::to_string(sym1__)); - } - } + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + param_names__.emplace_back(std::string() + "phi_std_raw" + '.' + + std::to_string(sym1__)); } - if (emit_transformed_parameters__) {} - if (emit_generated_quantities__) { - for (int sym1__ = 1; sym1__ <= K; ++sym1__) { - for (int sym2__ = 1; sym2__ <= I; ++sym2__) { - param_names__.emplace_back(std::string() + "log_Pr_z" + '.' + - std::to_string(sym2__) + '.' + std::to_string(sym1__)); - } + if (emit_transformed_parameters__) { + param_names__.emplace_back(std::string() + "sigma_phi"); + for (int sym1__ = 1; sym1__ <= N; ++sym1__) { + param_names__.emplace_back(std::string() + "phi" + '.' + + std::to_string(sym1__)); } } + if (emit_generated_quantities__) {} } inline std::string get_constrained_sizedtypes() const { - return std::string("[{\"name\":\"pi\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(K) + "},\"block\":\"parameters\"},{\"name\":\"theta\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(J) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(K) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string(K) + "}}},\"block\":\"parameters\"},{\"name\":\"log_Pr_z\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(I) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string(K) + "}},\"block\":\"generated_quantities\"}]"); + return std::string("[{\"name\":\"beta0\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta1\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"tau_theta\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"tau_phi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"theta_std\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"parameters\"},{\"name\":\"phi_std_raw\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"parameters\"},{\"name\":\"sigma_phi\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"transformed_parameters\"}]"); } inline std::string get_unconstrained_sizedtypes() const { - return std::string("[{\"name\":\"pi\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string((K -1)) + "},\"block\":\"parameters\"},{\"name\":\"theta\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(J) + ",\"element_type\":{\"name\":\"array\",\"length\":" + std::to_string(K) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string((K -1)) + "}}},\"block\":\"parameters\"},{\"name\":\"log_Pr_z\",\"type\":{\"name\":\"array\",\"length\":" + std::to_string(I) + ",\"element_type\":{\"name\":\"vector\",\"length\":" + std::to_string(K) + "}},\"block\":\"generated_quantities\"}]"); + return std::string("[{\"name\":\"beta0\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta1\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"tau_theta\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"tau_phi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"theta_std\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"parameters\"},{\"name\":\"phi_std_raw\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"parameters\"},{\"name\":\"sigma_phi\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"transformed_parameters\"}]"); } // Begin method overload boilerplate template inline void @@ -9071,9 +9980,9 @@ class expr_prop_fail7_model final : public model_base_crtp params_i; @@ -9088,9 +9997,9 @@ class expr_prop_fail7_model final : public model_base_crtp(num_to_write, @@ -9122,8 +10031,11 @@ class expr_prop_fail7_model final : public model_base_crtp& params_i, std::vector& vars, std::ostream* pstream__ = nullptr) const { - constexpr std::array names__{"pi", "theta"}; - const std::array constrain_param_sizes__{K, (J * K * K)}; + constexpr std::array + names__{"beta0", "beta1", "tau_theta", "tau_phi", "theta_std", + "phi_std_raw"}; + const std::array + constrain_param_sizes__{1, 1, 1, 1, N, N}; const auto num_constrained_params__ = std::accumulate(constrain_param_sizes__.begin(), constrain_param_sizes__.end(), 0); @@ -9136,72 +10048,246 @@ class expr_prop_fail7_model final : public model_base_crtp +namespace fails_test_model_namespace { +using stan::model::model_base_crtp; +using namespace stan::math; +stan::math::profile_map profiles__; +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'fails-test.stan', line 68, column 2 to column 32)", + " (in 'fails-test.stan', line 69, column 2 to column 41)", + " (in 'fails-test.stan', line 72, column 2 to column 52)", + " (in 'fails-test.stan', line 73, column 2 to column 50)", + " (in 'fails-test.stan', line 74, column 2 to column 50)", + " (in 'fails-test.stan', line 79, column 6 to column 20)", + " (in 'fails-test.stan', line 80, column 6 to column 18)", + " (in 'fails-test.stan', line 78, column 34 to line 81, column 5)", + " (in 'fails-test.stan', line 78, column 4 to line 81, column 5)", + " (in 'fails-test.stan', line 83, column 6 to column 32)", + " (in 'fails-test.stan', line 84, column 6 to column 23)", + " (in 'fails-test.stan', line 82, column 40 to line 85, column 5)", + " (in 'fails-test.stan', line 82, column 4 to line 85, column 5)", + " (in 'fails-test.stan', line 77, column 22 to line 86, column 3)", + " (in 'fails-test.stan', line 77, column 2 to line 86, column 3)", + " (in 'fails-test.stan', line 25, column 11 to column 15)", + " (in 'fails-test.stan', line 25, column 17 to column 28)", + " (in 'fails-test.stan', line 25, column 4 to column 34)", + " (in 'fails-test.stan', line 28, column 6 to column 32)", + " (in 'fails-test.stan', line 31, column 8 to column 37)", + " (in 'fails-test.stan', line 32, column 8 to column 32)", + " (in 'fails-test.stan', line 40, column 8 to line 42, column 44)", + " (in 'fails-test.stan', line 29, column 39 to line 43, column 7)", + " (in 'fails-test.stan', line 29, column 6 to line 43, column 7)", + " (in 'fails-test.stan', line 27, column 24 to line 44, column 5)", + " (in 'fails-test.stan', line 27, column 4 to line 44, column 5)", + " (in 'fails-test.stan', line 45, column 4 to column 15)", + " (in 'fails-test.stan', line 100, column 8 to column 37)", + " (in 'fails-test.stan', line 101, column 8 to column 41)", + " (in 'fails-test.stan', line 99, column 42 to line 102, column 7)", + " (in 'fails-test.stan', line 99, column 6 to line 102, column 7)", + " (in 'fails-test.stan', line 103, column 6 to column 37)", + " (in 'fails-test.stan', line 98, column 22 to line 104, column 5)", + " (in 'fails-test.stan', line 98, column 4 to line 104, column 5)", + " (in 'fails-test.stan', line 97, column 22 to line 105, column 3)", + " (in 'fails-test.stan', line 97, column 2 to line 105, column 3)", + " (in 'fails-test.stan', line 49, column 2 to column 20)", + " (in 'fails-test.stan', line 50, column 2 to column 27)", + " (in 'fails-test.stan', line 51, column 8 to column 12)", + " (in 'fails-test.stan', line 51, column 14 to column 25)", + " (in 'fails-test.stan', line 51, column 2 to column 51)", + " (in 'fails-test.stan', line 52, column 2 to column 23)", + " (in 'fails-test.stan', line 53, column 8 to column 12)", + " (in 'fails-test.stan', line 53, column 14 to column 29)", + " (in 'fails-test.stan', line 53, column 2 to column 61)", + " (in 'fails-test.stan', line 56, column 2 to column 38)", + " (in 'fails-test.stan', line 58, column 8 to column 12)", + " (in 'fails-test.stan', line 58, column 2 to column 52)", + " (in 'fails-test.stan', line 59, column 8 to column 12)", + " (in 'fails-test.stan', line 59, column 2 to column 51)", + " (in 'fails-test.stan', line 63, column 4 to column 35)", + " (in 'fails-test.stan', line 62, column 2 to line 63, column 35)", + " (in 'fails-test.stan', line 65, column 4 to column 33)", + " (in 'fails-test.stan', line 64, column 2 to line 65, column 33)", + " (in 'fails-test.stan', line 69, column 27 to column 34)", + " (in 'fails-test.stan', line 72, column 27 to column 31)", + " (in 'fails-test.stan', line 72, column 33 to column 46)", + " (in 'fails-test.stan', line 73, column 27 to column 31)", + " (in 'fails-test.stan', line 73, column 33 to column 46)", + " (in 'fails-test.stan', line 74, column 27 to column 31)", + " (in 'fails-test.stan', line 74, column 33 to column 44)", + " (in 'fails-test.stan', line 8, column 8 to column 17)", + " (in 'fails-test.stan', line 7, column 6 to line 8, column 17)", + " (in 'fails-test.stan', line 6, column 4 to line 8, column 17)", + " (in 'fails-test.stan', line 9, column 4 to column 13)", + " (in 'fails-test.stan', line 5, column 37 to line 10, column 3)", + " (in 'fails-test.stan', line 15, column 6 to column 32)", + " (in 'fails-test.stan', line 19, column 8 to column 17)", + " (in 'fails-test.stan', line 18, column 6 to line 19, column 17)", + " (in 'fails-test.stan', line 13, column 39 to line 20, column 5)", + " (in 'fails-test.stan', line 13, column 4 to line 20, column 5)", + " (in 'fails-test.stan', line 21, column 4 to column 13)", + " (in 'fails-test.stan', line 12, column 36 to line 22, column 3)", + " (in 'fails-test.stan', line 24, column 74 to line 46, column 3)"}; +int first_capture(const std::vector& y_i, std::ostream* pstream__); +int last_capture(const std::vector& y_i, std::ostream* pstream__); +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>* = nullptr> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, + const T3__& phi_arg__, std::ostream* pstream__); +int first_capture(const std::vector& y_i, std::ostream* pstream__) { + using local_scalar_t__ = double; + int current_statement__ = 0; + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 64; + for (int k = 1; k <= stan::math::size(y_i); ++k) { + current_statement__ = 63; + if (stan::model::rvalue(y_i, "y_i", stan::model::index_uni(k))) { + current_statement__ = 62; + return k; + } + } + current_statement__ = 65; + return 0; + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +int last_capture(const std::vector& y_i, std::ostream* pstream__) { + using local_scalar_t__ = double; + int current_statement__ = 0; + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 71; + for (int k_rev = 0; k_rev <= (stan::math::size(y_i) - 1); ++k_rev) { + int k; + current_statement__ = 67; + k = (stan::math::size(y_i) - k_rev); + current_statement__ = 69; + if (stan::model::rvalue(y_i, "y_i", stan::model::index_uni(k))) { + current_statement__ = 68; + return k; + } + } + current_statement__ = 72; + return 0; + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +template , + stan::is_vt_not_complex, + stan::is_eigen_matrix_dynamic, + stan::is_vt_not_complex>*> +Eigen::Matrix, + stan::base_type_t>,-1,-1> +prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, + const T3__& phi_arg__, std::ostream* pstream__) { + using local_scalar_t__ = stan::promote_args_t, + stan::base_type_t>; + int current_statement__ = 0; + const auto& p = stan::math::to_ref(p_arg__); + const auto& phi = stan::math::to_ref(phi_arg__); + static constexpr bool propto__ = true; + // suppress unused var warning + (void) propto__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 16; + stan::math::validate_non_negative_index("chi", "nind", nind); + current_statement__ = 17; + stan::math::validate_non_negative_index("chi", "n_occasions", n_occasions); + Eigen::Matrix chi = + Eigen::Matrix::Constant(nind, n_occasions, + DUMMY_VAR__); + current_statement__ = 26; + for (int i = 1; i <= nind; ++i) { + current_statement__ = 19; + stan::model::assign(chi, 1.0, "assigning variable chi", + stan::model::index_uni(i), stan::model::index_uni(n_occasions)); + current_statement__ = 24; + for (int t = 1; t <= (n_occasions - 1); ++t) { + int t_curr; + current_statement__ = 20; + t_curr = (n_occasions - t); + int t_next; + current_statement__ = 21; + t_next = (t_curr + 1); + current_statement__ = 22; + stan::model::assign(chi, + stan::math::fma( + (stan::model::rvalue(phi, "phi", stan::model::index_uni(i), + stan::model::index_uni(t_curr)) * (1 - + stan::model::rvalue(p, "p", stan::model::index_uni(i), + stan::model::index_uni((t_next - 1))))), + stan::model::rvalue(chi, "chi", stan::model::index_uni(i), + stan::model::index_uni(t_next)), (1 - + stan::model::rvalue(phi, "phi", stan::model::index_uni(i), + stan::model::index_uni(t_curr)))), "assigning variable chi", + stan::model::index_uni(i), stan::model::index_uni(t_curr)); + } } - vars.resize(num_params_r__); - transform_inits_impl(params_r_flat__, params_i, vars, pstream__); + current_statement__ = 27; + return chi; + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); } -}; -} -using stan_model = expr_prop_fail7_model_namespace::expr_prop_fail7_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* m = new stan_model(data_context, seed, msg_stream); - return *m; -} -stan::math::profile_map& get_stan_profile_data() { - return expr_prop_fail7_model_namespace::profiles__; } -#endif - $ ../../../../../install/default/bin/stanc --O1 --print-cpp expr-prop-fail8.stan -// Code generated by %%NAME%% %%VERSION%% -#include -namespace expr_prop_fail8_model_namespace { -using stan::model::model_base_crtp; -using namespace stan::math; -stan::math::profile_map profiles__; -static constexpr std::array locations_array__ = - {" (found before start of program)", - " (in 'expr-prop-fail8.stan', line 11, column 2 to column 13)", - " (in 'expr-prop-fail8.stan', line 12, column 2 to column 13)", - " (in 'expr-prop-fail8.stan', line 14, column 2 to column 26)", - " (in 'expr-prop-fail8.stan', line 15, column 2 to column 24)", - " (in 'expr-prop-fail8.stan', line 17, column 2 to column 22)", - " (in 'expr-prop-fail8.stan', line 18, column 2 to column 24)", - " (in 'expr-prop-fail8.stan', line 21, column 2 to column 47)", - " (in 'expr-prop-fail8.stan', line 22, column 2 to column 16)", - " (in 'expr-prop-fail8.stan', line 23, column 2 to column 27)", - " (in 'expr-prop-fail8.stan', line 24, column 2 to column 24)", - " (in 'expr-prop-fail8.stan', line 27, column 2 to column 33)", - " (in 'expr-prop-fail8.stan', line 2, column 2 to column 17)", - " (in 'expr-prop-fail8.stan', line 3, column 2 to column 23)", - " (in 'expr-prop-fail8.stan', line 4, column 8 to column 15)", - " (in 'expr-prop-fail8.stan', line 4, column 2 to column 45)", - " (in 'expr-prop-fail8.stan', line 5, column 8 to column 15)", - " (in 'expr-prop-fail8.stan', line 5, column 2 to column 45)", - " (in 'expr-prop-fail8.stan', line 7, column 8 to column 9)", - " (in 'expr-prop-fail8.stan', line 7, column 2 to column 26)", - " (in 'expr-prop-fail8.stan', line 8, column 9 to column 10)", - " (in 'expr-prop-fail8.stan', line 8, column 2 to column 14)", - " (in 'expr-prop-fail8.stan', line 17, column 9 to column 10)", - " (in 'expr-prop-fail8.stan', line 18, column 9 to column 10)", - " (in 'expr-prop-fail8.stan', line 22, column 9 to column 10)"}; -class expr_prop_fail8_model final : public model_base_crtp { +class fails_test_model final : public model_base_crtp { private: - int N; - int N_edges; - std::vector node1; - std::vector node2; - std::vector y; - Eigen::Matrix x_data__; - Eigen::Map> x{nullptr, 0}; + int nind; + int n_occasions; + std::vector> y; + int max_age; + std::vector> x; + int n_occ_minus_1; + std::vector first; + std::vector last; public: - ~expr_prop_fail8_model() {} - expr_prop_fail8_model(stan::io::var_context& context__, unsigned int - random_seed__ = 0, std::ostream* pstream__ = nullptr) + ~fails_test_model() {} + fails_test_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; @@ -9210,7 +10296,7 @@ class expr_prop_fail8_model final : public model_base_crtp::quiet_NaN()); @@ -9219,92 +10305,159 @@ class expr_prop_fail8_model final : public model_base_crtp{}); - N = std::numeric_limits::min(); - current_statement__ = 12; - N = context__.vals_i("N")[(1 - 1)]; - current_statement__ = 12; - stan::math::check_greater_or_equal(function__, "N", N, 0); - current_statement__ = 13; - context__.validate_dims("data initialization", "N_edges", "int", + nind = std::numeric_limits::min(); + current_statement__ = 37; + nind = context__.vals_i("nind")[(1 - 1)]; + current_statement__ = 37; + stan::math::check_greater_or_equal(function__, "nind", nind, 0); + current_statement__ = 38; + context__.validate_dims("data initialization", "n_occasions", "int", std::vector{}); - N_edges = std::numeric_limits::min(); - current_statement__ = 13; - N_edges = context__.vals_i("N_edges")[(1 - 1)]; - current_statement__ = 13; - stan::math::check_greater_or_equal(function__, "N_edges", N_edges, 0); - current_statement__ = 14; - stan::math::validate_non_negative_index("node1", "N_edges", N_edges); - current_statement__ = 15; - context__.validate_dims("data initialization", "node1", "int", - std::vector{static_cast(N_edges)}); - node1 = std::vector(N_edges, std::numeric_limits::min()); - current_statement__ = 15; - node1 = context__.vals_i("node1"); - current_statement__ = 15; - stan::math::check_greater_or_equal(function__, "node1", node1, 1); - current_statement__ = 15; - stan::math::check_less_or_equal(function__, "node1", node1, N); - current_statement__ = 16; - stan::math::validate_non_negative_index("node2", "N_edges", N_edges); - current_statement__ = 17; - context__.validate_dims("data initialization", "node2", "int", - std::vector{static_cast(N_edges)}); - node2 = std::vector(N_edges, std::numeric_limits::min()); - current_statement__ = 17; - node2 = context__.vals_i("node2"); - current_statement__ = 17; - stan::math::check_greater_or_equal(function__, "node2", node2, 1); - current_statement__ = 17; - stan::math::check_less_or_equal(function__, "node2", node2, N); - current_statement__ = 18; - stan::math::validate_non_negative_index("y", "N", N); - current_statement__ = 19; + n_occasions = std::numeric_limits::min(); + current_statement__ = 38; + n_occasions = context__.vals_i("n_occasions")[(1 - 1)]; + current_statement__ = 38; + stan::math::check_greater_or_equal(function__, "n_occasions", + n_occasions, 2); + current_statement__ = 39; + stan::math::validate_non_negative_index("y", "nind", nind); + current_statement__ = 40; + stan::math::validate_non_negative_index("y", "n_occasions", n_occasions); + current_statement__ = 41; context__.validate_dims("data initialization", "y", "int", - std::vector{static_cast(N)}); - y = std::vector(N, std::numeric_limits::min()); - current_statement__ = 19; - y = context__.vals_i("y"); - current_statement__ = 19; + std::vector{static_cast(nind), + static_cast(n_occasions)}); + y = std::vector>(nind, + std::vector(n_occasions, std::numeric_limits::min())); + { + std::vector y_flat__; + current_statement__ = 41; + y_flat__ = context__.vals_i("y"); + current_statement__ = 41; + pos__ = 1; + current_statement__ = 41; + for (int sym1__ = 1; sym1__ <= n_occasions; ++sym1__) { + current_statement__ = 41; + for (int sym2__ = 1; sym2__ <= nind; ++sym2__) { + current_statement__ = 41; + stan::model::assign(y, y_flat__[(pos__ - 1)], + "assigning variable y", stan::model::index_uni(sym2__), + stan::model::index_uni(sym1__)); + current_statement__ = 41; + pos__ = (pos__ + 1); + } + } + } + current_statement__ = 41; stan::math::check_greater_or_equal(function__, "y", y, 0); - current_statement__ = 20; - stan::math::validate_non_negative_index("x", "N", N); - current_statement__ = 21; - context__.validate_dims("data initialization", "x", "double", - std::vector{static_cast(N)}); - x_data__ = Eigen::Matrix::Constant(N, - std::numeric_limits::quiet_NaN()); - new (&x) Eigen::Map>(x_data__.data(), N); + current_statement__ = 41; + stan::math::check_less_or_equal(function__, "y", y, 1); + current_statement__ = 42; + context__.validate_dims("data initialization", "max_age", "int", + std::vector{}); + max_age = std::numeric_limits::min(); + current_statement__ = 42; + max_age = context__.vals_i("max_age")[(1 - 1)]; + current_statement__ = 42; + stan::math::check_greater_or_equal(function__, "max_age", max_age, 1); + current_statement__ = 43; + stan::math::validate_non_negative_index("x", "nind", nind); + current_statement__ = 44; + stan::math::validate_non_negative_index("x", "n_occasions - 1", + (n_occasions - 1)); + current_statement__ = 45; + context__.validate_dims("data initialization", "x", "int", + std::vector{static_cast(nind), + static_cast((n_occasions - 1))}); + x = std::vector>(nind, + std::vector((n_occasions - 1), + std::numeric_limits::min())); { - std::vector x_flat__; - current_statement__ = 21; - x_flat__ = context__.vals_r("x"); - current_statement__ = 21; + std::vector x_flat__; + current_statement__ = 45; + x_flat__ = context__.vals_i("x"); + current_statement__ = 45; pos__ = 1; - current_statement__ = 21; - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - current_statement__ = 21; - stan::model::assign(x, x_flat__[(pos__ - 1)], - "assigning variable x", stan::model::index_uni(sym1__)); - current_statement__ = 21; - pos__ = (pos__ + 1); + current_statement__ = 45; + for (int sym1__ = 1; sym1__ <= (n_occasions - 1); ++sym1__) { + current_statement__ = 45; + for (int sym2__ = 1; sym2__ <= nind; ++sym2__) { + current_statement__ = 45; + stan::model::assign(x, x_flat__[(pos__ - 1)], + "assigning variable x", stan::model::index_uni(sym2__), + stan::model::index_uni(sym1__)); + current_statement__ = 45; + pos__ = (pos__ + 1); + } } } - current_statement__ = 22; - stan::math::validate_non_negative_index("theta_std", "N", N); - current_statement__ = 23; - stan::math::validate_non_negative_index("phi_std_raw", "N", N); - current_statement__ = 24; - stan::math::validate_non_negative_index("phi", "N", N); + current_statement__ = 45; + stan::math::check_greater_or_equal(function__, "x", x, 0); + current_statement__ = 45; + stan::math::check_less_or_equal(function__, "x", x, max_age); + current_statement__ = 46; + n_occ_minus_1 = std::numeric_limits::min(); + current_statement__ = 46; + n_occ_minus_1 = (n_occasions - 1); + current_statement__ = 47; + stan::math::validate_non_negative_index("first", "nind", nind); + current_statement__ = 48; + first = std::vector(nind, std::numeric_limits::min()); + current_statement__ = 49; + stan::math::validate_non_negative_index("last", "nind", nind); + current_statement__ = 50; + last = std::vector(nind, std::numeric_limits::min()); + current_statement__ = 52; + for (int i = 1; i <= nind; ++i) { + current_statement__ = 51; + stan::model::assign(first, + first_capture( + stan::model::rvalue(y, "y", stan::model::index_uni(i)), pstream__), + "assigning variable first", stan::model::index_uni(i)); + } + current_statement__ = 54; + for (int i = 1; i <= nind; ++i) { + current_statement__ = 53; + stan::model::assign(last, + last_capture( + stan::model::rvalue(y, "y", stan::model::index_uni(i)), pstream__), + "assigning variable last", stan::model::index_uni(i)); + } + current_statement__ = 48; + stan::math::check_greater_or_equal(function__, "first", first, 0); + current_statement__ = 48; + stan::math::check_less_or_equal(function__, "first", first, n_occasions); + current_statement__ = 50; + stan::math::check_greater_or_equal(function__, "last", last, 0); + current_statement__ = 50; + stan::math::check_less_or_equal(function__, "last", last, n_occasions); + current_statement__ = 55; + stan::math::validate_non_negative_index("beta", "max_age", max_age); + current_statement__ = 56; + stan::math::validate_non_negative_index("phi", "nind", nind); + current_statement__ = 57; + stan::math::validate_non_negative_index("phi", "n_occ_minus_1", + n_occ_minus_1); + current_statement__ = 58; + stan::math::validate_non_negative_index("p", "nind", nind); + current_statement__ = 59; + stan::math::validate_non_negative_index("p", "n_occ_minus_1", + n_occ_minus_1); + current_statement__ = 60; + stan::math::validate_non_negative_index("chi", "nind", nind); + current_statement__ = 61; + stan::math::validate_non_negative_index("chi", "n_occasions", + n_occasions); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } - num_params_r__ = 1 + 1 + 1 + 1 + N + N; + num_params_r__ = 1 + max_age; } inline std::string model_name() const final { - return "expr_prop_fail8_model"; + return "fails_test_model"; } inline std::vector model_compile_info() const noexcept { return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", @@ -9326,60 +10479,167 @@ class expr_prop_fail8_model final : public model_base_crtp(); - local_scalar_t__ beta1; + mean_p = in__.template read_constrain_lub(0, 1, lp__); + Eigen::Matrix beta; current_statement__ = 2; - beta1 = in__.template read(); - local_scalar_t__ tau_theta; + beta = in__.template read_constrain_lub< + Eigen::Matrix, jacobian__>(0, 1, lp__, + max_age); + Eigen::Matrix phi = + Eigen::Matrix::Constant(nind, n_occ_minus_1, + DUMMY_VAR__); + Eigen::Matrix p = + Eigen::Matrix::Constant(nind, n_occ_minus_1, + DUMMY_VAR__); + Eigen::Matrix chi = + Eigen::Matrix::Constant(nind, n_occasions, + DUMMY_VAR__); + current_statement__ = 15; + for (int i = 1; i <= nind; ++i) { + current_statement__ = 9; + for (int t = 1; t <= + (stan::model::rvalue(first, "first", stan::model::index_uni(i)) + - 1); ++t) { + current_statement__ = 6; + stan::model::assign(phi, 0, "assigning variable phi", + stan::model::index_uni(i), stan::model::index_uni(t)); + current_statement__ = 7; + stan::model::assign(p, 0, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(t)); + } + current_statement__ = 13; + for (int t = + stan::model::rvalue(first, "first", stan::model::index_uni(i)); t + <= n_occ_minus_1; ++t) { + current_statement__ = 10; + stan::model::assign(phi, + stan::model::rvalue(beta, "beta", + stan::model::index_uni( + stan::model::rvalue(x, "x", stan::model::index_uni(i), + stan::model::index_uni(t)))), "assigning variable phi", + stan::model::index_uni(i), stan::model::index_uni(t)); + current_statement__ = 11; + stan::model::assign(p, mean_p, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(t)); + } + } + Eigen::Matrix + inline_prob_uncaptured_return_sym8__; + { + current_statement__ = 16; + stan::math::validate_non_negative_index("chi", "nind", nind); + current_statement__ = 17; + stan::math::validate_non_negative_index("chi", "n_occasions", + n_occasions); + Eigen::Matrix + inline_prob_uncaptured_chi_sym9__ = + Eigen::Matrix::Constant(nind, n_occasions, + DUMMY_VAR__); + current_statement__ = 26; + for (int inline_prob_uncaptured_i_sym13__ = 1; inline_prob_uncaptured_i_sym13__ + <= nind; ++inline_prob_uncaptured_i_sym13__) { + current_statement__ = 19; + stan::model::assign(inline_prob_uncaptured_chi_sym9__, 1.0, + "assigning variable inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(n_occasions)); + current_statement__ = 24; + for (int inline_prob_uncaptured_t_sym12__ = 1; inline_prob_uncaptured_t_sym12__ + <= (n_occasions - 1); ++inline_prob_uncaptured_t_sym12__) { + int inline_prob_uncaptured_t_curr_sym10__; + current_statement__ = 20; + inline_prob_uncaptured_t_curr_sym10__ = (n_occasions - + inline_prob_uncaptured_t_sym12__); + int inline_prob_uncaptured_t_next_sym11__; + current_statement__ = 21; + inline_prob_uncaptured_t_next_sym11__ = (inline_prob_uncaptured_t_curr_sym10__ + + 1); + current_statement__ = 22; + stan::model::assign(inline_prob_uncaptured_chi_sym9__, + stan::math::fma( + (stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni( + inline_prob_uncaptured_t_curr_sym10__)) * (1 - + stan::model::rvalue(p, "p", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni( + (inline_prob_uncaptured_t_next_sym11__ - 1))))), + stan::model::rvalue(inline_prob_uncaptured_chi_sym9__, + "inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni( + inline_prob_uncaptured_t_next_sym11__)), (1 - + stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni( + inline_prob_uncaptured_t_curr_sym10__)))), + "assigning variable inline_prob_uncaptured_chi_sym9__", + stan::model::index_uni(inline_prob_uncaptured_i_sym13__), + stan::model::index_uni(inline_prob_uncaptured_t_curr_sym10__)); + } + } + current_statement__ = 27; + stan::model::assign(inline_prob_uncaptured_return_sym8__, + inline_prob_uncaptured_chi_sym9__, + "assigning variable inline_prob_uncaptured_return_sym8__"); + } + stan::model::assign(chi, inline_prob_uncaptured_return_sym8__, + "assigning variable chi"); current_statement__ = 3; - tau_theta = in__.template read_constrain_lb(0, lp__); - local_scalar_t__ tau_phi; + stan::math::check_greater_or_equal(function__, "phi", phi, 0); + current_statement__ = 3; + stan::math::check_less_or_equal(function__, "phi", phi, 1); current_statement__ = 4; - tau_phi = in__.template read_constrain_lb(0, lp__); - stan::conditional_var_value_t> theta_std; + stan::math::check_greater_or_equal(function__, "p", p, 0); + current_statement__ = 4; + stan::math::check_less_or_equal(function__, "p", p, 1); current_statement__ = 5; - theta_std = in__.template read< - stan::conditional_var_value_t>>(N); - stan::conditional_var_value_t> phi_std_raw; - current_statement__ = 6; - phi_std_raw = in__.template read< - stan::conditional_var_value_t>>(N); - local_scalar_t__ sigma_phi; - current_statement__ = 7; - sigma_phi = stan::math::inv_sqrt(tau_phi); - stan::conditional_var_value_t> phi = - stan::conditional_var_value_t>(Eigen::Matrix::Constant(N, - std::numeric_limits::quiet_NaN( - ))); - current_statement__ = 9; - stan::model::assign(phi, phi_std_raw, "assigning variable phi", - stan::model::index_min_max(1, N)); - current_statement__ = 10; - stan::model::assign(phi, - stan::math::multiply(stan::model::deep_copy(phi), sigma_phi), - "assigning variable phi"); - current_statement__ = 7; - stan::math::check_greater_or_equal(function__, "sigma_phi", sigma_phi, - 0); + stan::math::check_greater_or_equal(function__, "chi", chi, 0); + current_statement__ = 5; + stan::math::check_less_or_equal(function__, "chi", chi, 1); { - current_statement__ = 11; - lp_accum__.add(stan::math::dot_self( - stan::model::rvalue(phi, "phi", - stan::model::index_multi(node1)))); + current_statement__ = 36; + for (int i = 1; i <= nind; ++i) { + current_statement__ = 34; + if (stan::math::logical_gt( + stan::model::rvalue(first, "first", stan::model::index_uni(i)), + 0)) { + current_statement__ = 31; + for (int t = + (stan::model::rvalue(first, "first", + stan::model::index_uni(i)) + 1); t <= + stan::model::rvalue(last, "last", stan::model::index_uni(i)); ++t) { + current_statement__ = 28; + lp_accum__.add(stan::math::bernoulli_lpmf(1, + stan::model::rvalue(phi, "phi", + stan::model::index_uni(i), + stan::model::index_uni((t - 1))))); + current_statement__ = 29; + lp_accum__.add(stan::math::bernoulli_lpmf( + stan::model::rvalue(y, "y", + stan::model::index_uni(i), + stan::model::index_uni(t)), + stan::model::rvalue(p, "p", + stan::model::index_uni(i), + stan::model::index_uni((t - 1))))); + } + current_statement__ = 32; + lp_accum__.add(stan::math::bernoulli_lpmf(1, + stan::model::rvalue(chi, "chi", + stan::model::index_uni(i), + stan::model::index_uni( + stan::model::rvalue(last, "last", + stan::model::index_uni(i)))))); + } + } } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); @@ -9414,61 +10674,141 @@ class expr_prop_fail8_model final : public model_base_crtp(); - double beta1; + mean_p = in__.template read_constrain_lub(0, 1, lp__); + Eigen::Matrix beta; current_statement__ = 2; - beta1 = in__.template read(); - double tau_theta; - current_statement__ = 3; - tau_theta = in__.template read_constrain_lb(0, lp__); - double tau_phi; - current_statement__ = 4; - tau_phi = in__.template read_constrain_lb(0, lp__); - Eigen::Matrix theta_std; - current_statement__ = 5; - theta_std = in__.template read>(N); - Eigen::Matrix phi_std_raw; - current_statement__ = 6; - phi_std_raw = in__.template read< - Eigen::Matrix>(N); - double sigma_phi = std::numeric_limits::quiet_NaN(); - Eigen::Matrix phi = - Eigen::Matrix::Constant(N, + beta = in__.template read_constrain_lub< + Eigen::Matrix, jacobian__>(0, 1, lp__, + max_age); + Eigen::Matrix phi = + Eigen::Matrix::Constant(nind, n_occ_minus_1, std::numeric_limits::quiet_NaN()); - out__.write(beta0); - out__.write(beta1); - out__.write(tau_theta); - out__.write(tau_phi); - out__.write(theta_std); - out__.write(phi_std_raw); + Eigen::Matrix p = + Eigen::Matrix::Constant(nind, n_occ_minus_1, + std::numeric_limits::quiet_NaN()); + Eigen::Matrix chi = + Eigen::Matrix::Constant(nind, n_occasions, + std::numeric_limits::quiet_NaN()); + out__.write(mean_p); + out__.write(beta); if (stan::math::logical_negation( (stan::math::primitive_value(emit_transformed_parameters__) || stan::math::primitive_value(emit_generated_quantities__)))) { return ; } - current_statement__ = 7; - sigma_phi = stan::math::inv_sqrt(tau_phi); - current_statement__ = 9; - stan::model::assign(phi, phi_std_raw, "assigning variable phi", - stan::model::index_min_max(1, N)); - current_statement__ = 10; - stan::model::assign(phi, - stan::math::multiply(stan::model::deep_copy(phi), sigma_phi), - "assigning variable phi"); - current_statement__ = 7; - stan::math::check_greater_or_equal(function__, "sigma_phi", sigma_phi, - 0); + current_statement__ = 15; + for (int i = 1; i <= nind; ++i) { + current_statement__ = 9; + for (int t = 1; t <= + (stan::model::rvalue(first, "first", stan::model::index_uni(i)) + - 1); ++t) { + current_statement__ = 6; + stan::model::assign(phi, 0, "assigning variable phi", + stan::model::index_uni(i), stan::model::index_uni(t)); + current_statement__ = 7; + stan::model::assign(p, 0, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(t)); + } + current_statement__ = 13; + for (int t = + stan::model::rvalue(first, "first", stan::model::index_uni(i)); t + <= n_occ_minus_1; ++t) { + current_statement__ = 10; + stan::model::assign(phi, + stan::model::rvalue(beta, "beta", + stan::model::index_uni( + stan::model::rvalue(x, "x", stan::model::index_uni(i), + stan::model::index_uni(t)))), "assigning variable phi", + stan::model::index_uni(i), stan::model::index_uni(t)); + current_statement__ = 11; + stan::model::assign(p, mean_p, "assigning variable p", + stan::model::index_uni(i), stan::model::index_uni(t)); + } + } + Eigen::Matrix inline_prob_uncaptured_return_sym1__; + { + current_statement__ = 16; + stan::math::validate_non_negative_index("chi", "nind", nind); + current_statement__ = 17; + stan::math::validate_non_negative_index("chi", "n_occasions", + n_occasions); + Eigen::Matrix + inline_prob_uncaptured_chi_sym2__ = + Eigen::Matrix::Constant(nind, n_occasions, + DUMMY_VAR__); + current_statement__ = 26; + for (int inline_prob_uncaptured_i_sym6__ = 1; inline_prob_uncaptured_i_sym6__ + <= nind; ++inline_prob_uncaptured_i_sym6__) { + current_statement__ = 19; + stan::model::assign(inline_prob_uncaptured_chi_sym2__, 1.0, + "assigning variable inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(n_occasions)); + current_statement__ = 24; + for (int inline_prob_uncaptured_t_sym5__ = 1; inline_prob_uncaptured_t_sym5__ + <= (n_occasions - 1); ++inline_prob_uncaptured_t_sym5__) { + int inline_prob_uncaptured_t_curr_sym3__; + current_statement__ = 20; + inline_prob_uncaptured_t_curr_sym3__ = (n_occasions - + inline_prob_uncaptured_t_sym5__); + int inline_prob_uncaptured_t_next_sym4__; + current_statement__ = 21; + inline_prob_uncaptured_t_next_sym4__ = (inline_prob_uncaptured_t_curr_sym3__ + + 1); + current_statement__ = 22; + stan::model::assign(inline_prob_uncaptured_chi_sym2__, + stan::math::fma( + (stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni( + inline_prob_uncaptured_t_curr_sym3__)) * (1 - + stan::model::rvalue(p, "p", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni( + (inline_prob_uncaptured_t_next_sym4__ - 1))))), + stan::model::rvalue(inline_prob_uncaptured_chi_sym2__, + "inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(inline_prob_uncaptured_t_next_sym4__)), + (1 - + stan::model::rvalue(phi, "phi", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(inline_prob_uncaptured_t_curr_sym3__)))), + "assigning variable inline_prob_uncaptured_chi_sym2__", + stan::model::index_uni(inline_prob_uncaptured_i_sym6__), + stan::model::index_uni(inline_prob_uncaptured_t_curr_sym3__)); + } + } + current_statement__ = 27; + stan::model::assign(inline_prob_uncaptured_return_sym1__, + inline_prob_uncaptured_chi_sym2__, + "assigning variable inline_prob_uncaptured_return_sym1__"); + } + stan::model::assign(chi, inline_prob_uncaptured_return_sym1__, + "assigning variable chi"); + current_statement__ = 3; + stan::math::check_greater_or_equal(function__, "phi", phi, 0); + current_statement__ = 3; + stan::math::check_less_or_equal(function__, "phi", phi, 1); + current_statement__ = 4; + stan::math::check_greater_or_equal(function__, "p", p, 0); + current_statement__ = 4; + stan::math::check_less_or_equal(function__, "p", p, 1); + current_statement__ = 5; + stan::math::check_greater_or_equal(function__, "chi", chi, 0); + current_statement__ = 5; + stan::math::check_less_or_equal(function__, "chi", chi, 1); if (emit_transformed_parameters__) { - out__.write(sigma_phi); out__.write(phi); + out__.write(p); + out__.write(chi); } if (stan::math::logical_negation(emit_generated_quantities__)) { return ; @@ -9493,70 +10833,60 @@ class expr_prop_fail8_model final : public model_base_crtp(); - out__.write(beta0); - local_scalar_t__ beta1; - beta1 = in__.read(); - out__.write(beta1); - local_scalar_t__ tau_theta; - tau_theta = in__.read(); - out__.write_free_lb(0, tau_theta); - local_scalar_t__ tau_phi; - tau_phi = in__.read(); - out__.write_free_lb(0, tau_phi); - Eigen::Matrix theta_std = - Eigen::Matrix::Constant(N, DUMMY_VAR__); - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - stan::model::assign(theta_std, in__.read(), - "assigning variable theta_std", stan::model::index_uni(sym1__)); - } - out__.write(theta_std); - Eigen::Matrix phi_std_raw = - Eigen::Matrix::Constant(N, DUMMY_VAR__); - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - stan::model::assign(phi_std_raw, in__.read(), - "assigning variable phi_std_raw", stan::model::index_uni(sym1__)); + local_scalar_t__ mean_p; + mean_p = in__.read(); + out__.write_free_lub(0, 1, mean_p); + Eigen::Matrix beta = + Eigen::Matrix::Constant(max_age, DUMMY_VAR__); + for (int sym1__ = 1; sym1__ <= max_age; ++sym1__) { + stan::model::assign(beta, in__.read(), + "assigning variable beta", stan::model::index_uni(sym1__)); } - out__.write(phi_std_raw); + out__.write_free_lub(0, 1, beta); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } inline void get_param_names(std::vector& names__) const { - names__ = std::vector{"beta0", "beta1", "tau_theta", - "tau_phi", "theta_std", "phi_std_raw", "sigma_phi", "phi"}; + names__ = std::vector{"mean_p", "beta", "phi", "p", "chi"}; } inline void get_dims(std::vector>& dimss__) const { dimss__ = std::vector>{std::vector{}, - std::vector{}, std::vector{}, - std::vector{}, - std::vector{static_cast(N)}, - std::vector{static_cast(N)}, - std::vector{}, - std::vector{static_cast(N)}}; + std::vector{static_cast(max_age)}, + std::vector{static_cast(nind), + static_cast(n_occ_minus_1)}, + std::vector{static_cast(nind), + static_cast(n_occ_minus_1)}, + std::vector{static_cast(nind), + static_cast(n_occasions)}}; } inline void constrained_param_names(std::vector& param_names__, bool emit_transformed_parameters__ = true, bool - emit_generated_quantities__ = true) const final { - param_names__.emplace_back(std::string() + "beta0"); - param_names__.emplace_back(std::string() + "beta1"); - param_names__.emplace_back(std::string() + "tau_theta"); - param_names__.emplace_back(std::string() + "tau_phi"); - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - param_names__.emplace_back(std::string() + "theta_std" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - param_names__.emplace_back(std::string() + "phi_std_raw" + '.' + - std::to_string(sym1__)); + emit_generated_quantities__ = true) const final { + param_names__.emplace_back(std::string() + "mean_p"); + for (int sym15__ = 1; sym15__ <= max_age; ++sym15__) { + param_names__.emplace_back(std::string() + "beta" + '.' + + std::to_string(sym15__)); } if (emit_transformed_parameters__) { - param_names__.emplace_back(std::string() + "sigma_phi"); - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - param_names__.emplace_back(std::string() + "phi" + '.' + - std::to_string(sym1__)); + for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { + for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { + param_names__.emplace_back(std::string() + "phi" + '.' + + std::to_string(sym16__) + '.' + std::to_string(sym15__)); + } + } + for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { + for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { + param_names__.emplace_back(std::string() + "p" + '.' + + std::to_string(sym16__) + '.' + std::to_string(sym15__)); + } + } + for (int sym15__ = 1; sym15__ <= n_occasions; ++sym15__) { + for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { + param_names__.emplace_back(std::string() + "chi" + '.' + + std::to_string(sym16__) + '.' + std::to_string(sym15__)); + } } } if (emit_generated_quantities__) {} @@ -9565,32 +10895,38 @@ class expr_prop_fail8_model final : public model_base_crtp& param_names__, bool emit_transformed_parameters__ = true, bool emit_generated_quantities__ = true) const final { - param_names__.emplace_back(std::string() + "beta0"); - param_names__.emplace_back(std::string() + "beta1"); - param_names__.emplace_back(std::string() + "tau_theta"); - param_names__.emplace_back(std::string() + "tau_phi"); - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - param_names__.emplace_back(std::string() + "theta_std" + '.' + - std::to_string(sym1__)); - } - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - param_names__.emplace_back(std::string() + "phi_std_raw" + '.' + - std::to_string(sym1__)); + param_names__.emplace_back(std::string() + "mean_p"); + for (int sym15__ = 1; sym15__ <= max_age; ++sym15__) { + param_names__.emplace_back(std::string() + "beta" + '.' + + std::to_string(sym15__)); } if (emit_transformed_parameters__) { - param_names__.emplace_back(std::string() + "sigma_phi"); - for (int sym1__ = 1; sym1__ <= N; ++sym1__) { - param_names__.emplace_back(std::string() + "phi" + '.' + - std::to_string(sym1__)); + for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { + for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { + param_names__.emplace_back(std::string() + "phi" + '.' + + std::to_string(sym16__) + '.' + std::to_string(sym15__)); + } + } + for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { + for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { + param_names__.emplace_back(std::string() + "p" + '.' + + std::to_string(sym16__) + '.' + std::to_string(sym15__)); + } + } + for (int sym15__ = 1; sym15__ <= n_occasions; ++sym15__) { + for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { + param_names__.emplace_back(std::string() + "chi" + '.' + + std::to_string(sym16__) + '.' + std::to_string(sym15__)); + } } } if (emit_generated_quantities__) {} } inline std::string get_constrained_sizedtypes() const { - return std::string("[{\"name\":\"beta0\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta1\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"tau_theta\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"tau_phi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"theta_std\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"parameters\"},{\"name\":\"phi_std_raw\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"parameters\"},{\"name\":\"sigma_phi\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"transformed_parameters\"}]"); + return std::string("[{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(max_age) + "},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"}]"); } inline std::string get_unconstrained_sizedtypes() const { - return std::string("[{\"name\":\"beta0\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta1\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"tau_theta\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"tau_phi\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"theta_std\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"parameters\"},{\"name\":\"phi_std_raw\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"parameters\"},{\"name\":\"sigma_phi\",\"type\":{\"name\":\"real\"},\"block\":\"transformed_parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(N) + "},\"block\":\"transformed_parameters\"}]"); + return std::string("[{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(max_age) + "},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"}]"); } // Begin method overload boilerplate template inline void @@ -9599,8 +10935,9 @@ class expr_prop_fail8_model final : public model_base_crtp(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 { - constexpr std::array - names__{"beta0", "beta1", "tau_theta", "tau_phi", "theta_std", - "phi_std_raw"}; - const std::array - constrain_param_sizes__{1, 1, 1, 1, N, N}; - const auto num_constrained_params__ = - std::accumulate(constrain_param_sizes__.begin(), - constrain_param_sizes__.end(), 0); - std::vector params_r_flat__(num_constrained_params__); - Eigen::Index size_iter__ = 0; - Eigen::Index flat_iter__ = 0; - for (auto&& param_name__: names__) { - const auto param_vec__ = context.vals_r(param_name__); - for (Eigen::Index i = 0; i < constrain_param_sizes__[size_iter__]; ++i) { - params_r_flat__[flat_iter__] = param_vec__[i]; - ++flat_iter__; - } - ++size_iter__; - } - vars.resize(num_params_r__); - transform_inits_impl(params_r_flat__, params_i, vars, pstream__); - } -}; -} -using stan_model = expr_prop_fail8_model_namespace::expr_prop_fail8_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* m = new stan_model(data_context, seed, msg_stream); - return *m; -} -stan::math::profile_map& get_stan_profile_data() { - return expr_prop_fail8_model_namespace::profiles__; -} -#endif - $ ../../../../../install/default/bin/stanc --O1 --print-cpp fails-test.stan -// Code generated by %%NAME%% %%VERSION%% -#include -namespace fails_test_model_namespace { -using stan::model::model_base_crtp; -using namespace stan::math; -stan::math::profile_map profiles__; -static constexpr std::array locations_array__ = - {" (found before start of program)", - " (in 'fails-test.stan', line 68, column 2 to column 32)", - " (in 'fails-test.stan', line 69, column 2 to column 41)", - " (in 'fails-test.stan', line 72, column 2 to column 52)", - " (in 'fails-test.stan', line 73, column 2 to column 50)", - " (in 'fails-test.stan', line 74, column 2 to column 50)", - " (in 'fails-test.stan', line 79, column 6 to column 20)", - " (in 'fails-test.stan', line 80, column 6 to column 18)", - " (in 'fails-test.stan', line 78, column 34 to line 81, column 5)", - " (in 'fails-test.stan', line 78, column 4 to line 81, column 5)", - " (in 'fails-test.stan', line 83, column 6 to column 32)", - " (in 'fails-test.stan', line 84, column 6 to column 23)", - " (in 'fails-test.stan', line 82, column 40 to line 85, column 5)", - " (in 'fails-test.stan', line 82, column 4 to line 85, column 5)", - " (in 'fails-test.stan', line 77, column 22 to line 86, column 3)", - " (in 'fails-test.stan', line 77, column 2 to line 86, column 3)", - " (in 'fails-test.stan', line 25, column 11 to column 15)", - " (in 'fails-test.stan', line 25, column 17 to column 28)", - " (in 'fails-test.stan', line 25, column 4 to column 34)", - " (in 'fails-test.stan', line 28, column 6 to column 32)", - " (in 'fails-test.stan', line 31, column 8 to column 37)", - " (in 'fails-test.stan', line 32, column 8 to column 32)", - " (in 'fails-test.stan', line 40, column 8 to line 42, column 44)", - " (in 'fails-test.stan', line 29, column 39 to line 43, column 7)", - " (in 'fails-test.stan', line 29, column 6 to line 43, column 7)", - " (in 'fails-test.stan', line 27, column 24 to line 44, column 5)", - " (in 'fails-test.stan', line 27, column 4 to line 44, column 5)", - " (in 'fails-test.stan', line 45, column 4 to column 15)", - " (in 'fails-test.stan', line 100, column 8 to column 37)", - " (in 'fails-test.stan', line 101, column 8 to column 41)", - " (in 'fails-test.stan', line 99, column 42 to line 102, column 7)", - " (in 'fails-test.stan', line 99, column 6 to line 102, column 7)", - " (in 'fails-test.stan', line 103, column 6 to column 37)", - " (in 'fails-test.stan', line 98, column 22 to line 104, column 5)", - " (in 'fails-test.stan', line 98, column 4 to line 104, column 5)", - " (in 'fails-test.stan', line 97, column 22 to line 105, column 3)", - " (in 'fails-test.stan', line 97, column 2 to line 105, column 3)", - " (in 'fails-test.stan', line 49, column 2 to column 20)", - " (in 'fails-test.stan', line 50, column 2 to column 27)", - " (in 'fails-test.stan', line 51, column 8 to column 12)", - " (in 'fails-test.stan', line 51, column 14 to column 25)", - " (in 'fails-test.stan', line 51, column 2 to column 51)", - " (in 'fails-test.stan', line 52, column 2 to column 23)", - " (in 'fails-test.stan', line 53, column 8 to column 12)", - " (in 'fails-test.stan', line 53, column 14 to column 29)", - " (in 'fails-test.stan', line 53, column 2 to column 61)", - " (in 'fails-test.stan', line 56, column 2 to column 38)", - " (in 'fails-test.stan', line 58, column 8 to column 12)", - " (in 'fails-test.stan', line 58, column 2 to column 52)", - " (in 'fails-test.stan', line 59, column 8 to column 12)", - " (in 'fails-test.stan', line 59, column 2 to column 51)", - " (in 'fails-test.stan', line 63, column 4 to column 35)", - " (in 'fails-test.stan', line 62, column 2 to line 63, column 35)", - " (in 'fails-test.stan', line 65, column 4 to column 33)", - " (in 'fails-test.stan', line 64, column 2 to line 65, column 33)", - " (in 'fails-test.stan', line 69, column 27 to column 34)", - " (in 'fails-test.stan', line 72, column 27 to column 31)", - " (in 'fails-test.stan', line 72, column 33 to column 46)", - " (in 'fails-test.stan', line 73, column 27 to column 31)", - " (in 'fails-test.stan', line 73, column 33 to column 46)", - " (in 'fails-test.stan', line 74, column 27 to column 31)", - " (in 'fails-test.stan', line 74, column 33 to column 44)", - " (in 'fails-test.stan', line 8, column 8 to column 17)", - " (in 'fails-test.stan', line 7, column 6 to line 8, column 17)", - " (in 'fails-test.stan', line 6, column 4 to line 8, column 17)", - " (in 'fails-test.stan', line 9, column 4 to column 13)", - " (in 'fails-test.stan', line 5, column 37 to line 10, column 3)", - " (in 'fails-test.stan', line 15, column 6 to column 32)", - " (in 'fails-test.stan', line 19, column 8 to column 17)", - " (in 'fails-test.stan', line 18, column 6 to line 19, column 17)", - " (in 'fails-test.stan', line 13, column 39 to line 20, column 5)", - " (in 'fails-test.stan', line 13, column 4 to line 20, column 5)", - " (in 'fails-test.stan', line 21, column 4 to column 13)", - " (in 'fails-test.stan', line 12, column 36 to line 22, column 3)", - " (in 'fails-test.stan', line 24, column 74 to line 46, column 3)"}; -int first_capture(const std::vector& y_i, std::ostream* pstream__); -int last_capture(const std::vector& y_i, std::ostream* pstream__); -template , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>* = nullptr> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, - const T3__& phi_arg__, std::ostream* pstream__); -int first_capture(const std::vector& y_i, std::ostream* pstream__) { - using local_scalar_t__ = double; - int current_statement__ = 0; - static constexpr bool propto__ = true; - // suppress unused var warning - (void) propto__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - current_statement__ = 64; - for (int k = 1; k <= stan::math::size(y_i); ++k) { - current_statement__ = 63; - if (stan::model::rvalue(y_i, "y_i", stan::model::index_uni(k))) { - current_statement__ = 62; - return k; - } - } - current_statement__ = 65; - return 0; - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); + write_array_impl(base_rng, params_r, params_i, vars, + emit_transformed_parameters, emit_generated_quantities, pstream); } -} -int last_capture(const std::vector& y_i, std::ostream* pstream__) { - using local_scalar_t__ = double; - int current_statement__ = 0; - static constexpr bool propto__ = true; - // suppress unused var warning - (void) propto__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - current_statement__ = 71; - for (int k_rev = 0; k_rev <= (stan::math::size(y_i) - 1); ++k_rev) { - int k; - current_statement__ = 67; - k = (stan::math::size(y_i) - k_rev); - current_statement__ = 69; - if (stan::model::rvalue(y_i, "y_i", stan::model::index_uni(k))) { - current_statement__ = 68; - return k; - } - } - current_statement__ = 72; - return 0; - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); + 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 , - stan::is_vt_not_complex, - stan::is_eigen_matrix_dynamic, - stan::is_vt_not_complex>*> -Eigen::Matrix, - stan::base_type_t>,-1,-1> -prob_uncaptured(const int& nind, const int& n_occasions, const T2__& p_arg__, - const T3__& phi_arg__, std::ostream* pstream__) { - using local_scalar_t__ = stan::promote_args_t, - stan::base_type_t>; - int current_statement__ = 0; - const auto& p = stan::math::to_ref(p_arg__); - const auto& phi = stan::math::to_ref(phi_arg__); - static constexpr bool propto__ = true; - // suppress unused var warning - (void) propto__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - current_statement__ = 16; - stan::math::validate_non_negative_index("chi", "nind", nind); - current_statement__ = 17; - stan::math::validate_non_negative_index("chi", "n_occasions", n_occasions); - Eigen::Matrix chi = - Eigen::Matrix::Constant(nind, n_occasions, - DUMMY_VAR__); - current_statement__ = 26; - for (int i = 1; i <= nind; ++i) { - current_statement__ = 19; - stan::model::assign(chi, 1.0, "assigning variable chi", - stan::model::index_uni(i), stan::model::index_uni(n_occasions)); - current_statement__ = 24; - for (int t = 1; t <= (n_occasions - 1); ++t) { - int t_curr; - current_statement__ = 20; - t_curr = (n_occasions - t); - int t_next; - current_statement__ = 21; - t_next = (t_curr + 1); - current_statement__ = 22; - stan::model::assign(chi, - stan::math::fma( - (stan::model::rvalue(phi, "phi", stan::model::index_uni(i), - stan::model::index_uni(t_curr)) * (1 - - stan::model::rvalue(p, "p", stan::model::index_uni(i), - stan::model::index_uni((t_next - 1))))), - stan::model::rvalue(chi, "chi", stan::model::index_uni(i), - stan::model::index_uni(t_next)), (1 - - stan::model::rvalue(phi, "phi", stan::model::index_uni(i), - stan::model::index_uni(t_curr)))), "assigning variable chi", - stan::model::index_uni(i), stan::model::index_uni(t_curr)); + 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 { + constexpr std::array names__{"mean_p", "beta"}; + const std::array constrain_param_sizes__{1, max_age}; + const auto num_constrained_params__ = + std::accumulate(constrain_param_sizes__.begin(), + constrain_param_sizes__.end(), 0); + std::vector params_r_flat__(num_constrained_params__); + Eigen::Index size_iter__ = 0; + Eigen::Index flat_iter__ = 0; + for (auto&& param_name__: names__) { + const auto param_vec__ = context.vals_r(param_name__); + for (Eigen::Index i = 0; i < constrain_param_sizes__[size_iter__]; ++i) { + params_r_flat__[flat_iter__] = param_vec__[i]; + ++flat_iter__; } + ++size_iter__; } - current_statement__ = 27; - return chi; - } catch (const std::exception& e) { - stan::lang::rethrow_located(e, locations_array__[current_statement__]); + vars.resize(num_params_r__); + transform_inits_impl(params_r_flat__, params_i, vars, pstream__); } +}; } -class fails_test_model final : public model_base_crtp { - private: - int nind; - int n_occasions; - std::vector> y; - int max_age; - std::vector> x; - int n_occ_minus_1; - std::vector first; - std::vector last; - public: - ~fails_test_model() {} - fails_test_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__ = - "fails_test_model_namespace::fails_test_model"; - // suppress unused var warning - (void) function__; - local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); - // suppress unused var warning - (void) DUMMY_VAR__; - try { - int pos__; - pos__ = 1; - current_statement__ = 37; - context__.validate_dims("data initialization", "nind", "int", - std::vector{}); - nind = std::numeric_limits::min(); - current_statement__ = 37; - nind = context__.vals_i("nind")[(1 - 1)]; - current_statement__ = 37; - stan::math::check_greater_or_equal(function__, "nind", nind, 0); - current_statement__ = 38; - context__.validate_dims("data initialization", "n_occasions", "int", - std::vector{}); - n_occasions = std::numeric_limits::min(); - current_statement__ = 38; - n_occasions = context__.vals_i("n_occasions")[(1 - 1)]; - current_statement__ = 38; - stan::math::check_greater_or_equal(function__, "n_occasions", - n_occasions, 2); - current_statement__ = 39; - stan::math::validate_non_negative_index("y", "nind", nind); - current_statement__ = 40; - stan::math::validate_non_negative_index("y", "n_occasions", n_occasions); - current_statement__ = 41; - context__.validate_dims("data initialization", "y", "int", - std::vector{static_cast(nind), - static_cast(n_occasions)}); - y = std::vector>(nind, - std::vector(n_occasions, std::numeric_limits::min())); - { - std::vector y_flat__; - current_statement__ = 41; - y_flat__ = context__.vals_i("y"); - current_statement__ = 41; - pos__ = 1; - current_statement__ = 41; - for (int sym1__ = 1; sym1__ <= n_occasions; ++sym1__) { - current_statement__ = 41; - for (int sym2__ = 1; sym2__ <= nind; ++sym2__) { - current_statement__ = 41; - stan::model::assign(y, y_flat__[(pos__ - 1)], - "assigning variable y", stan::model::index_uni(sym2__), - stan::model::index_uni(sym1__)); - current_statement__ = 41; - pos__ = (pos__ + 1); - } - } - } - current_statement__ = 41; - stan::math::check_greater_or_equal(function__, "y", y, 0); - current_statement__ = 41; - stan::math::check_less_or_equal(function__, "y", y, 1); - current_statement__ = 42; - context__.validate_dims("data initialization", "max_age", "int", - std::vector{}); - max_age = std::numeric_limits::min(); - current_statement__ = 42; - max_age = context__.vals_i("max_age")[(1 - 1)]; - current_statement__ = 42; - stan::math::check_greater_or_equal(function__, "max_age", max_age, 1); - current_statement__ = 43; - stan::math::validate_non_negative_index("x", "nind", nind); - current_statement__ = 44; - stan::math::validate_non_negative_index("x", "n_occasions - 1", - (n_occasions - 1)); - current_statement__ = 45; - context__.validate_dims("data initialization", "x", "int", - std::vector{static_cast(nind), - static_cast((n_occasions - 1))}); - x = std::vector>(nind, - std::vector((n_occasions - 1), - std::numeric_limits::min())); +using stan_model = fails_test_model_namespace::fails_test_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* m = new stan_model(data_context, seed, msg_stream); + return *m; +} +stan::math::profile_map& get_stan_profile_data() { + return fails_test_model_namespace::profiles__; +} +#endif + $ ../../../../../install/default/bin/stanc --O1 --print-cpp function-in-function-inline.stan +// Code generated by %%NAME%% %%VERSION%% +#include +namespace function_in_function_inline_model_namespace { +using stan::model::model_base_crtp; +using namespace stan::math; +stan::math::profile_map profiles__; +static constexpr std::array locations_array__ = + {" (found before start of program)", + " (in 'function-in-function-inline.stan', line 14, column 2 to column 29)", + " (in 'function-in-function-inline.stan', line 3, column 4 to column 20)", + " (in 'function-in-function-inline.stan', line 15, column 2 to column 16)", + " (in 'function-in-function-inline.stan', line 11, column 2 to column 17)", + " (in 'function-in-function-inline.stan', line 2, column 30 to line 4, column 3)", + " (in 'function-in-function-inline.stan', line 7, column 4 to column 27)", + " (in 'function-in-function-inline.stan', line 6, column 30 to line 8, column 3)"}; +template , + stan::is_vt_not_complex>* = nullptr> +stan::promote_args_t> +inner_lpdf(const T0__& phi_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>* = nullptr> +stan::promote_args_t> +outer_lpdf(const T0__& phi_arg__, std::ostream* pstream__); +template , + stan::is_vt_not_complex>*> +stan::promote_args_t> +inner_lpdf(const T0__& phi_arg__, std::ostream* pstream__) { + using local_scalar_t__ = stan::promote_args_t>; + int current_statement__ = 0; + const auto& phi = stan::math::to_ref(phi_arg__); + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 2; + return stan::math::sum(phi); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +template , + stan::is_vt_not_complex>*> +stan::promote_args_t> +outer_lpdf(const T0__& phi_arg__, std::ostream* pstream__) { + using local_scalar_t__ = stan::promote_args_t>; + int current_statement__ = 0; + const auto& phi = stan::math::to_ref(phi_arg__); + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + current_statement__ = 6; + return inner_lpdf(phi, pstream__); + } catch (const std::exception& e) { + stan::lang::rethrow_located(e, locations_array__[current_statement__]); + } +} +class function_in_function_inline_model final : public model_base_crtp { + private: + Eigen::Matrix phi_data__; + Eigen::Map> phi{nullptr, 0}; + public: + ~function_in_function_inline_model() {} + function_in_function_inline_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__ = + "function_in_function_inline_model_namespace::function_in_function_inline_model"; + // suppress unused var warning + (void) function__; + local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN()); + // suppress unused var warning + (void) DUMMY_VAR__; + try { + int pos__; + pos__ = 1; + current_statement__ = 4; + context__.validate_dims("data initialization", "phi", "double", + std::vector{static_cast(10)}); + phi_data__ = Eigen::Matrix::Constant(10, + std::numeric_limits::quiet_NaN()); + new (&phi) Eigen::Map>(phi_data__.data(), + 10); { - std::vector x_flat__; - current_statement__ = 45; - x_flat__ = context__.vals_i("x"); - current_statement__ = 45; + std::vector phi_flat__; + current_statement__ = 4; + phi_flat__ = context__.vals_r("phi"); + current_statement__ = 4; pos__ = 1; - current_statement__ = 45; - for (int sym1__ = 1; sym1__ <= (n_occasions - 1); ++sym1__) { - current_statement__ = 45; - for (int sym2__ = 1; sym2__ <= nind; ++sym2__) { - current_statement__ = 45; - stan::model::assign(x, x_flat__[(pos__ - 1)], - "assigning variable x", stan::model::index_uni(sym2__), - stan::model::index_uni(sym1__)); - current_statement__ = 45; - pos__ = (pos__ + 1); - } + current_statement__ = 4; + for (int sym1__ = 1; sym1__ <= 10; ++sym1__) { + current_statement__ = 4; + stan::model::assign(phi, phi_flat__[(pos__ - 1)], + "assigning variable phi", stan::model::index_uni(sym1__)); + current_statement__ = 4; + pos__ = (pos__ + 1); } } - current_statement__ = 45; - stan::math::check_greater_or_equal(function__, "x", x, 0); - current_statement__ = 45; - stan::math::check_less_or_equal(function__, "x", x, max_age); - current_statement__ = 46; - n_occ_minus_1 = std::numeric_limits::min(); - current_statement__ = 46; - n_occ_minus_1 = (n_occasions - 1); - current_statement__ = 47; - stan::math::validate_non_negative_index("first", "nind", nind); - current_statement__ = 48; - first = std::vector(nind, std::numeric_limits::min()); - current_statement__ = 49; - stan::math::validate_non_negative_index("last", "nind", nind); - current_statement__ = 50; - last = std::vector(nind, std::numeric_limits::min()); - current_statement__ = 52; - for (int i = 1; i <= nind; ++i) { - current_statement__ = 51; - stan::model::assign(first, - first_capture( - stan::model::rvalue(y, "y", stan::model::index_uni(i)), pstream__), - "assigning variable first", stan::model::index_uni(i)); - } - current_statement__ = 54; - for (int i = 1; i <= nind; ++i) { - current_statement__ = 53; - stan::model::assign(last, - last_capture( - stan::model::rvalue(y, "y", stan::model::index_uni(i)), pstream__), - "assigning variable last", stan::model::index_uni(i)); - } - current_statement__ = 48; - stan::math::check_greater_or_equal(function__, "first", first, 0); - current_statement__ = 48; - stan::math::check_less_or_equal(function__, "first", first, n_occasions); - current_statement__ = 50; - stan::math::check_greater_or_equal(function__, "last", last, 0); - current_statement__ = 50; - stan::math::check_less_or_equal(function__, "last", last, n_occasions); - current_statement__ = 55; - stan::math::validate_non_negative_index("beta", "max_age", max_age); - current_statement__ = 56; - stan::math::validate_non_negative_index("phi", "nind", nind); - current_statement__ = 57; - stan::math::validate_non_negative_index("phi", "n_occ_minus_1", - n_occ_minus_1); - current_statement__ = 58; - stan::math::validate_non_negative_index("p", "nind", nind); - current_statement__ = 59; - stan::math::validate_non_negative_index("p", "n_occ_minus_1", - n_occ_minus_1); - current_statement__ = 60; - stan::math::validate_non_negative_index("chi", "nind", nind); - current_statement__ = 61; - stan::math::validate_non_negative_index("chi", "n_occasions", - n_occasions); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } - num_params_r__ = 1 + max_age; + num_params_r__ = 0U; } inline std::string model_name() const final { - return "fails_test_model"; + return "function_in_function_inline_model"; } inline std::vector model_compile_info() const noexcept { return std::vector{"stanc_version = %%NAME%%3 %%VERSION%%", @@ -10098,168 +11160,24 @@ class fails_test_model final : public model_base_crtp { // suppress unused var warning (void) DUMMY_VAR__; static constexpr const char* function__ = - "fails_test_model_namespace::log_prob"; + "function_in_function_inline_model_namespace::log_prob"; // suppress unused var warning (void) function__; try { - local_scalar_t__ mean_p; - current_statement__ = 1; - mean_p = in__.template read_constrain_lub(0, 1, lp__); - Eigen::Matrix beta; - current_statement__ = 2; - beta = in__.template read_constrain_lub< - Eigen::Matrix, jacobian__>(0, 1, lp__, - max_age); - Eigen::Matrix phi = - Eigen::Matrix::Constant(nind, n_occ_minus_1, - DUMMY_VAR__); - Eigen::Matrix p = - Eigen::Matrix::Constant(nind, n_occ_minus_1, - DUMMY_VAR__); - Eigen::Matrix chi = - Eigen::Matrix::Constant(nind, n_occasions, - DUMMY_VAR__); - current_statement__ = 15; - for (int i = 1; i <= nind; ++i) { - current_statement__ = 9; - for (int t = 1; t <= - (stan::model::rvalue(first, "first", stan::model::index_uni(i)) - - 1); ++t) { - current_statement__ = 6; - stan::model::assign(phi, 0, "assigning variable phi", - stan::model::index_uni(i), stan::model::index_uni(t)); - current_statement__ = 7; - stan::model::assign(p, 0, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(t)); - } - current_statement__ = 13; - for (int t = - stan::model::rvalue(first, "first", stan::model::index_uni(i)); t - <= n_occ_minus_1; ++t) { - current_statement__ = 10; - stan::model::assign(phi, - stan::model::rvalue(beta, "beta", - stan::model::index_uni( - stan::model::rvalue(x, "x", stan::model::index_uni(i), - stan::model::index_uni(t)))), "assigning variable phi", - stan::model::index_uni(i), stan::model::index_uni(t)); - current_statement__ = 11; - stan::model::assign(p, mean_p, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(t)); - } - } - Eigen::Matrix - inline_prob_uncaptured_return_sym8__; - { - current_statement__ = 16; - stan::math::validate_non_negative_index("chi", "nind", nind); - current_statement__ = 17; - stan::math::validate_non_negative_index("chi", "n_occasions", - n_occasions); - Eigen::Matrix - inline_prob_uncaptured_chi_sym9__ = - Eigen::Matrix::Constant(nind, n_occasions, - DUMMY_VAR__); - current_statement__ = 26; - for (int inline_prob_uncaptured_i_sym13__ = 1; inline_prob_uncaptured_i_sym13__ - <= nind; ++inline_prob_uncaptured_i_sym13__) { - current_statement__ = 19; - stan::model::assign(inline_prob_uncaptured_chi_sym9__, 1.0, - "assigning variable inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni(n_occasions)); - current_statement__ = 24; - for (int inline_prob_uncaptured_t_sym12__ = 1; inline_prob_uncaptured_t_sym12__ - <= (n_occasions - 1); ++inline_prob_uncaptured_t_sym12__) { - int inline_prob_uncaptured_t_curr_sym10__; - current_statement__ = 20; - inline_prob_uncaptured_t_curr_sym10__ = (n_occasions - - inline_prob_uncaptured_t_sym12__); - int inline_prob_uncaptured_t_next_sym11__; - current_statement__ = 21; - inline_prob_uncaptured_t_next_sym11__ = (inline_prob_uncaptured_t_curr_sym10__ - + 1); - current_statement__ = 22; - stan::model::assign(inline_prob_uncaptured_chi_sym9__, - stan::math::fma( - (stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni( - inline_prob_uncaptured_t_curr_sym10__)) * (1 - - stan::model::rvalue(p, "p", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni( - (inline_prob_uncaptured_t_next_sym11__ - 1))))), - stan::model::rvalue(inline_prob_uncaptured_chi_sym9__, - "inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni( - inline_prob_uncaptured_t_next_sym11__)), (1 - - stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni( - inline_prob_uncaptured_t_curr_sym10__)))), - "assigning variable inline_prob_uncaptured_chi_sym9__", - stan::model::index_uni(inline_prob_uncaptured_i_sym13__), - stan::model::index_uni(inline_prob_uncaptured_t_curr_sym10__)); - } - } - current_statement__ = 27; - stan::model::assign(inline_prob_uncaptured_return_sym8__, - inline_prob_uncaptured_chi_sym9__, - "assigning variable inline_prob_uncaptured_return_sym8__"); - } - stan::model::assign(chi, inline_prob_uncaptured_return_sym8__, - "assigning variable chi"); - current_statement__ = 3; - stan::math::check_greater_or_equal(function__, "phi", phi, 0); - current_statement__ = 3; - stan::math::check_less_or_equal(function__, "phi", phi, 1); - current_statement__ = 4; - stan::math::check_greater_or_equal(function__, "p", p, 0); - current_statement__ = 4; - stan::math::check_less_or_equal(function__, "p", p, 1); - current_statement__ = 5; - stan::math::check_greater_or_equal(function__, "chi", chi, 0); - current_statement__ = 5; - stan::math::check_less_or_equal(function__, "chi", chi, 1); + local_scalar_t__ ret = DUMMY_VAR__; + local_scalar_t__ inline_outer_lpdf_return_sym9__; { - current_statement__ = 36; - for (int i = 1; i <= nind; ++i) { - current_statement__ = 34; - if (stan::math::logical_gt( - stan::model::rvalue(first, "first", stan::model::index_uni(i)), - 0)) { - current_statement__ = 31; - for (int t = - (stan::model::rvalue(first, "first", - stan::model::index_uni(i)) + 1); t <= - stan::model::rvalue(last, "last", stan::model::index_uni(i)); ++t) { - current_statement__ = 28; - lp_accum__.add(stan::math::bernoulli_lpmf(1, - stan::model::rvalue(phi, "phi", - stan::model::index_uni(i), - stan::model::index_uni((t - 1))))); - current_statement__ = 29; - lp_accum__.add(stan::math::bernoulli_lpmf( - stan::model::rvalue(y, "y", - stan::model::index_uni(i), - stan::model::index_uni(t)), - stan::model::rvalue(p, "p", - stan::model::index_uni(i), - stan::model::index_uni((t - 1))))); - } - current_statement__ = 32; - lp_accum__.add(stan::math::bernoulli_lpmf(1, - stan::model::rvalue(chi, "chi", - stan::model::index_uni(i), - stan::model::index_uni( - stan::model::rvalue(last, "last", - stan::model::index_uni(i)))))); - } + local_scalar_t__ + inline_outer_lpdf_inline_inner_lpdf_return_sym5___sym10__; + { + current_statement__ = 2; + inline_outer_lpdf_inline_inner_lpdf_return_sym5___sym10__ = + stan::math::sum(phi); } + inline_outer_lpdf_return_sym9__ = inline_outer_lpdf_inline_inner_lpdf_return_sym5___sym10__; } + current_statement__ = 3; + lp_accum__.add(inline_outer_lpdf_return_sym9__); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } @@ -10293,142 +11211,15 @@ class fails_test_model final : public model_base_crtp { (void) DUMMY_VAR__; constexpr bool jacobian__ = false; static constexpr const char* function__ = - "fails_test_model_namespace::write_array"; + "function_in_function_inline_model_namespace::write_array"; // suppress unused var warning (void) function__; try { - double mean_p; - current_statement__ = 1; - mean_p = in__.template read_constrain_lub(0, 1, lp__); - Eigen::Matrix beta; - current_statement__ = 2; - beta = in__.template read_constrain_lub< - Eigen::Matrix, jacobian__>(0, 1, lp__, - max_age); - Eigen::Matrix phi = - Eigen::Matrix::Constant(nind, n_occ_minus_1, - std::numeric_limits::quiet_NaN()); - Eigen::Matrix p = - Eigen::Matrix::Constant(nind, n_occ_minus_1, - std::numeric_limits::quiet_NaN()); - Eigen::Matrix chi = - Eigen::Matrix::Constant(nind, n_occasions, - std::numeric_limits::quiet_NaN()); - out__.write(mean_p); - out__.write(beta); if (stan::math::logical_negation( (stan::math::primitive_value(emit_transformed_parameters__) || stan::math::primitive_value(emit_generated_quantities__)))) { return ; } - current_statement__ = 15; - for (int i = 1; i <= nind; ++i) { - current_statement__ = 9; - for (int t = 1; t <= - (stan::model::rvalue(first, "first", stan::model::index_uni(i)) - - 1); ++t) { - current_statement__ = 6; - stan::model::assign(phi, 0, "assigning variable phi", - stan::model::index_uni(i), stan::model::index_uni(t)); - current_statement__ = 7; - stan::model::assign(p, 0, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(t)); - } - current_statement__ = 13; - for (int t = - stan::model::rvalue(first, "first", stan::model::index_uni(i)); t - <= n_occ_minus_1; ++t) { - current_statement__ = 10; - stan::model::assign(phi, - stan::model::rvalue(beta, "beta", - stan::model::index_uni( - stan::model::rvalue(x, "x", stan::model::index_uni(i), - stan::model::index_uni(t)))), "assigning variable phi", - stan::model::index_uni(i), stan::model::index_uni(t)); - current_statement__ = 11; - stan::model::assign(p, mean_p, "assigning variable p", - stan::model::index_uni(i), stan::model::index_uni(t)); - } - } - Eigen::Matrix inline_prob_uncaptured_return_sym1__; - { - current_statement__ = 16; - stan::math::validate_non_negative_index("chi", "nind", nind); - current_statement__ = 17; - stan::math::validate_non_negative_index("chi", "n_occasions", - n_occasions); - Eigen::Matrix - inline_prob_uncaptured_chi_sym2__ = - Eigen::Matrix::Constant(nind, n_occasions, - DUMMY_VAR__); - current_statement__ = 26; - for (int inline_prob_uncaptured_i_sym6__ = 1; inline_prob_uncaptured_i_sym6__ - <= nind; ++inline_prob_uncaptured_i_sym6__) { - current_statement__ = 19; - stan::model::assign(inline_prob_uncaptured_chi_sym2__, 1.0, - "assigning variable inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(n_occasions)); - current_statement__ = 24; - for (int inline_prob_uncaptured_t_sym5__ = 1; inline_prob_uncaptured_t_sym5__ - <= (n_occasions - 1); ++inline_prob_uncaptured_t_sym5__) { - int inline_prob_uncaptured_t_curr_sym3__; - current_statement__ = 20; - inline_prob_uncaptured_t_curr_sym3__ = (n_occasions - - inline_prob_uncaptured_t_sym5__); - int inline_prob_uncaptured_t_next_sym4__; - current_statement__ = 21; - inline_prob_uncaptured_t_next_sym4__ = (inline_prob_uncaptured_t_curr_sym3__ - + 1); - current_statement__ = 22; - stan::model::assign(inline_prob_uncaptured_chi_sym2__, - stan::math::fma( - (stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni( - inline_prob_uncaptured_t_curr_sym3__)) * (1 - - stan::model::rvalue(p, "p", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni( - (inline_prob_uncaptured_t_next_sym4__ - 1))))), - stan::model::rvalue(inline_prob_uncaptured_chi_sym2__, - "inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(inline_prob_uncaptured_t_next_sym4__)), - (1 - - stan::model::rvalue(phi, "phi", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(inline_prob_uncaptured_t_curr_sym3__)))), - "assigning variable inline_prob_uncaptured_chi_sym2__", - stan::model::index_uni(inline_prob_uncaptured_i_sym6__), - stan::model::index_uni(inline_prob_uncaptured_t_curr_sym3__)); - } - } - current_statement__ = 27; - stan::model::assign(inline_prob_uncaptured_return_sym1__, - inline_prob_uncaptured_chi_sym2__, - "assigning variable inline_prob_uncaptured_return_sym1__"); - } - stan::model::assign(chi, inline_prob_uncaptured_return_sym1__, - "assigning variable chi"); - current_statement__ = 3; - stan::math::check_greater_or_equal(function__, "phi", phi, 0); - current_statement__ = 3; - stan::math::check_less_or_equal(function__, "phi", phi, 1); - current_statement__ = 4; - stan::math::check_greater_or_equal(function__, "p", p, 0); - current_statement__ = 4; - stan::math::check_less_or_equal(function__, "p", p, 1); - current_statement__ = 5; - stan::math::check_greater_or_equal(function__, "chi", chi, 0); - current_statement__ = 5; - stan::math::check_less_or_equal(function__, "chi", chi, 1); - if (emit_transformed_parameters__) { - out__.write(phi); - out__.write(p); - out__.write(chi); - } if (stan::math::logical_negation(emit_generated_quantities__)) { return ; } @@ -10452,100 +11243,35 @@ class fails_test_model final : public model_base_crtp { try { int pos__; pos__ = 1; - local_scalar_t__ mean_p; - mean_p = in__.read(); - out__.write_free_lub(0, 1, mean_p); - Eigen::Matrix beta = - Eigen::Matrix::Constant(max_age, DUMMY_VAR__); - for (int sym1__ = 1; sym1__ <= max_age; ++sym1__) { - stan::model::assign(beta, in__.read(), - "assigning variable beta", stan::model::index_uni(sym1__)); - } - out__.write_free_lub(0, 1, beta); } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); } } inline void get_param_names(std::vector& names__) const { - names__ = std::vector{"mean_p", "beta", "phi", "p", "chi"}; + names__ = std::vector{}; } inline void get_dims(std::vector>& dimss__) const { - dimss__ = std::vector>{std::vector{}, - std::vector{static_cast(max_age)}, - std::vector{static_cast(nind), - static_cast(n_occ_minus_1)}, - std::vector{static_cast(nind), - static_cast(n_occ_minus_1)}, - std::vector{static_cast(nind), - static_cast(n_occasions)}}; + dimss__ = std::vector>{}; } inline void constrained_param_names(std::vector& param_names__, bool emit_transformed_parameters__ = true, bool emit_generated_quantities__ = true) const final { - param_names__.emplace_back(std::string() + "mean_p"); - for (int sym15__ = 1; sym15__ <= max_age; ++sym15__) { - param_names__.emplace_back(std::string() + "beta" + '.' + - std::to_string(sym15__)); - } - if (emit_transformed_parameters__) { - for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { - for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { - param_names__.emplace_back(std::string() + "phi" + '.' + - std::to_string(sym16__) + '.' + std::to_string(sym15__)); - } - } - for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { - for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { - param_names__.emplace_back(std::string() + "p" + '.' + - std::to_string(sym16__) + '.' + std::to_string(sym15__)); - } - } - for (int sym15__ = 1; sym15__ <= n_occasions; ++sym15__) { - for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { - param_names__.emplace_back(std::string() + "chi" + '.' + - std::to_string(sym16__) + '.' + std::to_string(sym15__)); - } - } - } + if (emit_transformed_parameters__) {} 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 { - param_names__.emplace_back(std::string() + "mean_p"); - for (int sym15__ = 1; sym15__ <= max_age; ++sym15__) { - param_names__.emplace_back(std::string() + "beta" + '.' + - std::to_string(sym15__)); - } - if (emit_transformed_parameters__) { - for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { - for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { - param_names__.emplace_back(std::string() + "phi" + '.' + - std::to_string(sym16__) + '.' + std::to_string(sym15__)); - } - } - for (int sym15__ = 1; sym15__ <= n_occ_minus_1; ++sym15__) { - for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { - param_names__.emplace_back(std::string() + "p" + '.' + - std::to_string(sym16__) + '.' + std::to_string(sym15__)); - } - } - for (int sym15__ = 1; sym15__ <= n_occasions; ++sym15__) { - for (int sym16__ = 1; sym16__ <= nind; ++sym16__) { - param_names__.emplace_back(std::string() + "chi" + '.' + - std::to_string(sym16__) + '.' + std::to_string(sym15__)); - } - } - } + if (emit_transformed_parameters__) {} if (emit_generated_quantities__) {} } inline std::string get_constrained_sizedtypes() const { - return std::string("[{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(max_age) + "},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"}]"); + return std::string("[]"); } inline std::string get_unconstrained_sizedtypes() const { - return std::string("[{\"name\":\"mean_p\",\"type\":{\"name\":\"real\"},\"block\":\"parameters\"},{\"name\":\"beta\",\"type\":{\"name\":\"vector\",\"length\":" + std::to_string(max_age) + "},\"block\":\"parameters\"},{\"name\":\"phi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"p\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occ_minus_1) + "},\"block\":\"transformed_parameters\"},{\"name\":\"chi\",\"type\":{\"name\":\"matrix\",\"rows\":" + std::to_string(nind) + ",\"cols\":" + std::to_string(n_occasions) + "},\"block\":\"transformed_parameters\"}]"); + return std::string("[]"); } // Begin method overload boilerplate template inline void @@ -10554,9 +11280,8 @@ class fails_test_model final : public model_base_crtp { emit_transformed_parameters = true, const bool emit_generated_quantities = true, std::ostream* pstream = nullptr) const { - const size_t num_params__ = (1 + max_age); - const size_t num_transformed = emit_transformed_parameters * ((((nind * - n_occ_minus_1) + (nind * n_occ_minus_1)) + (nind * n_occasions))); + const size_t num_params__ = 0; + const size_t num_transformed = emit_transformed_parameters * (0); const size_t num_gen_quantities = emit_generated_quantities * (0); const size_t num_to_write = num_params__ + num_transformed + num_gen_quantities; @@ -10572,9 +11297,8 @@ class fails_test_model final : public model_base_crtp { emit_transformed_parameters = true, bool emit_generated_quantities = true, std::ostream* pstream = nullptr) const { - const size_t num_params__ = (1 + max_age); - const size_t num_transformed = emit_transformed_parameters * ((((nind * - n_occ_minus_1) + (nind * n_occ_minus_1)) + (nind * n_occasions))); + const size_t num_params__ = 0; + const size_t num_transformed = emit_transformed_parameters * (0); const size_t num_gen_quantities = emit_generated_quantities * (0); const size_t num_to_write = num_params__ + num_transformed + num_gen_quantities; @@ -10607,8 +11331,8 @@ class fails_test_model final : public model_base_crtp { transform_inits(const stan::io::var_context& context, std::vector& params_i, std::vector& vars, std::ostream* pstream__ = nullptr) const { - constexpr std::array names__{"mean_p", "beta"}; - const std::array constrain_param_sizes__{1, max_age}; + constexpr std::array names__{}; + const std::array constrain_param_sizes__{}; const auto num_constrained_params__ = std::accumulate(constrain_param_sizes__.begin(), constrain_param_sizes__.end(), 0); @@ -10628,7 +11352,7 @@ class fails_test_model final : public model_base_crtp { } }; } -using stan_model = fails_test_model_namespace::fails_test_model; +using stan_model = function_in_function_inline_model_namespace::function_in_function_inline_model; #ifndef USING_R // Boilerplate stan::model::model_base& @@ -10638,7 +11362,7 @@ new_model(stan::io::var_context& data_context, unsigned int seed, return *m; } stan::math::profile_map& get_stan_profile_data() { - return fails_test_model_namespace::profiles__; + return function_in_function_inline_model_namespace::profiles__; } #endif $ ../../../../../install/default/bin/stanc --O1 --print-cpp function-in-function-loops.stan diff --git a/test/integration/good/compiler-optimizations/dune b/test/integration/good/compiler-optimizations/dune index bc10287705..be8d20d1ea 100644 --- a/test/integration/good/compiler-optimizations/dune +++ b/test/integration/good/compiler-optimizations/dune @@ -3,41 +3,7 @@ (deps (package stanc) (:stanfiles - optimizations.stan - expr-prop-fail8.stan - lcm-experiment2.stan - expr-prop-fail7.stan - expr-prop-experiment2.stan - lcm-experiment.stan - expr-prop-fail6.stan - expr-prop-experiment.stan - expr-prop-fail5.stan - expr-prop-fail4.stan - lcm-fails2.stan - lcm-fails.stan - unroll-limit.stan - expr-prop-fail3.stan - expr-prop-fail2.stan - inlining-fail2.stan - dce-fail.stan - partial-eval.stan - copy_fail.stan - fails-test.stan - off-small.stan - off-dce.stan - stalled1-failure.stan - expr-prop-fail.stan - ad-level-failing.stan - ad-level-deep-dependence.stan - overloaded-fn.stan - overloaded-fn2.stan - lupdf-inlining.stan - unenforce-initialize.stan - partial_eval_multiply.stan - inline-functions-varmat.stan - inliner-same-names.stan - inline-tdata.stan - function-in-function-loops.stan)) + (glob_files *.stan))) (action (with-stdout-to %{targets} @@ -53,42 +19,7 @@ (deps (package stanc) (:stanfiles - optimizations.stan - expr-prop-fail8.stan - lcm-experiment2.stan - expr-prop-fail7.stan - expr-prop-experiment2.stan - lcm-experiment.stan - expr-prop-fail6.stan - expr-prop-experiment.stan - expr-prop-fail5.stan - expr-prop-fail4.stan - lcm-fails2.stan - lcm-fails.stan - unroll-limit.stan - expr-prop-fail3.stan - expr-prop-fail2.stan - inlining-fail2.stan - dce-fail.stan - partial-eval.stan - copy_fail.stan - fails-test.stan - off-small.stan - off-dce.stan - overloaded-fn.stan - overloaded-fn2.stan - stalled1-failure.stan - expr-prop-fail.stan - ad-level-failing.stan - ad-level-deep-dependence.stan - lupdf-inlining.stan - unenforce-initialize.stan - unenforce-initialize-should-fail.stan - partial_eval_multiply.stan - inline-functions-varmat.stan - inliner-same-names.stan - inline-tdata.stan - function-in-function-loops.stan)) + (glob_files *.stan))) (action (with-stdout-to %{targets}