boost::histogram::algorithm::reduce — Shrink, slice, and/or rebin axes of a histogram.
// In header: <boost/histogram/algorithm/reduce.hpp> template<typename Histogram, class... Ts> Histogram reduce(const Histogram & hist, const reduce_command & opt, const Ts &... opts);
Returns a new reduced histogram and leaves the original histogram untouched.
slice for the same axis are automatically combined, this is not an error. Passing a
shrink and a
slice command for the same axis or two
rebin commands triggers an invalid_argument exception. It is safe to reduce histograms with some axis that are not reducible along the other axes. Trying to reducing a non-reducible axis triggers an invalid_argument exception.
An overload allows one to pass an iterable of reduce_command.