ArrayFire: setunique

Return the unique values in an array. More...

Functions

AFAPI array setUnique (const array &in, const bool is_sorted=false)
 C++ Interface to return the unique values in an array. More...
 
AFAPI af_err af_set_unique (af_array *out, const af_array in, const bool is_sorted)
 C Interface to return the unique values in an array. More...
 
AFAPI array setunique (const array &in, const bool is_sorted=false)
 

Return the unique values in an array.

The input must be a one-dimensional array. Batching is not currently supported.

An example, unsorted:

int h_set[6] = {3, 2, 3, 3, 2, 1};

A multi dimensional data container.

The function can be sped up if it is known that the inputs are sorted.

An example, sorted (ascending):

int h_set[6] = {1, 2, 2, 3, 3, 3};

const bool is_sorted = true;

af::array unique = setUnique(set, is_sorted);

The inputs can be sorted in ascending or descending order.

An example, sorted (descending):

int h_set[6] = {3, 3, 3, 2, 2, 1};

const bool is_sorted = true;

af::array unique = setUnique(set, is_sorted);

◆ af_set_unique()

C Interface to return the unique values in an array.

Parameters
[out]outunique values
[in]ininput array
[in]is_sortedif true, skip the sorting steps internally
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

C++ Interface to return the unique values in an array.

Parameters
[in]ininput array
[in]is_sortedif true, skip the sorting steps internally
Returns
unique values

◆ setunique()

C++ Interface to return the unique values in an array.

Parameters
[in]ininput array
[in]is_sortedif true, skip the sorting steps internally
Returns
unique values
Deprecated:
Use setUnique instead