summaryrefslogtreecommitdiff
path: root/numpy/random
Commit message (Collapse)AuthorAgeFilesLines
...
| * | BUILD: remove SSE2 flag from numpy.random buildsmattip2019-11-111-5/+0
| | |
* | | MAINT: Remove uses of scalar aliasesEric Wieser2019-11-137-32/+31
| | | | | | | | | | | | Relates to gh-6103
* | | MAINT: Delete and ignore generated filesEric Wieser2019-11-133-1593/+3
|/ /
* | merge latest changes on master branchRedRuM2019-11-0341-997/+3010
|\ \ | |/
| * DOC: random: Remove redundant 'See Also' entry in 'uniform' docstring.Warren Weckesser2019-10-281-1/+0
| |
| * BUG: random: biased samples from integers() with 8 or 16 bit dtype.Warren Weckesser2019-10-242-16/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an 8 or 16 bit dtype was given to the integers() method of the Generator class, the resulting sample was biased. The problem was the lines of the form const uint8_t threshold = -rng_excl % rng_excl; in the implementations of Lemire's method, in the C file distributions.c. The intent was to compute (UINT8_MAX+1 - rng_excl) % rng_excl However, when the type of rng_excl has integer conversion rank lower than a C int (which is almost certainly the case for the 8 and 16 bit types), the terms in the expression -rng_excl % rng_excl are promoted to int, and the result of the calculation is always 0. The fix is to make the expression explicit, and write it as const uint8_t threshold = (UINT8_MAX - rng) % rng_excl; rng is used, because rng_excl is simply rng + 1; by using rng, we we only need the constant UINT#_MAX, without the extra +1. For consistency, I made the same change for all the data types (8, 16, 32 and 64 bit). Closes gh-14774.
| * ENH: random: Add the multivariate hypergeometric distributionWarren Weckesser2019-10-186-3/+668
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new method multivariate_hypergeometric(self, object colors, object nsample, size=None, method='marginals') of the class numpy.random.Generator implements the multivariate hypergeometric distribution; see https://en.wikipedia.org/wiki/Hypergeometric_distribution, specifically the section "Multivariate hypergeometric distribution". Two algorithms are implemented. The user selects which algorithm to use with the `method` parameter. The default, `method='marginals'`, is based on repeated calls of the univariate hypergeometric distribution function. The other algorithm, selected with `method='count'`, is a brute-force method that allocates an internal array of length ``sum(colors)``. It should only be used when that value is small, but it can be much faster than the "marginals" algorithm in that case. The C implementations of the two methods are in the files random_mvhg_count.c and random_mvhg_marginals.c in numpy/random/src/distributions.
| * DOC: fix from reviewmattip2019-10-171-1/+1
| |
| * TEST, DOC: fixes from reviewmattip2019-10-171-1/+1
| |
| * DOC: typos from reviewmattip2019-10-151-1/+1
| |
| * DOC: clean up for moved references, remove ISeedSequencemattip2019-10-138-33/+27
| |
| * API: move bit_generator and generator to be privatemattip2019-10-1116-26/+17
| |
| * API: remove unused functions from distributions.hmattip2019-10-113-39/+36
| |
| * API: refactor function names in distribution.{h,c}, refactor float_fillmattip2019-10-117-262/+117
| |
| * API: make BitGenerators privatemattip2019-10-1111-25/+25
| |
| * API: rename common, bounded_integers -> _common, _bounded_integers; cleanupmattip2019-10-1116-20/+1615
| |
| * API: rearrange the cython files in numpy.randommattip2019-10-1119-259/+281
| |
| * BUG: random: Use correct length when axis is given to shuffle.Warren Weckesser2019-10-082-3/+12
| | | | | | | | | | | | | | When an axis argument was given, shuffle was using the original length of the array instead of the length of the given axis. This meant that, for example, if an array with shape (2, 10) was shuffled with axis=1, only the first two columns were shuffled.
| * BLD: remove unused functions, rearrange headers (from CC=clang) (#14534)Matti Picus2019-09-264-6/+5
| | | | | | | | | | * BUILD: remove unused functions, rearrange headers (from CC=clang) * MAINT: check enum at API call, not in provate function
| * Merge pull request #14573 from rgommers/remove-info-filesMatti Picus2019-09-251-5/+0
| |\ | | | | | | DOC: update submodule docstrings, remove info.py files
| | * MAINT: remove stray numpy/random/info.py fileRalf Gommers2019-09-221-5/+0
| | |
| * | MAINT: don't install partial numpy.random C/Cython API.Ralf Gommers2019-09-214-4/+22
| |/ | | | | | | | | | | | | | | | | See https://mail.python.org/pipermail/numpy-discussion/2019-September/080088.html for discussion. We need to do this right, and add tests and docs. All this PR does is not install bitgen.h, common.pxd and bit_generator.pxd (they're still shipped in the sdist, that is needed). Should be backported to 1.17.x
| * Merge pull request #14531 from WarrenWeckesser/binomial-regressionMatti Picus2019-09-197-11/+75
| |\ | | | | | | BUG: random: Create a legacy implementation of random.binomial.
| | * BUG: random: Create a legacy implementation of random.binomial.Warren Weckesser2019-09-167-11/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | Create a legacy implementation of the random_binomial method of RandomState that does not include the "short-circuit" check for n == 0 or p == 0. This ensures that the stream of variates is consistent with the behavior in 1.16. Closes gh-14522.
| * | BUG: Avoid ctypes in GeneratorsKevin Sheppard2019-09-182-4/+4
| |/ | | | | | | | | | | Avoid unnecessary use of ctypes in Generators closes #14131
| * Merge pull request #14523 from WarrenWeckesser/random-dup-protosMatti Picus2019-09-161-5/+0
| |\ | | | | | | MAINT: random: Remove a few duplicated C function prototypes.
| | * MAINT: random: Remove a few duplicated C function prototypes.Warren Weckesser2019-09-151-5/+0
| | |
| * | Merge pull request #13829 from kianasun/add-permutation-axisMatti Picus2019-09-162-14/+79
| |\ \ | | |/ | |/| ENH: Add axis argument to random.permutation and random.shuffle
| | * ENH: Improve permutation and shuffle functions on a given axisKexuan Sun2019-09-142-14/+79
| | |
| * | Merge pull request #14498 from mattip/random-namespaceRalf Gommers2019-09-157-320/+5
| |\ \ | | | | | | | | MAINT: remove the entropy c-extension module
| | * | MAINT: remove the entropy c-extension modulemattip2019-09-137-320/+5
| | |/
| * | BUG: Fix randint when range is 2**32Kevin Sheppard2019-09-142-2/+13
| |/ | | | | | | | | | | Fix randint to use 32-bit path when range is exactly 2**32 closes #14189
| * BUG: random: Fix the mistaken duplicate line. Fixes gh-14557.Warren Weckesser2019-09-121-1/+1
| |
| * MAINT: random: Revert gh-14458.Warren Weckesser2019-09-121-3/+3
| |
| * BUG: random.hypergeometic assumes npy_long is npy_int64, hung ppc64Allan Haldane2019-09-091-3/+3
| | | | | | | | Fixes #14457
| * DOC: fix doc linking, was referencing private submodules.Ralf Gommers2019-08-251-2/+2
| | | | | | | | Closes gh-14359
| * BUG: Fix segfault in `random.permutation(x)` when x is a string. (#14241)Maxwell Aladago2019-08-224-2/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fixing segfault error in np.random.permutation(x) where x is str * removed whitespace * changing error type to ValueError * changing error type to ValueError * changing error type to ValueError * tests * changed error to IndexError for backward compatibility with numpy 1.16 * fixes numpy.randomstate.permutation segfault too * Rolled back to ValueError for Generator.permutation() for all 0-dimensional * fixes refuige erro and rolls backs to AxisError
| * Merge pull request #14298 from 5ghz/cross_compileCharles Harris2019-08-201-2/+2
| |\ | | | | | | BUG: Fix numpy.random bug in platform detection
| | * Fix bug in platform detectionVladimir Pershin2019-08-161-2/+2
| | |
| * | MAINT: random: Change type of SeedSequence.n_children_spawned to uint32_t.Warren Weckesser2019-08-202-1/+3
| | |
| * | MAINT: random: Fix import in example for _coerce_to_uint32_array.Warren Weckesser2019-08-201-1/+1
| | |
| * | MAINT: random: Match type of SeedSequence.pool_size to DEFAULT_POOL_SIZE.Warren Weckesser2019-08-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes this compiler warning: gcc: numpy/random/bit_generator.c numpy/random/bit_generator.c:4889:41: warning: comparison of integers of different signs: 'int' and 'uint32_t' (aka 'unsigned int') [-Wsign-compare] __pyx_t_6 = ((__pyx_v_self->pool_size != __pyx_v_5numpy_6random_13bit_generator_DEFAULT_POOL_SIZE) != 0); ~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated
| * | MAINT: Improve error message dtype appearancealeju2019-08-131-1/+1
| | | | | | | | | | | | | | | | | | This changes the string conversion of an expected dtype in an error message from e.g. "<class 'numpy.float64'>" to "float64".
| * | BUG: Fix formatting error in exception messagealeju2019-08-131-1/+1
| |/ | | | | | | | | | | | | | | This commit fixes a simple formatting error in the generation of an exception message. The message is supposed to contain the expected vs. the actual dtype, but instead contained two times the expected dtype.
| * Merge pull request #14141 from KmolYuan/random_freeze_analysisCharles Harris2019-08-081-1/+6
| |\ | | | | | | ENH: add c-imported modules for freeze analysis in np.random
| | * ENH: add c-imported modules for freeze analysis in np.randomYuan2019-07-281-1/+6
| | |
| * | Fixed default BitGenerator nameGiuseppe Cuccu2019-08-061-3/+3
| |/
* | ensure that sqrt does not return NaN for method=eigh is check_valid='ignore'RedRuM2019-11-031-1/+4
| |
* | DOC: add a note about using svd(hermitian=True) as an alternative to eighzoj6132019-11-011-0/+1
| | | | | | Co-Authored-By: Eric Wieser <wieser.eric@gmail.com>
* | MAINT: use v instead of u inside check_valid if statement and set _factor ↵RedRuM2019-10-181-3/+9
| | | | | | | | separately for each method