Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sum.hpp
Go to the documentation of this file.
1 #ifndef STAN__MATH__FUNCTIONS__SUM_HPP
2 #define STAN__MATH__FUNCTIONS__SUM_HPP
3 
4 #include <vector>
5 #include <cstddef>
6 
7 namespace stan {
8  namespace math {
9 
10  inline double sum(std::vector<double>& x) {
11  double sum = x[0];
12  for (size_t i = 1; i < x.size(); ++i)
13  sum += x[i];
14  return sum;
15  }
16 
17  }
18 }
19 
20 #endif
double sum(std::vector< double > &x)
Definition: sum.hpp:10

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