| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
|
|
|
|
| |
Improve error message when the sum of pvals is larger than 1
when the input data is an ndarray
closes #8317
xref #16732
|
| |
|
|
|
|
|
|
| |
Apply vonmises fix only to Generator
Add tests for correctness
closes #17378
closes #17275
|
| |
|
|
| |
large values of kappa (>1e6)
|
| |
|
|
|
|
|
| |
The test checks that the warning originates in the correct file
(test_random.py). I am not quite sure how safe the test is, though.
Unfortunately, there is no "obvious" way to test stacklevels.
|
| |
|
|
|
|
| |
Remove ndim for non-ndarrays and check axis is 0
closes #18142
|
| |
|
|
|
|
| |
* allow graceful shuffling of memoryviews, with
same behavior as arrays, instead of producing
a warning on `memoryview` shuffle
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This would trigger:
```
NotImplementedError: Axis argument is only supported on ndarray objects
```
because empty arrays and array scalars would take the "untyped" path.
The bug exists only for Generator, not in RandomState (it doesn't have
axis keyword for `shuffle`), but update both because it keeps
implementations in sync and the change results in more understandable
code also for RandomState.
|
| |
|
|
| |
This doesn't qualify for fixing under the NEP.
|
| |
|
|
|
|
| |
Check that high is weakly larger than low and raise if now
closes #17905
|
| |
|
|
|
|
|
|
|
| |
Tests using MD5 algorithms fail in FIPS Mode because MD5 is not FIPS
compliant.
Replace MD5 with SHA256 to overcome that.
Signed-off-by: Nikola Forró <nforro@redhat.com>
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
* ENH: random: Make _shuffle_raw and _shuffle_int standalone functions.
* ENH: random: Add the method `permuted` to Generator.
The method permuted(x, axis=None, out=None) shuffles an array.
Unlike the existing shuffle method, it shuffles the slices along
the given axis independently.
Closes gh-5173.
|
| |
|
|
|
|
| |
Check that size is not being broadcast
closes #16833
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes #16539
The implicit 0-padding that is done to small entropy inputs to make them the
size of the internal pool conflicts with the spawn keys, which start with an
appended 0.
In order to maintain stream compatibility with unspawned `SeedSequence`s, we
explicitly 0-pad short inputs out to the pool size only if the spawn key is
provided, and thus would trigger the bug. This should minimize the impact on
users that were not encountering the bug.
|
| |
|
|
|
|
|
| |
Broadcastable size with inputs does not produce an error when size produces
a smaller output array than the broadcast input shape. Patch checks that
the output shape matches the outer shape of the broadcast fo all inputs and
the size when given.
|
| |
|
|
|
|
| |
Refactor polynomial to be unsigned long array
Remove unused code
Fix md5 calculation on BE
|
| |
|
|
|
|
| |
Use the original loop order instead of an inverted order
closes #15394
|
| |\
| |
| | |
BUG: add missing numpy/__init__.pxd to the wheel
|
| | | |
|
| |/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#14924)
* Add stick-breaking
* Add tests demonstrating slowness for beta and dirichlet generators for small alpha (and beta) values
* Remove the test for beta with small `a` and `b`
* Switch from standard to stick-breaking method whenever alpha.max() < 0.1
Co-authored-by: Warren Weckesser <warren.weckesser@gmail.com>
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
|
| | |
|
| |
|
|
|
|
|
| |
Add repeatability tests for when the range of the integers is `2**32`
(and `2**32 +/- 1` for good measure) with broadcasting. The underlying
functions called by Generator.integers and random.randint when the
inputs are broadcast are different than when the inputs are scalars.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
When the input to Generator.integers was 2**32, the value 2**32-1
was being passed as the `rng` argument to the 32-bit Lemire method,
but that method requires `rng` be strictly less then 2**32-1.
The fix was to handle 2**32-1 by calling next_uint32 directly.
This also works for the legacy code without changing the stream
of random integers from `randint`.
Closes gh-16066.
|
| |
|
|
|
| |
Only one dimensional alpha paramter is currently supported, but higher dimensions were silently allowed and gave an incorrect results. This fixes the regression. In the future, the API could be extended to allow higher dimensional arrays for alpha.
Fixes gh-15915
|
| |\
| |
| | |
BUG: Check that `pvals` is 1D in `_generator.multinomial`.
|
| | | |
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Make `Generator.negative_binomial` raise a ValueError if p=0.
`negative_binomial(n, p)` draws samples from the distribution of
the number of failures until n successes are encountered. If p is 0,
then a success is never encountered, so the probability distribution
is 0 for any finite number of failures. In other words, it is not
really a meaningful distribution, so we disallow p=0.
Closes gh-15913.
|
| |/
|
|
| |
Fixes #15871
|
| |
|
|
|
| |
types (#15816)
Cleanup from the dropping of python 2
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(gh-15463)
xref gh-14778
As pointed out in the comment by @jamesthomasgriffin, we did not include a pxd file to expose the distribution functions documented in the random c-api. This PR adds a c_distributions.pxd file that exposes them.
Squashed commits:
* BUG: add missing c_distributions.pxd to enable cython use of random C-API
* ENH, TST: add npyrandom library like npymath, test cython use of it
* BUG: actually prefix f-string with f
* MAINT: fixes from review, add _bit_generato_bit_generator.pxd
* STY: fixes from review
* BLD: don't use nprandom library for mtrand legacy build
* TST: WindowsPath cannot be used in subprocess's list2cmdline
* MAINT, API: move _bit_generator to bit_generator
* DOC: add release note about moving bit_generator
* DOC, MAINT: fixes from review
* MAINT: redo dtype determination from review
|
| |
|
|
|
|
|
| |
* Cleanup unused imports (F401) of mostly standard Python modules,
or some internal but unlikely referenced modules
* Where internal imports are potentially used, mark with noqa
* Avoid redefinition of imports (F811)
|
| |
|
|
|
|
| |
* PEP 8: "Imports should usually be on separate lines"
* Where modified, sort imported modules alphabetically
* Clean-up unused imports from these expanded lines
|
| |
|
|
| |
This implements NEP 34.
|
| |
|
|
|
|
|
| |
Inheriting from object was necessary for Python 2 compatibility to use
new-style classes. In Python 3, this is unnecessary as there are no
old-style classes.
Dropping the object is more idiomatic Python.
|
| |
|
|
|
| |
As numpy is Python 3 only, these import statements are now unnecessary
and don't alter runtime behavior.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* BUG: use tmp dir and check version for cython test
* TST, MAINT: skip on win32, fix formatting
* TST: fixes from review
* TST: fixes from review
* TST: fixes from review
|
| | |
|
| | |
|
| |\
| |
| | |
DEP: issue deprecation warning when creating ragged array (NEP 34)
|
| | | |
|
| | | |
|
| |\ \
| | |
| | | |
TST. API: test using distributions.h via cffi
|
| | | | |
|
| | | | |
|
| |/ / |
|