median

Functions
median
Complete List of ArrayFire Functions ArrayFire Functions by Category » Statistics » | Basic statistics functions

Find the median of values in the input. More...

## Functions
AFAPI array | median (const array &in, const dim_t dim=-1)
| C++ Interface for median. More...
template<typename T >
AFAPI T | median (const array &in)
| C++ Interface for median of all elements. More...
AFAPI af_err | af_median (af_array *out, const af_array in, const dim_t dim)
| C Interface for median. More...
AFAPI af_err | af_median_all (double *realVal, double *imagVal, const af_array in)
| C Interface for median. More...

## Detailed Description

Find the median of values in the input.

This function performs the operation across all batches present in the input simultaneously.

## Function Documentation

## ◆ af_median()

AFAPI af_err af_median | ( | af_array * | out,
|  | const af_array | in,
|  | const dim_t | dim
| ) |  |

C Interface for median.

Parameters

  [out] | out | will contain the median of the input array along dimension `dim`
  [in] | in | is the input array
  [in] | dim | the dimension along which the median is extracted

Returns
  AF_SUCCESS if the operation is successful, otherwise an appropriate error code is returned.

## ◆ af_median_all()

AFAPI af_err af_median_all | ( | double * | realVal,
|  | double * | imagVal,
|  | const af_array | in
| ) |  |

C Interface for median.

Parameters

  [out] | realVal | will contain the real part of median of the entire input array
  [out] | imagVal | will contain the imaginary part of median of the entire input array
  [in] | in | is the input array

Returns
  AF_SUCCESS if the operation is successful, otherwise an appropriate error code is returned.

## ◆ median() [1/2]

AFAPI array af::median | ( | const array & | in,
|  | const dim_t | dim = `-1`
| ) |  |

C++ Interface for median.

Parameters

  [in] | in | is the input array
  [in] | dim | the dimension along which the median is extracted

Returns
  the median of the input array along dimension `dim`

Note
  `dim` is -1 by default. -1 denotes the first non-singleton dimension.

## ◆ median() [2/2]

AFAPI T af::median | ( | const array & | in | ) |

C++ Interface for median of all elements.

Parameters

  [in] | in | is the input array

Returns
  median of the entire input array