Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the develop branch, built from commit a0dc1f9511.
PrevUpHomeNext

Function template reduce

boost::histogram::algorithm::reduce — Shrink, slice, and/or rebin axes of a histogram.

Synopsis

// In header: <boost/histogram/algorithm/reduce.hpp>


template<typename Histogram, class... Ts> 
  Histogram reduce(const Histogram & hist, const reduce_command & opt, 
                   const Ts &... opts);

Description

Returns a new reduced histogram and leaves the original histogram untouched.

The commands rebin andshrink orslice for the same axis are automatically combined, this is not an error. Passing ashrink and aslice command for the same axis or tworebin 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.

Parameters:

hist

original histogram.

opt

first reduce command; one of shrink,slice,rebin,shrink_and_rebin, orslice_or_rebin.

opts

more reduce commands.


PrevUpHomeNext