Automatic Differentiation
 
Loading...
Searching...
No Matches
mean.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_OPENCL_PRIM_MEAN_HPP
2#define STAN_MATH_OPENCL_PRIM_MEAN_HPP
3#ifdef STAN_OPENCL
4
7
8namespace stan {
9namespace math {
10
18template <typename T,
19 require_nonscalar_prim_or_rev_kernel_expression_t<T>* = nullptr>
21 check_nonzero_size("mean", "m", m);
22 return sum(m) / m.size();
23}
24
25} // namespace math
26} // namespace stan
27
28#endif
29#endif
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
fvar< T > sum(const std::vector< fvar< T > > &m)
Return the sum of the entries of the specified standard vector.
Definition sum.hpp:22
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.
typename scalar_type< T >::type scalar_type_t
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition fvar.hpp:9