...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
namespace boost { namespace histogram { namespace accumulators { template<typename RealType> class mean; } } }
namespace boost { namespace histogram { namespace accumulators { template<typename RealType> class sum; } } }
namespace boost { namespace histogram { namespace algorithm { template<typename A, typename S> auto sum(const histogram< A, S > &); } } }
namespace boost { namespace histogram { namespace accumulators { template<typename RealType> class weighted_mean; } } }
namespace boost { namespace histogram { namespace accumulators { template<typename RealType> class weighted_sum; } } }
namespace boost { namespace histogram { namespace algorithm { template<typename A, typename S, unsigned N, typename... Ns> auto project(const histogram< A, S > &, std::integral_constant< unsigned, N >, Ns...); template<typename A, typename S, typename Iterable, typename = detail::requires_iterable<Iterable> > auto project(const histogram< A, S > &, const Iterable &); } } }
namespace boost { namespace histogram { namespace algorithm { struct reduce_option; auto shrink_and_rebin(unsigned, double, double, unsigned); auto shrink(unsigned, double, double); auto rebin(unsigned, unsigned); auto shrink_and_rebin(double, double, unsigned); auto shrink(double, double); auto rebin(unsigned); template<typename Histogram, typename Iterable> decltype(auto) reduce(const Histogram &, const Iterable &); template<typename Histogram, class... Ts> decltype(auto) reduce(const Histogram &, const reduce_option &, Ts &&...); } } }
namespace boost { namespace histogram { namespace axis { template<typename Value, typename MetaData, typename Options, typename Allocator> class category; } } }
namespace boost { namespace histogram { namespace axis { template<typename Value, typename MetaData, typename Options> class integer; } } }
namespace boost { namespace histogram { namespace axis { template<typename Axis> class interval_view; } } }
namespace boost { namespace histogram { namespace axis { template<typename Axis> class iterator; template<typename Derived> class iterator_mixin; } } }
Options for builtin axis types.
Options circular
and growth
are mutually exclusive. Options circular
and underflow
are mutually exclusive.
namespace boost { namespace histogram { namespace axis { namespace option { template<unsigned Pos> struct bit; template<unsigned Bits> struct bitset; typedef bitset< 0 > none_t; // All options off. typedef bit< 0 > underflow_t; // Axis has an underflow bin. Mutually exclusive withcircular
. typedef bit< 1 > overflow_t; // Axis has overflow bin. typedef bit< 2 > circular_t; // Axis is circular. Mutually exclusive withgrowth
andunderflow
. typedef bit< 3 > growth_t; // Axis can grow. Mutually exclusive withcircular
. constexpr none_t none; // Instance ofnone_t
. constexpr underflow_t underflow; // Instance ofunderflow_t
. constexpr overflow_t overflow; // Instance ofoverflow_t
. constexpr circular_t circular; // Instance ofcircular_t
. constexpr growth_t growth; // Instance ofgrowth_t
. // Set union of the axis option arguments. template<unsigned B1, unsigned B2> constexpr auto operator|(bitset< B1 >, bitset< B2 >); // Set intersection of the option arguments. template<unsigned B1, unsigned B2> constexpr auto operator&(bitset< B1 >, bitset< B2 >); // Set difference of the option arguments. template<unsigned B1, unsigned B2> constexpr auto operator-(bitset< B1 >, bitset< B2 >); } } } }
namespace boost { namespace histogram { namespace axis { template<typename RealType> class polymorphic_bin; } } }
namespace boost { namespace histogram { namespace axis { template<typename Value, typename Transform, typename MetaData, typename Options> class regular; typedef unspecified circular; // Helper function to mark argument as step size. template<typename T> auto step(T && t); namespace transform { struct id; struct log; struct pow; struct sqrt; } } } }
namespace boost { namespace histogram { namespace axis { namespace traits { typedef unspecified static_options; template<typename Axis> decltype(auto) metadata(Axis &&); template<typename Axis> constexpr unsigned options(const Axis &); template<typename Axis> constexpr index_type extent(const Axis &); template<typename Axis> decltype(auto) value(const Axis &, real_index_type); template<typename Result, typename Axis> Result value_as(const Axis &, real_index_type); template<typename Axis, typename U> auto index(const Axis &, const U &); template<class... Ts, typename U> auto index(const variant< Ts... > &, const U &); template<typename Axis, typename U> std::pair< int, int > update(Axis &, const U &); template<class... Ts, typename U> auto update(variant< Ts... > &, const U &); template<typename Axis> decltype(auto) width(const Axis &, index_type); template<typename Result, typename Axis> Result width_as(const Axis &, index_type); } } } }
namespace boost { namespace histogram { namespace axis { template<typename Value, typename MetaData, typename Options, typename Allocator> class variable; } } }
namespace boost { namespace histogram { namespace axis { template<class... Ts> class variant; // Returns pointer to T in variant or null pointer if type does not match. template<typename T, class... Us> T * get_if(variant< Us... > * v); // Returns pointer to const T in variant or null pointer if type does not match. template<typename T, class... Us> const T * get_if(const variant< Us... > * v); // Apply visitor to variant. template<typename Visitor, typename Variant> auto visit(Visitor && vis, Variant && var); // Return lvalue reference to T, throws unspecified exception if type does not match. template<typename T, class... Us> T & get(variant< Us... > & v); // Return rvalue reference to T, throws unspecified exception if type does not match. template<typename T, class... Us> T && get(variant< Us... > && v); // Return const reference to T, throws unspecified exception if type does not match. template<typename T, class... Us> const T & get(const variant< Us... > & v); } } }
Forward declarations, tag types and type aliases.
namespace boost { namespace histogram { typedef storage_adaptor< std::vector< T, A > > dense_storage; // Vector-like storage for fast zero-overhead access to cells. typedef unlimited_storage<> default_storage; // Default storage, optimized for unweighted histograms. typedef dense_storage< accumulators::weighted_sum<> > weight_storage; // Dense storage which tracks sums of weights and a variance estimate. typedef dense_storage< accumulators::mean<> > profile_storage; // Dense storage which tracks means of samples in each cell. typedef dense_storage< accumulators::weighted_mean<> > weighted_profile_storage; // Dense storage which tracks means of weighted samples in each cell. namespace axis { struct null_type; typedef int index_type; // Integral type for axis indices. typedef double real_index_type; // Real type for axis indices. } } }
namespace boost { namespace histogram { template<typename Axes, typename Storage> class histogram; template<typename A1, typename S1, typename A2, typename S2> auto operator+(const histogram< A1, S1 > & a, const histogram< A2, S2 > & b); template<typename A1, typename S1, typename A2, typename S2> auto operator*(const histogram< A1, S1 > & a, const histogram< A2, S2 > & b); template<typename A1, typename S1, typename A2, typename S2> auto operator-(const histogram< A1, S1 > & a, const histogram< A2, S2 > & b); template<typename A1, typename S1, typename A2, typename S2> auto operator/(const histogram< A1, S1 > & a, const histogram< A2, S2 > & b); template<typename A, typename S> auto operator*(const histogram< A, S > & h, double x); template<typename A, typename S> auto operator*(double x, const histogram< A, S > & h); template<typename A, typename S> auto operator/(const histogram< A, S > & h, double x); template<typename T> auto weight(T &&); template<typename... Ts> auto sample(Ts &&...); } }
namespace boost { namespace histogram { template<typename Histogram> class indexed_range; enum coverage; template<typename Histogram> auto indexed(Histogram &&, coverage = coverage::inner); } }
namespace boost { namespace histogram { namespace literals { // Suffix operator to generate literal compile-time numbers, 0_c, 12_c, etc. template<char... digits> auto operator""_c(); } } }
Collection of factory functions to conveniently create histograms.
namespace boost { namespace histogram { template<typename Storage, typename Axis, class... Axes, typename = detail::requires_axis<Axis> > auto make_histogram_with(Storage &&, Axis &&, Axes &&...); template<typename Axis, class... Axes, typename = detail::requires_axis<Axis> > auto make_histogram(Axis &&, Axes &&...); template<typename Axis, class... Axes, typename = detail::requires_axis<Axis> > auto make_weighted_histogram(Axis &&, Axes &&...); template<typename Storage, typename Iterable, typename = detail::requires_sequence_of_any_axis<Iterable> > auto make_histogram_with(Storage &&, Iterable &&); template<typename Iterable, typename = detail::requires_sequence_of_any_axis<Iterable> > auto make_histogram(Iterable &&); template<typename Iterable, typename = detail::requires_sequence_of_any_axis<Iterable> > auto make_weighted_histogram(Iterable &&); template<typename Storage, typename Iterator, typename = detail::requires_iterator<Iterator> > auto make_histogram_with(Storage &&, Iterator, Iterator); template<typename Iterator, typename = detail::requires_iterator<Iterator> > auto make_histogram(Iterator, Iterator); template<typename Iterator, typename = detail::requires_iterator<Iterator> > auto make_weighted_histogram(Iterator, Iterator); } }
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 { template<typename Axis, typename... Axes, typename = detail::requires_axis<Axis> > auto make_profile(Axis &&, Axes &&...); template<typename Axis, typename... Axes, typename = detail::requires_axis<Axis> > auto make_weighted_profile(Axis &&, Axes &&...); template<typename Iterable, typename = detail::requires_sequence_of_any_axis<Iterable> > auto make_profile(Iterable &&); template<typename Iterable, typename = detail::requires_sequence_of_any_axis<Iterable> > auto make_weighted_profile(Iterable &&); template<typename Iterator, typename = detail::requires_iterator<Iterator> > auto make_profile(Iterator, Iterator); template<typename Iterator, typename = detail::requires_iterator<Iterator> > auto make_weighted_profile(Iterator, Iterator); } }
Implemenations of the serialization functions using Boost.Serialization.
namespace boost { namespace histogram { template<typename T> class storage_adaptor; } }
namespace boost { namespace histogram { template<typename Allocator> class unlimited_storage; } }
namespace boost { namespace histogram { struct unsafe_access; } }