11#ifndef STAN_MATH_MIX_FUNCTOR_LAPLACE_LIKELIHOOD_HPP
22#define STAN_MATH_MIX_FUNCTOR_LAPLACE_LIKELIHOOD_HPP
33
4- #include < stan/math/mix/functor/hessian_block_diag.hpp>
5- #include < stan/math/mix/functor/conditional_copy_and_promote.hpp>
4+ #include < stan/math/prim/fun/Eigen.hpp>
5+ #include < stan/math/rev/core.hpp>
6+ #include < stan/math/rev/meta.hpp>
7+ #include < stan/math/rev/fun/grad.hpp>
8+ #include < stan/math/prim/functor/conditional_copy_and_promote.hpp>
69#include < stan/math/prim/functor/apply.hpp>
7- #include < stan/math/prim/fun.hpp>
10+ #include < stan/math/mix/functor/hessian_block_diag.hpp>
11+ #include < stan/math/mix/functor/hessian_times_vector.hpp>
12+
13+ #include < tuple>
14+ #include < utility>
815
916namespace stan {
1017namespace math {
@@ -367,7 +374,7 @@ template <typename F, typename Theta, typename TupleArgs, typename Stream,
367374 require_tuple_t <TupleArgs>* = nullptr >
368375inline auto theta_grad (F&& f, Theta&& theta, TupleArgs&& ll_tup,
369376 Stream* msgs = nullptr ) {
370- return apply (
377+ return stan::math:: apply (
371378 [](auto && f, auto && theta, auto && msgs, auto &&... args) {
372379 return internal::theta_grad (std::forward<decltype (f)>(f),
373380 std::forward<decltype (theta)>(theta), msgs,
@@ -382,7 +389,7 @@ template <typename F, typename Theta, typename TupleArgs, typename Stream,
382389 require_tuple_t <TupleArgs>* = nullptr >
383390inline auto ll_arg_grad (F&& f, Theta&& theta, TupleArgs&& ll_tup,
384391 Stream* msgs = nullptr ) {
385- return apply (
392+ return stan::math:: apply (
386393 [](auto && f, auto && theta, auto && msgs, auto &&... args) {
387394 return internal::ll_arg_grad (std::forward<decltype (f)>(f),
388395 std::forward<decltype (theta)>(theta), msgs,
@@ -397,7 +404,7 @@ template <typename F, typename Theta, typename TupleArgs, typename Stream,
397404 require_tuple_t <TupleArgs>* = nullptr >
398405inline auto diagonal_hessian (F&& f, Theta&& theta, TupleArgs&& ll_tuple,
399406 Stream* msgs) {
400- return apply (
407+ return stan::math:: apply (
401408 [](auto && f, auto && theta, auto * msgs, auto &&... args) {
402409 return internal::diagonal_hessian (
403410 std::forward<decltype (f)>(f), std::forward<decltype (theta)>(theta),
@@ -413,7 +420,7 @@ template <typename F, typename Theta, typename TupleArgs, typename Stream,
413420inline auto block_hessian (F&& f, Theta&& theta,
414421 const Eigen::Index hessian_block_size,
415422 TupleArgs&& ll_tuple, Stream* msgs) {
416- return apply (
423+ return stan::math:: apply (
417424 [](auto && f, auto && theta, auto hessian_block_size, auto * msgs,
418425 auto &&... args) {
419426 return internal::block_hessian (
@@ -440,7 +447,7 @@ template <typename F, typename Theta, typename TupleArgs, typename Stream,
440447 require_tuple_t <TupleArgs>* = nullptr >
441448inline auto log_likelihood (F&& f, Theta&& theta, TupleArgs&& ll_tup,
442449 Stream* msgs) {
443- return apply (
450+ return stan::math:: apply (
444451 [](auto && f, auto && theta, auto && msgs, auto &&... args) {
445452 return internal::log_likelihood (
446453 std::forward<decltype (f)>(f), std::forward<decltype (theta)>(theta),
@@ -468,7 +475,7 @@ template <typename F, typename Theta, typename TupleArgs, typename Stream,
468475 require_tuple_t <TupleArgs>* = nullptr >
469476inline auto diff (F&& f, Theta&& theta, const Eigen::Index hessian_block_size,
470477 TupleArgs&& ll_tuple, Stream* msgs) {
471- return apply (
478+ return stan::math:: apply (
472479 [](auto && f, auto && theta, auto hessian_block_size, auto * msgs,
473480 auto &&... args) {
474481 return internal::diff (
@@ -495,7 +502,7 @@ template <typename F, typename Theta, typename TupleArgs, typename Stream,
495502 require_tuple_t <TupleArgs>* = nullptr >
496503inline Eigen::VectorXd third_diff (F&& f, Theta&& theta, TupleArgs&& ll_args,
497504 Stream* msgs) {
498- return apply (
505+ return stan::math:: apply (
499506 [](auto && f, auto && theta, auto && msgs, auto &&... args) {
500507 return internal::third_diff (std::forward<decltype (f)>(f),
501508 std::forward<decltype (theta)>(theta), msgs,
@@ -525,7 +532,7 @@ template <typename F, typename Theta, typename AMat, typename TupleArgs,
525532 require_tuple_t <TupleArgs>* = nullptr >
526533inline auto compute_s2 (F&& f, Theta&& theta, AMat&& A, int hessian_block_size,
527534 TupleArgs&& ll_args, Stream* msgs) {
528- return apply (
535+ return stan::math:: apply (
529536 [](auto && f, auto && theta, auto && A, auto hessian_block_size, auto * msgs,
530537 auto &&... args) {
531538 return internal::compute_s2 (
@@ -556,7 +563,7 @@ template <typename F, typename V_t, typename Theta, typename TupleArgs,
556563 require_eigen_vector_t <Theta>* = nullptr >
557564inline auto diff_eta_implicit (F&& f, V_t&& v, Theta&& theta,
558565 TupleArgs&& ll_args, Stream* msgs) {
559- return apply (
566+ return stan::math:: apply (
560567 [](auto && f, auto && v, auto && theta, auto && msgs, auto &&... args) {
561568 return internal::diff_eta_implicit (
562569 std::forward<decltype (f)>(f), std::forward<decltype (v)>(v),
0 commit comments