boostorg / histogram

Fast multi-dimensional generalized histogram with convenient interface for C++14
Boost Software License 1.0
315 stars 73 forks source link

Flowless histograms unslicable #257

Closed henryiii closed 4 years ago

henryiii commented 4 years ago

You currently cannot slice an axes that has flow bins turned off:

using namespace boost::histogram;

auto h = make_histogram(
    axis::integer<int, use_default, axis::option::none_t>(0, 10)
);

auto h1 = algorithm::reduce(h, algorithm::slice(3,6));
terminate called after throwing an instance of 'boost::wrapexcept<std::out_of_range>'
  what():  at least one index out of bounds

(Seen on wandbox with 1.71 and in Python boost-histogram current develop).

HDembinski commented 4 years ago

Huh, that is very strange, thanks for reporting the bug.

HDembinski commented 4 years ago

Turns out reduce does not work for any axis without underflow/overflow. I am working on a fix.

HDembinski commented 4 years ago

Fixed in develop

henryiii commented 4 years ago

Works, thank you for the fast fix!

HDembinski commented 4 years ago

Thank you for reporting this nasty bug. At least it failed instead of giving a wrong result...