Calculate if any values that share the same consecutive keys are true. More...
Functions | |
AFAPI void | anyTrueByKey (array &keys_out, array &vals_out, const array &keys, const array &vals, const int dim=-1) |
C++ Interface for checking any true values in an array according to a key. | |
AFAPI af_err | af_any_true_by_key (af_array *keys_out, af_array *vals_out, const af_array keys, const af_array vals, const int dim) |
C Interface for checking any true values in an array according to key. | |
Calculate if any values that share the same consecutive keys are true.
Finds if any of the values of an input array are true according to an array of keys. All values corresponding to each group of consecutive equal keys will be tested to make sure any are true. Keys can repeat, however only consecutive key values will be considered for each reduction. If a key value is repeated somewhere else in the keys array it will be considered the start of a new reduction. There are two outputs: the reduced set of consecutive keys and the corresponding final reduced values. An example demonstrating the reduction behavior can be seen in the following snippet.
The keys input type must be an integer type(s32 or u32). The values return type will be of type u8.
The input keys must be a 1-D vector matching the size of the reduced dimension. In the case of multiple dimensions in the input values array, the dim parameter specifies which dimension to reduce along. An example of multi-dimensional reduce by key can be seen below:
AFAPI af_err af_any_true_by_key | ( | af_array * | keys_out, |
af_array * | vals_out, | ||
const af_array | keys, | ||
const af_array | vals, | ||
const int | dim | ||
) |
C Interface for checking any true values in an array according to key.
[out] | keys_out | will contain the reduced keys in vals along dim |
[out] | vals_out | will contain the reduced or of all values in vals along dim according to keys |
[in] | keys | is the key array |
[in] | vals | is the array containing the values to be reduced |
[in] | dim | The dimension along which the "or" operation occurs |
AFAPI void anyTrueByKey | ( | array & | keys_out, |
array & | vals_out, | ||
const array & | keys, | ||
const array & | vals, | ||
const int | dim = -1 |
||
) |
C++ Interface for checking any true values in an array according to a key.
[out] | keys_out | will contain the reduced keys in vals along dim |
[out] | vals_out | will contain the reduced or of all values in vals along dim according to keys |
[in] | keys | is the key array |
[in] | vals | is the array containing the values to be reduced |
[in] | dim | The dimension along which the any true operation occurs |
dim
is -1 by default. -1 denotes the first non-singleton dimension.