summaryrefslogtreecommitdiff
path: root/numpy
Commit message (Collapse)AuthorAgeFilesLines
* BUG, SIMD: Fix unsigned 8-bit integer divison by a scalarissue_20025Sayed Adel2021-10-231-1/+1
| | | | | | Same as 64-bit divistion, except quad wide divison leads to inaccurate multiplier in certain cases when the log2 of the divisor overflow to zero.
* TST, SIMD: Enhance the test case for SIMD integer division by adding several ↵Sayed Adel2021-10-231-50/+25
| | | | data ranges
* BUG, SIMD: Fix 64-bit integer divison by a scalar on MSVC <= 2017Sayed Adel2021-10-211-2/+3
| | | | | | The multiplier factor that used for integer division wasn't correctly calculated due inaccurate implementation of the emulated version of intrinsic `_udiv128`.
* MAINT: core: Update the comment about _parse_signature with more complete info.Warren Weckesser2021-10-191-3/+18
|
* BUG: core: Fix incorrect check of NpyIter_Deallocate return value.warren2021-10-193-1/+19
| | | | | | | NpyIter_Deallocate returns 0 for failure and 1 for success, so the check `NpyIter_Deallocate(iter) < 0` is not correct. (See relevant comments in gh-20069.)
* Merge pull request #18905 from seberg/ufunc-refactor-2021Matti Picus2021-10-1916-521/+866
|\ | | | | MAINT: Refactor reductions to use NEP 43 style dispatching/promotion
| * TST: Add a test covering logical ufuncs for custom DTypesSebastian Berg2021-10-112-0/+72
| | | | | | | | | | | | In particular, this covers a casting error that currently cannot be hit for normal ufuncs, because they already check casting during the legacy dtype resolution (which is called first).
| * DOC: Comment fixups based on Marten's reviewSebastian Berg2021-10-113-7/+11
| |
| * MAINT: Fixups and new tests based on Marten's reviewsSebastian Berg2021-10-114-27/+52
| | | | | | | | | | | | | | | | | | More fixups are coming, the biggest change is that the error message is now improved when a reduction makes no sense such as `np.subtract.reduce(np.array([1, 2, 3], dtype="M8[s]"))` where input and output cannot have the same descriptor. (Some more fixups still to go)
| * BUG: Fixup and add tests for logical ufuncsSebastian Berg2021-10-111-2/+9
| |
| * TST: Add test for reduceat/accumulate output shape mismatchSebastian Berg2021-10-112-2/+22
| | | | | | | | | | | | | | At least the reduceat path seems to have been untested before. The slight change in code layout (added assert) is just to make the code slightly easier to read. Since otherwise it looks like there is an additional `else` branch when `out` is given.
| * BUG: Fix unsupplied DType path in dispatchingSebastian Berg2021-10-111-5/+2
| | | | | | | | | | | | | | This did not actually trigger any problems, probably because the reduce fallback mode later just catches it anyway... On the upside, this probably fixes most of the caching issues ;)
| * MAINT: Remove unnecessary assert that may trip 32 bitSebastian Berg2021-10-111-3/+0
| | | | | | | | | | | | Mainly to see if this is indeed the problem, but the assert is not necessary, and it might be we end up with the wrong dtype when the input is a compatible (but different) integer already?
| * TST: Add test for ufunc out-cast failure when input cast is ignoredSebastian Berg2021-10-111-0/+10
| |
| * TST: Add additional reduceat/accumulate testsSebastian Berg2021-10-111-0/+17
| |
| * TST: Add test for rare reduce dtype mismatch error pathSebastian Berg2021-10-111-0/+16
| |
| * BUG: Add forgotten fix for needs-api for reduceatSebastian Berg2021-10-111-1/+3
| |
| * BUG: Fixup some refcounting and remove unused error pathSebastian Berg2021-10-111-11/+12
| |
| * MAINT: Refactor reductions to use NEP 43 style dispatching/promotionSebastian Berg2021-10-1112-512/+689
| | | | | | | | | | | | | | | | This also implements new promoters for the logical functions. The reasoning is that any logical function can always be handled by first casting to boolean without changing the meaning. This is true (unless the output is object), and already effectively used for `np.all`/`np.any`.
* | ENH: Create an experimental export of the new DType API (#19919)Sebastian Berg2021-10-1811-76/+817
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ENH: Create an experimental export of the new DType API This expposes an experimental DType and ufunc API. It can be used by including the experimental header AND setting the `NUMPY_EXPERIMENTAL_DTYPE_API=1` environment variable. A user must further call: if (import_experimental_dtype_api(version) < 0) { return NULL; } with a strict version check that will error on any mismatch. At this time, I _know_ that some changes will happen, but it feels like it may be a good idea to make this public anyway, with all the problems attached... (e.g. as of now ufunc reductions will just not work, since that PR is not yet merged.) Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* | Add note to iterable docstring about 0d arrays.Ross Barnowski2021-10-151-0/+13
| | | | | | | | Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
* | fix minor typo in commentKent R. Spillner2021-10-131-1/+1
| |
* | Merge pull request #20105 from BvB93/matrixCharles Harris2021-10-124-52/+211
|\ \ | | | | | | ENH: Add annotations for `np.matrix`
| * | TST: Add typing tests for `np.matrix`Bas van Beek2021-10-121-0/+69
| | |
| * | ENH: Add annotations for `np.matrix`Bas van Beek2021-10-123-52/+142
| | |
* | | MAINT: Update F2PY documentation URLShriraj Hegde2021-10-121-2/+1
|/ / | | | | | | http://cens.ioc.ee/projects/f2py2e/ is unavailable and links to NumPy and SciPy at https://web.archive.org/web/20140822061353/http://cens.ioc.ee:80/projects/f2py2e/ are too outdated.
* | Merge pull request #20088 from WarrenWeckesser/fix-gh-200077Charles Harris2021-10-112-20/+49
|\ \ | | | | | | BUG: core: result_type(0, np.timedelta64(4)) would seg. fault.
| * | MAINT: core: Rename the utility function used by PyArray_ResultTypewarren2021-10-111-8/+8
| | |
| * | DOC: core: Improve a comment by making it more specific.Warren Weckesser2021-10-111-1/+1
| | | | | | | | | Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
| * | BUG: core: result_type(0, np.timedelta64(4)) would seg. fault.warren2021-10-102-20/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change, the line in convert_datatype.c result = PyArray_CastDescrToDType(all_descriptors[0], common_dtype); would trigger a seg. fault with a call such as np.result_type(0, np.timedelta64(4)) The problem was that `all_descriptors[0]` was NULL, and it was dereferenced in PyArray_CastDescrToDType. The code in the loop that followed the above line avoided passing NULL values in all_descriptors[i] to PyArray_CastDescrToDType by checking that the corresponding input argument to `result_type` was not a Python scalar. A different code path was taken in that case. The seg. fault is fixed by applying that same check to the first argument. Closes gh-20077.
* | | BUG: AVX-512F log() overflowsDeveloper-Ecosystem-Engineering2021-10-112-1/+40
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LLVM has a bug with AVX-512F masked multiply intrinsic `_mm512_mask_mul_pd`. The multiply operation is performed unmasked with a masked store. This can cause FP exceptions for lanes that should be masked. LLVM bug report: https://bugs.llvm.org/show_bug.cgi?id=51988. The bug affects NumPy / SciPy because NumPy has an AVX-512F implementation for log(), which uses a masked multiply intrinsic: `_mm512_mask_mul_pd`. The bug surfaces in SciPy when trying to setup constants: ``` # The largest [in magnitude] usable floating value. _XMAX = np.finfo(float).max # The log of the largest usable floating value; useful for knowing # when exp(something) will overflow _LOGXMAX = np.log(_XMAX) ``` The workaround here explicitly masks the inputs before the multiply operation. **Testing** - Added a test case to numpy/core/tests/test_umath.py - Fails on trunk - Passes after workaround SciPy testing before: ``` 93 failed, 22378 passed, 1385 skipped, 93 xfailed, 7 xpassed, 1128 errors in 117.54s (0:01:57) ``` SciPy testing after: ``` 74 failed, 33361 passed, 2230 skipped, 108 xfailed, 8 xpassed in 178.19s (0:02:58) ``` Note, all `1128` errors have been resolved as well as less test failures (`93` --> `74`)
* | Merge pull request #20091 from johan12345/patch-1Matti Picus2021-10-111-1/+1
|\ \ | | | | | | DOC: fix typo in docstring of bitwise_or
| * | DOC: fix typo in docstring of bitwise_orJohan von Forstner2021-10-111-1/+1
| |/
* | Merge pull request #20069 from seberg/issue-19634Matti Picus2021-10-113-1/+67
|\ \ | |/ |/| BUG: Add workaround for missing ufunc error propagation
| * BUG: Add workaround for missing ufunc error propagationSebastian Berg2021-10-073-1/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | Some ufuncs (currently `np.power` soon hopefully only some bad user ufunc) may release the GIL but still set Python errors. The best bet we have is attempting to blanket check for errors before returning from the ufunc. This adds a new ufunc (since we should move `np.power` to the new style definition with error return), and tests all relevant ufunc entrypoints. Closes gh-19634
* | Merge pull request #20059 from DimitriPapadopoulos/lgtm_recommendationsCharles Harris2021-10-104-7/+3
|\ \ | | | | | | MAINT: LGTM.com recommendations
| * | MAINT: LGTM.com recommendation: Except block handles 'BaseException'Dimitri Papadopoulos2021-10-071-4/+1
| | | | | | | | | | | | Except block directly handles BaseException.
| * | MAINT: LGTM.com recommendation: Unused importDimitri Papadopoulos2021-10-073-3/+2
| | | | | | | | | | | | | | | | | | Import of 'histogram' is not used. Import of 'histogramdd' is not used. Import of 'textwrap' is not used.
* | | Merge pull request #20057 from DimitriPapadopoulos/lgtm_warningsCharles Harris2021-10-102-5/+4
|\ \ \ | | | | | | | | MAINT: LGTM.com warnings
| * | | MAINT: Fix LGTM.com warning: File is not always closedDimitri Papadopoulos2021-10-061-4/+3
| | | | | | | | | | | | | | | | File may not be closed if an exception is raised.
| * | | MAINT: Fix LGTM.com warning: Implicit string concatenation in a listDimitri Papadopoulos2021-10-061-1/+1
| | | | | | | | | | | | | | | | Implicit string concatenation. Maybe missing a comma?
* | | | Merge pull request #20047 from sistaseetaram/flag-writeable-upon-copyMatti Picus2021-10-101-0/+11
|\ \ \ \ | | | | | | | | | | DOC:add an example to show flag writeable cleared upon copy related to #20035
| * | | | added-suggestion-to#20047Sista Seetaram2021-10-061-1/+4
| | | | |
| * | | | DOC:add an example to show flag writeable cleared upon copySista Seetaram2021-10-061-0/+8
| |/ / /
* | | | Merge pull request #19478 from r-devulap/svmlMatti Picus2021-10-108-40/+308
|\ \ \ \ | | | | | | | | | | ENH: Vectorizing umath module using AVX-512 (open sourced from Intel Short Vector Math Library, SVML)
| * | | | BLD: Use os.path.join to specify path to SVMLRaghuveer Devulapalli2021-08-241-2/+3
| | | | |
| * | | | BLD: add check_svml_submodule functionRaghuveer Devulapalli2021-08-241-3/+8
| | | | |
| * | | | MAINT: Fixing SVML sources pathRaghuveer Devulapalli2021-08-241-3/+3
| | | | |
| * | | | MAINT: Adding SVML submoduleRaghuveer Devulapalli2021-08-241-0/+0
| | | | |
| * | | | MAINT: Remove SVML sources from NumPy repoRaghuveer Devulapalli2021-08-2444-117115/+0
| | | | |