From 4393dd558247f209c7e421c75de984b8e91819ad Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Tue, 17 Feb 2026 10:51:45 -0500 Subject: [PATCH 1/4] Add generate_laplace_options --- src/stan_math_signatures/Generate.ml | 10 ++++++++++ src/stan_math_signatures/Stan_math_signatures.ml | 2 +- test/integration/signatures/stan_math_signatures.t | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/stan_math_signatures/Generate.ml b/src/stan_math_signatures/Generate.ml index f19932d1f..12f28abc3 100644 --- a/src/stan_math_signatures/Generate.ml +++ b/src/stan_math_signatures/Generate.ml @@ -1208,6 +1208,16 @@ let () = , ReturnType UReal , [UMatrix; UMatrix; UMatrix; UVector; UMatrix; UVector; UMatrix] , AoS ); + add_unqualified + ( "generate_laplace_options" + , ReturnType (UTuple [UVector; UReal; UInt; UInt; UInt; UInt; UInt]) + , [UVector] + , AoS ); + add_unqualified + ( "generate_laplace_options" + , ReturnType (UTuple [UVector; UReal; UInt; UInt; UInt; UInt; UInt]) + , [UInt] + , AoS ); add_unqualified ("gp_dot_prod_cov", ReturnType UMatrix, [UArray UReal; UReal], AoS); add_unqualified diff --git a/src/stan_math_signatures/Stan_math_signatures.ml b/src/stan_math_signatures/Stan_math_signatures.ml index c3fe5b0ab..d2680ed03 100644 --- a/src/stan_math_signatures/Stan_math_signatures.ml +++ b/src/stan_math_signatures/Stan_math_signatures.ml @@ -208,7 +208,7 @@ let is_special_function_name name = || is_embedded_laplace_fn name let disallowed_second_order = - [ "algebra_solver"; "algebra_solver_newton"; "integrate_ode" + [ "algebra_solver"; "algebra_solver_newton"; "integrate_1d"; "integrate_ode" ; "integrate_ode_adams"; "integrate_ode_bdf"; "integrate_ode_rk45"; "map_rect" ; "hmm_marginal"; "hmm_hidden_state_prob" ] |> String.Set.of_list diff --git a/test/integration/signatures/stan_math_signatures.t b/test/integration/signatures/stan_math_signatures.t index 7dbac266b..07a2a8ddd 100644 --- a/test/integration/signatures/stan_math_signatures.t +++ b/test/integration/signatures/stan_math_signatures.t @@ -7525,6 +7525,7 @@ Display all Stan math signatures exposed in the language gaussian_dlm_obs_lpdf(matrix, matrix, matrix, vector, matrix, vector, matrix) => real gaussian_dlm_obs_lpdf(matrix, matrix, matrix, matrix, matrix, vector, matrix) => real generalized_inverse(matrix) => matrix + generate_laplace_options(vector) => tuple(vector, real, int, int, int, int, int) get_imag(complex) => real get_imag(complex_vector) => vector get_imag(complex_row_vector) => row_vector From e3b33b99c3b83e33bd5a0f5a5d3a2e44490a013b Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Tue, 24 Feb 2026 11:09:04 -0500 Subject: [PATCH 2/4] Update laplace signatures to have hessian_block_size before covariance function --- src/frontend/Semantic_error.ml | 108 ++++-- src/frontend/Semantic_error.mli | 6 + src/frontend/Typechecker.ml | 20 +- src/middle/UnsizedType.ml | 9 +- .../Stan_math_signatures.ml | 3 +- .../autodiff_incompatibility1.stan | 2 +- .../autodiff_incompatibility2.stan | 2 +- .../autodiff_incompatibility3.stan | 2 +- .../autodiff_incompatibility4.stan | 5 +- .../autodiff_incompatibility5.stan | 2 +- .../bad/embedded_laplace/bad_callback1.stan | 2 +- .../bad/embedded_laplace/bad_callback2.stan | 2 +- .../bad/embedded_laplace/bad_callback3.stan | 2 +- .../bad/embedded_laplace/bad_callback4.stan | 2 +- .../bad/embedded_laplace/bad_callback5.stan | 2 +- .../bad/embedded_laplace/bad_forward1.stan | 2 +- .../bad/embedded_laplace/bad_forward2.stan | 2 +- .../bad/embedded_laplace/bad_forward3.stan | 2 +- .../bad/embedded_laplace/bad_forward4.stan | 2 +- .../bad/embedded_laplace/bad_forward5.stan | 2 +- .../bad/embedded_laplace/bad_forward6.stan | 2 +- .../bad/embedded_laplace/bad_forward9.stan | 2 +- ...tol8.stan => bad_hessian_block_size1.stan} | 4 +- .../bad_hessian_block_size2.stan | 40 +++ .../bad/embedded_laplace/bad_theta0.stan | 4 +- .../bad/embedded_laplace/bad_tol0.stan | 2 +- .../bad/embedded_laplace/bad_tol1.stan | 2 +- .../bad/embedded_laplace/bad_tol10.stan | 4 +- .../bad/embedded_laplace/bad_tol11.stan | 2 +- .../bad/embedded_laplace/bad_tol2.stan | 2 +- .../bad/embedded_laplace/bad_tol3.stan | 2 +- .../bad/embedded_laplace/bad_tol4.stan | 4 +- .../bad/embedded_laplace/bad_tol5.stan | 4 +- .../bad/embedded_laplace/bad_tol6.stan | 4 +- .../bad/embedded_laplace/bad_tol7.stan | 4 +- .../bad/embedded_laplace/bad_tol9.stan | 4 +- .../bad/embedded_laplace/missing_args10.stan | 44 +++ .../bad/embedded_laplace/missing_args11.stan | 21 ++ .../bad/embedded_laplace/missing_args12.stan | 3 + .../bad/embedded_laplace/missing_args6.stan | 2 +- .../bad/embedded_laplace/missing_args7.stan | 2 +- .../bad/embedded_laplace/missing_args8.stan | 2 +- .../bad/embedded_laplace/missing_args9.stan | 2 +- .../bad/embedded_laplace/stanc.expected | 291 +++++++++------- test/integration/good/code-gen/cpp.expected | 312 +++++++++--------- .../code-gen/laplace_bernoulli_logit.stan | 24 +- .../good/code-gen/laplace_functionals.stan | 11 +- .../code-gen/laplace_neg_binomial_2_log.stan | 24 +- .../good/code-gen/laplace_nested_tuple.stan | 12 +- .../good/code-gen/laplace_nested_tuple2.stan | 12 +- .../good/code-gen/laplace_nested_tuple3.stan | 4 +- .../good/code-gen/laplace_overload_weird.stan | 2 +- .../good/code-gen/laplace_poisson.stan | 4 +- .../good/code-gen/laplace_poisson_log.stan | 24 +- .../integration/good/laplace_deriv_check.stan | 2 +- test/integration/good/pretty.expected | 2 +- .../signatures/stan_math_signatures.t | 1 + 57 files changed, 650 insertions(+), 416 deletions(-) rename test/integration/bad/embedded_laplace/{bad_tol8.stan => bad_hessian_block_size1.stan} (96%) create mode 100644 test/integration/bad/embedded_laplace/bad_hessian_block_size2.stan create mode 100644 test/integration/bad/embedded_laplace/missing_args10.stan create mode 100644 test/integration/bad/embedded_laplace/missing_args11.stan create mode 100644 test/integration/bad/embedded_laplace/missing_args12.stan diff --git a/src/frontend/Semantic_error.ml b/src/frontend/Semantic_error.ml index 8eab22e31..6319cfe1e 100644 --- a/src/frontend/Semantic_error.ml +++ b/src/frontend/Semantic_error.ml @@ -49,6 +49,8 @@ module TypeError = struct | IllTypedLaplaceMarginal of string * bool * UnsizedType.argumentlist | LaplaceCompatibilityIssue of string | IlltypedLaplaceTooMany of string * int + | IlltypedLaplaceHessianBlockSize of + string * (UnsizedType.autodifftype * UnsizedType.t) option | IlltypedLaplaceTolArgs of string * SignatureMismatch.function_mismatch | AmbiguousFunctionPromotion of string @@ -80,14 +82,38 @@ module TypeError = struct | 1 -> "first element of the control parameter tuple (initial guess)" | 2 -> "second element of the control parameter tuple (tolerance)" | 3 -> "third element of the control parameter tuple (max_num_steps)" - | 4 -> "fourth element of the control parameter tuple (hessian_block_size)" - | 5 -> "fifth element of the control parameter tuple (solver)" - | 6 -> - "sixth element of the control parameter tuple (max_steps_line_search)" - | 7 -> "seventh element of the control parameter tuple (allow_fallthrough)" + | 4 -> "fourth element of the control parameter tuple (solver)" + | 5 -> + "fifth element of the control parameter tuple (max_steps_line_search)" + | 6 -> "sixth element of the control parameter tuple (allow_fallthrough)" | n -> Fmt.str "%a element of the control parameter tuple" (Fmt.ordinal ()) n + let generic_laplace_usage info ppf (name, supplied) = + let req = Stan_math_signatures.laplace_helper_param_types name in + let is_helper = not @@ List.is_empty req in + let pp_lik_args ppf = + if is_helper then Fmt.(list ~sep:comma UnsizedType.pp_fun_arg) ppf req + else Fmt.pf ppf "(vector, T_l%t) => real,@ tuple(T_l%t)" ellipsis ellipsis + in + let pp_laplace_tols ppf = + if String.is_substring ~substring:"_tol" name then + Fmt.pf ppf ", %a" + Fmt.(list ~sep:comma UnsizedType.pp_fun_arg) + Stan_math_signatures.laplace_tolerance_argument_types in + let pp_supplied_tys ppf = + if List.is_empty supplied then Fmt.nop ppf () + else + Fmt.pf ppf "@ However, we received the types:@ @[(%a)@]" + Fmt.(list ~sep:comma UnsizedType.pp_fun_arg) + supplied in + Fmt.pf ppf + "@[Ill-typed arguments supplied to function %a.@ The valid signature \ + of this function is@ @[%s(%t,@ data int,@ (T_k%t) => matrix,@ \ + tuple(T_k%t)%t)@]%t@ @[%a@]@]" + quoted name name pp_lik_args ellipsis ellipsis pp_laplace_tols + pp_supplied_tys info () + let rec expected_types : UnsizedType.t Common.Nonempty_list.t Fmt.t = let ust = expected_style UnsizedType.pp in fun ppf l -> @@ -193,39 +219,24 @@ module TypeError = struct details Fmt.(list ~sep:comma (expected_style UnsizedType.pp_fun_arg)) expected - | IllTypedLaplaceMarginal (name, early, supplied) -> - let req = Stan_math_signatures.laplace_helper_param_types name in - let is_helper = not @@ List.is_empty req in - let info = - if early then + | IllTypedLaplaceMarginal (name, true, supplied) -> + let info ppf () = + Fmt.text ppf "We were unable to start more in-depth checking. Please ensure you \ are passing enough arguments and that the first argument is a \ - function." - else - let n = if is_helper then List.length req else 2 in - Fmt.str - "Typechecking failed after checking the first %d arguments. \ - Please ensure you are passing enough arguments and that the %a \ - is a function." - n (Fmt.ordinal ()) (n + 1) in - let pp_lik_args ppf = - if is_helper then Fmt.(list ~sep:comma UnsizedType.pp_fun_arg) ppf req - else - Fmt.pf ppf "(vector, T_l%t) => real,@ tuple(T_l%t)" ellipsis - ellipsis in - let pp_laplace_tols ppf = - if String.is_substring ~substring:"_tol" name then - Fmt.pf ppf ", %a" - Fmt.(list ~sep:comma UnsizedType.pp_fun_arg) - Stan_math_signatures.laplace_tolerance_argument_types in - Fmt.pf ppf - "@[Ill-typed arguments supplied to function %a.@ The valid \ - signature of this function is@ @[%s(%t,@ vector,@ (T_k%t) => \ - matrix,@ tuple(T_k%t)%t)@]@ However, we received the types:@ @[(%a)@]@ @[%a@]@]" - quoted name name pp_lik_args ellipsis ellipsis pp_laplace_tols - Fmt.(list ~sep:comma UnsizedType.pp_fun_arg) - supplied Fmt.text info + function." in + generic_laplace_usage info ppf (name, supplied) + | IllTypedLaplaceMarginal (name, false, supplied) -> + let req = Stan_math_signatures.laplace_helper_param_types name in + let is_helper = not @@ List.is_empty req in + let info ppf () = + let n = (if is_helper then List.length req else 2) + 1 in + Fmt.pf ppf + "Typechecking failed after checking the first %d arguments.@ \ + Please ensure you are passing enough arguments and that the %a is \ + a function." + n (Fmt.ordinal ()) (n + 1) in + generic_laplace_usage info ppf (name, supplied) | LaplaceCompatibilityIssue banned_function -> Fmt.pf ppf "The function %a, called by this likelihood function,@ does not \ @@ -239,6 +250,28 @@ module TypeError = struct "Only a single tuple of control parameters is expected." else if n_args = 1 then "Did you mean to call the _tol version?" else "Did you mean to call the _tol version with a tuple of these?") + | IlltypedLaplaceHessianBlockSize (name, None) -> + let info ppf () = + Fmt.pf ppf + "@[Missing the hessian block size (data-only %a) and \ + remaining arguments.@]" + (expected_style UnsizedType.pp) + UInt in + generic_laplace_usage info ppf (name, []) + | IlltypedLaplaceHessianBlockSize (name, Some (DataOnly, ty)) -> + Fmt.pf ppf + "@[The hessian block size argument to %a must be a data-only \ + %a.%a@]" + quoted name + (expected_style UnsizedType.pp) + UInt found_type ty + | IlltypedLaplaceHessianBlockSize (name, Some (_, ty)) -> + Fmt.pf ppf + "@[The hessian block size argument to %a must be a data-only \ + %a.%a@ %a@]" + quoted name + (expected_style UnsizedType.pp) + UInt found_type ty SignatureMismatch.data_only_msg () | IlltypedLaplaceTolArgs (name, ArgNumMismatch (_, 0)) -> Fmt.pf ppf "Missing control parameter tuple at the end of the call to %a.@ \ @@ -777,6 +810,9 @@ let laplace_compatibility loc banned_function = let illtyped_laplace_extra_args loc name args = (loc, TypeError (TypeError.IlltypedLaplaceTooMany (name, args))) +let illtyped_laplace_hessian_block_size_arg loc name arg_ty = + (loc, TypeError (TypeError.IlltypedLaplaceHessianBlockSize (name, arg_ty))) + let illtyped_laplace_tolerance_args loc name mismatch = (loc, TypeError (TypeError.IlltypedLaplaceTolArgs (name, mismatch))) diff --git a/src/frontend/Semantic_error.mli b/src/frontend/Semantic_error.mli index d8612aa90..606843a63 100644 --- a/src/frontend/Semantic_error.mli +++ b/src/frontend/Semantic_error.mli @@ -95,6 +95,12 @@ val illtyped_laplace_generic : val laplace_compatibility : Location_span.t -> string -> t val illtyped_laplace_extra_args : Location_span.t -> string -> int -> t +val illtyped_laplace_hessian_block_size_arg : + Location_span.t + -> string + -> (UnsizedType.autodifftype * UnsizedType.t) option + -> t + val illtyped_laplace_tolerance_args : Location_span.t -> string -> SignatureMismatch.function_mismatch -> t diff --git a/src/frontend/Typechecker.ml b/src/frontend/Typechecker.ml index 115c20c6b..b49185a2d 100644 --- a/src/frontend/Typechecker.ml +++ b/src/frontend/Typechecker.ml @@ -864,6 +864,23 @@ and check_laplace_fn ~is_cond_dist loc cf tenv id tes = (UnsizedType.ReturnType UReal) in ([lik_fun; lik_tupl], tes) | _ -> generic_failure ~early:true () in + (* check hessian block size *) + let hbs_arg, rest = + let loc = + match List.last lik_args with + | Some e -> {e.emeta.loc with begin_loc= e.emeta.loc.end_loc} + | None -> loc in + match rest with + | hbs :: rest -> + let hbs_ty = arg_type hbs in + if hbs_ty <> UnsizedType.(DataOnly, UInt) then + Semantic_error.illtyped_laplace_hessian_block_size_arg hbs.emeta.loc + id.name (Some hbs_ty) + |> error + else (hbs, rest) + | _ -> + Semantic_error.illtyped_laplace_hessian_block_size_arg loc id.name None + |> error in (* Check the remaining arguments: initial guess, covariance, and tolerances *) match rest with | {expr= Variable cov_fun; _} :: cov_tupl :: control_args -> @@ -875,7 +892,8 @@ and check_laplace_fn ~is_cond_dist loc cf tenv id tes = probably require two more calls to [check_function_callable_with_tuple] *) verify_laplace_control_args loc id control_args; - let args = lik_args @ (cov_fun_type :: cov_tupl :: control_args) in + let args = + lik_args @ (hbs_arg :: cov_fun_type :: cov_tupl :: control_args) in let return_type = if String.is_suffix id.name ~suffix:"_rng" then UnsizedType.UVector else UnsizedType.UReal in diff --git a/src/middle/UnsizedType.ml b/src/middle/UnsizedType.ml index aab8174bd..cf1a834b1 100644 --- a/src/middle/UnsizedType.ml +++ b/src/middle/UnsizedType.ml @@ -65,6 +65,8 @@ let rec wind_array_type = function | typ, 0 -> typ | typ, n -> wind_array_type (UArray typ, n - 1) +let is_fun_type = function UFun _ | UMathLibraryFunction -> true | _ -> false + let rec pp ppf = function | UInt -> Fmt.string ppf "int" | UReal -> Fmt.string ppf "real" @@ -91,7 +93,10 @@ let rec pp ppf = function and pp_fun_arg ppf (ad_ty, unsized_ty) = let open Fmt in - let pp_data = if' (equal_autodifftype ad_ty DataOnly) (any "data ") in + let pp_data = + if' + (equal_autodifftype ad_ty DataOnly && not (is_fun_type unsized_ty)) + (any "data ") in (pp_data ++ pp) ppf unsized_ty and pp_returntype ppf = function @@ -236,8 +241,6 @@ let is_eigen_type ut = true | _ -> false -let is_fun_type = function UFun _ | UMathLibraryFunction -> true | _ -> false - (** Detect if type contains an integer *) let rec contains_int ut = match ut with diff --git a/src/stan_math_signatures/Stan_math_signatures.ml b/src/stan_math_signatures/Stan_math_signatures.ml index d2680ed03..3a4806bc0 100644 --- a/src/stan_math_signatures/Stan_math_signatures.ml +++ b/src/stan_math_signatures/Stan_math_signatures.ml @@ -197,8 +197,7 @@ let laplace_helper_param_types name = let laplace_tolerance_argument_types = UnsizedType. [ (AutoDiffable, UVector) (* theta_0 *); (DataOnly, UReal) (* tolerance *) - ; (DataOnly, UInt) (* max_num_steps *) - ; (DataOnly, UInt) (* hessian_block_size *); (DataOnly, UInt) (* solver *) + ; (DataOnly, UInt) (* max_num_steps *); (DataOnly, UInt) (* solver *) ; (DataOnly, UInt) (* max_steps_line_search *) ; (DataOnly, UInt) (* allow_fallthrough *) ] diff --git a/test/integration/bad/embedded_laplace/autodiff_incompatibility1.stan b/test/integration/bad/embedded_laplace/autodiff_incompatibility1.stan index 52ca767b7..fd6fad38f 100644 --- a/test/integration/bad/embedded_laplace/autodiff_incompatibility1.stan +++ b/test/integration/bad/embedded_laplace/autodiff_incompatibility1.stan @@ -53,6 +53,6 @@ parameters { } model { - target += laplace_marginal(ll_function, (eta, log_ye, y), + target += laplace_marginal(ll_function, (eta, log_ye, y), 1, K_function, (x, n_obs, alpha, rho)); } diff --git a/test/integration/bad/embedded_laplace/autodiff_incompatibility2.stan b/test/integration/bad/embedded_laplace/autodiff_incompatibility2.stan index 675872751..5df476f47 100644 --- a/test/integration/bad/embedded_laplace/autodiff_incompatibility2.stan +++ b/test/integration/bad/embedded_laplace/autodiff_incompatibility2.stan @@ -57,5 +57,5 @@ parameters { generated quantities { vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), - K_function, (x, n_obs, alpha, rho)); + 1, K_function, (x, n_obs, alpha, rho)); } diff --git a/test/integration/bad/embedded_laplace/autodiff_incompatibility3.stan b/test/integration/bad/embedded_laplace/autodiff_incompatibility3.stan index 517d7b2b7..d2fced362 100644 --- a/test/integration/bad/embedded_laplace/autodiff_incompatibility3.stan +++ b/test/integration/bad/embedded_laplace/autodiff_incompatibility3.stan @@ -49,5 +49,5 @@ parameters { generated quantities { vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), - K_function, (x, n_obs, alpha, rho)); + 1, K_function, (x, n_obs, alpha, rho)); } diff --git a/test/integration/bad/embedded_laplace/autodiff_incompatibility4.stan b/test/integration/bad/embedded_laplace/autodiff_incompatibility4.stan index e619581db..ea142f2df 100644 --- a/test/integration/bad/embedded_laplace/autodiff_incompatibility4.stan +++ b/test/integration/bad/embedded_laplace/autodiff_incompatibility4.stan @@ -16,8 +16,9 @@ functions { array[] int y) { // observed count return neg_binomial_2_lpmf(y | exp(log_ye + theta), eta) + - // integrate 1d is itself allowed, actually + // integrate 1d SHOULD be allowed, // see https://github.com/stan-dev/math/pull/2929 + // but there is a bug: https://github.com/stan-dev/math/issues/3280 integrate_1d(integrand, 0, 1, y, y, y); } @@ -48,5 +49,5 @@ parameters { generated quantities { vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), - K_function, (x, n_obs, alpha, rho)); + 1, K_function, (x, n_obs, alpha, rho)); } diff --git a/test/integration/bad/embedded_laplace/autodiff_incompatibility5.stan b/test/integration/bad/embedded_laplace/autodiff_incompatibility5.stan index 971524211..e4ef7a5a9 100644 --- a/test/integration/bad/embedded_laplace/autodiff_incompatibility5.stan +++ b/test/integration/bad/embedded_laplace/autodiff_incompatibility5.stan @@ -52,5 +52,5 @@ parameters { generated quantities { vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), - K_function, (x, n_obs, alpha, rho)); + 1, K_function, (x, n_obs, alpha, rho)); } diff --git a/test/integration/bad/embedded_laplace/bad_callback1.stan b/test/integration/bad/embedded_laplace/bad_callback1.stan index c30eda74d..d0d5a989d 100644 --- a/test/integration/bad/embedded_laplace/bad_callback1.stan +++ b/test/integration/bad/embedded_laplace/bad_callback1.stan @@ -33,6 +33,6 @@ parameters { real eta; } model { - target += laplace_marginal(ll_function, (eta, log_ye, y), + target += laplace_marginal(ll_function, (eta, log_ye, y), 1, K_function, (x, n_obs, alpha, rho)); } diff --git a/test/integration/bad/embedded_laplace/bad_callback2.stan b/test/integration/bad/embedded_laplace/bad_callback2.stan index daa3225ac..5e5c7833d 100644 --- a/test/integration/bad/embedded_laplace/bad_callback2.stan +++ b/test/integration/bad/embedded_laplace/bad_callback2.stan @@ -35,6 +35,6 @@ parameters { real eta; } model { - target += laplace_marginal(ll_function_jacobian, (eta, log_ye, y), + target += laplace_marginal(ll_function_jacobian, (eta, log_ye, y), 1, K_function, (x, n_obs, alpha, rho)); } diff --git a/test/integration/bad/embedded_laplace/bad_callback3.stan b/test/integration/bad/embedded_laplace/bad_callback3.stan index 93da31b88..2bcfb4574 100644 --- a/test/integration/bad/embedded_laplace/bad_callback3.stan +++ b/test/integration/bad/embedded_laplace/bad_callback3.stan @@ -25,6 +25,6 @@ parameters { } model { real ll_function; - target += laplace_marginal(ll_function, (eta, log_ye, y), + target += laplace_marginal(ll_function, (eta, log_ye, y), 1, K_function, (x, n_obs, alpha, rho)); } diff --git a/test/integration/bad/embedded_laplace/bad_callback4.stan b/test/integration/bad/embedded_laplace/bad_callback4.stan index f5b830c0f..ca11b28ba 100644 --- a/test/integration/bad/embedded_laplace/bad_callback4.stan +++ b/test/integration/bad/embedded_laplace/bad_callback4.stan @@ -34,6 +34,6 @@ parameters { } model { - target += laplace_marginal(ll_function, (eta, log_ye, y), + target += laplace_marginal(ll_function, (eta, log_ye, y), 1, K_function, (x, n_obs, alpha, rho)); } diff --git a/test/integration/bad/embedded_laplace/bad_callback5.stan b/test/integration/bad/embedded_laplace/bad_callback5.stan index 4e7d9c613..b9cff1ee7 100644 --- a/test/integration/bad/embedded_laplace/bad_callback5.stan +++ b/test/integration/bad/embedded_laplace/bad_callback5.stan @@ -34,6 +34,6 @@ parameters { real eta; } model { - target += laplace_marginal(ll_function, (eta, log_ye, y), + target += laplace_marginal(ll_function, (eta, log_ye, y), 1, K_function, (x, n_obs, alpha, rho)); } diff --git a/test/integration/bad/embedded_laplace/bad_forward1.stan b/test/integration/bad/embedded_laplace/bad_forward1.stan index edbe8de69..5d5a6e74f 100644 --- a/test/integration/bad/embedded_laplace/bad_forward1.stan +++ b/test/integration/bad/embedded_laplace/bad_forward1.stan @@ -35,5 +35,5 @@ parameters { model { target += laplace_marginal(ll_function, {2.0}, - K_function, (x, n_obs, alpha, rho)); + 1, K_function, (x, n_obs, alpha, rho)); } diff --git a/test/integration/bad/embedded_laplace/bad_forward2.stan b/test/integration/bad/embedded_laplace/bad_forward2.stan index 6bb52ed9a..9958e9034 100644 --- a/test/integration/bad/embedded_laplace/bad_forward2.stan +++ b/test/integration/bad/embedded_laplace/bad_forward2.stan @@ -35,5 +35,5 @@ parameters { model { target += laplace_marginal(ll_function, (eta, y, log_ye), - K_function, (x, n_obs, alpha, rho)); + 1, K_function, (x, n_obs, alpha, rho)); } diff --git a/test/integration/bad/embedded_laplace/bad_forward3.stan b/test/integration/bad/embedded_laplace/bad_forward3.stan index a9ba308d2..9888b43de 100644 --- a/test/integration/bad/embedded_laplace/bad_forward3.stan +++ b/test/integration/bad/embedded_laplace/bad_forward3.stan @@ -34,5 +34,5 @@ parameters { } model { target += laplace_marginal(ll_function, (eta, y), - K_function, (x, n_obs, alpha, rho)); + 1, K_function, (x, n_obs, alpha, rho)); } diff --git a/test/integration/bad/embedded_laplace/bad_forward4.stan b/test/integration/bad/embedded_laplace/bad_forward4.stan index a3caeb03e..c125ef3de 100644 --- a/test/integration/bad/embedded_laplace/bad_forward4.stan +++ b/test/integration/bad/embedded_laplace/bad_forward4.stan @@ -34,5 +34,5 @@ parameters { } model { target += laplace_marginal(ll_function, (eta, log_ye, y), - K_function, (x, alpha, rho, rho, rho)); + 1, K_function, (x, alpha, rho, rho, rho)); } diff --git a/test/integration/bad/embedded_laplace/bad_forward5.stan b/test/integration/bad/embedded_laplace/bad_forward5.stan index cba21dee8..ab59523f8 100644 --- a/test/integration/bad/embedded_laplace/bad_forward5.stan +++ b/test/integration/bad/embedded_laplace/bad_forward5.stan @@ -35,5 +35,5 @@ parameters { generated quantities { vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), - K_function, (x, n_obs, alpha, {rho})); + 1, K_function, (x, n_obs, alpha, {rho})); } diff --git a/test/integration/bad/embedded_laplace/bad_forward6.stan b/test/integration/bad/embedded_laplace/bad_forward6.stan index 8be303500..aedfdd7d3 100644 --- a/test/integration/bad/embedded_laplace/bad_forward6.stan +++ b/test/integration/bad/embedded_laplace/bad_forward6.stan @@ -47,5 +47,5 @@ parameters { generated quantities { vector[n_obs] theta = laplace_latent_rng(ll_function, (1,1, log_ye, y), - K_function, (x, n_obs, alpha, rho)); + 1, K_function, (x, n_obs, alpha, rho)); } diff --git a/test/integration/bad/embedded_laplace/bad_forward9.stan b/test/integration/bad/embedded_laplace/bad_forward9.stan index bf57559c4..2c0d502ea 100644 --- a/test/integration/bad/embedded_laplace/bad_forward9.stan +++ b/test/integration/bad/embedded_laplace/bad_forward9.stan @@ -34,5 +34,5 @@ parameters { } model { target += laplace_marginal(ll_function, (eta, log_ye, y), - K_function, (x, n_obs, alpha, rho)); + 1, K_function, (x, n_obs, alpha, rho)); } diff --git a/test/integration/bad/embedded_laplace/bad_tol8.stan b/test/integration/bad/embedded_laplace/bad_hessian_block_size1.stan similarity index 96% rename from test/integration/bad/embedded_laplace/bad_tol8.stan rename to test/integration/bad/embedded_laplace/bad_hessian_block_size1.stan index 887fab45c..f6b213dc5 100644 --- a/test/integration/bad/embedded_laplace/bad_tol8.stan +++ b/test/integration/bad/embedded_laplace/bad_hessian_block_size1.stan @@ -35,6 +35,6 @@ parameters { } generated quantities { - vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), - K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3i,4,5, 0)); + vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), 3i, + K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,4,5, 0)); } diff --git a/test/integration/bad/embedded_laplace/bad_hessian_block_size2.stan b/test/integration/bad/embedded_laplace/bad_hessian_block_size2.stan new file mode 100644 index 000000000..780775bf9 --- /dev/null +++ b/test/integration/bad/embedded_laplace/bad_hessian_block_size2.stan @@ -0,0 +1,40 @@ +functions { + // specify negative binomial likelihood with mean offset + real ll_function(vector theta, // latent Gaussian + real eta, + vector log_ye, // mean offset + array[] int y) { + // observed count + return neg_binomial_2_lpmf(y | exp(log_ye + theta), eta); + } + + // specify covariance function + matrix K_function(array[] vector x, int n_obs, real alpha, real rho) { + matrix[n_obs, n_obs] K = gp_exp_quad_cov(x, alpha, rho); + for (i in 1 : n_obs) + K[i, i] += 1e-8; + return K; + } +} +data { + int n_obs; + int n_coordinates; + array[n_obs] int y; + vector[n_obs] ye; + array[n_obs] vector[n_coordinates] x; +} + +transformed data { + vector[n_obs] log_ye = log(ye); + vector[n_obs] theta_0 = rep_vector(0.0, n_obs); // initial guess +} +parameters { + real alpha; + real rho; + real eta; +} + +model { + target += laplace_marginal(ll_function, (eta, log_ye, y), eta, + K_function, (x, n_obs, alpha, rho)); +} diff --git a/test/integration/bad/embedded_laplace/bad_theta0.stan b/test/integration/bad/embedded_laplace/bad_theta0.stan index 6548e0ed9..3ff963db9 100644 --- a/test/integration/bad/embedded_laplace/bad_theta0.stan +++ b/test/integration/bad/embedded_laplace/bad_theta0.stan @@ -39,7 +39,7 @@ parameters { } model { target += laplace_marginal_tol(ll_function, (eta, log_ye, y), - K_function, (x, n_obs, alpha, rho), - (theta_0, tolerance, max_num_steps, hessian_block_size, + hessian_block_size, K_function, (x, n_obs, alpha, rho), + (theta_0, tolerance, max_num_steps, solver, max_steps_line_search, allow_fallthrough)); } diff --git a/test/integration/bad/embedded_laplace/bad_tol0.stan b/test/integration/bad/embedded_laplace/bad_tol0.stan index d5946b7f5..7c3f426f7 100644 --- a/test/integration/bad/embedded_laplace/bad_tol0.stan +++ b/test/integration/bad/embedded_laplace/bad_tol0.stan @@ -37,5 +37,5 @@ parameters { generated quantities { vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), - K_function, (x, n_obs, alpha, rho), theta_0); + 1, K_function, (x, n_obs, alpha, rho), theta_0); } diff --git a/test/integration/bad/embedded_laplace/bad_tol1.stan b/test/integration/bad/embedded_laplace/bad_tol1.stan index e72a024d6..fbf9b883f 100644 --- a/test/integration/bad/embedded_laplace/bad_tol1.stan +++ b/test/integration/bad/embedded_laplace/bad_tol1.stan @@ -36,6 +36,6 @@ parameters { generated quantities { - vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), + vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), 1, K_function, (x, n_obs, alpha, rho), theta_0, 1); } diff --git a/test/integration/bad/embedded_laplace/bad_tol10.stan b/test/integration/bad/embedded_laplace/bad_tol10.stan index 6e883abb0..1c440d2de 100644 --- a/test/integration/bad/embedded_laplace/bad_tol10.stan +++ b/test/integration/bad/embedded_laplace/bad_tol10.stan @@ -35,6 +35,6 @@ parameters { } generated quantities { - vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), - K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3,4,5,0.1)); + vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), 1, + K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3,4,0.1)); } diff --git a/test/integration/bad/embedded_laplace/bad_tol11.stan b/test/integration/bad/embedded_laplace/bad_tol11.stan index e21d807b3..db4c8f46e 100644 --- a/test/integration/bad/embedded_laplace/bad_tol11.stan +++ b/test/integration/bad/embedded_laplace/bad_tol11.stan @@ -36,5 +36,5 @@ parameters { generated quantities { vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), - K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3,4,5,0),1); + 1, K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3,4,0),1); } diff --git a/test/integration/bad/embedded_laplace/bad_tol2.stan b/test/integration/bad/embedded_laplace/bad_tol2.stan index 84c41d524..f2c54f19b 100644 --- a/test/integration/bad/embedded_laplace/bad_tol2.stan +++ b/test/integration/bad/embedded_laplace/bad_tol2.stan @@ -35,6 +35,6 @@ parameters { } generated quantities { - vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), + vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), 1, K_function, (x, n_obs, alpha, rho), theta_0, 1,2,3,4,5); } diff --git a/test/integration/bad/embedded_laplace/bad_tol3.stan b/test/integration/bad/embedded_laplace/bad_tol3.stan index 6e2cf7a45..e13c71e1c 100644 --- a/test/integration/bad/embedded_laplace/bad_tol3.stan +++ b/test/integration/bad/embedded_laplace/bad_tol3.stan @@ -35,6 +35,6 @@ parameters { } generated quantities { - vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), + vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y),1, K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3,4)); } diff --git a/test/integration/bad/embedded_laplace/bad_tol4.stan b/test/integration/bad/embedded_laplace/bad_tol4.stan index dc973797d..bdf7b7455 100644 --- a/test/integration/bad/embedded_laplace/bad_tol4.stan +++ b/test/integration/bad/embedded_laplace/bad_tol4.stan @@ -43,7 +43,7 @@ parameters { } model { target += laplace_marginal_tol(ll_function, (eta, log_ye, y), - K_function, (x, n_obs, alpha, rho), (theta_0, - eta, max_num_steps, hessian_block_size, + hessian_block_size, K_function, (x, n_obs, alpha, rho), (theta_0, + eta, max_num_steps, solver, max_steps_line_search, allow_fallthrough)); } diff --git a/test/integration/bad/embedded_laplace/bad_tol5.stan b/test/integration/bad/embedded_laplace/bad_tol5.stan index 0cbbfc264..c93ab763a 100644 --- a/test/integration/bad/embedded_laplace/bad_tol5.stan +++ b/test/integration/bad/embedded_laplace/bad_tol5.stan @@ -35,6 +35,6 @@ parameters { } generated quantities { - vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), - K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3,4,5.5,0)); + vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y),1, + K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3,4.5,0)); } diff --git a/test/integration/bad/embedded_laplace/bad_tol6.stan b/test/integration/bad/embedded_laplace/bad_tol6.stan index 87ec5a42d..99289cd39 100644 --- a/test/integration/bad/embedded_laplace/bad_tol6.stan +++ b/test/integration/bad/embedded_laplace/bad_tol6.stan @@ -35,6 +35,6 @@ parameters { } generated quantities { - vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), - K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3,4,5,6,7)); + vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), 1, + K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3,4,5,6)); } diff --git a/test/integration/bad/embedded_laplace/bad_tol7.stan b/test/integration/bad/embedded_laplace/bad_tol7.stan index a799cadaf..3347e219b 100644 --- a/test/integration/bad/embedded_laplace/bad_tol7.stan +++ b/test/integration/bad/embedded_laplace/bad_tol7.stan @@ -35,6 +35,6 @@ parameters { } generated quantities { - vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), - K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3,4.0,5,0)); + vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), 1, + K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3.4,5,0)); } diff --git a/test/integration/bad/embedded_laplace/bad_tol9.stan b/test/integration/bad/embedded_laplace/bad_tol9.stan index 3adbadb1d..52409183f 100644 --- a/test/integration/bad/embedded_laplace/bad_tol9.stan +++ b/test/integration/bad/embedded_laplace/bad_tol9.stan @@ -35,6 +35,6 @@ parameters { } generated quantities { - vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), - K_function, (x, n_obs, alpha, rho), (theta_0, 1,{2},3,4,5,0)); + vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y),1, + K_function, (x, n_obs, alpha, rho), (theta_0, 1,{2},4,5,0)); } diff --git a/test/integration/bad/embedded_laplace/missing_args10.stan b/test/integration/bad/embedded_laplace/missing_args10.stan new file mode 100644 index 000000000..317d95888 --- /dev/null +++ b/test/integration/bad/embedded_laplace/missing_args10.stan @@ -0,0 +1,44 @@ +functions { + // specify negative binomial likelihood with mean offset + real ll_function(vector theta, // latent Gaussian + real eta, + vector log_ye, // mean offset + array[] int y) { + // observed count + return neg_binomial_2_lpmf(y | exp(log_ye + theta), eta); + } +} +data { + int n_obs; + int n_coordinates; + array[n_obs] int y; + vector[n_obs] ye; + array[n_obs] vector[n_coordinates] x; +} + +transformed data { + + vector[n_obs] log_ye = log(ye); + + vector[n_obs] theta_0 = rep_vector(0.0, n_obs); // initial guess + + // control parameters for Laplace approximation + real tolerance = 1e-6; + int max_num_steps = 100; + int hessian_block_size = 1; + int solver = 1; + int max_steps_line_search = 0; +} +parameters { + real alpha; + real rho; + real eta; +} + +generated quantities { + +vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y)); + + + +} diff --git a/test/integration/bad/embedded_laplace/missing_args11.stan b/test/integration/bad/embedded_laplace/missing_args11.stan new file mode 100644 index 000000000..5b33ca651 --- /dev/null +++ b/test/integration/bad/embedded_laplace/missing_args11.stan @@ -0,0 +1,21 @@ +data { + int n_obs; + array[n_obs] int y; +} + +transformed data { + vector[n_obs] theta_0 = rep_vector(0.0, n_obs); // initial guess + +} +parameters { + real alpha; + real rho; + real eta; +} + +generated quantities { + + vector[n_obs] theta = laplace_latent_neg_binomial_2_log_rng(y, {1}, [1.0]', [0.0]' + ); + +} diff --git a/test/integration/bad/embedded_laplace/missing_args12.stan b/test/integration/bad/embedded_laplace/missing_args12.stan new file mode 100644 index 000000000..385d2eda0 --- /dev/null +++ b/test/integration/bad/embedded_laplace/missing_args12.stan @@ -0,0 +1,3 @@ +model { + target += laplace_marginal_tol_poisson_log_lpmf({1}, {1}, [0]'); +} diff --git a/test/integration/bad/embedded_laplace/missing_args6.stan b/test/integration/bad/embedded_laplace/missing_args6.stan index 317d95888..34d704fe8 100644 --- a/test/integration/bad/embedded_laplace/missing_args6.stan +++ b/test/integration/bad/embedded_laplace/missing_args6.stan @@ -37,7 +37,7 @@ parameters { generated quantities { -vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y)); +vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), 1); diff --git a/test/integration/bad/embedded_laplace/missing_args7.stan b/test/integration/bad/embedded_laplace/missing_args7.stan index 5b33ca651..8cf7684e4 100644 --- a/test/integration/bad/embedded_laplace/missing_args7.stan +++ b/test/integration/bad/embedded_laplace/missing_args7.stan @@ -15,7 +15,7 @@ parameters { generated quantities { - vector[n_obs] theta = laplace_latent_neg_binomial_2_log_rng(y, {1}, [1.0]', [0.0]' + vector[n_obs] theta = laplace_latent_neg_binomial_2_log_rng(y, {1}, [1.0]', [0.0]', 1 ); } diff --git a/test/integration/bad/embedded_laplace/missing_args8.stan b/test/integration/bad/embedded_laplace/missing_args8.stan index 385d2eda0..062e149db 100644 --- a/test/integration/bad/embedded_laplace/missing_args8.stan +++ b/test/integration/bad/embedded_laplace/missing_args8.stan @@ -1,3 +1,3 @@ model { - target += laplace_marginal_tol_poisson_log_lpmf({1}, {1}, [0]'); + target += laplace_marginal_tol_poisson_log_lpmf({1}, {1}, [0]', 1); } diff --git a/test/integration/bad/embedded_laplace/missing_args9.stan b/test/integration/bad/embedded_laplace/missing_args9.stan index a60bcdffd..047d28e09 100644 --- a/test/integration/bad/embedded_laplace/missing_args9.stan +++ b/test/integration/bad/embedded_laplace/missing_args9.stan @@ -38,6 +38,6 @@ parameters { generated quantities { vector[n_obs] theta = laplace_latent_tol_neg_binomial_2_log_rng(y, {1}, [1.0]', [0]', - K_function, (x, n_obs, alpha, rho)); + 1, K_function, (x, n_obs, alpha, rho)); } diff --git a/test/integration/bad/embedded_laplace/stanc.expected b/test/integration/bad/embedded_laplace/stanc.expected index 5e1a5ca33..3217d12c6 100644 --- a/test/integration/bad/embedded_laplace/stanc.expected +++ b/test/integration/bad/embedded_laplace/stanc.expected @@ -3,7 +3,7 @@ Semantic error in 'autodiff_incompatibility1.stan', line 56, column 29 to column ------------------------------------------------- 54: model { 55: - 56: target += laplace_marginal(ll_function, (eta, log_ye, y), + 56: target += laplace_marginal(ll_function, (eta, log_ye, y), 1, ^ 57: K_function, (x, n_obs, alpha, rho)); 58: } @@ -20,7 +20,7 @@ Semantic error in 'autodiff_incompatibility2.stan', line 59, column 43 to column 58: generated quantities { 59: vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), ^ - 60: K_function, (x, n_obs, alpha, rho)); + 60: 1, K_function, (x, n_obs, alpha, rho)); 61: } ------------------------------------------------- @@ -35,7 +35,7 @@ Semantic error in 'autodiff_incompatibility3.stan', line 51, column 43 to column 50: generated quantities { 51: vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), ^ - 52: K_function, (x, n_obs, alpha, rho)); + 52: 1, K_function, (x, n_obs, alpha, rho)); 53: } ------------------------------------------------- @@ -44,17 +44,17 @@ does not currently support higher-order derivatives, and cannot be used in an embedded Laplace approximation. [exit 1] $ ../../../../../install/default/bin/stanc autodiff_incompatibility4.stan -Semantic error in 'autodiff_incompatibility4.stan', line 50, column 43 to column 54: +Semantic error in 'autodiff_incompatibility4.stan', line 51, column 43 to column 54: ------------------------------------------------- - 48: - 49: generated quantities { - 50: vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), + 49: + 50: generated quantities { + 51: vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), ^ - 51: K_function, (x, n_obs, alpha, rho)); - 52: } + 52: 1, K_function, (x, n_obs, alpha, rho)); + 53: } ------------------------------------------------- -The function "reduce_sum", called by this likelihood function, +The function "integrate_1d", called by this likelihood function, does not currently support higher-order derivatives, and cannot be used in an embedded Laplace approximation. [exit 1] @@ -65,7 +65,7 @@ Semantic error in 'autodiff_incompatibility5.stan', line 54, column 43 to column 53: generated quantities { 54: vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), ^ - 55: K_function, (x, n_obs, alpha, rho)); + 55: 1, K_function, (x, n_obs, alpha, rho)); 56: } ------------------------------------------------- @@ -78,7 +78,7 @@ Semantic error in 'bad_callback1.stan', line 36, column 29 to column 40: ------------------------------------------------- 34: } 35: model { - 36: target += laplace_marginal(ll_function, (eta, log_ye, y), + 36: target += laplace_marginal(ll_function, (eta, log_ye, y), 1, ^ 37: K_function, (x, n_obs, alpha, rho)); 38: } @@ -92,7 +92,7 @@ Semantic error in 'bad_callback2.stan', line 38, column 29 to column 49: ------------------------------------------------- 36: } 37: model { - 38: target += laplace_marginal(ll_function_jacobian, (eta, log_ye, y), + 38: target += laplace_marginal(ll_function_jacobian, (eta, log_ye, y), 1, ^ 39: K_function, (x, n_obs, alpha, rho)); 40: } @@ -107,7 +107,7 @@ Semantic error in 'bad_callback3.stan', line 28, column 29 to column 40: ------------------------------------------------- 26: model { 27: real ll_function; - 28: target += laplace_marginal(ll_function, (eta, log_ye, y), + 28: target += laplace_marginal(ll_function, (eta, log_ye, y), 1, ^ 29: K_function, (x, n_obs, alpha, rho)); 30: } @@ -120,7 +120,7 @@ Semantic error in 'bad_callback4.stan', line 37, column 29 to column 40: ------------------------------------------------- 35: model { 36: - 37: target += laplace_marginal(ll_function, (eta, log_ye, y), + 37: target += laplace_marginal(ll_function, (eta, log_ye, y), 1, ^ 38: K_function, (x, n_obs, alpha, rho)); 39: } @@ -136,7 +136,7 @@ Semantic error in 'bad_callback5.stan', line 37, column 29 to column 40: ------------------------------------------------- 35: } 36: model { - 37: target += laplace_marginal(ll_function, (eta, log_ye, y), + 37: target += laplace_marginal(ll_function, (eta, log_ye, y), 1, ^ 38: K_function, (x, n_obs, alpha, rho)); 39: } @@ -152,7 +152,7 @@ Semantic error in 'bad_forward1.stan', line 37, column 42 to column 47: 36: 37: target += laplace_marginal(ll_function, {2.0}, ^ - 38: K_function, (x, n_obs, alpha, rho)); + 38: 1, K_function, (x, n_obs, alpha, rho)); 39: } ------------------------------------------------- @@ -166,7 +166,7 @@ Semantic error in 'bad_forward2.stan', line 37, column 42 to column 58: 36: 37: target += laplace_marginal(ll_function, (eta, y, log_ye), ^ - 38: K_function, (x, n_obs, alpha, rho)); + 38: 1, K_function, (x, n_obs, alpha, rho)); 39: } ------------------------------------------------- @@ -182,7 +182,7 @@ Semantic error in 'bad_forward3.stan', line 36, column 42 to column 50: 35: model { 36: target += laplace_marginal(ll_function, (eta, y), ^ - 37: K_function, (x, n_obs, alpha, rho)); + 37: 1, K_function, (x, n_obs, alpha, rho)); 38: } ------------------------------------------------- @@ -192,12 +192,12 @@ Expected 3 arguments (excluding the latent gaussian vector argument) but got 2 arguments. [exit 1] $ ../../../../../install/default/bin/stanc bad_forward4.stan -Semantic error in 'bad_forward4.stan', line 37, column 46 to column 71: +Semantic error in 'bad_forward4.stan', line 37, column 49 to column 74: ------------------------------------------------- 35: model { 36: target += laplace_marginal(ll_function, (eta, log_ye, y), - 37: K_function, (x, alpha, rho, rho, rho)); - ^ + 37: 1, K_function, (x, alpha, rho, rho, rho)); + ^ 38: } ------------------------------------------------- @@ -206,12 +206,12 @@ Cannot call "K_function" with arguments forwarded from call to Expected 4 arguments but got 5 arguments. [exit 1] $ ../../../../../install/default/bin/stanc bad_forward5.stan -Semantic error in 'bad_forward5.stan', line 38, column 32 to column 56: +Semantic error in 'bad_forward5.stan', line 38, column 35 to column 59: ------------------------------------------------- 36: generated quantities { 37: vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), - 38: K_function, (x, n_obs, alpha, {rho})); - ^ + 38: 1, K_function, (x, n_obs, alpha, {rho})); + ^ 39: } ------------------------------------------------- @@ -226,7 +226,7 @@ Semantic error in 'bad_forward6.stan', line 49, column 43 to column 54: 48: generated quantities { 49: vector[n_obs] theta = laplace_latent_rng(ll_function, (1,1, log_ye, y), ^ - 50: K_function, (x, n_obs, alpha, rho)); + 50: 1, K_function, (x, n_obs, alpha, rho)); 51: } ------------------------------------------------- @@ -269,12 +269,12 @@ Expected the arguments to start with: (array[] int, array[] int, vector, vector) [exit 1] $ ../../../../../install/default/bin/stanc bad_forward9.stan -Semantic error in 'bad_forward9.stan', line 37, column 32 to column 54: +Semantic error in 'bad_forward9.stan', line 37, column 34 to column 56: ------------------------------------------------- 35: model { 36: target += laplace_marginal(ll_function, (eta, log_ye, y), - 37: K_function, (x, n_obs, alpha, rho)); - ^ + 37: 1, K_function, (x, n_obs, alpha, rho)); + ^ 38: } ------------------------------------------------- @@ -283,6 +283,36 @@ Cannot call "K_function" with arguments forwarded from call to The fourth argument is marked data-only. (Local variables are assumed to depend on parameters; same goes for function inputs unless they are marked with the keyword "data".) +[exit 1] + $ ../../../../../install/default/bin/stanc bad_hessian_block_size1.stan +Semantic error in 'bad_hessian_block_size1.stan', line 38, column 78 to column 80: + ------------------------------------------------- + 36: + 37: generated quantities { + 38: vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), 3i, + ^ + 39: K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,4,5, 0)); + 40: } + ------------------------------------------------- + +The hessian block size argument to "laplace_latent_tol_rng" must be a data-only int. +Instead found type complex. +[exit 1] + $ ../../../../../install/default/bin/stanc bad_hessian_block_size2.stan +Semantic error in 'bad_hessian_block_size2.stan', line 38, column 60 to column 63: + ------------------------------------------------- + 36: + 37: model { + 38: target += laplace_marginal(ll_function, (eta, log_ye, y), eta, + ^ + 39: K_function, (x, n_obs, alpha, rho)); + 40: } + ------------------------------------------------- + +The hessian block size argument to "laplace_marginal" must be a data-only int. +Instead found type real. (Local variables are assumed to depend on +parameters; same goes for function inputs unless they are marked with the +keyword "data".) [exit 1] $ ../../../../../install/default/bin/stanc bad_overload.stan Semantic error in 'bad_overload.stan', line 2, column 7 to column 51: @@ -300,8 +330,8 @@ Identifier "laplace_marginal_tol_neg_binomial_2_log_lpmf" clashes with a non-ove Semantic error in 'bad_theta0.stan', line 43, column 9 to column 16: ------------------------------------------------- 41: target += laplace_marginal_tol(ll_function, (eta, log_ye, y), - 42: K_function, (x, n_obs, alpha, rho), - 43: (theta_0, tolerance, max_num_steps, hessian_block_size, + 42: hessian_block_size, K_function, (x, n_obs, alpha, rho), + 43: (theta_0, tolerance, max_num_steps, ^ 44: solver, max_steps_line_search, allow_fallthrough)); 45: } @@ -311,12 +341,12 @@ The first element of the control parameter tuple (initial guess) to "laplace_mar must be vector. Instead found type array[] real. [exit 1] $ ../../../../../install/default/bin/stanc bad_tol0.stan -Semantic error in 'bad_tol0.stan', line 40, column 56 to column 63: +Semantic error in 'bad_tol0.stan', line 40, column 59 to column 66: ------------------------------------------------- 38: generated quantities { 39: vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), - 40: K_function, (x, n_obs, alpha, rho), theta_0); - ^ + 40: 1, K_function, (x, n_obs, alpha, rho), theta_0); + ^ 41: } ------------------------------------------------- @@ -327,7 +357,7 @@ Did you mean to call the _tol version? Semantic error in 'bad_tol1.stan', line 40, column 56 to column 63: ------------------------------------------------- 38: generated quantities { - 39: vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), + 39: vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), 1, 40: K_function, (x, n_obs, alpha, rho), theta_0, 1); ^ 41: } @@ -337,25 +367,25 @@ Received 2 extra arguments at the end of the call to "laplace_latent_rng". Did you mean to call the _tol version with a tuple of these? [exit 1] $ ../../../../../install/default/bin/stanc bad_tol10.stan -Semantic error in 'bad_tol10.stan', line 39, column 76 to column 79: +Semantic error in 'bad_tol10.stan', line 39, column 74 to column 77: ------------------------------------------------- 37: generated quantities { - 38: vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), - 39: K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3,4,5,0.1)); - ^ + 38: vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), 1, + 39: K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3,4,0.1)); + ^ 40: } ------------------------------------------------- -The seventh element of the control parameter tuple (allow_fallthrough) to +The sixth element of the control parameter tuple (allow_fallthrough) to "laplace_latent_tol_rng" must be int. Instead found type real. [exit 1] $ ../../../../../install/default/bin/stanc bad_tol11.stan -Semantic error in 'bad_tol11.stan', line 39, column 79 to column 80: +Semantic error in 'bad_tol11.stan', line 39, column 80 to column 81: ------------------------------------------------- 37: generated quantities { 38: vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), - 39: K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3,4,5,0),1); - ^ + 39: 1, K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3,4,0),1); + ^ 40: } ------------------------------------------------- @@ -366,7 +396,7 @@ Only a single tuple of control parameters is expected. Semantic error in 'bad_tol2.stan', line 39, column 56 to column 63: ------------------------------------------------- 37: generated quantities { - 38: vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), + 38: vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), 1, 39: K_function, (x, n_obs, alpha, rho), theta_0, 1,2,3,4,5); ^ 40: } @@ -379,21 +409,21 @@ Did you mean to call the _tol version with a tuple of these? Semantic error in 'bad_tol3.stan', line 39, column 57 to column 64: ------------------------------------------------- 37: generated quantities { - 38: vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), + 38: vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y),1, 39: K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3,4)); ^ 40: } ------------------------------------------------- Received a tuple of 5 control arguments at the end of the call to "laplace_latent_tol_rng". -Expected tuple of 7 arguments for the control parameters instead. +Expected tuple of 6 arguments for the control parameters instead. [exit 1] $ ../../../../../install/default/bin/stanc bad_tol4.stan Semantic error in 'bad_tol4.stan', line 47, column 32 to column 35: ------------------------------------------------- 45: target += laplace_marginal_tol(ll_function, (eta, log_ye, y), - 46: K_function, (x, n_obs, alpha, rho), (theta_0, - 47: eta, max_num_steps, hessian_block_size, + 46: hessian_block_size, K_function, (x, n_obs, alpha, rho), (theta_0, + 47: eta, max_num_steps, ^ 48: solver, max_steps_line_search, allow_fallthrough)); 49: } @@ -405,63 +435,50 @@ but the second element of the control parameter tuple (tolerance) here is not. inputs unless they are marked with the keyword "data".) [exit 1] $ ../../../../../install/default/bin/stanc bad_tol5.stan -Semantic error in 'bad_tol5.stan', line 39, column 74 to column 77: +Semantic error in 'bad_tol5.stan', line 39, column 72 to column 75: ------------------------------------------------- 37: generated quantities { - 38: vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), - 39: K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3,4,5.5,0)); - ^ + 38: vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y),1, + 39: K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3,4.5,0)); + ^ 40: } ------------------------------------------------- -The sixth element of the control parameter tuple (max_steps_line_search) to +The fifth element of the control parameter tuple (max_steps_line_search) to "laplace_latent_tol_rng" must be int. Instead found type real. [exit 1] $ ../../../../../install/default/bin/stanc bad_tol6.stan Semantic error in 'bad_tol6.stan', line 39, column 57 to column 64: ------------------------------------------------- 37: generated quantities { - 38: vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), - 39: K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3,4,5,6,7)); + 38: vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), 1, + 39: K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3,4,5,6)); ^ 40: } ------------------------------------------------- -Received a tuple of 8 control arguments at the end of the call to "laplace_latent_tol_rng". -Expected tuple of 7 arguments for the control parameters instead. +Received a tuple of 7 control arguments at the end of the call to "laplace_latent_tol_rng". +Expected tuple of 6 arguments for the control parameters instead. [exit 1] $ ../../../../../install/default/bin/stanc bad_tol7.stan -Semantic error in 'bad_tol7.stan', line 39, column 73 to column 76: +Semantic error in 'bad_tol7.stan', line 39, column 71 to column 74: ------------------------------------------------- 37: generated quantities { - 38: vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), - 39: K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3,4.0,5,0)); - ^ + 38: vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), 1, + 39: K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3.4,5,0)); + ^ 40: } ------------------------------------------------- -The fifth element of the control parameter tuple (solver) to "laplace_latent_tol_rng" +The fourth element of the control parameter tuple (solver) to "laplace_latent_tol_rng" must be int. Instead found type real. -[exit 1] - $ ../../../../../install/default/bin/stanc bad_tol8.stan -Semantic error in 'bad_tol8.stan', line 39, column 70 to column 72: - ------------------------------------------------- - 37: generated quantities { - 38: vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), - 39: K_function, (x, n_obs, alpha, rho), (theta_0, 1,2,3i,4,5, 0)); - ^ - 40: } - ------------------------------------------------- - -The fourth element of the control parameter tuple (hessian_block_size) to -"laplace_latent_tol_rng" must be int. Instead found type complex. [exit 1] $ ../../../../../install/default/bin/stanc bad_tol9.stan Semantic error in 'bad_tol9.stan', line 39, column 68 to column 71: ------------------------------------------------- 37: generated quantities { - 38: vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y), - 39: K_function, (x, n_obs, alpha, rho), (theta_0, 1,{2},3,4,5,0)); + 38: vector[n_obs] theta = laplace_latent_tol_rng(ll_function, (eta, log_ye, y),1, + 39: K_function, (x, n_obs, alpha, rho), (theta_0, 1,{2},4,5,0)); ^ 40: } ------------------------------------------------- @@ -480,12 +497,60 @@ Semantic error in 'missing_args1.stan', line 2, column 12 to column 30: Ill-typed arguments supplied to function "laplace_marginal". The valid signature of this function is -laplace_marginal((vector, T_l...) => real, tuple(T_l...), vector, +laplace_marginal((vector, T_l...) => real, tuple(T_l...), data int, (T_k...) => matrix, tuple(T_k...)) -However, we received the types: -() We were unable to start more in-depth checking. Please ensure you are passing enough arguments and that the first argument is a function. +[exit 1] + $ ../../../../../install/default/bin/stanc missing_args10.stan +Semantic error in 'missing_args10.stan', line 40, column 70: + ------------------------------------------------- + 38: generated quantities { + 39: + 40: vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y)); + ^ + 41: + 42: + ------------------------------------------------- + +Ill-typed arguments supplied to function "laplace_latent_rng". +The valid signature of this function is +laplace_latent_rng((vector, T_l...) => real, tuple(T_l...), data int, + (T_k...) => matrix, tuple(T_k...)) +Missing the hessian block size (data-only int) and remaining arguments. +[exit 1] + $ ../../../../../install/default/bin/stanc missing_args11.stan +Semantic error in 'missing_args11.stan', line 18, column 84: + ------------------------------------------------- + 16: generated quantities { + 17: + 18: vector[n_obs] theta = laplace_latent_neg_binomial_2_log_rng(y, {1}, [1.0]', [0.0]' + ^ + 19: ); + 20: + ------------------------------------------------- + +Ill-typed arguments supplied to function "laplace_latent_neg_binomial_2_log_rng". +The valid signature of this function is +laplace_latent_neg_binomial_2_log_rng(array[] int, array[] int, vector, + vector, data int, (T_k...) => matrix, tuple(T_k...)) +Missing the hessian block size (data-only int) and remaining arguments. +[exit 1] + $ ../../../../../install/default/bin/stanc missing_args12.stan +Semantic error in 'missing_args12.stan', line 2, column 64: + ------------------------------------------------- + 1: model { + 2: target += laplace_marginal_tol_poisson_log_lpmf({1}, {1}, [0]'); + ^ + 3: } + ------------------------------------------------- + +Ill-typed arguments supplied to function "laplace_marginal_tol_poisson_log_lpmf". +The valid signature of this function is +laplace_marginal_tol_poisson_log_lpmf(array[] int, array[] int, vector, + data int, (T_k...) => matrix, tuple(T_k...), vector, data real, data int, + data int, data int, data int) +Missing the hessian block size (data-only int) and remaining arguments. [exit 1] $ ../../../../../install/default/bin/stanc missing_args2.stan Semantic error in 'missing_args2.stan', line 2, column 12 to column 34: @@ -498,11 +563,9 @@ Semantic error in 'missing_args2.stan', line 2, column 12 to column 34: Ill-typed arguments supplied to function "laplace_marginal_tol". The valid signature of this function is -laplace_marginal_tol((vector, T_l...) => real, tuple(T_l...), vector, +laplace_marginal_tol((vector, T_l...) => real, tuple(T_l...), data int, (T_k...) => matrix, tuple(T_k...), vector, data real, data int, data int, - data int, data int, data int) -However, we received the types: -() + data int, data int) We were unable to start more in-depth checking. Please ensure you are passing enough arguments and that the first argument is a function. [exit 1] @@ -522,25 +585,21 @@ Expected the arguments to start with: (array[] int, array[] int, vector, vector) [exit 1] $ ../../../../../install/default/bin/stanc missing_args4.stan -Semantic error in 'missing_args4.stan', line 29, column 12 to column 59: +Semantic error in 'missing_args4.stan', line 29, column 58: ------------------------------------------------- 27: } 28: model { 29: target += laplace_marginal(ll_function, (eta, log_ye, y)); - ^ + ^ 30: 31: } ------------------------------------------------- Ill-typed arguments supplied to function "laplace_marginal". The valid signature of this function is -laplace_marginal((vector, T_l...) => real, tuple(T_l...), vector, +laplace_marginal((vector, T_l...) => real, tuple(T_l...), data int, (T_k...) => matrix, tuple(T_k...)) -However, we received the types: -((vector, real, vector, array[] int) => real, - tuple(real, vector, array[] int)) -Typechecking failed after checking the first 2 arguments. Please ensure you -are passing enough arguments and that the 3rd is a function. +Missing the hessian block size (data-only int) and remaining arguments. [exit 1] $ ../../../../../install/default/bin/stanc missing_args5.stan Semantic error in 'missing_args5.stan', line 3, column 20 to column 40: @@ -554,19 +613,17 @@ Semantic error in 'missing_args5.stan', line 3, column 20 to column 40: Ill-typed arguments supplied to function "laplace_latent_rng". The valid signature of this function is -laplace_latent_rng((vector, T_l...) => real, tuple(T_l...), vector, +laplace_latent_rng((vector, T_l...) => real, tuple(T_l...), data int, (T_k...) => matrix, tuple(T_k...)) -However, we received the types: -() We were unable to start more in-depth checking. Please ensure you are passing enough arguments and that the first argument is a function. [exit 1] $ ../../../../../install/default/bin/stanc missing_args6.stan -Semantic error in 'missing_args6.stan', line 40, column 22 to column 71: +Semantic error in 'missing_args6.stan', line 40, column 22 to column 74: ------------------------------------------------- 38: generated quantities { 39: - 40: vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y)); + 40: vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), 1); ^ 41: 42: @@ -574,20 +631,20 @@ Semantic error in 'missing_args6.stan', line 40, column 22 to column 71: Ill-typed arguments supplied to function "laplace_latent_rng". The valid signature of this function is -laplace_latent_rng((vector, T_l...) => real, tuple(T_l...), vector, +laplace_latent_rng((vector, T_l...) => real, tuple(T_l...), data int, (T_k...) => matrix, tuple(T_k...)) However, we received the types: -(data (vector, real, vector, array[] int) => real, - tuple(real, vector, array[] int)) -Typechecking failed after checking the first 2 arguments. Please ensure you -are passing enough arguments and that the 3rd is a function. +((vector, real, vector, array[] int) => real, + tuple(real, vector, array[] int), data int) +Typechecking failed after checking the first 3 arguments. +Please ensure you are passing enough arguments and that the 4th is a function. [exit 1] $ ../../../../../install/default/bin/stanc missing_args7.stan Semantic error in 'missing_args7.stan', line 18, column 24 to line 19, column 23: ------------------------------------------------- 16: generated quantities { 17: - 18: vector[n_obs] theta = laplace_latent_neg_binomial_2_log_rng(y, {1}, [1.0]', [0.0]' + 18: vector[n_obs] theta = laplace_latent_neg_binomial_2_log_rng(y, {1}, [1.0]', [0.0]', 1 ^ 19: ); 20: @@ -596,17 +653,17 @@ Semantic error in 'missing_args7.stan', line 18, column 24 to line 19, column 23 Ill-typed arguments supplied to function "laplace_latent_neg_binomial_2_log_rng". The valid signature of this function is laplace_latent_neg_binomial_2_log_rng(array[] int, array[] int, vector, - vector, vector, (T_k...) => matrix, tuple(T_k...)) + vector, data int, (T_k...) => matrix, tuple(T_k...)) However, we received the types: -(data array[] int, data array[] int, data vector, data vector) -Typechecking failed after checking the first 4 arguments. Please ensure you -are passing enough arguments and that the 5th is a function. +(data array[] int, data array[] int, data vector, data vector, data int) +Typechecking failed after checking the first 5 arguments. +Please ensure you are passing enough arguments and that the 6th is a function. [exit 1] $ ../../../../../install/default/bin/stanc missing_args8.stan -Semantic error in 'missing_args8.stan', line 2, column 12 to column 65: +Semantic error in 'missing_args8.stan', line 2, column 12 to column 68: ------------------------------------------------- 1: model { - 2: target += laplace_marginal_tol_poisson_log_lpmf({1}, {1}, [0]'); + 2: target += laplace_marginal_tol_poisson_log_lpmf({1}, {1}, [0]', 1); ^ 3: } ------------------------------------------------- @@ -614,24 +671,24 @@ Semantic error in 'missing_args8.stan', line 2, column 12 to column 65: Ill-typed arguments supplied to function "laplace_marginal_tol_poisson_log_lpmf". The valid signature of this function is laplace_marginal_tol_poisson_log_lpmf(array[] int, array[] int, vector, - vector, (T_k...) => matrix, tuple(T_k...), vector, data real, data int, - data int, data int, data int, data int) + data int, (T_k...) => matrix, tuple(T_k...), vector, data real, data int, + data int, data int, data int) However, we received the types: -(data array[] int, data array[] int, data vector) -Typechecking failed after checking the first 3 arguments. Please ensure you -are passing enough arguments and that the 4th is a function. +(data array[] int, data array[] int, data vector, data int) +Typechecking failed after checking the first 4 arguments. +Please ensure you are passing enough arguments and that the 5th is a function. [exit 1] $ ../../../../../install/default/bin/stanc missing_args9.stan -Semantic error in 'missing_args9.stan', line 40, column 24 to line 41, column 59: +Semantic error in 'missing_args9.stan', line 40, column 24 to line 41, column 62: ------------------------------------------------- 38: generated quantities { 39: 40: vector[n_obs] theta = laplace_latent_tol_neg_binomial_2_log_rng(y, {1}, [1.0]', [0]', ^ - 41: K_function, (x, n_obs, alpha, rho)); + 41: 1, K_function, (x, n_obs, alpha, rho)); 42: ------------------------------------------------- Missing control parameter tuple at the end of the call to "laplace_latent_tol_neg_binomial_2_log_rng". -Expected a tuple of 7 arguments for the control parameters. +Expected a tuple of 6 arguments for the control parameters. [exit 1] diff --git a/test/integration/good/code-gen/cpp.expected b/test/integration/good/code-gen/cpp.expected index 98292f349..a46aff629 100644 --- a/test/integration/good/code-gen/cpp.expected +++ b/test/integration/good/code-gen/cpp.expected @@ -7481,43 +7481,46 @@ class laplace_bernoulli_logit_model final : public model_base_crtp(0), static_cast(1))); current_statement__ = 9; lp_accum__.add(stan::math::laplace_marginal_bernoulli_logit_lpmf< - propto__>(y, y, prior_mean, K_function_functor__(), + propto__>(y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), pstream__)); current_statement__ = 10; lp_accum__.add(stan::math::laplace_marginal_bernoulli_logit_lpmf< - false>(y, y, prior_mean, K_function_functor__(), + false>(y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), pstream__)); current_statement__ = 11; lp_accum__.add(stan::math::laplace_marginal_bernoulli_logit_lpmf< - propto__>(y, y, prior_mean, K_function_functor__(), + propto__>(y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), pstream__)); current_statement__ = 12; lp_accum__.add(stan::math::laplace_marginal_tol_bernoulli_logit_lpmf< - propto__>(y, y, prior_mean, K_function_functor__(), + propto__>(y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), std::forward_as_tuple(theta_0, tolerance, - max_num_steps, hessian_block_size, solver, - max_steps_line_search, allow_fallthrough), - pstream__)); + max_num_steps, solver, max_steps_line_search, + allow_fallthrough), pstream__)); current_statement__ = 13; lp_accum__.add(stan::math::laplace_marginal_tol_bernoulli_logit_lpmf< - false>(y, y, prior_mean, K_function_functor__(), + false>(y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), std::forward_as_tuple(theta_0, tolerance, - max_num_steps, hessian_block_size, solver, - max_steps_line_search, allow_fallthrough), - pstream__)); + max_num_steps, solver, max_steps_line_search, + allow_fallthrough), pstream__)); current_statement__ = 14; lp_accum__.add(stan::math::laplace_marginal_tol_bernoulli_logit_lpmf< - propto__>(y, y, prior_mean, K_function_functor__(), + propto__>(y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), std::forward_as_tuple(theta_0, tolerance, - max_num_steps, hessian_block_size, solver, - max_steps_line_search, allow_fallthrough), - pstream__)); + max_num_steps, solver, max_steps_line_search, + allow_fallthrough), pstream__)); } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); @@ -7573,43 +7576,46 @@ class laplace_bernoulli_logit_model final : public model_base_crtp(0), static_cast(1))); current_statement__ = 9; lp_accum__.add(stan::math::laplace_marginal_bernoulli_logit_lpmf< - propto__>(y, y, prior_mean, K_function_functor__(), + propto__>(y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), pstream__)); current_statement__ = 10; lp_accum__.add(stan::math::laplace_marginal_bernoulli_logit_lpmf< - false>(y, y, prior_mean, K_function_functor__(), + false>(y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), pstream__)); current_statement__ = 11; lp_accum__.add(stan::math::laplace_marginal_bernoulli_logit_lpmf< - propto__>(y, y, prior_mean, K_function_functor__(), + propto__>(y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), pstream__)); current_statement__ = 12; lp_accum__.add(stan::math::laplace_marginal_tol_bernoulli_logit_lpmf< - propto__>(y, y, prior_mean, K_function_functor__(), + propto__>(y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), std::forward_as_tuple(theta_0, tolerance, - max_num_steps, hessian_block_size, solver, - max_steps_line_search, allow_fallthrough), - pstream__)); + max_num_steps, solver, max_steps_line_search, + allow_fallthrough), pstream__)); current_statement__ = 13; lp_accum__.add(stan::math::laplace_marginal_tol_bernoulli_logit_lpmf< - false>(y, y, prior_mean, K_function_functor__(), + false>(y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), std::forward_as_tuple(theta_0, tolerance, - max_num_steps, hessian_block_size, solver, - max_steps_line_search, allow_fallthrough), - pstream__)); + max_num_steps, solver, max_steps_line_search, + allow_fallthrough), pstream__)); current_statement__ = 14; lp_accum__.add(stan::math::laplace_marginal_tol_bernoulli_logit_lpmf< - propto__>(y, y, prior_mean, K_function_functor__(), + propto__>(y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), std::forward_as_tuple(theta_0, tolerance, - max_num_steps, hessian_block_size, solver, - max_steps_line_search, allow_fallthrough), - pstream__)); + max_num_steps, solver, max_steps_line_search, + allow_fallthrough), pstream__)); } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); @@ -7681,7 +7687,7 @@ class laplace_bernoulli_logit_model final : public model_base_crtp theta2 = @@ -7690,11 +7696,10 @@ class laplace_bernoulli_logit_model final : public model_base_crtp locations_array__ = " (in 'laplace_functionals.stan', line 44, column 2 to column 20)", " (in 'laplace_functionals.stan', line 45, column 2 to column 20)", " (in 'laplace_functionals.stan', line 62, column 2 to line 64, column 67)", - " (in 'laplace_functionals.stan', line 66, column 2 to line 71, column 99)", + " (in 'laplace_functionals.stan', line 66, column 2 to line 72, column 99)", " (in 'laplace_functionals.stan', line 48, column 2 to column 55)", " (in 'laplace_functionals.stan', line 49, column 2 to column 61)", " (in 'laplace_functionals.stan', line 50, column 2 to column 21)", @@ -8380,19 +8385,18 @@ class laplace_functionals_model final : public model_base_crtp theta2 = @@ -8542,11 +8546,11 @@ class laplace_functionals_model final : public model_base_crtp locations_array__ = " (in 'laplace_neg_binomial_2_log.stan', line 36, column 2 to column 22)", " (in 'laplace_neg_binomial_2_log.stan', line 37, column 2 to column 20)", " (in 'laplace_neg_binomial_2_log.stan', line 38, column 2 to column 20)", - " (in 'laplace_neg_binomial_2_log.stan', line 70, column 2 to line 71, column 74)", + " (in 'laplace_neg_binomial_2_log.stan', line 70, column 2 to line 71, column 94)", " (in 'laplace_neg_binomial_2_log.stan', line 73, column 2 to line 77, column 77)", " (in 'laplace_neg_binomial_2_log.stan', line 41, column 2 to column 55)", " (in 'laplace_neg_binomial_2_log.stan', line 42, column 2 to column 61)", " (in 'laplace_neg_binomial_2_log.stan', line 43, column 2 to column 21)", " (in 'laplace_neg_binomial_2_log.stan', line 45, column 2 to line 46, column 32)", - " (in 'laplace_neg_binomial_2_log.stan', line 48, column 2 to line 49, column 62)", - " (in 'laplace_neg_binomial_2_log.stan', line 51, column 2 to line 52, column 62)", + " (in 'laplace_neg_binomial_2_log.stan', line 48, column 2 to line 49, column 82)", + " (in 'laplace_neg_binomial_2_log.stan', line 51, column 2 to line 52, column 82)", " (in 'laplace_neg_binomial_2_log.stan', line 54, column 2 to line 57, column 59)", " (in 'laplace_neg_binomial_2_log.stan', line 59, column 2 to line 62, column 65)", " (in 'laplace_neg_binomial_2_log.stan', line 64, column 2 to line 67, column 65)", @@ -9188,48 +9192,45 @@ class laplace_neg_binomial_2_log_model final : public model_base_crtp(y, y, log_ye, prior_mean, - K_function_functor__(), + hessian_block_size, K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), pstream__)); current_statement__ = 10; lp_accum__.add(stan::math::laplace_marginal_neg_binomial_2_log_lpmf< - false>(y, y, log_ye, prior_mean, + false>(y, y, log_ye, prior_mean, hessian_block_size, K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), pstream__)); current_statement__ = 11; lp_accum__.add(stan::math::laplace_marginal_neg_binomial_2_log_lpmf< propto__>(y, y, log_ye, prior_mean, - K_function_functor__(), + hessian_block_size, K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), pstream__)); current_statement__ = 12; lp_accum__.add(stan::math::laplace_marginal_tol_neg_binomial_2_log_lpmf< propto__>(y, y, log_ye, prior_mean, - K_function_functor__(), + hessian_block_size, K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), std::forward_as_tuple(theta_0, tolerance, - max_num_steps, hessian_block_size, solver, - max_steps_line_search, allow_fallthrough), - pstream__)); + max_num_steps, solver, max_steps_line_search, + allow_fallthrough), pstream__)); current_statement__ = 13; lp_accum__.add(stan::math::laplace_marginal_tol_neg_binomial_2_log_lpmf< - false>(y, y, log_ye, prior_mean, + false>(y, y, log_ye, prior_mean, hessian_block_size, K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), std::forward_as_tuple(theta_0, tolerance, - max_num_steps, hessian_block_size, solver, - max_steps_line_search, allow_fallthrough), - pstream__)); + max_num_steps, solver, max_steps_line_search, + allow_fallthrough), pstream__)); current_statement__ = 14; lp_accum__.add(stan::math::laplace_marginal_tol_neg_binomial_2_log_lpmf< propto__>(y, y, log_ye, prior_mean, - K_function_functor__(), + hessian_block_size, K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), std::forward_as_tuple(theta_0, tolerance, - max_num_steps, hessian_block_size, solver, - max_steps_line_search, allow_fallthrough), - pstream__)); + max_num_steps, solver, max_steps_line_search, + allow_fallthrough), pstream__)); } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); @@ -9286,48 +9287,45 @@ class laplace_neg_binomial_2_log_model final : public model_base_crtp(y, y, log_ye, prior_mean, - K_function_functor__(), + hessian_block_size, K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), pstream__)); current_statement__ = 10; lp_accum__.add(stan::math::laplace_marginal_neg_binomial_2_log_lpmf< - false>(y, y, log_ye, prior_mean, + false>(y, y, log_ye, prior_mean, hessian_block_size, K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), pstream__)); current_statement__ = 11; lp_accum__.add(stan::math::laplace_marginal_neg_binomial_2_log_lpmf< propto__>(y, y, log_ye, prior_mean, - K_function_functor__(), + hessian_block_size, K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), pstream__)); current_statement__ = 12; lp_accum__.add(stan::math::laplace_marginal_tol_neg_binomial_2_log_lpmf< propto__>(y, y, log_ye, prior_mean, - K_function_functor__(), + hessian_block_size, K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), std::forward_as_tuple(theta_0, tolerance, - max_num_steps, hessian_block_size, solver, - max_steps_line_search, allow_fallthrough), - pstream__)); + max_num_steps, solver, max_steps_line_search, + allow_fallthrough), pstream__)); current_statement__ = 13; lp_accum__.add(stan::math::laplace_marginal_tol_neg_binomial_2_log_lpmf< - false>(y, y, log_ye, prior_mean, + false>(y, y, log_ye, prior_mean, hessian_block_size, K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), std::forward_as_tuple(theta_0, tolerance, - max_num_steps, hessian_block_size, solver, - max_steps_line_search, allow_fallthrough), - pstream__)); + max_num_steps, solver, max_steps_line_search, + allow_fallthrough), pstream__)); current_statement__ = 14; lp_accum__.add(stan::math::laplace_marginal_tol_neg_binomial_2_log_lpmf< propto__>(y, y, log_ye, prior_mean, - K_function_functor__(), + hessian_block_size, K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), std::forward_as_tuple(theta_0, tolerance, - max_num_steps, hessian_block_size, solver, - max_steps_line_search, allow_fallthrough), - pstream__)); + max_num_steps, solver, max_steps_line_search, + allow_fallthrough), pstream__)); } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); @@ -9399,7 +9397,7 @@ class laplace_neg_binomial_2_log_model final : public model_base_crtp theta2 = @@ -9408,11 +9406,10 @@ class laplace_neg_binomial_2_log_model final : public model_base_crtp locations_array__ = {" (found before start of program)", " (in 'laplace_nested_tuple.stan', line 33, column 2 to column 22)", " (in 'laplace_nested_tuple.stan', line 34, column 2 to column 20)", - " (in 'laplace_nested_tuple.stan', line 47, column 2 to line 48, column 68)", + " (in 'laplace_nested_tuple.stan', line 47, column 2 to line 48, column 71)", " (in 'laplace_nested_tuple.stan', line 50, column 2 to line 52, column 56)", " (in 'laplace_nested_tuple.stan', line 54, column 2 to line 56, column 74)", " (in 'laplace_nested_tuple.stan', line 37, column 2 to line 38, column 36)", @@ -10241,7 +10238,7 @@ class laplace_nested_tuple_model final : public model_base_crtp(y, y, ye, - stan::math::rep_vector(0.0, n_obs), + stan::math::rep_vector(0.0, n_obs), 1, scalar_tuple_functor__(), std::forward_as_tuple(x, std::forward_as_tuple(n_obs, @@ -10249,14 +10246,14 @@ class laplace_nested_tuple_model final : public model_base_crtp(y, y, ye, - stan::math::rep_vector(0.0, n_obs), + stan::math::rep_vector(0.0, n_obs), 1, arr_vec_tuple_functor__(), std::forward_as_tuple(std::forward_as_tuple(x, x), n_obs, alpha, rho), pstream__)); current_statement__ = 8; lp_accum__.add(stan::math::laplace_marginal_neg_binomial_2_log_lpmf< propto__>(y, y, ye, - stan::math::rep_vector(0.0, n_obs), + stan::math::rep_vector(0.0, n_obs), 1, arr_and_vec_tuple_functor__(), std::forward_as_tuple( std::forward_as_tuple(x, @@ -10305,7 +10302,7 @@ class laplace_nested_tuple_model final : public model_base_crtp(y, y, ye, - stan::math::rep_vector(0.0, n_obs), + stan::math::rep_vector(0.0, n_obs), 1, scalar_tuple_functor__(), std::forward_as_tuple(x, std::forward_as_tuple(n_obs, @@ -10313,14 +10310,14 @@ class laplace_nested_tuple_model final : public model_base_crtp(y, y, ye, - stan::math::rep_vector(0.0, n_obs), + stan::math::rep_vector(0.0, n_obs), 1, arr_vec_tuple_functor__(), std::forward_as_tuple(std::forward_as_tuple(x, x), n_obs, alpha, rho), pstream__)); current_statement__ = 8; lp_accum__.add(stan::math::laplace_marginal_neg_binomial_2_log_lpmf< propto__>(y, y, ye, - stan::math::rep_vector(0.0, n_obs), + stan::math::rep_vector(0.0, n_obs), 1, arr_and_vec_tuple_functor__(), std::forward_as_tuple( std::forward_as_tuple(x, @@ -10392,7 +10389,7 @@ class laplace_nested_tuple_model final : public model_base_crtp theta3 = @@ -10411,7 +10408,8 @@ class laplace_nested_tuple_model final : public model_base_crtp locations_array__ = " (in 'laplace_nested_tuple2.stan', line 50, column 2 to column 55)", " (in 'laplace_nested_tuple2.stan', line 51, column 2 to column 61)", " (in 'laplace_nested_tuple2.stan', line 52, column 2 to column 21)", - " (in 'laplace_nested_tuple2.stan', line 54, column 2 to line 55, column 65)", - " (in 'laplace_nested_tuple2.stan', line 57, column 2 to line 58, column 65)", - " (in 'laplace_nested_tuple2.stan', line 60, column 2 to line 61, column 65)", + " (in 'laplace_nested_tuple2.stan', line 54, column 2 to line 55, column 68)", + " (in 'laplace_nested_tuple2.stan', line 57, column 2 to line 58, column 68)", + " (in 'laplace_nested_tuple2.stan', line 60, column 2 to line 61, column 68)", " (in 'laplace_nested_tuple2.stan', line 24, column 2 to column 12)", " (in 'laplace_nested_tuple2.stan', line 25, column 2 to column 20)", " (in 'laplace_nested_tuple2.stan', line 26, column 8 to column 13)", @@ -11329,7 +11327,7 @@ class laplace_nested_tuple2_model final : public model_base_crtp theta2 = @@ -11506,7 +11504,7 @@ class laplace_nested_tuple2_model final : public model_base_crtp>>{ std::forward_as_tuple( eta, log_ye)}, y)}, - eta), K_function_functor__(), + eta), 1, K_function_functor__(), std::forward_as_tuple( std::vector< std::tuple< @@ -12521,7 +12519,7 @@ class laplace_nested_tuple3_model final : public model_base_crtp>>{ std::forward_as_tuple( eta, log_ye)}, y)}, - eta), K_function_functor__(), + eta), 1, K_function_functor__(), std::forward_as_tuple( std::vector< std::tuple< @@ -12611,7 +12609,7 @@ class laplace_nested_tuple3_model final : public model_base_crtp>>{ std::forward_as_tuple(eta, log_ye)}, y)}, - eta), K_function_functor__(), + eta), 1, K_function_functor__(), std::forward_as_tuple( std::vector< std::tuple>, @@ -13263,7 +13261,7 @@ class laplace_overload_weird_model final : public model_base_crtp(0), static_cast(1))); current_statement__ = 7; lp_accum__.add(stan::math::laplace_marginal(my_fun_functor__(), - std::forward_as_tuple(eta, log_ye, y), + std::forward_as_tuple(eta, log_ye, y), 1, my_fun_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), pstream__)); @@ -13322,7 +13320,7 @@ class laplace_overload_weird_model final : public model_base_crtp(0), static_cast(1))); current_statement__ = 7; lp_accum__.add(stan::math::laplace_marginal(my_fun_functor__(), - std::forward_as_tuple(eta, log_ye, y), + std::forward_as_tuple(eta, log_ye, y), 1, my_fun_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), pstream__)); @@ -14072,9 +14070,10 @@ class laplace_poisson_model final : public model_base_crtp locations_array__ = " (in 'laplace_poisson_log.stan', line 34, column 2 to column 22)", " (in 'laplace_poisson_log.stan', line 35, column 2 to column 20)", " (in 'laplace_poisson_log.stan', line 36, column 2 to column 20)", - " (in 'laplace_poisson_log.stan', line 68, column 2 to line 69, column 62)", + " (in 'laplace_poisson_log.stan', line 68, column 2 to line 69, column 82)", " (in 'laplace_poisson_log.stan', line 71, column 2 to line 74, column 79)", " (in 'laplace_poisson_log.stan', line 39, column 2 to column 55)", " (in 'laplace_poisson_log.stan', line 40, column 2 to column 61)", @@ -14736,43 +14735,46 @@ class laplace_poisson_log_model final : public model_base_crtp(0), static_cast(1))); current_statement__ = 9; lp_accum__.add(stan::math::laplace_marginal_poisson_log_lpmf< - propto__>(y, y, prior_mean, K_function_functor__(), + propto__>(y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), pstream__)); current_statement__ = 10; lp_accum__.add(stan::math::laplace_marginal_poisson_log_lpmf( - y, y, prior_mean, K_function_functor__(), + y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), pstream__)); current_statement__ = 11; lp_accum__.add(stan::math::laplace_marginal_poisson_log_lpmf< - propto__>(y, y, prior_mean, K_function_functor__(), + propto__>(y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), pstream__)); current_statement__ = 12; lp_accum__.add(stan::math::laplace_marginal_tol_poisson_log_lpmf< - propto__>(y, y, prior_mean, K_function_functor__(), + propto__>(y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), std::forward_as_tuple(theta_0, tolerance, - max_num_steps, hessian_block_size, solver, - max_steps_line_search, allow_fallthrough), - pstream__)); + max_num_steps, solver, max_steps_line_search, + allow_fallthrough), pstream__)); current_statement__ = 13; lp_accum__.add(stan::math::laplace_marginal_tol_poisson_log_lpmf< - false>(y, y, prior_mean, K_function_functor__(), + false>(y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), std::forward_as_tuple(theta_0, tolerance, - max_num_steps, hessian_block_size, solver, - max_steps_line_search, allow_fallthrough), - pstream__)); + max_num_steps, solver, max_steps_line_search, + allow_fallthrough), pstream__)); current_statement__ = 14; lp_accum__.add(stan::math::laplace_marginal_tol_poisson_log_lpmf< - propto__>(y, y, prior_mean, K_function_functor__(), + propto__>(y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), std::forward_as_tuple(theta_0, tolerance, - max_num_steps, hessian_block_size, solver, - max_steps_line_search, allow_fallthrough), - pstream__)); + max_num_steps, solver, max_steps_line_search, + allow_fallthrough), pstream__)); } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); @@ -14828,43 +14830,46 @@ class laplace_poisson_log_model final : public model_base_crtp(0), static_cast(1))); current_statement__ = 9; lp_accum__.add(stan::math::laplace_marginal_poisson_log_lpmf< - propto__>(y, y, prior_mean, K_function_functor__(), + propto__>(y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), pstream__)); current_statement__ = 10; lp_accum__.add(stan::math::laplace_marginal_poisson_log_lpmf( - y, y, prior_mean, K_function_functor__(), + y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), pstream__)); current_statement__ = 11; lp_accum__.add(stan::math::laplace_marginal_poisson_log_lpmf< - propto__>(y, y, prior_mean, K_function_functor__(), + propto__>(y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), pstream__)); current_statement__ = 12; lp_accum__.add(stan::math::laplace_marginal_tol_poisson_log_lpmf< - propto__>(y, y, prior_mean, K_function_functor__(), + propto__>(y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), std::forward_as_tuple(theta_0, tolerance, - max_num_steps, hessian_block_size, solver, - max_steps_line_search, allow_fallthrough), - pstream__)); + max_num_steps, solver, max_steps_line_search, + allow_fallthrough), pstream__)); current_statement__ = 13; lp_accum__.add(stan::math::laplace_marginal_tol_poisson_log_lpmf< - false>(y, y, prior_mean, K_function_functor__(), + false>(y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), std::forward_as_tuple(theta_0, tolerance, - max_num_steps, hessian_block_size, solver, - max_steps_line_search, allow_fallthrough), - pstream__)); + max_num_steps, solver, max_steps_line_search, + allow_fallthrough), pstream__)); current_statement__ = 14; lp_accum__.add(stan::math::laplace_marginal_tol_poisson_log_lpmf< - propto__>(y, y, prior_mean, K_function_functor__(), + propto__>(y, y, prior_mean, hessian_block_size, + K_function_functor__(), std::forward_as_tuple(x, n_obs, alpha, rho), std::forward_as_tuple(theta_0, tolerance, - max_num_steps, hessian_block_size, solver, - max_steps_line_search, allow_fallthrough), - pstream__)); + max_num_steps, solver, max_steps_line_search, + allow_fallthrough), pstream__)); } } catch (const std::exception& e) { stan::lang::rethrow_located(e, locations_array__[current_statement__]); @@ -14936,7 +14941,7 @@ class laplace_poisson_log_model final : public model_base_crtp theta2 = @@ -14945,11 +14950,10 @@ class laplace_poisson_log_model final : public model_base_crtp rho; } model { - y ~ laplace_marginal_neg_binomial_2_log(y, ye, rep_vector(0.0, n_obs), scalar_tuple, + y ~ laplace_marginal_neg_binomial_2_log(y, ye, rep_vector(0.0, n_obs), 1, scalar_tuple, (x, (n_obs, (alpha, rho)))); - y ~ laplace_marginal_neg_binomial_2_log(y, ye, rep_vector(0.0, n_obs), arr_vec_tuple, + y ~ laplace_marginal_neg_binomial_2_log(y, ye, rep_vector(0.0, n_obs), 1, arr_vec_tuple, ((x, x), n_obs, alpha, rho)); - y ~ laplace_marginal_neg_binomial_2_log(y, ye, rep_vector(0.0, n_obs), arr_and_vec_tuple, + y ~ laplace_marginal_neg_binomial_2_log(y, ye, rep_vector(0.0, n_obs), 1, arr_and_vec_tuple, ((x, rep_vector(rho, 10)), n_obs, alpha, rho)); } generated quantities { vector[n_obs] theta = laplace_latent_neg_binomial_2_log_rng(y, y, ye, rep_vector(0.0, n_obs), - scalar_tuple, (x, (n_obs, (alpha, rho)))); + 1, scalar_tuple, (x, (n_obs, (alpha, rho)))); vector[n_obs] theta2 = laplace_latent_neg_binomial_2_log_rng(y, y, ye, rep_vector(0.0, n_obs), - arr_vec_tuple, + 1, arr_vec_tuple, ((x, x), n_obs, alpha, rho)); vector[n_obs] theta3 = laplace_latent_neg_binomial_2_log_rng(y, y, ye, rep_vector(0.0, n_obs), - arr_and_vec_tuple, + 1, arr_and_vec_tuple, ((x, rep_vector(rho, 10)), n_obs, alpha, rho)); } diff --git a/test/integration/good/code-gen/laplace_nested_tuple2.stan b/test/integration/good/code-gen/laplace_nested_tuple2.stan index 8a06dd8c0..616d8e9e5 100644 --- a/test/integration/good/code-gen/laplace_nested_tuple2.stan +++ b/test/integration/good/code-gen/laplace_nested_tuple2.stan @@ -52,24 +52,24 @@ model { eta ~ normal(0, 1); target += laplace_marginal(scalar_tuple, ((eta, eta), log_ye, y), - K_function, (x, n_obs, alpha, rho)); + 1, K_function, (x, n_obs, alpha, rho)); target += laplace_marginal(arr_vec_tuple, (eta, (log_ye, y)), - K_function, (x, n_obs, alpha, rho)); + 1, K_function, (x, n_obs, alpha, rho)); target += laplace_marginal(nested, (((eta, log_ye), y), eta), - K_function, (x, n_obs, alpha, rho)); + 1, K_function, (x, n_obs, alpha, rho)); } generated quantities { vector[n_obs] theta = laplace_latent_rng(scalar_tuple, - ((eta, eta), log_ye, y), K_function, + ((eta, eta), log_ye, y), 1, K_function, (x, n_obs, alpha, rho)); vector[n_obs] theta2 = laplace_latent_rng(arr_vec_tuple, - (eta, (log_ye, y)), K_function, + (eta, (log_ye, y)), 1, K_function, (x, n_obs, alpha, rho)); vector[n_obs] theta3 = laplace_latent_rng(nested, - (((eta, log_ye), y), eta), K_function, + (((eta, log_ye), y), eta), 1, K_function, (x, n_obs, alpha, rho)); } diff --git a/test/integration/good/code-gen/laplace_nested_tuple3.stan b/test/integration/good/code-gen/laplace_nested_tuple3.stan index 42bc7d0e5..83a7d3fff 100644 --- a/test/integration/good/code-gen/laplace_nested_tuple3.stan +++ b/test/integration/good/code-gen/laplace_nested_tuple3.stan @@ -46,13 +46,13 @@ model { alpha ~ inv_gamma(alpha_location_prior, alpha_scale_prior); eta ~ normal(0, 1); - target += laplace_marginal(ll_nested, ({({(eta, log_ye)}, y)}, eta), + target += laplace_marginal(ll_nested, ({({(eta, log_ye)}, y)}, eta), 1, K_function, ({(x, {(n_obs, alpha)})}, rho)); } generated quantities { vector[n_obs] theta3 = laplace_latent_rng(ll_nested, - ({({(eta, log_ye)}, y)}, eta), + ({({(eta, log_ye)}, y)}, eta), 1, K_function, ({(x, {(n_obs, alpha)})}, rho)); } diff --git a/test/integration/good/code-gen/laplace_overload_weird.stan b/test/integration/good/code-gen/laplace_overload_weird.stan index dc08dd07d..bcf78c4da 100644 --- a/test/integration/good/code-gen/laplace_overload_weird.stan +++ b/test/integration/good/code-gen/laplace_overload_weird.stan @@ -46,7 +46,7 @@ model { alpha ~ inv_gamma(alpha_location_prior, alpha_scale_prior); eta ~ normal(0, 1); - target += laplace_marginal(my_fun, (eta, log_ye, y), + target += laplace_marginal(my_fun, (eta, log_ye, y), 1, my_fun, (x, n_obs, alpha, rho)); } diff --git a/test/integration/good/code-gen/laplace_poisson.stan b/test/integration/good/code-gen/laplace_poisson.stan index ce51863ed..0d0f8a5fa 100644 --- a/test/integration/good/code-gen/laplace_poisson.stan +++ b/test/integration/good/code-gen/laplace_poisson.stan @@ -37,7 +37,7 @@ model { } generated quantities { -real log_lik_sum = laplace_marginal_tol(poisson_re_log_ll, (y, offsett + alpha + X*beta), cov_fun, (sigmaz, N), - (rep_vector(0.0, N), tolerance, max_num_steps, hessian_block_size, +real log_lik_sum = laplace_marginal_tol(poisson_re_log_ll, (y, offsett + alpha + X*beta), hessian_block_size, cov_fun, (sigmaz, N), + (rep_vector(0.0, N), tolerance, max_num_steps, solver, max_steps_line_search, allow_fallthrough)); } diff --git a/test/integration/good/code-gen/laplace_poisson_log.stan b/test/integration/good/code-gen/laplace_poisson_log.stan index 9a2868385..80079fab0 100644 --- a/test/integration/good/code-gen/laplace_poisson_log.stan +++ b/test/integration/good/code-gen/laplace_poisson_log.stan @@ -40,36 +40,36 @@ model { alpha ~ inv_gamma(alpha_location_prior, alpha_scale_prior); eta ~ normal(0, 1); - y ~ laplace_marginal_poisson_log(y, prior_mean, K_function, + y ~ laplace_marginal_poisson_log(y, prior_mean, hessian_block_size, K_function, (x, n_obs, alpha, rho)); - target += laplace_marginal_poisson_log_lpmf(y | y, prior_mean, K_function, + target += laplace_marginal_poisson_log_lpmf(y | y, prior_mean, hessian_block_size, K_function, (x, n_obs, alpha, rho)); - target += laplace_marginal_poisson_log_lupmf(y | y, prior_mean, K_function, + target += laplace_marginal_poisson_log_lupmf(y | y, prior_mean, hessian_block_size, K_function, (x, n_obs, alpha, rho)); - y ~ laplace_marginal_tol_poisson_log(y, prior_mean, K_function, + y ~ laplace_marginal_tol_poisson_log(y, prior_mean, hessian_block_size, K_function, (x, n_obs, alpha, rho), - (theta_0, tolerance, max_num_steps, hessian_block_size, + (theta_0, tolerance, max_num_steps, solver, max_steps_line_search, allow_fallthrough)); - target += laplace_marginal_tol_poisson_log_lpmf(y | y, prior_mean, K_function, + target += laplace_marginal_tol_poisson_log_lpmf(y | y, prior_mean,hessian_block_size, K_function, (x, n_obs, alpha, rho), - (theta_0, tolerance, max_num_steps, hessian_block_size, + (theta_0, tolerance, max_num_steps, solver, max_steps_line_search, allow_fallthrough)); target += laplace_marginal_tol_poisson_log_lupmf(y | y, prior_mean, - K_function, (x, n_obs, alpha, rho), - (theta_0, tolerance, max_num_steps, hessian_block_size, + hessian_block_size, K_function, (x, n_obs, alpha, rho), + (theta_0, tolerance, max_num_steps, solver, max_steps_line_search, allow_fallthrough)); } generated quantities { vector[n_obs] theta = laplace_latent_poisson_log_rng(y, y, prior_mean, - K_function, (x, n_obs, alpha, rho)); + hessian_block_size, K_function, (x, n_obs, alpha, rho)); vector[n_obs] theta2 = laplace_latent_tol_poisson_log_rng(y, y, prior_mean, - K_function, (x, n_obs, alpha, rho), - (theta_0, tolerance, max_num_steps, hessian_block_size, + hessian_block_size, K_function, (x, n_obs, alpha, rho), + (theta_0, tolerance, max_num_steps, solver, max_steps_line_search, allow_fallthrough)); } diff --git a/test/integration/good/laplace_deriv_check.stan b/test/integration/good/laplace_deriv_check.stan index e678eea4a..d61e7b0f7 100644 --- a/test/integration/good/laplace_deriv_check.stan +++ b/test/integration/good/laplace_deriv_check.stan @@ -42,6 +42,6 @@ parameters { } generated quantities { - vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), + vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), 1, K_function, (x, n_obs, alpha, rho)); } diff --git a/test/integration/good/pretty.expected b/test/integration/good/pretty.expected index be39f404d..6b0fa8d9c 100644 --- a/test/integration/good/pretty.expected +++ b/test/integration/good/pretty.expected @@ -3923,7 +3923,7 @@ parameters { real eta; } generated quantities { - vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), + vector[n_obs] theta = laplace_latent_rng(ll_function, (eta, log_ye, y), 1, K_function, (x, n_obs, alpha, rho)); } diff --git a/test/integration/signatures/stan_math_signatures.t b/test/integration/signatures/stan_math_signatures.t index 07a2a8ddd..79bd31066 100644 --- a/test/integration/signatures/stan_math_signatures.t +++ b/test/integration/signatures/stan_math_signatures.t @@ -7525,6 +7525,7 @@ Display all Stan math signatures exposed in the language gaussian_dlm_obs_lpdf(matrix, matrix, matrix, vector, matrix, vector, matrix) => real gaussian_dlm_obs_lpdf(matrix, matrix, matrix, matrix, matrix, vector, matrix) => real generalized_inverse(matrix) => matrix + generate_laplace_options(int) => tuple(vector, real, int, int, int, int, int) generate_laplace_options(vector) => tuple(vector, real, int, int, int, int, int) get_imag(complex) => real get_imag(complex_vector) => vector From 5c62ad3a01da88fcf3c6aada3ed69e33d7efe233 Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Tue, 24 Feb 2026 11:15:13 -0500 Subject: [PATCH 3/4] Add generate_laplace_options test file --- .../functions/generate_laplace_options.stan | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/integration/good/function-signatures/math/functions/generate_laplace_options.stan diff --git a/test/integration/good/function-signatures/math/functions/generate_laplace_options.stan b/test/integration/good/function-signatures/math/functions/generate_laplace_options.stan new file mode 100644 index 000000000..958cb5df9 --- /dev/null +++ b/test/integration/good/function-signatures/math/functions/generate_laplace_options.stan @@ -0,0 +1,26 @@ +data { + int d_int; + vector[d_int] d_vector; +} + +transformed data { + tuple(vector[d_int], real, int,int,int,int,int) transformed_data_tols; + + transformed_data_tols = generate_laplace_options(d_int); + transformed_data_tols = generate_laplace_options(d_vector); +} +parameters { + real y_p; + vector[d_int] p_vector; + +} +transformed parameters { + +} +model { + tuple(vector[d_int], real, int,int,int,int,int) model_tols; + + model_tols = generate_laplace_options(d_int); + model_tols = generate_laplace_options(d_vector); + model_tols = generate_laplace_options(p_vector); +} From 5ec948853aee658ec58ec93da5de82a51e7cbc33 Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Tue, 3 Mar 2026 14:29:06 -0500 Subject: [PATCH 4/4] remove hessian block size from return of generate_laplace_options --- src/stan_math_signatures/Generate.ml | 21 ++++++++++--------- .../functions/generate_laplace_options.stan | 4 ++-- .../signatures/stan_math_signatures.t | 4 ++-- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/stan_math_signatures/Generate.ml b/src/stan_math_signatures/Generate.ml index 12f28abc3..436c7a388 100644 --- a/src/stan_math_signatures/Generate.ml +++ b/src/stan_math_signatures/Generate.ml @@ -1208,16 +1208,17 @@ let () = , ReturnType UReal , [UMatrix; UMatrix; UMatrix; UVector; UMatrix; UVector; UMatrix] , AoS ); - add_unqualified - ( "generate_laplace_options" - , ReturnType (UTuple [UVector; UReal; UInt; UInt; UInt; UInt; UInt]) - , [UVector] - , AoS ); - add_unqualified - ( "generate_laplace_options" - , ReturnType (UTuple [UVector; UReal; UInt; UInt; UInt; UInt; UInt]) - , [UInt] - , AoS ); + List.iter [UnsizedType.UInt; UVector] ~f:(fun t -> + add_unqualified + ( "generate_laplace_options" + , ReturnType + (UTuple + [ UVector (* theta_0 *); UReal (* tolerance *) + ; UInt (* max_num_steps *); UInt (* solver *) + ; UInt (* max_steps_line_search *); UInt (* allow_fallthrough *) + ]) + , [t] + , AoS )); add_unqualified ("gp_dot_prod_cov", ReturnType UMatrix, [UArray UReal; UReal], AoS); add_unqualified diff --git a/test/integration/good/function-signatures/math/functions/generate_laplace_options.stan b/test/integration/good/function-signatures/math/functions/generate_laplace_options.stan index 958cb5df9..f0df124f6 100644 --- a/test/integration/good/function-signatures/math/functions/generate_laplace_options.stan +++ b/test/integration/good/function-signatures/math/functions/generate_laplace_options.stan @@ -4,7 +4,7 @@ data { } transformed data { - tuple(vector[d_int], real, int,int,int,int,int) transformed_data_tols; + tuple(vector[d_int], real, int,int,int,int) transformed_data_tols; transformed_data_tols = generate_laplace_options(d_int); transformed_data_tols = generate_laplace_options(d_vector); @@ -18,7 +18,7 @@ transformed parameters { } model { - tuple(vector[d_int], real, int,int,int,int,int) model_tols; + tuple(vector[d_int], real, int,int,int,int) model_tols; model_tols = generate_laplace_options(d_int); model_tols = generate_laplace_options(d_vector); diff --git a/test/integration/signatures/stan_math_signatures.t b/test/integration/signatures/stan_math_signatures.t index 79bd31066..de048be95 100644 --- a/test/integration/signatures/stan_math_signatures.t +++ b/test/integration/signatures/stan_math_signatures.t @@ -7525,8 +7525,8 @@ Display all Stan math signatures exposed in the language gaussian_dlm_obs_lpdf(matrix, matrix, matrix, vector, matrix, vector, matrix) => real gaussian_dlm_obs_lpdf(matrix, matrix, matrix, matrix, matrix, vector, matrix) => real generalized_inverse(matrix) => matrix - generate_laplace_options(int) => tuple(vector, real, int, int, int, int, int) - generate_laplace_options(vector) => tuple(vector, real, int, int, int, int, int) + generate_laplace_options(int) => tuple(vector, real, int, int, int, int) + generate_laplace_options(vector) => tuple(vector, real, int, int, int, int) get_imag(complex) => real get_imag(complex_vector) => vector get_imag(complex_row_vector) => row_vector