1#ifndef STAN_MATH_REV_CORE_ACCUMULATE_ADJOINTS_HPP
2#define STAN_MATH_REV_CORE_ACCUMULATE_ADJOINTS_HPP
14template <
typename... Pargs>
17template <
typename VarVec, require_std_vector_vt<is_var, VarVec>* =
nullptr,
21template <
typename VecContainer,
22 require_std_vector_st<is_var, VecContainer>* =
nullptr,
23 require_std_vector_vt<is_container, VecContainer>* =
nullptr,
28template <
typename EigT, require_eigen_vt<is_var, EigT>* =
nullptr,
32template <
typename Arith, require_st_arithmetic<Arith>* =
nullptr,
50template <
typename... Pargs>
69template <
typename VarVec, require_std_vector_vt<is_var, VarVec>*,
72 for (
auto&& x_iter : x) {
73 *dest += x_iter.adj();
94template <
typename VecContainer, require_std_vector_st<is_var, VecContainer>*,
95 require_std_vector_vt<is_container, VecContainer>*,
typename... Pargs>
98 for (
auto&& x_iter : x) {
118template <
typename EigT, require_eigen_vt<is_var, EigT>*,
typename... Pargs>
120 Eigen::Map<Eigen::MatrixXd>(dest, x.rows(), x.cols()) += x.adj();
138template <
typename Arith, require_st_arithmetic<Arith>*,
typename... Pargs>
double * accumulate_adjoints(double *dest, const var &x, Pargs &&... args)
Accumulate adjoints from x into storage pointed to by dest, increment the adjoint storage pointer,...
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...