Re: [Numpy-discussion] Using logfactorial instead of loggamma in random_poisson sampler

2021-03-06 Thread Warren Weckesser
On 3/6/21, zoj613 wrote: > Hi All, > > I noticed that the transformed rejection method for generating Poisson > random variables used in numpy makes use of the `random_loggam` function > which directly calculates the log-gamma function. It appears that a > log-factorial lookup table was added a

[Numpy-discussion] String accessor methods

2021-03-06 Thread Todd
Currently. working with strings in numpy is not very convenient. You have to use a separate set of functions in a separate namespace, and those functions are relatively limited and poorly-documented. A solution several other projects, including pandas [0] and xarray [1], have found are string

[Numpy-discussion] Using logfactorial instead of loggamma in random_poisson sampler

2021-03-06 Thread zoj613
Hi All, I noticed that the transformed rejection method for generating Poisson random variables used in numpy makes use of the `random_loggam` function which directly calculates the log-gamma function. It appears that a log-factorial lookup table was added a few years back which could be used in

Re: [Numpy-discussion] guide for downstream package authors & setting version constraints

2021-03-06 Thread zoj613
Thanks you, this looks very informative. Is there a best practice guide somewhere in the docs on how to correctly expose C-level code to third parties via .pxd files, similarly to how one can access the c_distributions of numpy via cython? I tried this previously and failed miserably. It seemed

Re: [Numpy-discussion] String accessor methods

2021-03-06 Thread dan_patterson
The are in np.char mystr = np.array(["test first", "test second", "test third"]) np.char.title(mystr) array(['Test First', 'Test Second', 'Test Third'], dtype='http://numpy-discussion.10968.n7.nabble.com/ ___ NumPy-Discussion mailing list

Re: [Numpy-discussion] Using logfactorial instead of loggamma in random_poisson sampler

2021-03-06 Thread zoj613
Ah, I had a suspicion that it was to preserve the random stream but wasn't too sure. Thanks for the clarification. -- Sent from: http://numpy-discussion.10968.n7.nabble.com/ ___ NumPy-Discussion mailing list NumPy-Discussion@python.org

Re: [Numpy-discussion] Using logfactorial instead of loggamma in random_poisson sampler

2021-03-06 Thread Robert Kern
On Sat, Mar 6, 2021 at 1:45 PM Warren Weckesser wrote: > At the time, making that change was not a high priority, so I didn't > pursue it. It does make sense to use the logfactorial function there, > and I'd be happy to see it updated, but be aware that making the > change is more work than

Re: [Numpy-discussion] guide for downstream package authors & setting version constraints

2021-03-06 Thread Matti Picus
This is a different topic altogether. I think you would get better results asking on the cython-users mailing list with a concrete example of something that didn't work. Matti On 3/6/21 7:52 PM, zoj613 wrote: Is there a best practice guide somewhere in the docs on how to correctly expose

Re: [Numpy-discussion] String accessor methods

2021-03-06 Thread Todd
On Sat, Mar 6, 2021 at 12:57 PM dan_patterson wrote: > The are in np.char > > mystr = np.array(["test first", "test second", "test third"]) > > np.char.title(mystr) > array(['Test First', 'Test Second', 'Test Third'], dtype=' I mentioned those in my email, but they are far less convenient to