Go to the first, previous, next, last section, table of contents.

Searching histogram ranges

The following functions are used by the access and update routines to locate the bin which corresponds to a given @math{x} coordinate.

Function: int gsl_histogram_find (const gsl_histogram * h, double x, size_t * i)
This function finds and sets the index i to the bin number which covers the coordinate x in the histogram h. The bin is located using a binary search. The search includes an optimization for histograms with uniform range, and will return the correct bin immediately in this case. If x is found in the range of the histogram then the function sets the index i and returns GSL_SUCCESS. If x lies outside the valid range of the histogram then the function returns GSL_EDOM and the error handler is invoked.


Go to the first, previous, next, last section, table of contents.