From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30675 invoked by alias); 8 Aug 2008 10:52:35 -0000 Received: (qmail 12955 invoked by uid 22791); 7 Aug 2008 22:04:29 -0000 X-Spam-Check-By: sourceware.org X-Authority-Analysis: v=1.0 c=1 a=DtN4h1R2_ZoG-hGdtUkA:9 a=jS_U9b_BEtt7iufC8LMA:7 a=ER7G-eKXuDoHl2Anak7FUEqQs1cA:4 a=50e4U0PicR4A:10 Date: Fri, 08 Aug 2008 10:52:00 -0000 From: Patrick Alken To: gsl-discuss@sourceware.org Subject: Finding a bin in gsl_histogram Message-ID: <20080807220844.GA3562@hippogriff.homeunix.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.17+20080114 (2008-01-14) Mailing-List: contact gsl-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gsl-discuss-owner@sourceware.org X-SW-Source: 2008-q3/txt/msg00010.txt.bz2 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