This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: gsl_histogram_sum proposal
- From: Gerard Jungman <jungman at lanl dot gov>
- To: gsl discussion list <gsl-discuss at sources dot redhat dot com>
- Cc: Achim Gaedke <Achim dot Gaedke at uni-koeln dot de>
- Date: Mon, 14 Jan 2002 11:35:05 -0700
- Subject: Re: gsl_histogram_sum proposal
- Organization: LANL T-3
- References: <3C40CDFA.6DE9E0F4@uni-koeln.de> <15425.60842.541431.631790@debian>
Brian Gough wrote:
>
> Achim Gaedke writes:
> > Here is a proposal for an additional function in histogram/stat.c:
> > double gsl_histogram_sum(gsl_histogram * h)
> > Using gsl_histogram_increment() it gives you the number of
> > samples, you have added to the histogram. Maybe someone is missing
> > it, too.
>
> That looks fine. If you can send me a complete patch for 1d/2d
> histograms and documentation I'll add it straight in.
>
> Brian
I have a trivial comment. But, after all, my forte is trivial
interface issues. It would probably be better to have something
like the following.
double
gsl_histogram_sum(gsl_histogram * h, size_t i_begin, size_t i_end)
{
double sum = 0;
size_t i;
i_begin = ( i_begin > h->n ? h->n : i_begin );
i_end = ( i_end > h->n ? h->n : i_end );
for (i = i_begin; i < i_end; i++)
{
sum += h->bin[i];
}
return sum;
}
Once the desire comes to sum from 0 to n, the desire
to sum with arbitrary limits will surefly follow.
--
G. Jungman