MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / setUnique

Function setUnique

src/backend/opencl/set.cpp:41–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39
40template<typename T>
41Array<T> setUnique(const Array<T> &in, const bool is_sorted) {
42 try {
43 Array<T> out = copyArray<T>(in);
44
45 compute::command_queue queue(getQueue()());
46
47 compute::buffer out_data((*out.get())());
48
49 compute::buffer_iterator<type_t<T>> begin(out_data, 0);
50 compute::buffer_iterator<type_t<T>> end(out_data, out.elements());
51
52 if (!is_sorted) { compute::sort(begin, end, queue); }
53
54 end = compute::unique(begin, end, queue);
55
56 out.resetDims(dim4(std::distance(begin, end), 1, 1, 1));
57
58 return out;
59 } catch (const std::exception &ex) { AF_ERROR(ex.what(), AF_ERR_INTERNAL); }
60}
61
62template<typename T>
63Array<T> setUnion(const Array<T> &first, const Array<T> &second,

Callers 2

setUnionFunction · 0.70
setIntersectFunction · 0.70

Calls 7

sortFunction · 0.70
getQueueFunction · 0.50
dim4Class · 0.50
distanceFunction · 0.50
getMethod · 0.45
elementsMethod · 0.45
resetDimsMethod · 0.45

Tested by

no test coverage detected