Find the union of two sets. The inputs must be one-dimensional arrays. Batching is not currently supported.
A simple example of finding the union of two sets using setUnion() can be seen below:
int h_setA[4] = {1, 2, 3, 3};
int h_setB[4] = {3, 4, 5, 5};
The function can be sped up if it is known that each input is sorted in increasing order and its values are unique.
int h_setA[4] = {1, 2, 3, 4};
int h_setB[4] = {2, 3, 4, 5};
const bool is_unique = true;
◆ af_set_union()
C Interface for finding the union of two arrays.
- Parameters
-
[out] | out | will contain the union of first and second |
[in] | first | is the first input array |
[in] | second | is the second input array |
[in] | is_unique | if true, skips calling unique internally |
- Returns
- AF_SUCCESS if the execution completes properly
◆ setunion()
AFAPI array af::setunion |
( |
const array & |
first, |
|
|
const array & |
second, |
|
|
const bool |
is_unique = false |
|
) |
| |
C++ Interface for finding the union of two arrays.
- Parameters
-
[in] | first | is the first input array |
[in] | second | is the second input array |
[in] | is_unique | if true, skips calling unique internally |
- Returns
- all unique values present in
first
and second
(union) in increasing order
- Deprecated:
- Use setUnion instead
◆ setUnion()
AFAPI array af::setUnion |
( |
const array & |
first, |
|
|
const array & |
second, |
|
|
const bool |
is_unique = false |
|
) |
| |
C++ Interface for finding the union of two arrays.
- Parameters
-
[in] | first | is the first input array |
[in] | second | is the second input array |
[in] | is_unique | if true, skips calling unique internally |
- Returns
- all unique values present in
first
and second
(union) in increasing order