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

PrevUpHomeNext

Class template regular

boost::histogram::axis::regular — Axis for equidistant intervals on the real line.

Synopsis

// 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 metadata_base_t< MetaData >
{
public:
  // construct/copy/destruct
  regular() = default;
  regular(transform_type, unsigned, value_type, value_type, 
          metadata_type = {}, options_type = {});
  regular(unsigned, value_type, value_type, metadata_type = {}, 
          options_type = {});
  template<typename T> 
    regular(transform_type, step_type< T >, value_type, value_type, 
            metadata_type = {}, options_type = {});
  template<typename T> 
    regular(step_type< T >, value_type, value_type, metadata_type = {}, 
            options_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;
  std::pair< index_type, index_type > 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;
};

Description

The most common binning strategy. Very fast. Binning is a O(1) operation.

If the axis has an overflow bin (the default), a value on the upper edge of the last bin is put in the overflow bin. The axis range represents a semi-open interval.

If the overflow bin is deactivated, then a value on the upper edge of the last bin is still counted towards the last bin. The axis range represents a closed interval. This is the desired behavior for random numbers drawn from a bounded interval, which is usually closed.

Template Parameters

  1. typename Value

    input value type, must be floating point.

  2. typename Transform

    builtin or user-defined transform type.

  3. typename MetaData

    type to store meta data.

  4. typename Options

    see boost::histogram::axis::option.

regular public construct/copy/destruct

  1. regular() = default;
  2. regular(transform_type trans, unsigned n, value_type start, value_type stop, 
            metadata_type meta = {}, options_type options = {});
    Construct n bins over real transformed range [start, stop).

    Parameters:

    meta

    description of the axis (optional).

    n

    number of bins.

    options

    see boost::histogram::axis::option (optional).

    start

    low edge of first bin.

    stop

    high edge of last bin.

    trans

    transform instance to use.

  3. regular(unsigned n, value_type start, value_type stop, 
            metadata_type meta = {}, options_type options = {});
    Construct n bins over real range [start, stop).

    Parameters:

    meta

    description of the axis (optional).

    n

    number of bins.

    options

    see boost::histogram::axis::option (optional).

    start

    low edge of first bin.

    stop

    high edge of last bin.

  4. template<typename T> 
      regular(transform_type trans, step_type< T > step, value_type start, 
              value_type stop, metadata_type meta = {}, 
              options_type options = {});
    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:

    meta

    description of the axis (optional).

    options

    see boost::histogram::axis::option (optional).

    start

    low edge of first bin.

    step

    width of a single bin.

    stop

    upper limit of high edge of last bin (see below).

    trans

    transform instance to use.

  5. template<typename T> 
      regular(step_type< T > step, value_type start, value_type stop, 
              metadata_type meta = {}, options_type options = {});
    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:

    meta

    description of the axis (optional).

    options

    see boost::histogram::axis::option (optional).

    start

    low edge of first bin.

    step

    width of a single bin.

    stop

    upper limit of high edge of last bin (see below).

  6. 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 functions

  1. const transform_type & transform() const noexcept;
    Return instance of the transform type.
  2. index_type index(value_type x) const noexcept;
    Return index for value argument.
  3. std::pair< index_type, index_type > update(value_type x) noexcept;
    Returns index and shift (if axis has grown) for the passed argument.
  4. value_type value(real_index_type i) const noexcept;
    Return value for fractional index argument.
  5. decltype(auto) bin(index_type idx) const noexcept;
    Return bin for index argument.
  6. index_type size() const noexcept;
    Returns the number of bins, without over- or underflow.
  7. template<typename V, typename T, typename M, typename O> 
      bool operator==(const regular< V, T, M, O > & o) const noexcept;
  8. template<typename V, typename T, typename M, typename O> 
      bool operator!=(const regular< V, T, M, O > & o) const noexcept;
  9. template<typename Archive> void serialize(Archive & ar, unsigned);

regular public static functions

  1. static constexpr unsigned options() noexcept;
    Returns the options.

PrevUpHomeNext