The C++ interface for minmax. More...

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

Detailed Description

The C++ interface for minmax.

Returns the minimum and the maximum value along a given dimension
or for all of the elements of an array.
float ha[] = {1, 2, 3, 4, 5, 6};
array in = array(2, 3, ha);
array minvals, maxvals;
minmax(minvals, maxvals, in, 0);
print(minvals);
print(maxvals);
// minvals = 1.0000 3.0000 5.0000
// maxvals = 2.0000 4.0000 6.0000
minmax(minvals, maxvals, in, 1);
print(minvals);
print(maxvals);
// minvals = 1.0000
// 2.0000
//
// maxvals = 5.0000
// 6.0000

Function Documentation

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 non-singleton dimension)
Returns
array of minimum (real part) and maximum (imag part) along the dimension dim in the input
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 non-singleton 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(2,2, hx); // 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