Boost logo

Boost :

Subject: Re: [boost] Formal Review of Proposed Boost.Histogram Library Starts TODAY
From: Hans Dembinski (hans.dembinski_at_[hidden])
Date: 2018-09-26 16:23:26

> On 26. Sep 2018, at 15:07, <a.hagen-zanker_at_[hidden]> <a.hagen-zanker_at_[hidden]> wrote:

>>> "value()" seems to be a misnomer, since it is used to print a label for the bin (in your second example: getting_started_listing_02.cpp line 41). To me it is not logical for a bin to have a value() member function, since a bin really is a domain of values.
>> That depends on the axis. axis::category has bins which represent a single value, not a continuum.
> A single value, a set of values and a continuum of values are all domains of values. A bin logically is a domain of values.

Histogram uses a generalized bin concept, where a single bin can represent a single value on an axis or a domain of values. You cannot implement a category axis with your narrow concept of bin. When you have an category axis that represents the sequence "red", "green", "blue", then what's the domain for the bin "red"?

>> That's the example you are referring to. Same for axis::integer. The other axes types use a different kind of bin type that represents an interval. That's why there are two helper templates interval_view and value_view. Use the former for axis types whose bins represent an interval and the latter for axis types whose bins represent a single item.
> I don't agree, a bin always is a domain of values and there are more options than interval and value. For instance, I could chose to have bins for odd and even integers. I think you need an interface for the generic case: a bin is a domain.

You are free to define your bin_type in almost any way you like.

>>> operator int() seems inappropriate because why would a bin need to
>>> know its index? That should logically be the responsibility of the
>>> axis
>> I explained the benefit in an answer to Steven.
> But, I don't think that convenience is sufficient reason. It is not logical and brings about further questions. A histogram is a relatively simple mathematical construct, it must be possible to support it with concepts that are rigorously logical, not just convenient.

Why is it illogical that a bin knows its own index? A bin both represents a location on an axis and a value or value range on that axis.

The library is not forcing you to define your own bins in this way.

Boost list run by bdawes at, gregod at, cpdaniel at, john at