-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
RandomGen review notes (feel free to close) #13606
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
The main page has a Features section with a link to Extending, which states "An example showing the use of a more complicated distribution is in the examples folder."
removing
Added to #13164
added missing
Not clear to me the motivation. @bashtage? |
Yeah, the namespace stuff since not in I can't really sieve through all the code (or well, I guess I could, but would need much more time), in any case, as you see 2 hours looking at did not make me see any real issue... If |
The intention is to fully split into legacy and non-legacy. |
lam_max is there because it is there on RandomState, numpy/numpy/random/mtrand/mtrand.pyx Line 640 in 5e46e3d
It is actually one final change that needs to go through. I never changed the value from a long to an int64 in Generator. I'll PR in a bit on this.
https://github.com/bashtage/randomgen/blob/master/randomgen/generator.pyx#L115 I suppose this should have a docstring somewhere. |
It is split where needed but shared where the generation code is the same. For example, the bounded integers code is that same. |
np.random.bounded_integers and np.random.common both only expose cdef functions. They both export a few standard imported modules (e.g., |
This is where the distributions that are used by mtrand.pyx but not Generator are kept. It is not a great name, and perhaps should be called |
@mattip I think |
Ok, I seem to remember someone mentioning it should be a stub function that warns and calls random_sample to aid people in the transition, but we can always add it back in later. Removing both it and |
I don't have a strong opinion, but probably better to keep it minimal from the beginning if possible. |
One final note about |
These could be hidden without any loss. They probably should be.
Is there a NumPy C style doc? I used clang-format's defaults since I didn't see a definitive numpy C style guide. It would probably be a good idea to autoreformat, if possible, before the first merge, to simplify history once bugs or other changes come in. |
The NumPy C style guide is here. |
Anyone have a clang-format file for the guide? :-) |
We'd have to trawl the history to confirm, but I strongly suspect that it was not intended to be public. It's just a constant. I don't think anyone is relying on its presence. |
We moved it to private. It is undocumented but is unit tested so it is convenient to leave it exposed to Python. |
Thanks for all the small fixups! The lock I was just a bit curious, because it seemed that from the python side there is not much actual use. Anyway, it is good to keep it there, probably better, it may make lowlevel calls a bit smoother to implement even if hiding were easy. |
Uh oh!
There was an error while loading. Please reload this page.
@mattip some silly things I noticed looking at randomgen. Just creating an issue for now, to keep editing it in case I find something more interesting. Running things to valgrind, but unsurprisingly, looks good (no invalid behaviour, no definitely lost memory, except the expected ones due to buffer caching of scalars).
np.random.bounded_integers
exposure does not matter I guessnp.random.common
exposure also does not matter?BitGenerators
innp.random
namespace? Same for the corresponding module, e.g.np.random.dsfmt
andnp.random.DSFMT
or have anp.random.generators
namespace?Generator
repr
could have<>
(maybe longer path).src/legacy/distributions-boxmuller.c
about, aren't those already in the_mtrand
distributions?PyArray_calloc_aligned
inDSFMT
(no initialization is OK? but no matter)Generator
random_sample
exists, but is just a warning and returns None. Probably meant to raise an error?.poisson_lam_max
is it necessary to expose, or add leading underscore?tomaxint
is something we want I guess (well nobody complained and it was always there)?BitGenerator
.lock
on the python level (all py-level functions must check lock anyway)? But nothing much wrong with it either.The text was updated successfully, but these errors were encountered: