> ISTM that this elementary functionality deserves an implementation
> that's as fast as it can be.

To substantiate this, I just wrote a simple implementation of
"categorical" in "numpy/random/mtrand.pyx" and it's more than 8x faster
than your version for multiple samples of the same distribution and more
than 3x faster than using "multinomial(1, ...)" for multiple samples of
different distributions (each time tested with 1000 samples drawn from
distributions over 1000 categories).

I can provide it as a patch if there's any interest.

- Hagen

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to