This is the mail archive of the gsl-discuss@sources.redhat.com 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]

proposal gsl_histogram_set_ranges_uniform


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


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