Select elements from two arrays based on an conditional array. More...

Functions

AFAPI array select (const array &cond, const array &a, const array &b)
 
AFAPI array select (const array &cond, const array &a, const double &b)
 
AFAPI array select (const array &cond, const double &a, const array &b)
 
AFAPI af_err af_select (af_array *out, const af_array cond, const af_array a, const af_array b)
 
AFAPI af_err af_select_scalar_r (af_array *out, const af_array cond, const af_array a, const double b)
 
AFAPI af_err af_select_scalar_l (af_array *out, const af_array cond, const double a, const af_array b)
 

Detailed Description

Select elements from two arrays based on an conditional array.

If the condition array has an element as true, then the element from the lhs array/value is selected, otherwise the element from the rhs array/value is selected.


Function Documentation

AFAPI af_err af_select ( af_array out,
const af_array  cond,
const af_array  a,
const af_array  b 
)
Parameters
[out]outis the output containing elements of a when cond is true else elements from b
[in]condis the conditional array
[in]ais the array containing elements from the true part of the condition
[in]bis the array containing elements from the false part of the condition
AFAPI af_err af_select_scalar_l ( af_array out,
const af_array  cond,
const double  a,
const af_array  b 
)
Parameters
[out]outis the output containing elements of a when cond is true else elements from b
[in]condis the conditional array
[in]ais a scalar assigned to out when cond is true
[in]bis the array containing elements from the false part of the condition
AFAPI af_err af_select_scalar_r ( af_array out,
const af_array  cond,
const af_array  a,
const double  b 
)
Parameters
[out]outis the output containing elements of a when cond is true else elements from b
[in]condis the conditional array
[in]ais the array containing elements from the true part of the condition
[in]bis a scalar assigned to out when cond is false
AFAPI array af::select ( const array cond,
const array a,
const array b 
)
Parameters
[in]condis the conditional array
[in]ais the array containing elements from the true part of the condition
[in]bis the array containing elements from the false part of the condition
Returns
the output containing elements of a when cond is true else elements from b
AFAPI array af::select ( const array cond,
const array a,
const double &  b 
)
Parameters
[in]condis the conditional array
[in]ais the array containing elements from the true part of the condition
[in]bis a scalar assigned to out when cond is false
Returns
the output containing elements of a when cond is true else the value b
AFAPI array af::select ( const array cond,
const double &  a,
const array b 
)
Parameters
[in]condis the conditional array
[in]ais a scalar assigned to out when cond is true
[in]bis the array containing elements from the false part of the condition
Returns
the output containing the value a when cond is true else elements from b