]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/histogram/make_profile.hpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / boost / histogram / make_profile.hpp
1 // Copyright 2018 Hans Dembinski
2 //
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt
5 // or copy at http://www.boost.org/LICENSE_1_0.txt)
6
7 #ifndef BOOST_HISTOGRAM_MAKE_PROFILE_HPP
8 #define BOOST_HISTOGRAM_MAKE_PROFILE_HPP
9
10 #include <boost/histogram/accumulators/mean.hpp>
11 #include <boost/histogram/accumulators/weighted_mean.hpp>
12 #include <boost/histogram/fwd.hpp>
13 #include <boost/histogram/make_histogram.hpp>
14
15 /**
16 \file boost/histogram/make_profile.hpp
17 Collection of factory functions to conveniently create profiles.
18
19 Profiles are histograms which accept an additional sample and compute the mean of the
20 sample in each cell.
21 */
22
23 namespace boost {
24 namespace histogram {
25
26 /**
27 Make profle from compile-time axis configuration.
28 @param axis First axis instance.
29 @param axes Other axis instances.
30 */
31 template <class Axis, class... Axes, class = detail::requires_axis<Axis>>
32 auto make_profile(Axis&& axis, Axes&&... axes) {
33 return make_histogram_with(profile_storage(), std::forward<Axis>(axis),
34 std::forward<Axes>(axes)...);
35 }
36
37 /**
38 Make profle from compile-time axis configuration which accepts weights.
39 @param axis First axis instance.
40 @param axes Other axis instances.
41 */
42 template <class Axis, class... Axes, class = detail::requires_axis<Axis>>
43 auto make_weighted_profile(Axis&& axis, Axes&&... axes) {
44 return make_histogram_with(weighted_profile_storage(), std::forward<Axis>(axis),
45 std::forward<Axes>(axes)...);
46 }
47
48 /**
49 Make profile from iterable range.
50 @param iterable Iterable range of axis objects.
51 */
52 template <class Iterable, class = detail::requires_sequence_of_any_axis<Iterable>>
53 auto make_profile(Iterable&& iterable) {
54 return make_histogram_with(profile_storage(), std::forward<Iterable>(iterable));
55 }
56
57 /**
58 Make profile from iterable range which accepts weights.
59 @param iterable Iterable range of axis objects.
60 */
61 template <class Iterable, class = detail::requires_sequence_of_any_axis<Iterable>>
62 auto make_weighted_profile(Iterable&& iterable) {
63 return make_histogram_with(weighted_profile_storage(),
64 std::forward<Iterable>(iterable));
65 }
66
67 /**
68 Make profile from iterator interval.
69 @param begin Iterator to range of axis objects.
70 @param end Iterator to range of axis objects.
71 */
72 template <class Iterator, class = detail::requires_iterator<Iterator>>
73 auto make_profile(Iterator begin, Iterator end) {
74 return make_histogram_with(profile_storage(), begin, end);
75 }
76
77 /**
78 Make profile from iterator interval which accepts weights.
79 @param begin Iterator to range of axis objects.
80 @param end Iterator to range of axis objects.
81 */
82 template <class Iterator, class = detail::requires_iterator<Iterator>>
83 auto make_weighted_profile(Iterator begin, Iterator end) {
84 return make_histogram_with(weighted_profile_storage(), begin, end);
85 }
86
87 } // namespace histogram
88 } // namespace boost
89
90 #endif