@@ -48,7 +48,6 @@ struct laplace_options {
4848
4949namespace internal {
5050
51-
5251template <typename Covar, typename ThetaVec, typename WR, typename L_t,
5352 typename A_vec, typename ThetaGrad, typename LU_t, typename KRoot>
5453struct laplace_density_estimates {
@@ -341,7 +340,7 @@ inline void collect_adjoints(Output& output, Input&& input) {
341340 Eigen::Map<Eigen::Matrix<double , -1 , 1 >> output_map (output_i.data (),
342341 output_i.size ());
343342 Eigen::Map<Eigen::Matrix<var, -1 , 1 >> input_map (input_i.data (),
344- input_i.size ());
343+ input_i.size ());
345344 output_map.array () += input_map.adj ().array ();
346345 if constexpr (ZeroInput) {
347346 input_map.adj ().setZero ();
@@ -737,7 +736,7 @@ inline auto laplace_marginal_density_est(LLFun&& ll_fun, LLTupleArgs&& ll_args,
737736 std::string (" You chose a solver (" ) + std::to_string (options.solver )
738737 + " ) that is not valid. Please choose either 1, 2, or 3." );
739738}
740- }
739+ } // namespace internal
741740/* *
742741 * For a latent Gaussian model with global parameters phi, latent
743742 * variables theta, and observations y, this function computes
@@ -803,8 +802,8 @@ inline void collect_adjoints(Output&& output, Input&& input) {
803802 if constexpr (is_std_vector_v<output_i_t >) {
804803 Eigen::Map<Eigen::Matrix<double , -1 , 1 >> output_map (output_i.data (),
805804 output_i.size ());
806- Eigen::Map<Eigen::Matrix<double , -1 , 1 >> input_map (
807- input_i. data (), input_i.size ());
805+ Eigen::Map<Eigen::Matrix<double , -1 , 1 >> input_map (input_i. data (),
806+ input_i.size ());
808807 output_map.array () += input_map.array ();
809808 } else if constexpr (is_eigen_v<output_i_t >) {
810809 output_i.array () += input_i.array ();
@@ -835,7 +834,7 @@ inline void constexpr copy_compute_s2(const std::tuple<>& output,
835834 * @param input The input from which the adjoints will be collected
836835 */
837836template <bool ZeroInput = false , typename Output, typename Input,
838- require_t <is_all_arithmetic_scalar<Output>> * = nullptr ,
837+ require_t <is_all_arithmetic_scalar<Output>>* = nullptr ,
839838 require_t <is_any_var_scalar<Input>>* = nullptr >
840839inline void copy_compute_s2 (Output&& output, Input&& input) {
841840 return iter_tuple_n (
@@ -845,7 +844,7 @@ inline void copy_compute_s2(Output&& output, Input&& input) {
845844 Eigen::Map<Eigen::Matrix<double , -1 , 1 >> output_map (output_i.data (),
846845 output_i.size ());
847846 Eigen::Map<Eigen::Matrix<var, -1 , 1 >> input_map (input_i.data (),
848- input_i.size ());
847+ input_i.size ());
849848 output_map.array () += 0.5 * input_map.adj ().array ();
850849 if constexpr (ZeroInput) {
851850 input_map.adj ().setZero ();
@@ -895,7 +894,7 @@ inline constexpr auto make_zeroed_arena(Input&& input) {
895894 } else if constexpr (is_eigen_v<Input>) {
896895 return arena_t <promote_scalar_t <double , Input>>(
897896 plain_type_t <promote_scalar_t <double , Input>>::Zero (input.rows (),
898- input.cols ()));
897+ input.cols ()));
899898 } else if constexpr (is_var<Input>::value) {
900899 return static_cast <double >(0.0 );
901900 }
@@ -941,8 +940,7 @@ inline void print_adjoint(Output&& output) {
941940 * @param input The input from which the adjoints will be collected
942941 */
943942template <typename Output, typename Input>
944- inline void collect_adjoints (Output&& output, const vari* ret,
945- Input&& input) {
943+ inline void collect_adjoints (Output&& output, const vari* ret, Input&& input) {
946944 if constexpr (is_tuple_v<Output>) {
947945 static_assert (1 ,
948946 " INTERNAL ERROR:(laplace_marginal_lpdf)"
@@ -959,8 +957,8 @@ inline void collect_adjoints(Output&& output, const vari* ret,
959957 } else {
960958 Eigen::Map<Eigen::Matrix<var, -1 , 1 >> output_map (output.data (),
961959 output.size ());
962- Eigen::Map<const Eigen::Matrix<double , -1 , 1 >> input_map (
963- input. data (), input.size ());
960+ Eigen::Map<const Eigen::Matrix<double , -1 , 1 >> input_map (input. data (),
961+ input.size ());
964962 output_map.array ().adj () += ret->adj_ * input_map.array ();
965963 }
966964 } else if constexpr (is_eigen_v<Output>) {
@@ -982,7 +980,7 @@ inline void collect_adjoints(Output&& output, const vari* ret,
982980 */
983981template <typename Output, typename Input>
984982inline void reverse_pass_collect_adjoints (var ret, Output&& output,
985- Input&& input) {
983+ Input&& input) {
986984 if constexpr (is_tuple_v<Output>) {
987985 stan::math::for_each (
988986 [ret](auto && inner_arg, auto && inner_input) mutable {
@@ -1003,7 +1001,7 @@ inline void reverse_pass_collect_adjoints(var ret, Output&& output,
10031001 });
10041002 }
10051003}
1006- }
1004+ } // namespace internal
10071005/* *
10081006 * For a latent Gaussian model with global parameters phi, latent
10091007 * variables theta, and observations y, this function computes
@@ -1023,7 +1021,7 @@ inline void reverse_pass_collect_adjoints(var ret, Output&& output,
10231021 * where `InnerLLTupleArgs` are the elements of `LLTupleArgs`
10241022 * @tparam LLTupleArgs A tuple whose elements follow the types required for
10251023 * `LLFun`
1026- * \laplace_common_template_args
1024+ * \laplace_common_template_args
10271025 * @param[in] ll_fun A log likelihood functor
10281026 * @param[in] ll_args Tuple containing parameters for `LLFun`
10291027 * \laplace_common_args
@@ -1056,7 +1054,8 @@ inline auto laplace_marginal_density(const LLFun& ll_fun, LLTupleArgs&& ll_args,
10561054 // Solver 3
10571055 arena_t <Eigen::MatrixXd> LU_solve_covariance;
10581056 // Solver 1, 2, 3
1059- arena_t <promote_scalar_t <double , std::decay_t <ThetaVec>>> s2 (theta_0.size ());
1057+ arena_t <promote_scalar_t <double , std::decay_t <ThetaVec>>> s2 (
1058+ theta_0.size ());
10601059 // Make one hard copy here
10611060 using laplace_likelihood::internal::conditional_copy_and_promote;
10621061 using laplace_likelihood::internal::COPY_TYPE;
@@ -1197,7 +1196,8 @@ inline auto laplace_marginal_density(const LLFun& ll_fun, LLTupleArgs&& ll_args,
11971196 if constexpr (is_any_var_scalar_v<CovarArgs>) {
11981197 auto covar_args_filter = stan::math::filter_map<is_any_var_scalar>(
11991198 [](auto && arg) -> decltype (auto ) { return arg; }, covar_args_refs);
1200- internal::reverse_pass_collect_adjoints (ret, covar_args_filter, covar_args_adj);
1199+ internal::reverse_pass_collect_adjoints (ret, covar_args_filter,
1200+ covar_args_adj);
12011201 }
12021202 if constexpr (ll_args_contain_var) {
12031203 auto ll_args_filter = stan::math::filter_map<is_any_var_scalar>(
0 commit comments