min

Functions
min
Complete List of ArrayFire Functions ArrayFire Functions by Category » Vector Algorithms » | Reduction operations

Find the minimum values and their locations. More...

## Functions
AFAPI array | min (const array &in, const int dim=-1)
| C++ Interface for minimum values in an array. More...
template<typename T >
T | min (const array &in)
| C++ Interface for getting minimum value of an array. More...
AFAPI void | min (array &val, array &idx, const array &in, const int dim=-1)
| C++ Interface for getting minimum values and their locations in an array. More...
template<typename T >
void | min (T *val, unsigned *idx, const array &in)
| C++ Interface for getting minimum value and its location from the entire array. More...
AFAPI af_err | af_min (af_array *out, const af_array in, const int dim)
| C Interface for minimum values in an array. More...
AFAPI af_err | af_min_all (double *real, double *imag, const af_array in)
| C Interface for getting minimum value of an array. More...
AFAPI af_err | af_imin (af_array *out, af_array *idx, const af_array in, const int dim)
| C Interface for getting minimum values and their locations in an array. More...
AFAPI af_err | af_imin_all (double *real, double *imag, unsigned *idx, const af_array in)
| C Interface for getting minimum value and its location from the entire array. More...

## Detailed Description

Find the minimum values and their locations.

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

## Function Documentation

## § af_imin()

AFAPI af_err af_imin | ( | af_array * | out,
|  | af_array * | idx,
|  | const af_array | in,
|  | const int | dim
| ) |  |

C Interface for getting minimum values and their locations in an array.

Parameters

  [out] | out | will contain the minimum of all values in `in` along `dim`
  [out] | idx | will contain the location of minimum of all values in `in` along `dim`
  [in] | in | is the input array
  [in] | dim | The dimension along which the minimum value is extracted

Returns
  AF_SUCCESS if the execution completes properly

## § af_imin_all()

AFAPI af_err af_imin_all | ( | double * | real,
|  | double * | imag,
|  | unsigned * | idx,
|  | const af_array | in
| ) |  |

C Interface for getting minimum value and its location from the entire array.

Parameters

  [out] | real | will contain the real part of minimum value of all elements in input `in`
  [out] | imag | will contain the imaginary part of minimum value of all elements in input `in`
  [out] | idx | will contain the location of minimum of all values in `in`
  [in] | in | is the input array

Returns
  AF_SUCCESS if the execution completes properly

Note
  `imag` is always set to 0 when `in` is real.

## § af_min()

AFAPI af_err af_min | ( | af_array * | out,
|  | const af_array | in,
|  | const int | dim
| ) |  |

C Interface for minimum values in an array.

Parameters

  [out] | out | will contain the minimum of all values in `in` along `dim`
  [in] | in | is the input array
  [in] | dim | The dimension along which the minimum value is extracted

Returns
  AF_SUCCESS if the execution completes properly

## § af_min_all()

AFAPI af_err af_min_all | ( | double * | real,
|  | double * | imag,
|  | const af_array | in
| ) |  |

C Interface for getting minimum value of an array.

Parameters

  [out] | real | will contain the real part of minimum value of all elements in input `in`
  [out] | imag | will contain the imaginary part of minimum value of all elements in input `in`
  [in] | in | is the input array

Returns
  AF_SUCCESS if the execution completes properly

Note
  `imag` is always set to 0 when `in` is real.

## § min() [1/4]

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

C++ Interface for minimum values in an array.

Parameters

  [in] | in | is the input array
  [in] | dim | The dimension along which the minimum value needs to be extracted

Returns
  result of minimum all values along dimension `dim`

Note
  `dim` is -1 by default. -1 denotes the first non-singleton dimension.
  NaN values are ignored

Examples:
  getting_started/integer.cpp, graphics/gravity_sim.cpp, graphics/plot3.cpp, image_processing/brain_segmentation.cpp, image_processing/filters.cpp, image_processing/image_editing.cpp, machine_learning/bagging.cpp, machine_learning/deep_belief_net.cpp, machine_learning/kmeans.cpp, machine_learning/knn.cpp, and machine_learning/rbm.cpp.

## § min() [2/4]

T af::min | ( | const array & | in | ) |

C++ Interface for getting minimum value of an array.

Parameters

  [in] | in | is the input array

Returns
  the minimum of all values of `in`

Note
  NaN values are ignored

## § min() [3/4]

AFAPI void af::min | ( | array & | val,
|  | array & | idx,
|  | const array & | in,
|  | const int | dim = `-1`
| ) |  |

C++ Interface for getting minimum values and their locations in an array.

Parameters

  [out] | val | will contain the minimum values along dimension `dim`
  [out] | idx | will contain the locations of minimum all values along dimension `dim`
  [in] | in | is the input array
  [in] | dim | The dimension along which the minimum value needs to be extracted

Note
  `dim` is -1 by default. -1 denotes the first non-singleton dimension.
  NaN values are ignored

## § min() [4/4]

void af::min | ( | T * | val,
|  | unsigned * | idx,
|  | const array & | in
| ) |  |

C++ Interface for getting minimum value and its location from the entire array.

Parameters

  [out] | val | will contain the minimum values in the input
  [out] | idx | will contain the locations of minimum all values in the input
  [in] | in | is the input array

Note
  NaN values are ignored