There are two ways to access histogram bins, either by specifying an x coordinate or by using the bin-index directly. The functions for accessing the histogram through x coordinates use a binary search to identify the bin which covers the appropriate range.
This function updates the histogram h by adding one (1.0) to the bin whose range contains the coordinate x.
If x lies in the valid range of the histogram then the function
returns zero to indicate success. If x is less than the lower
limit of the histogram then the function returns
none of bins are modified. Similarly, if the value of x is greater
than or equal to the upper limit of the histogram then the function
GSL_EDOM, and none of the bins are modified. The error
handler is not called, however, since it is often necessary to compute
histograms for a small range of a larger dataset, ignoring the values
outside the range of interest.
This function is similar to
gsl_histogram_increment but increases
the value of the appropriate bin in the histogram h by the
floating-point number weight.
This function returns the contents of the i-th bin of the histogram
h. If i lies outside the valid range of indices for the
histogram then the error handler is called with an error code of
GSL_EDOM and the function returns 0.
This function finds the upper and lower range limits of the i-th
bin of the histogram h. If the index i is valid then the
corresponding range limits are stored in lower and upper.
The lower limit is inclusive (i.e. events with this coordinate are
included in the bin) and the upper limit is exclusive (i.e. events with
the coordinate of the upper limit are excluded and fall in the
neighboring higher bin, if it exists). The function returns 0 to
indicate success. If i lies outside the valid range of indices for
the histogram then the error handler is called and the function returns
an error code of
These functions return the maximum upper and minimum lower range limits
and the number of bins of the histogram h. They provide a way of
determining these values without accessing the
This function resets all the bins in the histogram h to zero.