Documentation

Compute the minimum value of an array. More...

## Modules

min
The C++ interface for min.

af_min
the C interface for min

## Detailed Description

Compute the minimum value of an array.

Returns the minimum value of an array, or if specified, the
minimum value of each dimension of the array. min can
also return the index of the minimum element:

int hx[] = { -3, -5, 2, -9 };
// hx = -3 2
// -5 -9
array x(2,2, hx); // 2x2 matrix
float value;
int index;
min(&value, &index, x);
printf("%g,%d\n", value, index)); // -9,3

Return the minimum regardless of dimension:

int hx[] = { -3, -5, 2, -9 };
array x1(2,2, hx); // 2x2 matrix
array x2(4,1, hx); // 4x1 vector
printf("%d,%d\n", min<int>(x1), min<int>(x2)); // -9,-9

Return minimum and indices along a given dimension

float ha[] = {1, 2, 3, 4};
array in = array(2, 2, ha);
// Storage for the results
array m, i;
// Min along columns
min(m, i, in, 0);
print(m);
print(i);
// m = 1.0000 3.0000
// i = 0 0
// Min along rows
min(m, i, in, 1);
print(m);
print(i);
// m = 1.0000
// 2.0000
// i = 0
// 0