MCPcopy Create free account
hub / github.com/AdaptiveCpp/AdaptiveCpp / count

Function count

include/hipSYCL/algorithms/algorithm.hpp:856–868  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

854
855template<class ForwardIt, class T>
856sycl::event count(sycl::queue &q, util::allocation_group &scratch_allocations,
857 ForwardIt first, ForwardIt last,
858 typename std::iterator_traits<ForwardIt>::difference_type *out,
859 const T& value, const std::vector<sycl::event> &deps = {}) {
860
861 using DiffT = typename std::iterator_traits<ForwardIt>::difference_type;
862 using ValueT = typename std::iterator_traits<ForwardIt>::value_type;
863
864 return transform_reduce(q, scratch_allocations, first, last, out,
865 DiffT{}, std::plus<>{},
866 [value](ValueT x) {return (x == value ? 1 : 0);},
867 deps);
868}
869
870template<class ForwardIt, class UnaryPredicate>
871sycl::event count_if(sycl::queue &q, util::allocation_group &scratch_allocations,

Callers 1

test_countFunction · 0.50

Calls 1

transform_reduceFunction · 0.70

Tested by 1

test_countFunction · 0.40