Automatic Differentiation
 
Loading...
Searching...
No Matches
mean.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_MEAN_HPP
2#define STAN_MATH_PRIM_FUN_MEAN_HPP
3
7#include <vector>
8
9namespace stan {
10namespace math {
11
21template <typename T, require_container_t<T>* = nullptr>
22inline return_type_t<T> mean(const T& m) {
23 check_nonzero_size("mean", "m", m);
25 [](const auto& a) { return a.mean(); });
26}
27
28} // namespace math
29} // namespace stan
30
31#endif
typename return_type< Ts... >::type return_type_t
Convenience type for the return type of the specified template parameters.
scalar_type_t< T > mean(const T &m)
Returns the sample mean (i.e., average) of the coefficients in the specified std vector,...
Definition mean.hpp:20
void check_nonzero_size(const char *function, const char *name, const T_y &y)
Check if the specified matrix/vector is of non-zero size.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...