1 // Copyright 2018 Hans Dembinski
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)
7 #ifndef BOOST_HISTOGRAM_MAKE_PROFILE_HPP
8 #define BOOST_HISTOGRAM_MAKE_PROFILE_HPP
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>
16 \file boost/histogram/make_profile.hpp
17 Collection of factory functions to conveniently create profiles.
19 Profiles are histograms which accept an additional sample and compute the mean of the
27 Make profle from compile-time axis configuration.
28 @param axis First axis instance.
29 @param axes Other axis instances.
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)...);
38 Make profle from compile-time axis configuration which accepts weights.
39 @param axis First axis instance.
40 @param axes Other axis instances.
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)...);
49 Make profile from iterable range.
50 @param iterable Iterable range of axis objects.
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));
58 Make profile from iterable range which accepts weights.
59 @param iterable Iterable range of axis objects.
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));
68 Make profile from iterator interval.
69 @param begin Iterator to range of axis objects.
70 @param end Iterator to range of axis objects.
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);
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.
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);
87 } // namespace histogram