Blame view

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