Do more. Code less. Free software for GPU computing.
<scroll to top>

Mimimum and maximum

Data Analysis

array min (const array &input, int dim=-1)
 minimum of the elements along a dimension in matrix
void min (array &values, array &indices, const array &input, int dim=-1)
 minimum value and index found along dimension
template<typename ty >
ty min (const array &input)
 minimum value among all elements in array
template<typename ty >
void min (ty *value, int *index, const array &input)
 minimum value and index among all elements in array
array max (const array &input, int dim=-1)
 maximum of the elements along a dimension in matrix
void max (array &values, array &indices, const array &input, int dim=-1)
 maximum value and index found along dimension
template<typename ty >
ty max (const array &input)
 maximum value among all elements in array
template<typename ty >
void max (ty *value, int *index, const array &input)
 maximum value and index among all elements in array
array minmax_packed (const array &input, int dim=-1)
 minimum and maximum (packed) of the elements along a dimension in matrix
void minmax (array &minvalues, array &maxvalues, const array &input, int dim=-1)
 minimum and maximum of the elements along a dimension in matrix
template<typename ty >
ty minmax (const array &input)
 minimum (out.x) and maximum (out.y) values among all elements in array

Function Documentation

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

minimum of the elements along a dimension in matrix

Parameters:
[in]input
[in]dimdimension along which to operate (-1 indicates first nonsingleton dimension)
Returns:
array with minimum values along the dimension dim in the input
void af::min ( array &  values,
array &  indices,
const array &  input,
int  dim = -1 
)

minimum value and index found along dimension

Parameters:
[in]input
[in]dimdimension along which to operate (-1 indicates first nonsingleton dimension)
[out]valuesarray with minimum values along the dimension dim in input
[out]indicesfirst location where values occur in input (zero-based indexing)
ty af::min ( const array &  input)

minimum value among all elements in array

       int hx[] = { -3, -5, 2, -9 };
       array x1(hx, 2,2); // 2x2 matrix
       array x2(hx, 4,1); // 4x1 vector
       printf("%d,%d\n", min<int>(x1), min<int>(x2)); // -9,-9
Parameters:
[in]input
Returns:
minimum of all values in the input array
void af::min ( ty *  value,
int *  index,
const array &  input 
)

minimum value and index among all elements in array

       int hx[] = { -3, -5, 2, -9 };
       array x(hx, 2,2); // 2x2 matrix
       float value;
       int index;
       min(&value, &index, x);
       printf("%g,%d\n", value, index)); // -9,3
Parameters:
[in]input
[out]valuearray with minimum values along the dimension dim in input
[out]indexfirst location where values occur in input (zero-based indexing)
array af::max ( const array &  input,
int  dim = -1 
)

maximum of the elements along a dimension in matrix

Parameters:
[in]input
[in]dimdimension along which to operate (-1 indicates first nonsingleton dimension)
Returns:
array with maximum values along the dimension dim in the input
void af::max ( array &  values,
array &  indices,
const array &  input,
int  dim = -1 
)

maximum value and index found along dimension

Parameters:
[in]input
[in]dimdimension along which to operate (-1 indicates first nonsingleton dimension)
[out]valuesarray with maximum values along the dimension dim in input
[out]indicesfirst location where values occur in input (zero-based indexing)
ty af::max ( const array &  input)

maximum value among all elements in array

       int hx[] = { -3, -5, 2, -9 };
       array x1(hx, 2,2); // 2x2 matrix
       array x2(hx, 4,1); // 4x1 vector
       printf("%d,%d\n", max<int>(x1), max<int>(x2)); // 2,2
Parameters:
[in]input
Returns:
maximum of all values in the input array
void af::max ( ty *  value,
int *  index,
const array &  input 
)

maximum value and index among all elements in array

Parameters:
[in]input
[out]valuearray with maximum values along the dimension dim in input
[out]indexfirst location where values occur in input (zero-based indexing)
array af::minmax_packed ( const array &  input,
int  dim = -1 
)

minimum and maximum (packed) of the elements along a dimension in matrix

Parameters:
[in]input
[in]dimdimension along which to operate (-1 indicates first nonsingleton dimension)
Returns:
array of minimum (real part) and maximum (imag part) along the dimension dim in the input
Examples:
examples/image/gfor_hist_demo.cpp.
void af::minmax ( array &  minvalues,
array &  maxvalues,
const array &  input,
int  dim = -1 
)

minimum and maximum of the elements along a dimension in matrix

Parameters:
[in]input
[in]dimdimension along which to operate (-1 indicates first nonsingleton dimension)
[out]minvaluesminimums
[out]maxvaluesmaximums
ty af::minmax ( const array &  input)

minimum (out.x) and maximum (out.y) values among all elements in array

       int hx[] = { -3, -5, 2, -9 };
       array x(hx, 2,2); // 2x2 matrix
       float2 extrema = minmax<float2>(x);
       printf("%g,%g\n", extrema.x, extrema.y); // -9,2
Parameters:
[in]input
Returns:
both minimum and maximum of all values in array
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines