summaryrefslogtreecommitdiff
path: root/numpy/random/setup.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix lib flags for librandomMatthew Brett2022-06-291-22/+12
| | | | | Add the voltbl fix to librandom. Remove SSE flag for GCC on 32-bit Windows, it's the default.
* Fix typo in setup.pycaioagiani2022-01-301-1/+1
|
* BUG: Fix CI failure by adding symbols to be exported on CygwinMasamichi Hosoda2022-01-231-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two types of Cython in the Cygwin environment. One is a Cygwin package's Cython, which does not add a `__declspec(dllexport)` attribute to symbols due to its custom patch. The other is Cython, which is installed with pip and has no custom patches, so the symbols are added the `__declspec(dllexport)` attribute. Since CI uses symbols in distributions.c by cffi, we need to export them. The commit b797a0cb97a8a9e7e36962dc8c37c075967aa88b exports the symbols by adding the `__declspec(dllexport)` attribute to them. However, in the Cygwin package's Cython environment, the symbols required for import are not exported and the module cannot be imported. https://cygwin.com/pipermail/cygwin/2022-January/250481.html By the previous commit, the `__declspec(dllexport)` attribute is removed, so in the environment, the required symbols are exported and the module can be imported. However, on the other hand, in the pip-installed Cython environment, the symbols used by cffi are not exported, so CI failed. This commit exports the symbols without `__declspec(dllexport)` for use by cffi. It exports both the symbols required for import and the symbols used for cffi, regardless of which Cython environment is used.
* Apply suggestions from code reviewMatthew Brett2021-10-261-0/+2
| | | Co-authored-by: Matti Picus <matti.picus@gmail.com>
* Allow clib callable build flagsMatthew Brett2021-10-231-1/+13
| | | | | | | | | | | | | | | | | | | At the moment, we are guessing whether we have the MSVC compiler, by looking at what Python was originally compiled for. That works only if we are using the same compiler, but this is not the case when we compile with e.g. mingw-w64 using Python.org Python. Unfortunately, at the time we are specifying build flags, we don't know what compiler we are using. Allow build flags to clib to be callables that return lists of strings, instead of strings, where the callables can do work like inspecting the compiler, at build time. Use this to check for MSVC at build time, when specifying the `/GL-` flag. See gh-9977 for a related discussion about these flags.
* BUG: Use lop1p to improve numerical precisionKevin Sheppard2021-03-171-3/+4
| | | | | | | Use log1p(-x) instead of log(1 - x) Seperate legacy version from current closes #17020
* BUG: Fixed an issue where `.pyi` weren't picked up by numpy sub-packagesBas van Beek2020-11-031-0/+1
|
* Mark tests as a subpackage rather than data.Hameer Abbasi2020-05-061-1/+2
|
* BUG: missing 'f' prefix for fstringmattip2020-04-221-1/+1
|
* BUG: add missing c_distributions.pxd, enables cython use of random C-API ↵Matti Picus2020-03-161-30/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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
* MAINT: Remove unnecessary 'from __future__ import ...' statementsJon Dufresne2020-01-031-2/+0
| | | | | As numpy is Python 3 only, these import statements are now unnecessary and don't alter runtime behavior.
* Merge pull request #14954 from mattip/test-extending-cffiCharles Harris2019-11-271-3/+3
|\ | | | | TST. API: test using distributions.h via cffi
| * API, MAINT: export symbols on MSVC, fix typosmattip2019-11-211-3/+3
| |
* | DOC, API: add numpy.random.__index__.pxd and document numpy.random.* funcsmattip2019-11-211-0/+1
|/
* MAINT: move numpy/random/examples -> numpy/random/_examplesmattip2019-11-191-1/+1
|
* API: restructure and document numpy.random C-API (#14604)Matti Picus2019-11-191-0/+3
| | | | | | | | | | | | | | | | * API: restructure and document numpy.random C-API * DOC: fix bad reference * API: ship, document, and start to test numpy.random C-API examples * API, DOC, TST: fix tests, refactor documentation to include snippets * BUILD: move public headers to numpy/core/include/numpy/random * TST: ignore DeprecationWarnings in setuptools and numba * DOC: document the C-API as used from Cython
* BUILD: remove SSE2 flag from numpy.random buildsmattip2019-11-111-5/+0
|
* ENH: random: Add the multivariate hypergeometric distributionWarren Weckesser2019-10-181-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* API: move bit_generator and generator to be privatemattip2019-10-111-11/+2
|
* API: make BitGenerators privatemattip2019-10-111-11/+11
|
* API: rename common, bounded_integers -> _common, _bounded_integers; cleanupmattip2019-10-111-4/+4
|
* API: rearrange the cython files in numpy.randommattip2019-10-111-0/+9
|
* MAINT: don't install partial numpy.random C/Cython API.Ralf Gommers2019-09-211-2/+0
| | | | | | | | | 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
* MAINT: remove the entropy c-extension modulemattip2019-09-131-12/+0
|
* Fix bug in platform detectionVladimir Pershin2019-08-161-2/+2
|
* BUG: do not force emulation of 128-bit arithmetic.Robert Kern2019-06-271-3/+2
|
* MAINT: move location of bitgen.hmattip2019-06-271-1/+0
|
* ENH: Add SFC64 BitGenerator.Robert Kern2019-06-251-1/+1
|
* ENH: use SeedSequence to generate entropy for seedingmattip2019-06-261-3/+7
|
* MAINT: remove xoshiro* BitGeneratorsmattip2019-06-261-1/+1
|
* MAINT: remove ThreeFry BitGeneratormattip2019-06-251-2/+1
|
* MAINT: remove pcg32 BitGeneratormattip2019-06-251-1/+1
|
* MAINT: remove dSFMTmattip2019-06-161-17/+1
|
* MAINT: random: Rewrite the hypergeometric distribution.Warren Weckesser2019-06-141-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary of the changes: * Move the functions random_hypergeometric_hyp, random_hypergeometric_hrua and random_hypergeometric from distributions.c to legacy-distributions.c. These are now the legacy implementation of hypergeometric. * Add the files logfactorial.c and logfactorial.h, containing the function logfactorial(int64_t k). * Add the files random_hypergeometric.c and random_hypergeometric.h, containing the function random_hypergeometric (the new implementation of the hypergeometric distribution). See more details below. * Fix two tests in numpy/random/tests/test_generator_mt19937.py that used values returned by the hypergeometric distribution. The new implementation changes the stream, so those tests needed to be updated. * Remove another test obviated by an added constraint on the arguments of hypergeometric. Details of the rewrite: If you carefully step through the old function rk_hypergeometric_hyp(), you'll see that the end result is basically the same as the new function hypergeometric_sample(), but the new function accomplishes the result with just integers. The floating point calculations in the old code caused problems when the arguments were extremely large (explained in more detail in the unmerged pull request https://github.com/numpy/numpy/pull/9834). The new version of hypergeometric_hrua() is a new translation of Stadlober's ratio-of-uniforms algorithm for the hypergeometric distribution. It fixes a mistake in the old implementation that made the method less efficient than it could be (see the details in the unmerged pull request https://github.com/numpy/numpy/pull/11138), and uses a faster function for computing log(k!). The HRUA algorithm suffers from loss of floating point precision when the arguments are *extremely* large (see the comments in github issue 11443). To avoid these problems, the arguments `ngood` and `nbad` of hypergeometric must be less than 10**9. This constraint obviates an existing regression test that was run on systems with 64 bit long integers, so that test was removed.
* MAINT: random: Rename legacy distributions file.Warren Weckesser2019-06-091-1/+1
| | | | | | In numpy/random/src/legacy/, rename distributions-boxmuller.c to legacy-distributions.c. This file holds all the legacy distributions, so the new name is more accurate.
* Revert "MAINT: Implement API changes for randomgen-derived code"Kevin Sheppard2019-05-271-2/+8
| | | | This reverts commit 17e0070df93f4262908f884dca4b08cb7d0bba7f.
* BLD: Improve setupKevin Sheppard2019-05-271-107/+97
| | | | Attempt to avoid defining variables that are incorrect for some platforms
* MAINT: remove pre-randomgen _mtrandmattip2019-05-231-13/+0
|
* MAINT: remove threefry32, xoroshiro128, xorshift1024 BitGeneratorsmattip2019-05-201-4/+1
|
* BLD: Use numpy detection of SSEKevin Sheppard2019-05-201-18/+9
| | | | Let numpy detect SSE2
* BUG: Ensure integer-type stream on 32bitKevin Sheppard2019-05-201-3/+2
| | | | | | Ensure integer type is stream compatible on 32 bit Fix incorrect clause end Add integer-generator tests that check long streams
* MAINT: Implement API changes for randomgen-derived codemattip2019-05-201-22/+3
| | | | | | | | | | | | | | | | | | | | | remove numpy.random.gen, BRNG.generator, pcg*, rand, randn remove use_mask and Lemire's method, fix benchmarks for PCG removal convert brng to bitgen (in C) and bit_generator (in python) convert base R{NG,andom.*} to BitGenerator, fix last commit randint -> integers, remove rand, randn, random_integers RandomGenerator -> Generator, more "basic RNG" -> BitGenerator random_sample -> random, jump -> jumped, resync with randomgen Remove derived code from entropy Port over changes accepted in upstream to protect log(0.0) where relevant fix doctests for jumped, better document choice Remove Python 2.7 shims Use NPY_INLINE to simplify Fix performance.py to work Renam directory brng to bit_generators Fix examples wiht new directory structure Clarify relationship to historical RandomState Remove references to .generator Rename xoshiro256/512starstar
* MAINT: remove legacy, refactor legacy -> mtrand in docsmattip2019-05-201-5/+6
|
* BUG: __dealloc__ can be called without __init__ in some error modesmattip2019-05-201-1/+1
| | | | | | skip doctests that require scipy move original mtrand module to _mtrand adjust documentation for namespace change
* BENCH: convert bencmarks to asv formatmattip2019-05-201-7/+146
| | | | | | | remove files that were part of the origal repo rework randomgen docs to integrate with numpy and fix some links remove convenience functions, require explicit call to gen.brng move code out of numpy.random.randomgen into numpy.random
* BUILD: move files out of _randomgenmattip2019-05-201-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | first cut at building randomgen upgrade 'cythonize' and fix absolute imports to relative define NPY_NO_DEPRECATED_API and fix other warnings enable pgc64 by always using PCG_EMULATED_MATH refactor so import randomgen works add TODO comments for pcg64 improvements fix imports, module name in setup.py; remove _testing make cythonize non-recursive, restore examples to proper place update to randomgen 7bca296c0b9 replace mtrand with LegacyGenerator, tweak for compatibility port f879ef4 to fix GH10839 minimized difference between generator.pyx and _legacy.pyx fix namespace in doctests, mark results that are random update to randomgen commit 95c8cdd1c Incorporate testing of edge cases into main tests Rename test files to describe their purpose Import import locations to reflect numpy paths Correct tolerance on float32 tests Remove set_printoptions Remove complex normal Remove future imports Pull in BasicRNG source changes from original author Small doc fixes _mtrand => _rand Improve consistency of nan handling Prevent nans prducing values from int functions add randomgen documentation to the tree
* MAINT: remove unused stdlib importsEmil Hessman2018-09-301-2/+1
|
* 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.
* BLD: try_run fails on Python 3.5b4 for WindowsChristoph Gohlke2015-08-011-14/+1
|