1 #ifndef STAN__MATH__MATRIX__MEAN_HPP
2 #define STAN__MATH__MATRIX__MEAN_HPP
5 #include <boost/math/tools/promotion.hpp>
22 typename boost::math::tools::promote_args<T>::type
23 mean(
const std::vector<T>& v) {
26 for (
size_t i = 1; i < v.size(); ++i)
28 return sum / v.size();
37 template <
typename T,
int R,
int C>
39 typename boost::math::tools::promote_args<T>::type
40 mean(
const Eigen::Matrix<T,R,C>& m) {
boost::math::tools::promote_args< T >::type mean(const std::vector< T > &v)
Returns the sample mean (i.e., average) of the coefficients in the specified standard vector...
double sum(std::vector< double > &x)
bool check_nonzero_size(const char *function, const T_y &y, const char *name, T_result *result)
Return true if the specified matrix/vector is of non-zero size.