Lookup values of an array by indexing with another array. More...
Functions | |
AFAPI array | lookup (const array &in, const array &idx, const int dim=-1) |
Lookup the values of an input array by indexing with another array. More... | |
AFAPI af_err | af_lookup (af_array *out, const af_array in, const af_array indices, const unsigned dim) |
Lookup the values of an input array by indexing with another array. More... | |
Lookup values of an array by indexing with another array.
Will return an array with the values in the in
array from the locations specified in the idx
array. The resulting array contains values corresponding to each of the provided indices. Locations of the input data are assumed to be in the range [0, n). Indexing outside of this range will result in mirrored wrap-around behavior.
A simple example of one-dimension indexing can be seen in the following example.
Index locations can also be out of bounds.
The axis along which to query the indices can also be specified. The resulting array will be of the same size as the input, except for the queried dimension which will match the number of elements in the index array.
AFAPI af_err af_lookup | ( | af_array * | out, |
const af_array | in, | ||
const af_array | indices, | ||
const unsigned | dim | ||
) |
Lookup the values of an input array by indexing with another array.
[out] | out | output array containing values of in at locations specified by indices |
[in] | in | is the input array that will be queried |
[in] | indices | are the lookup indices |
[in] | dim | specifies the dimension for indexing |
Lookup the values of an input array by indexing with another array.
[in] | in | is the input array that will be queried |
[in] | idx | are the lookup indices |
[in] | dim | specifies the dimension for indexing |
in
at locations specified by index