Automatic Differentiation
 
Loading...
Searching...
No Matches
laplace_latent_solve.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_MIX_PROB_LAPLACE_LATENT_SOLVE_HPP
2#define STAN_MATH_MIX_PROB_LAPLACE_LATENT_SOLVE_HPP
3
5
6namespace stan {
7namespace math {
8
9namespace internal {
10// Placeholder RNG type: used whenever laplace_base_rng's
11// sampling branch is compiled out via `if constexpr`. In this case
12// no rng is needed as no sampling is performed.
14
15} // namespace internal
16
36template <typename LLFunc, typename LLArgs, typename CovarFun,
37 typename CovarArgs, typename OpsTuple>
38inline auto laplace_latent_solve_tol(LLFunc&& ll_fun, LLArgs&& ll_args,
39 int hessian_block_size,
40 CovarFun&& covariance_function,
41 CovarArgs&& covar_args, OpsTuple&& ops,
42 std::ostream* msgs) {
43 auto options
44 = internal::tuple_to_laplace_options(std::forward<OpsTuple>(ops));
45 options.hessian_block_size = hessian_block_size;
47 return laplace_base_rng<true>(std::forward<LLFunc>(ll_fun),
48 std::forward<LLArgs>(ll_args),
49 std::forward<CovarFun>(covariance_function),
50 std::forward<CovarArgs>(covar_args),
51 std::move(options), unused_rng, msgs);
52}
53
73template <typename LLFunc, typename LLArgs, typename CovarFun,
74 typename CovarArgs>
75inline auto laplace_latent_solve(LLFunc&& ll_fun, LLArgs&& ll_args,
76 int hessian_block_size,
77 CovarFun&& covariance_function,
78 CovarArgs&& covar_args, std::ostream* msgs) {
79 auto options = laplace_options_default{hessian_block_size};
81 return laplace_base_rng<true>(std::forward<LLFunc>(ll_fun),
82 std::forward<LLArgs>(ll_args),
83 std::forward<CovarFun>(covariance_function),
84 std::forward<CovarArgs>(covar_args),
85 std::move(options), unused_rng, msgs);
86}
87
88} // namespace math
89} // namespace stan
90
91#endif
constexpr auto tuple_to_laplace_options(Options &&ops)
auto laplace_latent_solve(LLFunc &&ll_fun, LLArgs &&ll_args, int hessian_block_size, CovarFun &&covariance_function, CovarArgs &&covar_args, std::ostream *msgs)
In a latent gaussian model,.
auto laplace_latent_solve_tol(LLFunc &&ll_fun, LLArgs &&ll_args, int hessian_block_size, CovarFun &&covariance_function, CovarArgs &&covar_args, OpsTuple &&ops, std::ostream *msgs)
In a latent gaussian model,.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...