A high-performance general-purpose compute library

Return the maximum along a given dimension. More...

Functions

AFAPI array max (const array &in, const int dim=-1)
 C++ Interface to return the maximum along a given dimension. More...
 
AFAPI void max (array &val, array &idx, const array &in, const array &ragged_len, const int dim)
 C++ Interface to return the ragged maximum along a given dimension. More...
 
template<typename T >
max (const array &in)
 C++ Interface to return the maximum along the first non-singleton dimension. More...
 
AFAPI void max (array &val, array &idx, const array &in, const int dim=-1)
 C++ Interface to return the maximum and its location along a given dimension. More...
 
template<typename T >
void max (T *val, unsigned *idx, const array &in)
 C++ Interface to return the maximum and its location over all dimensions. More...
 
AFAPI af_err af_max (af_array *out, const af_array in, const int dim)
 C Interface to return the maximum along a given dimension. More...
 
AFAPI af_err af_max_ragged (af_array *val, af_array *idx, const af_array in, const af_array ragged_len, const int dim)
 C Interface to return the ragged maximum over a given dimension. More...
 
AFAPI af_err af_max_all (double *real, double *imag, const af_array in)
 C Interface to return the maximum over all dimensions. More...
 
AFAPI af_err af_max_all_array (af_array *out, const af_array in)
 C Interface to return the maximum over all dimensions. More...
 
AFAPI af_err af_imax (af_array *out, af_array *idx, const af_array in, const int dim)
 C Interface to return the maximum and its location along a given dimension. More...
 
AFAPI af_err af_imax_all (double *real, double *imag, unsigned *idx, const af_array in)
 C Interface to return the maximum and its location over all dimensions. More...
 

Detailed Description

Return the maximum along a given dimension.

This function runs across all batches in the input simultaneously.

Function Documentation

◆ af_imax()

AFAPI af_err af_imax ( af_array out,
af_array idx,
const af_array  in,
const int  dim 
)

C Interface to return the maximum and its location along a given dimension.

Parameters
[out]outmaximum
[out]idxlocation
[in]ininput array
[in]dimdimension along which the maximum is found
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

◆ af_imax_all()

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

C Interface to return the maximum and its location over all dimensions.

NaN values are ignored.

Parameters
[out]realreal component of the maximum
[out]imagimaginary component of the maximum; 0 if idx is real
[out]idxlocation
[in]ininput array
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

◆ af_max()

AFAPI af_err af_max ( af_array out,
const af_array  in,
const int  dim 
)

C Interface to return the maximum along a given dimension.

Parameters
[out]outmaximum
[in]ininput array
[in]dimdimension along which the maximum is found
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

◆ af_max_all()

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

C Interface to return the maximum over all dimensions.

If in is real, imag will be set to zeros.

Parameters
[out]realreal component of the maximum
[out]imagimaginary component of the maximum
[in]ininput array
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

◆ af_max_all_array()

AFAPI af_err af_max_all_array ( af_array out,
const af_array  in 
)

C Interface to return the maximum over all dimensions.

Parameters
[out]outmaximum
[in]ininput array
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

◆ af_max_ragged()

AFAPI af_err af_max_ragged ( af_array val,
af_array idx,
const af_array  in,
const af_array  ragged_len,
const int  dim 
)

C Interface to return the ragged maximum over a given dimension.

Input parameter ragged_len sets the number of elements to consider.

NaN values are ignored.

Parameters
[out]valragged maximum
[out]idxlocations of the maximum ragged values
[in]ininput array
[in]ragged_lenarray containing the number of elements to use
[in]dimdimension along which the maximum is found
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

◆ max() [1/5]

AFAPI void max ( array val,
array idx,
const array in,
const array ragged_len,
const int  dim 
)

C++ Interface to return the ragged maximum along a given dimension.

Input parameter ragged_len sets the number of elements to consider.

NaN values are ignored.

Parameters
[out]valragged maximum
[out]idxlocations of the maximum ragged values
[in]ininput array
[in]ragged_lenarray containing the number of elements to use
[in]dimdimension along which the maximum is found

◆ max() [2/5]

AFAPI void max ( array val,
array idx,
const array in,
const int  dim = -1 
)

C++ Interface to return the maximum and its location along a given dimension.

NaN values are ignored.

Parameters
[out]valmaximum
[out]idxlocation
[in]ininput array
[in]dimdimension along which the maximum is found, -1 denotes the first non-singleton dimension

◆ max() [3/5]

T max ( const array in)

C++ Interface to return the maximum along the first non-singleton dimension.

NaN values are ignored.

Parameters
[in]ininput array
Returns
maximum

◆ max() [4/5]

AFAPI array max ( const array in,
const int  dim = -1 
)

C++ Interface to return the maximum along a given dimension.

NaN values are ignored.

Parameters
[in]ininput array
[in]dimdimension along which the maximum is found, -1 denotes the first non-singleton dimension
Returns
maximum
Examples
financial/heston_model.cpp, graphics/fractal.cpp, and graphics/gravity_sim.cpp.

◆ max() [5/5]

void max ( T *  val,
unsigned *  idx,
const array in 
)

C++ Interface to return the maximum and its location over all dimensions.

NaN values are ignored.

Often used to return values directly to the host.

Parameters
[out]valmaximum
[out]idxlocation
[in]ininput array