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 an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Function template reduce

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

Synopsis

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


template<typename Histogram, typename Iterable> 
  Histogram reduce(const Histogram & hist, const Iterable & options);

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 aninvalid_argument exception. Trying to reducing a non-reducible axis triggers aninvalid_argument exception. Histograms with non-reducible axes can still be reduced along the other axes that are reducible.

An overload allows one to pass reduce_command as positional arguments.

Parameters:

hist

original histogram.

options

iterable sequence of reduce commands: shrink,slice,rebin,shrink_and_rebin, orslice_and_rebin. The element type of the iterable should bereduce_command.


PrevUpHomeNext