This is the mail archive of the
gsl-discuss@sourceware.org
mailing list for the GSL project.
Finding a bin in gsl_histogram
- From: Patrick Alken <patrick dot alken at colorado dot edu>
- To: gsl-discuss at sourceware dot org
- Date: Thu, 7 Aug 2008 16:08:44 -0600
- Subject: Finding a bin in gsl_histogram
Hi,
I was suprised to see there is no function in the gsl histogram
module to find the bin corresponding to a given x value. There is
an internal function called find() to accomplish this, but I
think it would be useful to make an API for this routine.
For example I have an application in which I need to bin data
and compute the mean of the data in each bin. This can be done
with a running mean (keeping the current value of the mean as
the bin value) but each time I store a new data point in the
histogram, I need to find which bin it will be stored in so
I can update the bin value appropriately.
I propose to make a new function gsl_histogram_getbin() which
simply calls the internal find() function to determine the bin
number for a given x. This should probably also be done for the
2d case.
Patrick Alken