Find the intersection of two sets. More...
Functions | |
AFAPI array | setIntersect (const array &first, const array &second, const bool is_unique=false) |
C++ Interface for finding the intersection of two arrays. | |
AFAPI af_err | af_set_intersect (af_array *out, const af_array first, const af_array second, const bool is_unique) |
C Interface for finding the intersection of two arrays. | |
AFAPI array | setintersect (const array &first, const array &second, const bool is_unique=false) |
Find the intersection of two sets.
The inputs must be one-dimensional arrays. Batching is not currently supported.
A simple example of finding the intersection of two sets using setIntersect() can be seen below:
The function can be sped up if it is known that each input is sorted in increasing order and its values are unique.
AFAPI af_err af_set_intersect | ( | af_array * | out, |
const af_array | first, | ||
const af_array | second, | ||
const bool | is_unique | ||
) |
C Interface for finding the intersection of two arrays.
[out] | out | will contain the intersection 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 |
AFAPI array setIntersect | ( | const array & | first, |
const array & | second, | ||
const bool | is_unique = false |
||
) |
C++ Interface for finding the intersection of two arrays.
[in] | first | is the first input array |
[in] | second | is the second input array |
[in] | is_unique | if true, skips calling unique internally |
first
and second(intersection)
in increasing order AFAPI array setintersect | ( | const array & | first, |
const array & | second, | ||
const bool | is_unique = false |
||
) |
C++ Interface for finding the intersection of two arrays.
[in] | first | is the first input array |
[in] | second | is the second input array |
[in] | is_unique | if true, skips calling unique internally |
first
and second(intersection)
in increasing order