GNU Scientific Library Reference Manual - Third Edition (v1.12)by M. Galassi, J. Davies, J. Theiler, B. Gough, G. Jungman, P. Alken, M. Booth, F. Rossi Paperback (6"x9"), 592 pages, 60 figures ISBN 0954612078 RRP £24.95 ($39.95) |

## 21.17 Searching 2D histogram ranges

The following functions are used by the access and update routines to locate the bin which corresponds to a given (x,y) coordinate.

__Function:__int**gsl_histogram2d_find***(const gsl_histogram2d **`h`, double`x`, double`y`, size_t *`i`, size_t *`j`)- This function finds and sets the indices
`i`and`j`to the to the bin which covers the coordinates (`x`,`y`). The bin is located using a binary search. The search includes an optimization for histograms with uniform ranges, and will return the correct bin immediately in this case. If (x,y) is found then the function sets the indices (`i`,`j`) and returns`GSL_SUCCESS`

. If (x,y) lies outside the valid range of the histogram then the function returns`GSL_EDOM`

and the error handler is invoked.

ISBN 0954612078 | GNU Scientific Library Reference Manual - Third Edition (v1.12) | See the print edition |