The C++ interface for mean. More...

array mean (const array &input, int dim=-1)
 Average along a dimension. More...
 
template<typename ty >
ty mean (const array &input)
 Average of all elements in array. More...
 

Detailed Description

The C++ interface for mean.

Returns the mean of a set of elements

Function Documentation

array af::mean ( const array &  input,
int  dim = -1 
)

Average along a dimension.

Parameters
[in]input
[in]dimdimension along which to operate (-1 indicates first non-singleton dimension)
Returns
array with mean values along the dimension dim in the input
ty af::mean ( const array &  input)

Average of all elements in array.

array a = array(seq(5));
print(a); // 0 1 2 3 4
float m = mean<float>(a);
printf("%f\n",m); // 2.0
Parameters
[in]input
Returns
average of all elements in array