summaryrefslogtreecommitdiff
path: root/numpy/random
Commit message (Collapse)AuthorAgeFilesLines
* BUG: Missing dirichlet input validationKevin Sheppard2017-08-172-0/+12
| | | | | | | | 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
* TST, MAINT: Add `__init__.py` files to tests directories.Charles Harris2017-08-061-0/+0
| | | | | | | | This allows pytest to run with duplicate test file names. Note that `python <path-to-test-file>` no longer works with this change, nor will a simple `pytest numpy`, because numpy is imported from the numpy repository. However, `python runtests.py` and `>>> numpy.test()` are still available.
* MAINT/DOC: Use builtin when np.{x} is builtins.{x}.Eric Wieser2017-08-051-10/+10
| | | | | | | 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
* TST: Remove unittest dependencies in numpy/random/tests.Charles Harris2017-07-242-30/+32
|
* MAINT: Rearrange files in numpy/testing module.Charles Harris2017-07-041-1/+1
| | | | | | | | | | | | | | | | | The aim here is to separate out the nose dependent files prior to adding pytest support. This could be done by adding new files to the general numpy/testing directory, but I felt that it was to have the relevant files separated out as it makes it easier to completely remove nose dependencies when needed. Many places were accessing submodules in numpy/testing directly, and in some cases incorrectly. That presented a backwards compatibility problem. The solution adapted here is to have "dummy" files whose contents will depend on whether of not pytest is active. That way the module looks the same as before from the outside. In the case of numpy itself, direct accesses have been fixed. Having proper `__all__` lists in the submodules helped in that.
* DOC: BLD: fix lots of Sphinx warnings/errors.Ralf Gommers2017-06-101-2/+2
|
* BUG: Buttress handling of extreme values in randintgfyoung2017-05-093-15/+60
|
* Merge pull request #8962 from MSeifert04/random_choice_docsEric Wieser2017-04-261-2/+2
|\ | | | | DOC: Wrong return type of np.random.choice and wrong variable name in parameter description.
| * DOC: Wrong return type of np.random.choice and wrong variable nameMichael Seifert2017-04-201-2/+2
| | | | | | | | | | | | in parameter description. [ci skip]
* | [DOC] use of * instead of ` to refer to a function parameter.Matthias Bussonnier2017-04-261-2/+2
|/ | | | | It's funny because it's fine in EXAMPLE_DOCSTRING.rst.txt that uses the same example.
* MAINT: avoid memcpy when i == jYu Feng2017-04-101-0/+1
| | | | | | | | | | | | Valgrind complains about memcpy with overlapping address in mtrand.c It happens when i == j in this loop. Closer inspection the i == j iteration is not needed (it is a swap). So, skip it and avoid depending on undefined behavior of memcpy. related read: https://sourceware.org/bugzilla/show_bug.cgi?id=12518
* BUG: Check for errors when PyInt_AsLong is called in np.randomSimon Gibbons2017-04-022-9/+16
| | | | | | | | | 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.
* Fix testSimon Gibbons2017-04-011-1/+1
|
* BUG: Ensure Errors are correctly checked when PyFloat_AsDouble is called.Simon Gibbons2017-04-012-1/+15
| | | | | | | | | | | | | | 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
* DOC: update docs and comments for move of mailing list to python.orgRalf Gommers2017-03-261-1/+1
|
* MAINT: Remove asbytes where a b prefix would sufficeEric Wieser2017-03-251-2/+1
| | | | | | | | 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.
* Revert gh-8570.Charles Harris2017-03-132-42/+1
| | | | | | | | BUG: fix issue #8250 where np.random.permutation fail. This reverts commit 7a73bad2d9c04e4f16e87dbed9d7b627327fe814. Closes #8776.
* Merge pull request #8570 from evanlimanto/random-permutation-shuffle-fixEric Wieser2017-03-122-1/+42
|\ | | | | BUG: fix issue #8250 when np.array gets called on an invalid sequence
| * BUG: fix issue #8250 where np.random.permutation fails when np.array gets ↵Evan Limanto2017-03-102-1/+42
| | | | | | | | called on an invalid sequence.
* | BUG: Fix assert statements in random.choice testsMarein Könings2017-02-281-5/+5
|/ | | | Unless I am very much mistaken these 'assert_(x,y)' calls should really be 'assert_equal(x,y)'.
* TST: work around isfinite inconsistency on i386Julian Taylor2017-01-171-1/+3
| | | | | 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.
* TST: remove a duplicate test. Closes gh-8447.Ralf Gommers2017-01-061-4/+0
|
* single too argument + mention in release docs.Oscar Villellas2017-01-031-9/+5
|
* Documentation fix and proper handling of toleranceOscar Villellas2017-01-031-10/+15
|
* fixed merged testOscar Villellas2017-01-031-14/+8
|
* Merge remote-tracking branch 'numpy-org/master' into mult-normOscar Villellas2017-01-0314-840/+2145
|\
| * DOC: Fixed minor typoMikhail Pak2016-12-131-1/+1
| |
| * BUG: Better check for invalid bounds in np.random.uniform.Alistair Muldal2016-11-022-0/+6
| | | | | | | | Also check for invalid bounds when low= and high= are arraylike rather than scalar (closes #8226)
| * DOC: Clean up lomax and genpareto references.wrwrwr2016-10-281-3/+3
| |
| * MAINT, DOC: Update some scipy.stats references.wrwrwr2016-10-281-27/+27
| | | | | | | | Closes #5813.
| * Merge pull request #8173 from aixtools/issue8118Charles Harris2016-10-221-3/+6
| |\ | | | | | | BLD: Enable build on AIX
| | * STY: Fix indentation to follow PEP8Charles Harris2016-10-221-2/+2
| | |
| | * commit BLD: AIX uses the flag _LARGE_FILES to ensure proper prototype ↵Michael Felt2016-10-211-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | declarations The problem this fix resolves is to ensure that 32-bit and 64-bit functions (e.g., fclear() and fclear64()) to access/manipulate "large files" are defined properly - much as GNU and other platforms use one or more of the defines _FILE_OFFSET_BITS, _LARGEFILE_SOURCE, and _LARGEFILE64_SOURCE. Without this fix the numpy code only defines flags that are not recognized in the AIX environment and have no effect in anyway. The fix applies the AIX convention and does not "export" any of the flags currently exported. For all other platforms the current flags: _FILE_OFFSET_BITS, _LARGEFILE_SOURCE, and _LARGEFILE64_SOURCE are "exported". This fix should not have any impact or side-effect based on the version of python used. History: Starting around 1997 AIX started supporting so-called "large files", i.e., length > signed 32-bit. In the period 1997-1998 the flag _LARGE_FILES was established to simplify porting 32-bit applications to 64-bit. The convention is to define _LARGE_FILES before including any "system include files" either as an argument to ${CC} (e.g., in ${CFLAGS} or as the first #define in every source file. This is to ensure that that no relevant function calls would be redefined later in the build process.
| * | DOC: 'highest' is exclusive for randint()Ben North2016-10-201-2/+2
| |/
| * MAINT: Remove duplicate randint helpers code.gfyoung2016-09-231-277/+0
| | | | | | | | | | Continuation of gh-8071 by removing the duplicate randint Cython code that is not generated via Tempita.
| * MAINT: Add Tempita to randint helpersgfyoung2016-09-202-0/+78
| | | | | | | | | | | | Refactors the randint helpers to use a Tempita template. This will reduce technical debt in the long run.
| * DOC: change version references from x.y to x.y.zPierre de Buyl2016-09-071-1/+1
| |
| * DOC: change Numpy to NumPy in dosctrings and commentsPierre de Buyl2016-09-061-1/+1
| | | | | | | | The strings in error messages were left untouched
| * TST: Use new warnings context manager in all testsSebastian Berg2016-09-021-11/+15
| | | | | | | | | | | | | | | | 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.
| * Merge pull request #5822 from anntzer/0-scale-distributionsNathaniel J. Smith2016-06-222-60/+88
| |\ | | | | | | Allow many distributions to have a scale of 0.
| | * Don't allow -0. as distribution shape parameter.Antony Lee2016-06-092-24/+34
| | | | | | | | | | | | At least the gamma generator doesn't support it.
| | * Allow many distributions to have a scale of 0.Antony Lee2016-04-062-60/+78
| | | | | | | | | | | | | | | | | | (in which case a stream of 0's is usually returned (or 1's)). See #5818.
| * | DOC: add reference to poisson rngJulian Taylor2016-06-131-0/+5
| | | | | | | | | | | | [ci skip]
| * | BUG: Fix segfaults in np.random.shuffleSimon Gibbons2016-06-102-1/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | np.random.shuffle will allocate a buffer based on the size of the first element of an array of strings. If the first element is smaller than another in the array this buffer will overflow, causing a segfault when garbage is collected. Additionally if the array contains objects then one would be left in the buffer and have it's refcount erroniously decrimented on function exit, causing that object to be deallocated too early. To fix this we change the buffer to be an array of int8 of the the size of the array's dtype, which sidesteps both issues. Fixes #7710
| * | DOC: fix incorrect Gamma distribution parameterization commentsstevenjkern2016-05-051-2/+2
| | |
| * | MAINT: Ignore DeprecationWarning for random_integers in tests.Charles Harris2016-04-101-9/+13
| | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | MAINT: Always use PyCapsule instead of PyCObject in mtrand.pyx.Charles Harris2016-04-104-98/+11
| |/ | | | | | | | | | | Python 2.7 has a backport of PyCapsule so we no longer need to support PyCObject. This PR makes that change and removes the no longer needed mt_compat.h file.
| * DOC: Clarify the valid range of integers passed to random.seed.Charles Harris2016-02-271-6/+6
| |
| * DOC: Update random.seed in mtrand.pyx.Oren Amsalem2016-02-271-1/+1
| | | | | | | | | | | | | | I know int is between 0 and 4294967295, but I think many people that do not know that will benefit from this comment. [ci skip]
| * Merge pull request #7279 from madphysicist/percentile-testsJulian Taylor2016-02-231-2/+5
| |\ | | | | | | TST: Fixed elements being shuffled