Next: Searching histogram ranges, Previous: Copying Histograms, Up: Histograms [Index]

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.

- Function:
*int***gsl_histogram_increment***(gsl_histogram **`h`, double`x`) 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`GSL_EDOM`

, and 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 returns`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.

- Function:
*int***gsl_histogram_accumulate***(gsl_histogram **`h`, double`x`, double`weight`) 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`.

- Function:
*double***gsl_histogram_get***(const gsl_histogram **`h`, size_t`i`) 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.

- Function:
*int***gsl_histogram_get_range***(const gsl_histogram **`h`, size_t`i`, double *`lower`, double *`upper`) 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`GSL_EDOM`

.

- Function:
*double***gsl_histogram_max***(const gsl_histogram **`h`) - Function:
*double***gsl_histogram_min***(const gsl_histogram **`h`) - Function:
*size_t***gsl_histogram_bins***(const gsl_histogram **`h`) 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`gsl_histogram`

struct directly.

- Function:
*void***gsl_histogram_reset***(gsl_histogram **`h`) This function resets all the bins in the histogram

`h`to zero.

Next: Searching histogram ranges, Previous: Copying Histograms, Up: Histograms [Index]