The C++ interface for median. More...

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

Detailed Description

The C++ interface for median.

Returns the median of a set of elements

Function Documentation

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

Median along a dimension.

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

Median of all elements in array.

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