]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/histogram/detail/axes.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / histogram / detail / axes.hpp
index 10c5e9a9665fb499959d4dd30e9431da4bd457bd..5e4ee5e1ece7dc0584c84ceb316f849b872bb33c 100644 (file)
@@ -349,7 +349,21 @@ std::size_t bincount(const T& axes) {
   return n;
 }
 
-// initial offset for the linear index
+/** Initial offset for the linear index.
+
+  This precomputes an offset for the global index so that axis index = -1 addresses the
+  first entry in the storage. Example: one-dim. histogram. The offset is 1, stride is 1,
+  and global_index = offset + axis_index * stride == 0 addresses the first element of
+  the storage.
+
+  Using the offset makes the hot inner loop that computes the global_index simpler and
+  thus faster, because we do not have to branch for each axis to check whether it has
+  an underflow bin.
+
+  The offset is set to an invalid value when the histogram contains at least one growing
+  axis, because this optimization then cannot be used. See detail/linearize.hpp, in this
+  case linearize_growth is called.
+*/
 template <class T>
 std::size_t offset(const T& axes) {
   std::size_t n = 0;