proposal gsl_histogram_set_ranges_uniform

Achim Gaedke achim@zpr.uni-koeln.de
Wed Dec 19 13:20:00 GMT 2001


Hello!

Sometimes it is overkill to delete an old histogram and allocate a new.
But for convenience this function may be added to gsl_histogram.

int gsl_histogram_set_ranges_uniform(gsl_histogram* h, double xmin,
 double xmax )
{
  size_t i;
  if (xmin >= xmax)
    {
      GSL_ERROR_VAL ("xmin must be less than xmax", GSL_EINVAL, 0);
    }
  for (i = 0; i < h->n + 1; i++)
    {
      h->range[i] = xmin + ((double) i / (double) h->n) * (xmax - xmin);
    }
  return h->n;
}

Yours,

Achim

PS: gsl_ran_gaussian_tail works...

Achim Gaedke, ZPR
Weyertal 80, 50931 Köln
Tel: +49 221 470 6021



More information about the Gsl-discuss mailing list