IntervalAxis.qbk 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. [/
  2. Copyright Hans Dembinski 2018 - 2019.
  3. Distributed under the Boost Software License, Version 1.0.
  4. (See accompanying file LICENSE_1_0.txt or copy at
  5. https://www.boost.org/LICENSE_1_0.txt)
  6. ]
  7. [section:IntervalAxis IntervalAxis]
  8. A [*IntervalAxis] is one of two optional refinements of the [link histogram.concepts.Axis [*Axis]] concept, the other one is the [link histogram.concepts.DiscreteAxis DiscreteAxis]. It is for ordered values that form intervals with a well-defined lower and upper edge, and a center. Each bin represents an interval of values.
  9. [heading Associated Types]
  10. * [link histogram.concepts.Axis [*Axis]]
  11. * [link histogram.concepts.DiscreteAxis [*DiscreteAxis]]
  12. [heading Requirements]
  13. * `A` is a type meeting the requirements of [*IntervalAxis]
  14. * `a` is a value of type `A`
  15. * `V` is the type accepted for conversion into an index
  16. * `B` is the type that represents the bin interval
  17. * `v` is a value of type `V`
  18. * `i` is a value of type [headerref boost/histogram/fwd.hpp `boost::histogram::axis::index_type`]
  19. * `j` is a value of type [headerref boost/histogram/fwd.hpp `boost::histogram::axis::real_index_type`]
  20. * `AxisIter` is an /RandomAccessIterator/ over the bins of `A`
  21. * `ReAxisIter` is a reverse /RandomAccessIterator/ over the bins of `A`
  22. [table Valid expressions
  23. [[Expression] [Returns] [Semantics, Pre/Post-conditions]]
  24. [
  25. [`a.value(i)`]
  26. [`V`]
  27. [
  28. Const member function which maps an index to a value. The mapping must be injective: each index must be uniquely mapped to one value. The result of `a.value(a.index(v))` should agree to very high precision with `v` (the mapping may not be exact due to the finite precision of floating point computations). The return value may be a const reference, if the lifetime of the referred object is equal to the lifetime of the axis. `a.value(j)` is expected to return the lower edge of the bin, `a.value(j+1)` the upper edge, and `a.value(j + 0.5)` the center.
  29. ]
  30. ]
  31. [
  32. [`a.bin(i)`]
  33. [`B`]
  34. [
  35. Const member function which returns an instance that represents the current bin. Nothing about the type is required, but it is recommended that the type has the methods `B::lower()`, `B::upper()`, and `B::center()` similar to the types used by the builtin axis models. The return value may be a const reference, if the lifetime of the referred object is equal to the lifetime of the axis.
  36. ]
  37. ]
  38. [
  39. [`s.begin()`]
  40. [`AxisIter`]
  41. [
  42. Const member function which return an iterator to the bin with index `0`.
  43. ]
  44. ]
  45. [
  46. [`s.end()`]
  47. [`AxisIter`]
  48. [
  49. Const member function which returns an iterator to the bin with index `s.size()`.
  50. ]
  51. ]
  52. [
  53. [`s.rbegin()`]
  54. [`ReAxisIter`]
  55. [
  56. Const member function which return a reverse iterator to the bin with index `s.size()-1`.
  57. ]
  58. ]
  59. [
  60. [`s.rend()`]
  61. [`ReAxisIter`]
  62. [
  63. Const member function which returns an iterator to the bin with index `-1`.
  64. ]
  65. ]
  66. ]
  67. [tip The complete iterator interface can be added to a user-defined axis which implements `a.bin(i)` by inheriting from the [classref boost::histogram::axis::iterator_mixin iterator_mixin].]
  68. [heading Models]
  69. * [classref boost::histogram::axis::regular]
  70. * [classref boost::histogram::axis::variable]
  71. * [classref boost::histogram::axis::integer], if first template parameter is a floating point type
  72. [endsect]