boostorg / histogram

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

Generalize indexed #321

Closed HDembinski closed 3 years ago

HDembinski commented 3 years ago

Closes #277

auto ax = axis::integer<>(0, 4);
auto ay = axis::integer<>(0, 3);

auto h = make(Tag(), ax, ay);
for (auto&& x : indexed(h, coverage::all)) x = x.index(0) + x.index(1);

int range[2][2] = {{1, 3}, {0, 2}};
auto ir = indexed(h, range);
auto sum = std::accumulate(ir.begin(), ir.end(), 0); // returns 1 + 2 + 2 + 3