...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::histogram::axis::regular — Axis for equidistant intervals on the real line.
// In header: <boost/histogram/axis/regular.hpp> template<typename Value, typename Transform, typename MetaData, typename Options> class regular : public boost::histogram::axis::iterator_mixin< regular< Value, Transform, MetaData, Options > >, public boost::histogram::axis::metadata_base< MetaData > { public: // construct/copy/destruct regular() = default; regular(transform_type, unsigned, value_type, value_type, metadata_type = {}); regular(unsigned, value_type, value_type, metadata_type = {}); template<typename T> regular(transform_type, step_type< T >, value_type, value_type, metadata_type = {}); template<typename T> regular(step_type< T >, value_type, value_type, metadata_type = {}); regular(const regular &, index_type, index_type, unsigned); // public member functions const transform_type & transform() const noexcept; index_type index(value_type) const noexcept; auto update(value_type) noexcept; value_type value(real_index_type) const noexcept; decltype(auto) bin(index_type) const noexcept; index_type size() const noexcept; template<typename V, typename T, typename M, typename O> bool operator==(const regular< V, T, M, O > &) const noexcept; template<typename V, typename T, typename M, typename O> bool operator!=(const regular< V, T, M, O > &) const noexcept; template<typename Archive> void serialize(Archive &, unsigned); // public static functions static constexpr unsigned options() noexcept; };
The most common binning strategy. Very fast. Binning is a O(1) operation.
typename Value
input value type, must be floating point.
typename Transform
builtin or user-defined transform type.
typename MetaData
type to store meta data.
typename Options
see boost::histogram::axis::option (all values allowed).
regular
public
construct/copy/destructregular() = default;
regular(transform_type trans, unsigned n, value_type start, value_type stop, metadata_type meta = {});Construct n bins over real transformed range [start, stop).
Parameters: |
|
regular(unsigned n, value_type start, value_type stop, metadata_type meta = {});Construct n bins over real range [start, stop).
Parameters: |
|
template<typename T> regular(transform_type trans, step_type< T > step, value_type start, value_type stop, metadata_type meta = {});Construct bins with the given step size over real transformed range [start, stop).
The axis computes the number of bins as n = abs(stop - start) / step, rounded down. This means that stop is an upper limit to the actual value (start + n * step).
Parameters: |
|
template<typename T> regular(step_type< T > step, value_type start, value_type stop, metadata_type meta = {});Construct bins with the given step size over real range [start, stop).
The axis computes the number of bins as n = abs(stop - start) / step, rounded down. This means that stop is an upper limit to the actual value (start + n * step).
Parameters: |
|
regular(const regular & src, index_type begin, index_type end, unsigned merge);Constructor used by algorithm::reduce to shrink and rebin (not for users).
regular
public member functionsconst transform_type & transform() const noexcept;Return instance of the transform type.
index_type index(value_type x) const noexcept;Return index for value argument.
auto update(value_type x) noexcept;Returns index and shift (if axis has grown) for the passed argument.
value_type value(real_index_type i) const noexcept;Return value for fractional index argument.
decltype(auto) bin(index_type idx) const noexcept;Return bin for index argument.
index_type size() const noexcept;Returns the number of bins, without over- or underflow.
template<typename V, typename T, typename M, typename O> bool operator==(const regular< V, T, M, O > & o) const noexcept;
template<typename V, typename T, typename M, typename O> bool operator!=(const regular< V, T, M, O > & o) const noexcept;
template<typename Archive> void serialize(Archive & ar, unsigned);