1#ifndef STAN_MATH_PRIM_FUN_SUM_HPP
2#define STAN_MATH_PRIM_FUN_SUM_HPP
20template <
typename T, require_stan_scalar_t<T>* =
nullptr>
22 return std::forward<T>(m);
32template <
typename T, require_not_autodiff_t<T>* =
nullptr>
33inline T
sum(
const std::vector<T>& m) {
34 return std::accumulate(m.begin(), m.end(), T{0});
45template <
typename T, require_eigen_vt<std::is_arithmetic, T>* =
nullptr>
58template <
typename T, require_eigen_vt<is_complex, T>* =
nullptr>
59inline value_type_t<T>
sum(
const T& m) {
typename value_type< T >::type value_type_t
Helper function for accessing underlying type.
auto sum(const std::vector< T > &m)
Return the sum of the entries of the specified standard vector.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...