| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
This is fallout from https://github.com/cython/cython/pull/5386
|
|
|
|
| |
declaration.
|
| |
|
|\ |
|
| |
| |
| |
| | |
Generator.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
In C, when the integer part of a double exceeds the maximum int64, casting
the double to int64_t is undefined behavior. On some platforms, the result
is 2**64-1 and on others it is -2**64. That results in rng.geometric()
returning -2**64 when p was sufficiently small on some platforms.
The fix is to never invoke undefined behavior by ensuring we don't attempt
to cast very large double values to int64_t.
|
| |
| |
| |
| |
| | |
Changed alpha value error to pass a null value. This way, dirichlet function (on the generator, not mtrand) won't raise a value exception at 0. Also added test.
|
| |
| |
| |
| |
| | |
The original PR forgot to include the Parameters section (and thus
the paraeter itself).
|
| |\
| | |
| | | |
TYP: Fix return type to float on _FloatLike_co arguments
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Currently, `rng.exponential(scale=np.sum(np.arange(10.0)))` indicates
its return value as `np.ndarray[Any, dtype[float64]]` even though a
`float` is returned on `_FloatLike_co` values of the `scale` argument.
This commit fixes this problem such that `rng.exponential` indicates
the correct return type on `_FloatLike_co` inputs.
|
| | |
| | |
| | |
| | | |
[skip cirrus]
|
| |\ \
| | | |
| | | | |
API: Add `rng.spawn()`, `bit_gen.spawn()`, and `bit_gen.seed_seq`
|
| | | | |
|
| | | |
| | | |
| | | |
| | | | |
Trying to address Robert Kerns review comments.
|
| | | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This makes the seed sequence interface more public facing by:
1. Adding `BitGenerator.seed_seq` to give clear access to `_seed_seq`
2. Add `spawn()` to both the generator and the bit generator as
convenience methods for spawning new instances.
I somewhat remember that we always meant to consider making this
more public and adding such convenient methods, but did not do
so originally.
So, now, I do wonder whether it is time to make this fully public?
It would be nice to follow up at some point with a bit of best practices.
This also doesn't add it to the `RandomState`, although doing it via
`RandomState._bit_generator` is of course valid.
Can we define as this kind of access as stable enough that downstream
libraries could use it? I fear that backcompat with `RandomState`
might make adopting newer things like spawning hard for libraries?
|
| | | | |
|
| | | | |
|
| |/ / |
|
| | | |
|
| |/
| |
| | |
Correct floating point types on several npyrandom functions exposed for Cython in c_distributions.pyx, add missing float functions
|
| |\
| | |
| | | |
DOC: All integer values must be non-negative
|
| | | |
|
| | |
| | |
| | |
| | | |
"All integer values must be non-negative"
|
| | | |
|
| |/
| |
| |
| |
| | |
Make a note on results depending on system due.
Closes gh-22919
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* DOC: add examples for random generator exponential function (Issue #22270)
* DOC: fix doc test for random exponential generator example (Issue #22270)
* DOC: fix formatting on np.random.exponential example (Issue: #22270)
* DOC: fix test and problem context on np.random.exponential example (Issue: #22270)
* DOC: use may vary instead of will vary for exponential example (Issue: #22270)
|
| | |
|
| |\
| | |
| | | |
TST: Skip when numba/numpy compat issues cause SystemError
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
numba is a bit buggy when wrapping ufuncs, so what should be nothing
is (on non dev versions) a SystemError and not even an ImportError.
So simply catch those too, since it can be a confusing error during
dev otherwise.
|
| |\ \
| | | |
| | | | |
MAINT: Move set_module from numpy.core to numpy._utils
|
| | |/
| | |
| | |
| | |
| | | |
Note that unfortunately, compat does expose _inspect as well,
so the import remains (just the definition place moves).
|
| |\ \
| | | |
| | | |
| | | |
| | | | |
BLD: enable building NumPy with Meson
[ci skip]
|
| | |/
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This enables building with NumPy on Linux and macOS. Windows support
should be complete to, but is untested as of now and may need a few
tweaks. This contains:
- A set of `meson.build` files and related code generation script
tweaks, header templates, etc.
- One CI job on Linux
- Basic docs on using Meson to build NumPy (not yet integrated in the
html docs, it's too early for that - this is for early adopters right
now).
The build should be complete, with the major exception of SIMD support.
The full test suite passes. See gh-22546 for the tracking issue with
detailed notes on the plan for switching NumPy to Meson as its build
system.
Co-authored-by: Stefan van der Walt <stefanv@berkeley.edu>
|
| |/
| |
| |
| | |
Closes gh-22100
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
In some cases, the replacement is clearly not what is intended,
in those (where setup was called explicitly), I mostly renamed
`setup` to `_setup`.
The `test_ccompile_opt` is a bit confusing, so left it right now
(this will probably fail)
|
| |\
| | |
| | | |
BUG: Fix boundschecking for random.logseries
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Logseries previously did not enforce bounds to be strictly exclusive
for the upper bound, where it leads to incorrect behavior.
The NOT_NAN check is removed, since it was never used: The current bounded
version always excludes NaNs.
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The new weak promotion preserves the original type, this makes the
`//= 2**32` fail for certain inputs. The alternative would be
typing that as `np.int64(2**32)`, but using Python integers seems
easier and cleaner.
The code was effectively OK before, since the inputs were guaranteed
signed (or Python integers) at that point and 2**32 would have been
considered like a NumPy `int64`. (Which would be an alternative fix.)
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| | |
xref gh-21431
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This seems to have been removed by accident in #21887
stdlib.h is required for _rotr64() further down.
Fixes:
error: call to undeclared function '_rotr64'; ISO C99 and later do not support
implicit function declarations [-Wimplicit-function-declaration]
|
| |\
| | |
| | | |
DOC: Note symmetry requirement in `multivariate_normal` error
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
numpy.random.multivariate_normal more descriptive (closes #22140)
Issue #22140 says that numpy.random.multivariate_normal incorrectly warns that a non-symmetric positive-semidefinite matrix isn't positive-semidefinite. In the replies, there was some ambiguity over whether it was possible for a positive-semidefinite matrix to be non-symmetric, with reliable sources saying that symmetry is a common condition to add but not actually necessary. To solve this problem, two different members of the Numpy organization decided that the warning and error message "covariance is not positive-semidefinite" should be changed to "covariance is not symmetric positive-semidefinite". However, this change was never actually made yet.
Since this change only required me to change a few strings instead of actually changing the code, I've decided to skip the CI jobs.
[skip ci]
|
| |/
| |
| |
| | |
In numpy/random/tests/test_random.py, a class called TestSingleEltArrayInput had a method called test_randint that was commented out, with the instructions to uncomment it once np.random.randint was able to broadcast arguments. Since np.random.randint has been able to broadcast arguments for a while now, I uncommented the test. The only modification I made to the code was fixing a small error, where the author incorrectly tried to call "assert_equal" as a method of the TestSingleEltArrayInput instead of a function that was imported from numpy.testing. I ran runtests.py, and the new test passed.
|
| |
| |
| |
| |
| | |
[ci skip]
Co-authored-by: h-vetinari <h.vetinari@gmx.com>
|