This is the mail archive of the gsl-discuss@sourceware.org mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]