summaryrefslogtreecommitdiff
path: root/numpy/random
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #5051 from juliantaylor/thread-test-fixJulian Taylor2014-09-061-1/+8
|\ | | | | | | TST: accept small error in threaded random test
| * TST: accept small error in threaded random testJulian Taylor2014-09-061-1/+8
| | | | | | | | | | | | | | 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
* | Merge pull request #4937 from charris/pep8-numpy-randomJulian Taylor2014-08-244-175/+171
|\ \ | | | | | | | | | Pep8 numpy random
| * | BUG: Fix None comparison giving FutureWarning in choice function.Charles Harris2014-07-311-3/+3
| | | | | | | | | | | | | | | This is in numpy/random/mtrand/mtrand.pyx where the choice function was using comparisons of the form `None != p`.
| * | STY: PEP8 fixups for numpy/random.Charles Harris2014-07-313-172/+168
| |/
* | DOC: document broadcastable lam parameter of poissonJulian Taylor2014-06-111-2/+7
|/ | | | closes gh-4526
* Optimization for pickling random statesmarkdepristo2014-06-021-1/+9
| | | | -- Addresses https://github.com/numpy/numpy/issues/4763
* BUG: avoid infinite loop for small kappa in vonmisesJulian Taylor2014-05-282-4/+20
| | | | | | | 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
* BUG: reject too large seeds to RandomStateJulian Taylor2014-05-153-2/+40
| | | | | | 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.
* BUG: mtrand binomial algorithm is different from original paper algorithmJosh Lawrence2014-05-081-7/+4
|
* ENH: replace GIL of random module with a per state lockJulian Taylor2014-05-023-257/+383
| | | | | | | | | | | | | | | 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.
* Merge pull request #4641 from gdementen/random_docstring_fixesCharles Harris2014-05-011-87/+123
|\ | | | | DOC: standardize "size" arg description in random module docstrings
| * DOC: standardize "size" argument description in docstrings for functions of ↵Gaëtan de Menten2014-04-251-87/+123
| | | | | | | | | | | | random module there were many different versions for no good reason
* | DOC: fixed typoGaëtan de Menten2014-04-251-1/+1
|/
* fixed bad signature in docstring for uniform()Gaëtan de Menten2014-04-111-1/+1
|
* BLD: remove cython c source from gitJulian Taylor2014-04-051-26575/+0
| | | | | | | Instead generate at build time. The generated sources are still part of the sdist. tools/cythonize.py is copied from SciPy with small changes to the configuration.
* BUG: Explicitly reject nan values for p in binomial(n, p). Fixes #4571.Daniel da Silva2014-04-043-1259/+1339
| | | | Adds check with np.isnan(p) and raises ValueError if check is positive.
* TST: Add some tests for random.multivariate_normal.Charles Harris2014-03-221-10/+23
| | | | | | | | Explicitly Test that the default shape does not raise a DeprecationWarning. Check that a covariance matrix that is not positive-semidefinite raises a RuntimeWarning.
* ENH, MAINT: Check that covariance is positive-semidefinite.Charles Harris2014-03-222-7241/+7140
| | | | | | | | | | | | | | | | numpy.random.multivariate_normal uses SVD to obtain the covariance square root, but the result will be incorrect if the covariance is not positive-semidefinite and no warning will be given. However, a check can be made even while using the SVD by checking if the rows of u.T and v have the same sign, where u and v are given by u, d, v = svd(a). A deprecation warning is also fixed. When the default size was used an empty list was passed to multiply.reduce, which resulted in a default float 1. for a shape index. That is no longer legal. The problem is fixed by using an array reshape, which also avoids potential overflow in the original computation. Closes #4489.
* DOC: Fix typo in np.random.choice documentationAllen Riddell2014-02-271-1/+1
| | | np.random.permutation returns an array, which can be sliced.
* BUG: handle non integer types for multinomial/dirichlet sizeJulian Taylor2014-02-223-3048/+3296
| | | | Closes gh-3173
* BUG: fix shuffling of flexible dtypes and masked arraysJulian Taylor2014-02-133-589/+653
| | | | | closes gh-4270 and gh-3263 also regenerate with cython 0.20.1
* Merge pull request #4213 from juliantaylor/choice-improvseberg2014-01-222-8070/+8087
|\ | | | | improve random.choice performance and regen with cython 0.20
| * MAINT: regenerate with cython 0.20 and fix a warning it emitsJulian Taylor2014-01-192-8066/+8080
| | | | | | | | Fixed warning is "Non-trivial type declarators in shared declaration".
| * ENH: reduce overhead of probs check of choiceJulian Taylor2014-01-191-4/+7
| | | | | | | | | | Use kahan_sum as multinomial does. Closes gh-4188
* | MAINT: silence some build warnings due to missing NO_IMPORT_ARRAYRalf Gommers2014-01-191-0/+1
|/
* BUG: compile random in lfs modeJulian Taylor2014-01-032-1/+10
| | | | | randomkit.c uses fopen which requires LFS mode to support larger than 64 bit files on 32 bit systems.
* BUG: fix incorrect type in binomial ditsributions.cSebastian Berg2013-12-041-1/+1
| | | | | | | This caused slowness and wrong/potentially wrong results when the binomial result is larger then a native C int. Closes gh-3352
* DOC: Fix misleading description of random_sample in numpy.random docstring.Mark Dickinson2013-10-151-2/+2
|
* Fix example plot of Laplace distributionNiklas Koep2013-10-151-2/+2
| | | In the PDF used for the example plot of the Laplace distribution only the location parameter loc instead of the absolute difference between random variable and loc was divided by the scale parameter. For the example at hand this makes no difference as loc is 0 and lambda is 1. For different values, however, the plot makes no sense.
* MAINT: make loggam static in random kitLars Buitinck2013-09-081-3/+4
|
* STY: Giant comma spacing fixup.Charles Harris2013-08-183-36/+36
| | | | | | | Run the 2to3 ws_comma fixer on *.py files. Some lines are now too long and will need to be broken at some point. OTOH, some lines were already too long and need to be broken at some point. Now seems as good a time as any to do this with open PRs at a minimum.
* STY: Giant whitespace cleanup.Charles Harris2013-08-183-729/+729
| | | | Now is as good a time as any with open PR's at a low.
* DOC: Merge doc updates from http://docs.scipy.org/numpy/patch/.Charles Harris2013-08-151-1/+1
| | | | Preparatory to 1.8.0 branch.
* MAINT: Remove uses of the WarningManager class.Charles Harris2013-07-121-7/+3
| | | | | | | | | | | | WarningManager was a workaround for the lack of the with statement in Python versions < 2.6. As those versions are no longer supported it can be removed. Deprecation notes are added to WarningManager and WarningMessage, but to avoid a cascade of messages in third party apps, no warnings are raised at this time, that can be done later. Closes #3519.
* BUG: numpy.random.binomial raised ValueError for n == 0HaroldMills2013-06-283-1557/+1608
| | | | | | Range test for n was incorrect. Closes #3480
* ENH: random: Allow ngood=0 or nbad=0 in mtrand.hypergeometric.Warren Weckesser2013-06-133-252/+259
| | | | | Also edited the 'Parameters' section of the docstring to comply with the numpy docstring standard.
* Merge pull request #3243 from seberg/deprecate-non-integer-arguments-newCharles Harris2013-06-091-1/+1
|\ | | | | Deprecate non integer arguments
| * STY: Style fixes for integer deprecation changesSebastian Berg2013-06-091-1/+1
| | | | | | | | Also minor changes in the documentation.
| * MAINT: adept divisions for truedivideSebastian Berg2013-05-311-1/+1
| | | | | | | | Following deprecations would cause problems otherwise.
* | TST: remove docstrings from test_ functionsChristoph Gohlke2013-05-271-13/+8
| | | | | | | | See doc/TESTS.rst.txt for the reason.
* | BUG: Fix multivariate_normal issue with 'size' argumentChristoph Gohlke2013-05-273-4750/+5513
| | | | | | | | Ensure that the multivariate_normal size argument can be a numpy integer. Add regression test. Apply PEP8 to test_regression.py. Regenerate mtrand.c.
* | TST: remove docstring from test_randint_range functionChristoph Gohlke2013-05-271-1/+1
| | | | | | See doc/TESTS.rst.txt for the reason.
* | TST: rename one test_hypergeometric_range functionChristoph Gohlke2013-05-271-1/+1
|/ | | There are two test functions named `test_hypergeometric_range`
* 2to3: Apply the `numliterals` fixer and skip the `long` fixer.Charles Harris2013-04-131-1/+2
| | | | | | | | | | | | | | | | | | | The numliterals fixer replaces the old style octal number like '01' by '0o1' removes the 'L' suffix. Octal values were previously mistakenly specified in some dates, those uses have been corrected by removing the leading zeros. Simply Removing the 'L' suffix should not be a problem, but in some testing code it looks neccesary, so in those places the Python long constructor is used instead. The 'long' type is no longer defined in Python 3. Because we need to have it defined for Python 2 it is added to numpy/compat/np3k.py where it is defined as 'int' for Python 3 and 'long' for Python 2. The `long` fixer then needs to be skipped so that it doesn't undo the good work. Closes #3074, #3067.
* 2to3: Apply `print` fixer.Charles Harris2013-04-066-9/+8
| | | | | | | Add `print_function` to all `from __future__ import ...` statements and use the python3 print function syntax everywhere. Closes #3078.
* Merge pull request #460 from endolith/regex_formattingCharles Harris2013-04-031-1/+0
|\ | | | | DOC: Formatting fixes using regex
| * DOC: Used regex to find colons missing spaces which render wrong online, ↵endolith2013-03-191-1/+0
| | | | | | | | also other spacing or formatting mistakes
* | 2to3: Use absolute imports.Charles Harris2013-03-285-7/+7
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new import `absolute_import` is added the `from __future__ import` statement and The 2to3 `import` fixer is run to make the imports compatible. There are several things that need to be dealt with to make this work. 1) Files meant to be run as scripts run in a different environment than files imported as part of a package, and so changes to those files need to be skipped. The affected script files are: * all setup.py files * numpy/core/code_generators/generate_umath.py * numpy/core/code_generators/generate_numpy_api.py * numpy/core/code_generators/generate_ufunc_api.py 2) Some imported modules are not available as they are created during the build process and consequently 2to3 is unable to handle them correctly. Files that import those modules need a bit of extra work. The affected files are: * core/__init__.py, * core/numeric.py, * core/_internal.py, * core/arrayprint.py, * core/fromnumeric.py, * numpy/__init__.py, * lib/npyio.py, * lib/function_base.py, * fft/fftpack.py, * random/__init__.py Closes #3172
* Merge pull request #2992 from seberg/choice-object-scalarseberg2013-03-043-4241/+4450
|\ | | | | BUG: fix random.choice scalar object result and disallow 0-d arrays