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

Function count_if

include/hipSYCL/algorithms/algorithm.hpp:871–883  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

869
870template<class ForwardIt, class UnaryPredicate>
871sycl::event count_if(sycl::queue &q, util::allocation_group &scratch_allocations,
872 ForwardIt first, ForwardIt last,
873 typename std::iterator_traits<ForwardIt>::difference_type *out,
874 UnaryPredicate p, const std::vector<sycl::event> &deps = {}) {
875
876 using DiffT = typename std::iterator_traits<ForwardIt>::difference_type;
877 using ValueT = typename std::iterator_traits<ForwardIt>::value_type;
878
879 return transform_reduce(q, scratch_allocations, first, last, out,
880 DiffT{}, std::plus<>{},
881 [p](ValueT x) {return p(x) ? 1 : 0;},
882 deps);
883}
884
885template <class ForwardIt1, class ForwardIt2, class BinaryPredicate>
886sycl::event mismatch(sycl::queue &q, util::allocation_group &scratch_allocations,

Callers 1

test_count_ifFunction · 0.50

Calls 1

transform_reduceFunction · 0.70

Tested by 1

test_count_ifFunction · 0.40