On Apr 15, 3:33 pm, [EMAIL PROTECTED] wrote:
> With few tests, it seems this is faster than the version by Jussi only
> with quite big n,k.
>

True---and for large n and k it's difficult to imagine any real-world
applications that wouldn't be better served by using the lngamma
function instead.  That is, the natural log of n choose k can be
computed much more quickly as

lngamma(n+1) - lngamma(k+1) - lngamma(n-k+1)

I assume that lngamma is implemented somewhere in either numpy or
scipy, but right now I can't find it...

Mark

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to