| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
Dirichlet does not validate inputs and hangs when values are zero.
Adds check that values are strictly positive as required by the
distribution.
closes #2089
|
|
|
|
|
|
|
| |
This is the case for x in {int, bool, str, float, complex, object}.
Using the np.{x} version is deceptive as it suggests that there is a
difference. This change doesn't affect any external behaviour. The
`long` type is missing in python 3, so np.long is still useful
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
After #8883 was merged it was noticed that the same problem was
occuring with calls to PyInt_AsLong. Namely that PyErr_Occoured
wasn't being checked if it returned -1 indicating an exception
could have been thrown.
This PR adds those checks as well as a regression test.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There was an error in np.random.uniform where if np.random.uniform
were called with a type that throwed exceptions when it was converted
to a float this exception wouldn't be raised.
This bug was due to an issue where PyFloat_AsDouble was called but
no check for PyErr_Occurred was performed after.
This PR fixes the issue by ensuring that Cython will always emit a
call to PyErr_Occurred if PyFloat_AsDouble returns -1.0
Fixes: #8865
|
| |
|
|
|
|
|
|
|
|
| |
Since we only need to support python 2, we can remove any case where we just
pass a single string literal and use the b prefix instead.
What we can't do is transform asbytes("tests %d" % num), because %-formatting
fails on bytes in python 3.x < 3.5.
|
|
|
|
|
|
|
|
| |
BUG: fix issue #8250 where np.random.permutation fail.
This reverts commit 7a73bad2d9c04e4f16e87dbed9d7b627327fe814.
Closes #8776.
|
|\
| |
| | |
BUG: fix issue #8250 when np.array gets called on an invalid sequence
|
| |
| |
| |
| | |
called on an invalid sequence.
|
|/
|
|
| |
Unless I am very much mistaken these 'assert_(x,y)' calls should really be 'assert_equal(x,y)'.
|
|
|
|
|
| |
inlined isfinite on i386 does not work for DBL_MAX / 1e17 + DBL_MAX as
with extended precision this is not smaller equal than DBL_MAX.
|
| |
|
| |
|
|\ |
|
| |
| |
| |
| | |
Also check for invalid bounds when low= and high= are arraylike rather than scalar (closes #8226)
|
| |
| |
| |
| |
| |
| |
| |
| | |
In some places, just remove aparently unnecessary filters.
After this, all cases of ignore filters should be removed from
the tests, making testing (even multiple runs) normally fully
predictable.
|
| |\
| | |
| | | |
Allow many distributions to have a scale of 0.
|
| | |
| | |
| | |
| | | |
At least the gamma generator doesn't support it.
|
| | |
| | |
| | |
| | |
| | |
| | | |
(in which case a stream of 0's is usually returned (or 1's)).
See #5818.
|
| |/
| |
| |
| |
| |
| |
| |
| | |
The warning turned up when the numpy/randome/tests were run using
$ python runtests.py -t numpy/random/tests/
It doesn't show when all the tests are run.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The 'pandas' library expects Python integers to be
returned, so this commit changes the API so that
the default is 'np.int' which converts to native
Python integer types when a singleton is being
generated with this function.
Closes gh-7284.
|
| |
| |
| |
| | |
Closes gh-7203.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fixes bug in np.random methods that would return scalars
when passed one-element array inputs. This is because
one-element ndarrays can be cast to integers / floats, which
is what functions like PyFloat_AsDouble do before converting
to the intended data type.
This commit changes the check used to determine whether the
inputs are purely scalar by converting all inputs to arrays
and checking if the resulting shape is an empty tuple (scalar)
or not (array).
Closes gh-4263.
|
| |
| |
| |
| |
| |
| | |
Added a whole new suite of tests to ensure that
functions in mtrand.pyx which are broadcastable
actually broadcast their arguments properly.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Only for 1d-ndarrays exactly, as subtypes (e.g. masked arrays) may not
allow direct shuffle of the underlying buffer (in fact, the old
implementation destroyed the underlying values of masked arrays while
shuffling).
Also handles struct-containing-object 1d ndarrays properly.
See #6776 for an earlier, less general (but even faster: ~6x)
improvement attempt, #5514 for the original issue.
|
| | |
|
| |\
| | |
| | | |
ENH: Add dtype argument to random.randint.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* check exceptions
* check extreme bounds are reachable
* check that all values are in the specified bounds
* check repeatability of sequences
More exact statistical tests would be nice, but that is another
project.
|
| |/ |
|
| |
| |
| |
| |
| |
| |
| | |
Redistributes the code between the randint and random_integers
methods so that we can generate integers up to and including
np.iinfo('l').max with random_integers, which previously
would have caused an OverflowError.
|
| | |
|
| |
| |
| |
| |
| | |
Noncentral chi-square reduces to a central chi-square, so
just defer to that.
|
|/
|
|
| |
Test that warnings are or are not raised when check_valid kwarg is used.
|
|
|
|
| |
Closes #5766.
|
|
|
|
|
|
|
|
| |
This fixes issue #2138 by checking that the range (i.e. high - low) is finite
before invoking `rk_uniform`.
A test case was added to ensure valid ranges do not throw, but invalid ranges
do.
|
|
|
|
| |
http://lists.alioth.debian.org/pipermail/glibc-bsd-commits/2014-September/004163.html
|
|\
| |
| | |
TST: accept small error in threaded random test
|
| |
| |
| |
| |
| |
| |
| | |
freebsd and windows change x87 precision mode (fctrl bit 8 and 9) from
extended to double in child threads so the random numbers cannot be
exactly the same from master and child threads.
see gh-4909
|
|/ |
|
|
|
|
|
|
|
| |
rho results in 0. for kappa < 1.4e-8 whch leads to nans appearing and an
infinite loop.
the second order taylor expansion is more precise up to at least 1e-5.
Closes gh-4720
|
|
|
|
|
|
| |
mtrand accepts seeds larger than 32 bit but silently truncates them back
to 32 bit. This can lead to accidentally getting the same random stream
for two different seeds, e.g. 1 and 1 + 2**40.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The random module currently relies on the GIL for the state
synchronization which hampers threading performance.
Instead add a lock to the RandomState object and take it for all
operations calling into randomkit while releasing the GIL.
This allows parallizing random number generation using multiple states
or asynchronous generation in a worker thread.
Note that with a large number of threads the standard mersenne twister
used may exhibit overlap if the number of parallel streams is large
compared to the size of the state space, though due to the limited
scalability of Python in regards to threads this is likely not a big
issue.
|
|
|
|
| |
Adds check with np.isnan(p) and raises ValueError if check is positive.
|
|
|
|
|
|
|
|
| |
Explicitly Test that the default shape does not raise a
DeprecationWarning.
Check that a covariance matrix that is not positive-semidefinite
raises a RuntimeWarning.
|
|
|
|
| |
Closes gh-3173
|
|
|
|
|
| |
closes gh-4270 and gh-3263
also regenerate with cython 0.20.1
|