summaryrefslogtreecommitdiff
path: root/numpy
Commit message (Collapse)AuthorAgeFilesLines
* MAINT: lib: A few changes in some vectorize tests.Warren Weckesser2020-05-021-41/+31
| | | | | | | | | Added a note to some of the tests that the order of the calls is an important part of the test, because the code is testing the caching of the ufuncs. Also reuse a couple functions in the vectorize tests by defining them at the module level.
* BUG: lib: Fix a problem with vectorize with default parameters.Warren Weckesser2020-04-302-7/+92
| | | | | | | | | | | | | | | | | | | | | | | When `otypes` is given to `vectorize` and then the instance is called, it creates a ufunc by calling numpy.core.umath.frompyfunc. The number of arguments given to this ufunc is set to the number of arguments in the call of the vectorize instance. This ufunc is cached, so frompyfunc does not have to be called on the next call. The problem is that, if the function being wrapped has parameters with default values, the number of arguments passed to the vectorize instance can change, and when that happens, a new ufunc must be created by calling frompyfunc with the correct number of arguments. This commit changes the cache of the ufunc from a simple attribute that holds the most recent ufunc to a dictionary whose keys are the number of arguments in the call. The cache is only used when the vectorized function is called with only positional arguments and there are no excluded arguments. If keywords are used, the number of arguments is no longer sufficient to uniquely identify a previously created ufunc. Closes gh-16120.
* DOC: add note on type casting to numpy.left_shift(). (#16081)Petre-Flaviu Gostin2020-04-301-0/+11
| | | | | * DOC: add note on type casting to numpy.left_shift(). Co-Authored-By: Ross Barnowski <rossbar@berkeley.edu>
* MAINT: Fix random.PCG64 signature in its docstring (#16113)ndunnewind2020-04-291-1/+1
|
* ENH: update numpy.linalg.multi_dot to accept an `out` argument (#15715)sslivkoff2020-04-302-11/+60
| | | | | | | | | | | | | * ENH: update numpy.linalg.multi_dot to accept an `out` argument * TST ensure value returned by numpy.linalg.multi_dot matches out * DOC add note about initial call to numpy.linalg.multi_dot * DOC add release note for #15715 Co-authored-by: Matti Picus <matti.picus@gmail.com> Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
* BUG: Fix numpy.random.dirichlet returns NaN for small 'alpha' parameters. ↵Benjamin Trendelkamp-Schroer2020-04-292-13/+97
| | | | | | | | | | | | | | | (#14924) * Add stick-breaking * Add tests demonstrating slowness for beta and dirichlet generators for small alpha (and beta) values * Remove the test for beta with small `a` and `b` * Switch from standard to stick-breaking method whenever alpha.max() < 0.1 Co-authored-by: Warren Weckesser <warren.weckesser@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
* Merge pull request #16076 from WarrenWeckesser/fix-gh-16066Sebastian Berg2020-04-273-11/+104
|\ | | | | BUG: random: Generator.integers(2**32) always returned 0.
| * TST: random: Skip a test if integers are 32 bit.Warren Weckesser2020-04-271-0/+2
| |
| * TST: random: Add more repeatability tests for random integers.Warren Weckesser2020-04-272-0/+45
| | | | | | | | | | | | | | Add repeatability tests for when the range of the integers is `2**32` (and `2**32 +/- 1` for good measure) with broadcasting. The underlying functions called by Generator.integers and random.randint when the inputs are broadcast are different than when the inputs are scalars.
| * MAINT: random: Add assert() statements.Warren Weckesser2020-04-261-0/+11
| | | | | | | | | | Assert that an invalid value (2**n-1 for n = 8, 16, 32, 64) has not been passed to the Lemire function.
| * BUG: random: Generator.integers(2**32) always returned 0.Warren Weckesser2020-04-262-11/+46
| | | | | | | | | | | | | | | | | | | | | | | | When the input to Generator.integers was 2**32, the value 2**32-1 was being passed as the `rng` argument to the 32-bit Lemire method, but that method requires `rng` be strictly less then 2**32-1. The fix was to handle 2**32-1 by calling next_uint32 directly. This also works for the legacy code without changing the stream of random integers from `randint`. Closes gh-16066.
* | Merge pull request #16009 from eric-wieser/remove-npyiter-converterSebastian Berg2020-04-271-46/+2
|\ \ | | | | | | MAINT: Replace npyiter_order_converter with PyArray_OrderConverter
| * | MAINT: Replace npyiter_order_converter with PyArray_OrderConverterEric Wieser2020-04-271-46/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The TODO precondition now holds, so we no longer need this function.function_base.py A consequence of this change is that: * `None` is now accepted as an alias for `'K'` * Lowercase letters are now accepted as a replacement for the corresponding uppercase letter Neither of these are particularly desirable, but we could always deprecate them in PyArray_OrderConverter at a later date.
* | | Merge pull request #16008 from eric-wieser/tidy-converter-errorsSebastian Berg2020-04-274-271/+269
|\ \ \ | |/ / | | / | |/ |/| BUG: Unify handling of string enum converters
| * BUG: Unify handling of string enum convertersEric Wieser2020-04-274-271/+269
| | | | | | | | | | | | | | | | This fixes a collection of bugs: * Confusion between `TypeError` and `ValueError` * Allowing invalid arguments if they are valid up to the first embedded null * Producing better errors for non-ascii unicode strings
* | Merge pull request #16064 from keremh/fix-exception-raiseCharles Harris2020-04-254-10/+14
|\ \ | | | | | | ENH: Fix exception causes in four .py files
| * | Update numpy/lib/shape_base.pyKerem Hallaç2020-04-251-1/+3
| | | | | | | | | Co-Authored-By: Ross Barnowski <rossbar@berkeley.edu>
| * | Update numpy/lib/index_tricks.pyKerem Hallaç2020-04-251-1/+3
| | | | | | | | | Co-Authored-By: Ross Barnowski <rossbar@berkeley.edu>
| * | ENH: Fix exception causes in four .py fileskeremh2020-04-244-10/+10
| | |
* | | BUG: fix AttributeError on accessing object in nested MaskedArray. (#15949)RenaRuirui2020-04-252-2/+31
| | | | | | | | | | | | | | | | | | * BUG: fix AttributeError on accessing object in nested MaskedArray Co-authored-by: Rena Xu <renaxu@Renas-MacBook-Pro.local> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: vagrant <vagrant@vagrant.vm>
* | | Merge pull request #16075 from rgommers/doc-choiceCharles Harris2020-04-251-0/+5
|\ \ \ | | | | | | | | DOC: add a note on sampling 2-D arrays to random.choice docstring
| * | | DOC: add a note on sampling 2-D arrays to random.choice docstringRalf Gommers2020-04-251-0/+5
| |/ / | | | | | | | | | Addresses a comment on gh-10835.
* | | DOC: Add missing bracket (gh-16051)Chunlin2020-04-2517-33/+33
|/ / | | | | Add missing closing brackets, script to generate the list in the PR gh-16051.
* | Added some chained exceptionsChris Holland2020-04-232-8/+8
| |
* | DOC: Add converters example to the loadtxt docstring (gh-16043)Warren Weckesser2020-04-231-4/+15
| | | | | | Co-Authored-By: Ross Barnowski <rossbar@berkeley.edu>
* | Merge pull request #15648 from xiegengxin/avx512-exp-float64Matti Picus2020-04-239-53/+651
|\ \ | | | | | | MAINT: AVX512 implementation with intrinsic for float64 input np.exp()
| * | MAINT: Add test case of strides input & more commentsGengxin Xie2020-04-082-2/+13
| | |
| * | MAINT: Add test cases about +/- INF +/- NAN and overflowGengxin Xie2020-04-072-0/+7
| | |
| * | MAINT: Update more accuracy expected result of exp(x)Gengxin Xie2020-04-031-1/+1
| | |
| * | MAINT: Skip compiling AVX512_exp_DOUBLE when clang <= 10.0.0Gengxin Xie2020-04-031-0/+4
| | |
| * | MAINT: Add more accuracy test casesGengxin Xie2020-03-241-107/+271
| | |
| * | MANIT: Change some variables in AVX512F_exp_DOUBLEGengxin Xie2020-03-191-8/+8
| | |
| * | MANIT: Move lookup table and constants to new header fileGengxin Xie2020-03-183-132/+138
| | |
| * | MAINT: fix unicode errorGengxin Xie2020-03-161-1/+1
| | |
| * | MAINT: avx512 implementation with intrinsic for float64 np.exp()Gengxin Xie2020-03-047-6/+412
| | |
* | | BUG: Add _LARGE_FILES to def_macros[] when platform is AIX (gh-15938)Michael Felt2020-04-221-1/+5
| | | | | | | | | AIX needs to be told to use large file support at all times. Fixes parts of gh-15801.
* | | ENH: Fix exception causes in build_ext.pykeremh2020-04-221-2/+2
| | |
* | | BUG: missing 'f' prefix for fstringmattip2020-04-221-1/+1
| | |
* | | Merge pull request #16032 from keremh/fix-exception-raiseMatti Picus2020-04-221-2/+2
|\ \ \ | | | | | | | | ENH: Fix exception causes in build_clib.py
| * | | ENH: Fix exception causes in build_clib.pykeremh2020-04-211-2/+2
| | | |
* | | | Merge pull request #16007 from eric-wieser/add-converter-testsMatti Picus2020-04-222-0/+253
|\ \ \ \ | | |_|/ | |/| | TST: Add tests for the conversion utilities
| * | | TST: Add tests for the conversion utilitiesEric Wieser2020-04-172-0/+253
| | | | | | | | | | | | | | | | | | | | | | | | This way we can test them without having to try and guess their behavior from the functions that use them. This also makes a bit more apparently the inconsistencies between them.
* | | | Merge pull request #16038 from rossbar/maint/poly_movetestMatti Picus2020-04-222-50/+49
|\ \ \ \ | | | | | | | | | | MAINT,TST: Move _repr_latex tests to test_printing.
| * | | | MAINT,TST: Move _repr_latex tests to test_printing.Ross Barnowski2020-04-212-50/+49
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Organizational refactoring - the tests for the polynomial _repr_latex method were originally defined in test_classes.py. Based on the descriptions of the various test files, it is a better fit in test_printing.py. Updated docstring to reflect that _repr_latex is used in Jupyter environments, not IPython terminals (by default).
* | | | BUG: Fix lexsort axis checkvrakesh2020-04-212-3/+15
|/ / /
* | | DOC: Clarify docs on mixed advanced indexing and slicing (gh-15891)Paul Rougieux2020-04-201-4/+13
| | | | | | | | | | | | | | | | | | It was not clear how to reproduce the slice example with multi dimensional array indexing. I hope the additional example clarifies the equivalence between slice and multi array for new users. Co-Authored-By: Eric Wieser <wieser.eric@gmail.com> Co-Authored-By: Anirudh Subramanian <anirudh2290@apache.org>
* | | BUG: Alpha parameter must be 1D in `generator.dirichlet` (#15951)panpiort82020-04-184-18/+32
| | | | | | | | | | | | | | | Only one dimensional alpha paramter is currently supported, but higher dimensions were silently allowed and gave an incorrect results. This fixes the regression. In the future, the API could be extended to allow higher dimensional arrays for alpha. Fixes gh-15915
* | | BUG: Fix inf and NaN-warnings in half float `nextafter` (#15988)Adam2020-04-172-8/+28
| | | | | | | | | | | | | | | | | | | | | This commit fixes the at `nextafter(np.inf, ...)` should not return NaN unless the second value is NaN. Also `nextafter(NaN, ...)` and `nextafter(..., NaN) should not give the invalid value warning (no invalid value is created, the invalid value is propagated). This aligns half-float `nextafter` with double/float `nextafter`. Closes #15977
* | | Merge pull request #15993 from vrakesh/masked_array_sort_docSebastian Berg2020-04-161-2/+12
|\ \ \ | | | | | | | | DOC: Fix method documentation of function sort in MaskedArray
| * | | DOC:Fix method documentation of function sort()vrakesh2020-04-161-2/+12
| |/ /