-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
DOC: Generator is documented as part of the random c-api, but is missing #16597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I believe it is exposed in the upcoming 1.19. If you want to try there are wheels for the rc2 release on PyPI. |
Thanks for your quick reply. I just tried the above cimport statements with numpy 1.18.5, 1.19.0rc1, and 1.19.0rc2 and received Numpy/Python version information for the most recent candidate:1.19.0rc2 3.7.7 (default, May 6 2020, 04:59:01)
[Clang 4.0.1 (tags/RELEASE_401/final)] |
I think that is a documentation mistake. The functions mentioned on the page you reference come from
I am curious about the use case for the |
Yes, that absolutely makes sense. My understanding is that if one wants to use Generators they could use their Python objects, and it's absolutely valid to use default_rng(). However, it could appeal to certain Cython developers to either type name their Generator or to compile their Generator (via cimport-ing) to quickly access higher level methods out of the box. I'd say typing and the compilation of |
I second this |
We are trying to be conservative in adding to the sprawling NumPy API. If a project comes along with a real-world use case we can discuss exposing more, but as of now I think we should turn this into a documentation issue. |
Generator doesn't expose anything that is usable in lower-level cython. There is no point in making it part of the C-api. The components are all there as of 1.19 so you can mix pretty much any custom variant generators you need. |
Every function from Generator is |
xref gh-14778
This is an issue I noticed following the series of tickets on the random c-api usability. Quoting from the docs on Cython API:
I could verify cimport-ing BitGenerator in Cython, but on the Generator defined in
numpy/random/_generator.pyx
, it seems that it is not exposed which could be nice if we declare it inrandom/__init__.pxd
.Reproducing code example:
Error message:
Numpy/Python version information:
The text was updated successfully, but these errors were encountered: