question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why is there no `mtrand.pxd`?

See original GitHub issue

A thread from 2010 in python-cython-user articulated my exact problem. Namely, I’m doing (things like) MCMC, and I want to use numpy’s MT implementation. Mostly, I do this because I don’t want multiple PRNG objects floating around my implementation. And, I’m using the RandomState distributions in places other than the Cythonized code that needs access to the PRNG.

I searched the historical open and closed issues, but I never found a solution. Is there any reason, obvious or otherwise, why numpy does not include a .pxd counter-part to mtrand.pyx? If not, I’ll do this work and submit a PR. But, considering I often encounter this need, I’m assuming a well-justified reason for its absence.

Thanks!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:20 (20 by maintainers)

github_iconTop GitHub Comments

1reaction
mattipcommented, Jul 19, 2018

@jbn do the solutions suggested in randomgen solve this need?

1reaction
bashtagecommented, Apr 12, 2018

I’ve implemented some experiments along this line (both CFFI and Ctypes) in randomgen:

See, e.g.,

https://github.com/bashtage/randomgen/blob/master/randomgen/examples/numba/extending_distributions.py

and

https://bashtage.github.io/randomgen/extending.html

Read more comments on GitHub >

github_iconTop Results From Across the Web

Here's Why We Think Pioneer Natural Resources (NYSE:PXD ...
While we live in the present moment, there's little doubt that the future matters most in the investment decision process. So why not...
Read more >
thread-safe random number generation with cython
In practical terms #3 is the most realistic one. However I am puzzled as to why mtrand is not exposed. If I am...
Read more >
Here is What to Know Beyond Why Pioneer Natural ...
Pioneer Natural Resources (PXD) has been one of the stocks most watched by Zacks.com users lately. So, it is worth exploring what lies...
Read more >
Pioneer Natural Resources: I Don't Buy $175 Stocks (NYSE ...
We think PXD is a well-run company with an outstanding asset base. The company is generating a lot of cash under the current...
Read more >
numpy.random.mtrand.RandomState.normal
Draw random samples from a normal (Gaussian) distribution. The probability density function of the normal distribution, first derived by De ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found