[SciPy-User] NumPy Binomial BTPE method Problem

Robert Kern robert.kern@gmail....
Wed Oct 3 16:28:20 CDT 2012


On Wed, Oct 3, 2012 at 5:54 PM, Josh Lawrence <josh.k.lawrence@gmail.com> wrote:
> Hello all,
>
> I am implementing a binomial random variable in MATLAB. The default
> method in the statistics toolbox is extremely slow for large
> population/trial size. I am needing to do trials for n as large as
> 2**28. I found in NumPy some code that implements a binomial random
> draw in numpy/random/mtrand/distributions.c. I was trying to convert
> the code to MATLAB and the BTPE method seems to have an error in lines
> 337-341 of distributions.c. The if ... else if ... else statement I
> think is incorrect. I think it should be an if ... else ... statement
> followed by the contents of the original else which starts on line
> 337.

Yes, you are correct, on this point as well as the m+1 and y+1. Thank
you for debugging my code!

-- 
Robert Kern


More information about the SciPy-User mailing list