bug-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gsl]Bug in discrete random distribution


From: ahoward
Subject: Re: [Bug-gsl]Bug in discrete random distribution
Date: Tue, 21 Jan 2003 14:59:03 -0800 (PST)

Hi Brian:

Test code and Makefile are attached.  Note that since we're dealing with
un-initialized data, the program will ofter appear to run correctly; i.e.
it will generate valid numbers.  If you look closely at those numbers,
however, you will see that the distribution not correct (mostly zeros, for
example).  The bug is actually kind of weird, since it only seems to
happen for perfectly uniform *normalized* distributions; un-normalized
distributions work just fine.

        Andrew




On Tue, 21 Jan 2003, Brian Gough wrote:

> ahoward writes:
>  > I have found a bug in the discrete random number distribution code of your
>  > otherwise excellent package.  For near-uniform distributions,
>  > gsl_ran_discrete() sometimes generates invalid numbers (outside the range
>  > 0 <= k < K).  Digging around in the code, I found this:
>  >
>  > randist/discrete.c:221
>  >
>  > /*** Begin Walker's Algorithm ***/
>  >
>  > gsl_ran_discrete_t *
>  > gsl_ran_discrete_preproc(size_t Kevents, const double *ProbArray)
>  >
>
> Thanks for the bug report, could you send an example program which
> exercises the bug (for testing purposes).  Apologies if I already
> asked for this, my mailbox got a bit full and I lost track a bit.
>
> --
> Brian Gough
>
> ----------------------------------------------------------------------
> Network Theory Ltd            Phone: 0117 3179309 (+44 117 3179309)
> 15 Royal Park                   WWW: http://www.network-theory.co.uk/
> Bristol BS8 3AL               Email: address@hidden
> United Kingdom
> ----------------------------------------------------------------------
>

Andrew Howard                           email: address@hidden
Department of Computer Science          http:  www-robotics.usc.edu/~ahoward
University of Southern California       phone: 1 (213) 740 6416
Los Angeles, CA, U.S.A. 90089-0781      fax:   1 (213) 821 5696
    << Insert pithy saying here >>>












Attachment: gsl-randist-bug.tgz
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]