@@ -562,5 +562,40 @@ comparator and their associated values maintain the relative order as in the ori
562
562
and ``Comparator `` must satisfy the requirements for the ``Compare `` parameter of ``std::sort ``,
563
563
as defined by the `C++ Standard `_.
564
564
565
+ .. code :: cpp
566
+
567
+ template <typename Policy, typename InputIt, typename Size, typename ValueType,
568
+ typename OutputIt>
569
+ OutputIt
570
+ histogram(Policy&& exec, InputIt start, InputIt end, Size num_intervals,
571
+ ValueType first_interval_begin, ValueType last_interval_end, OutputIt histogram_first); // (1)
572
+
573
+ template <typename Policy, typename InputIt1, typename InputIt2, typename OutputIt>
574
+ OutputIt
575
+ histogram(Policy&& exec, InputIt1 start, InputIt1 end, InputIt2 boundary_start,
576
+ InputIt2 boundary_end, OutputIt histogram_first); // (2)
577
+
578
+ ``oneapi::dpl::histogram `` computes the histogram over the data in ``[start, end) ``
579
+ by counting the number of elements that map to each of a set of bins and storing the counts into
580
+ the output sequence starting from ``histogram_first ``. Input values that do not map to a defined
581
+ bin are skipped silently. The value type of ``OutputIt `` must be an integral type of sufficient
582
+ size to store the counts of the histogram without overflow. The return value is an iterator targeting
583
+ past the last element of the output sequence starting from ``histogram_first ``.
584
+
585
+ 1. The elements of ``[start, end) `` are mapped into ``num_intervals `` bins that evenly divide the range
586
+ ``[first_interval_begin, last_interval_end) ``. Each bin is of size
587
+ ``bin_size = (last_interval_end - first_interval_begin) / num_intervals `` as represented by a real
588
+ number without rounding or truncation. An input element ``start[i] `` maps to a bin
589
+ ``histogram_first[j] `` if and only if
590
+ ``(first_interval_begin + j * bin_size <= start[i]) && (start[i] < first_interval_begin + (j + 1) * bin_size) ``.
591
+ Both `ValueType ` and the value type of ``InputIt `` must be arithmetic types.
592
+
593
+ 2. The elements of ``[start, end) `` are mapped into ``std::distance(boundary_start, boundary_end) - 1) ``
594
+ bins defined by the values in ``[boundary_start, boundary_end) ``. An input
595
+ element ``start[i] `` maps to a bin ``histogram_first[j] `` if and only if
596
+ ``(boundary_start[j] <= start[i]) && (start[i] < boundary_start[j + 1]) ``. The value types
597
+ of ``InputIt1 `` and ``InputIt2 `` must be arithmetic types. The values in
598
+ ``[boundary_start, boundary_end) `` must be sorted with respect to ``operator< ``.
599
+
565
600
.. _`C++ Standard` : https://isocpp.org/std/the-standard
566
601
.. _`SYCL` : https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html
0 commit comments