Stan Math Library  2.20.0
reverse mode automatic differentiation
sum.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_ARR_FUN_SUM_HPP
2 #define STAN_MATH_PRIM_ARR_FUN_SUM_HPP
3 
5 #include <cstddef>
6 #include <vector>
7 #include <numeric>
8 
9 namespace stan {
10 namespace math {
11 
19 template <typename T>
20 inline T sum(const std::vector<T>& xs) {
21  return std::accumulate(xs.begin(), xs.end(), T{0});
22 }
23 
24 } // namespace math
25 } // namespace stan
26 #endif
fvar< T > sum(const std::vector< fvar< T > > &m)
Return the sum of the entries of the specified standard vector.
Definition: sum.hpp:20

     [ Stan Home Page ] © 2011–2018, Stan Development Team.