summaryrefslogtreecommitdiff
path: root/numpy/core
Commit message (Collapse)AuthorAgeFilesLines
...
| | * | | | | | | DOC: Align default with what the NEP draft saysSebastian Berg2023-04-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have three choices: 1. Be compatible with limited API (oldest supported Python version) 2. Be compatible with everything on the same Python version (this) 3. Be strict and default to NEP 29 This just rephrases things to be 2. Because our API version was not bumped over the relevant time frame, it is actually also compatible with the first.
| | * | | | | | | MAINT,DOC: Update based on Ralf's reviewSebastian Berg2023-04-201-7/+1
| | | | | | | | |
| | * | | | | | | Tweak to just warn for low versionsSebastian Berg2023-04-061-9/+9
| | | | | | | | |
| | * | | | | | | TST,DOC: Avoid spaces to hopefully ensure more info on error and fix memtestsSebastian Berg2023-04-042-1/+2
| | | | | | | | |
| | * | | | | | | BUG: Fix typo in new version checksSebastian Berg2023-04-041-1/+1
| | | | | | | | |
| | * | | | | | | MAINT: Bump version in mesonSebastian Berg2023-04-041-1/+2
| | | | | | | | |
| | * | | | | | | ENH: Allow compiling compatibly to old NumPy versionsSebastian Berg2023-04-047-23/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The default compiles compatibly with 1.17.x, we allow going back to 1.15 (mainly because it is easy). There were few additions in this time, a few structs grew and very few API functions were added. Added a way to mark API functions as requiring a specific target version. If a user wishes to use the *new* API, they have to add the definition: #define NPY_TARGET_VERSION NPY_1_22_API_VERSION Before importing NumPy. (Our version numbering is a bit funny I first thought to use a hex version of the main NumPy version, but since we already have the `NPY_1_22_API_VERSION` defines...)
| | * | | | | | | BLD: Add support for NPY_TARGET_VERSION macroSebastian Berg2023-04-043-33/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a way for downstream users to specify which NumPy version they wish to be compaible with. Note that we provide a conservative default here (because almost nobody actually uses new API as they would lose backwards compatibility). Initially I had thought we should just redefine it so that the target version uses the same scheme as the Python hex version (and limited API), but since we have `NPY_1_15_API_VERSION` defines, use those... This commit does not include any actual use of this!
| * | | | | | | | Merge pull request #18053 from Iamsoto/adding_object_to_einsumSebastian Berg2023-04-286-49/+231
| |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | ENH: Adding Object dtype to einsum
| | * | | | | | | | fixes from reviewmattip2023-04-273-24/+36
| | | | | | | | | |
| | * | | | | | | | MAINT: expand PyArray_AssignZero to handle object dtypemattip2023-03-303-38/+24
| | | | | | | | | |
| | * | | | | | | | TST: add test for 5e6e5863 (issue gh-23492)mattip2023-03-301-1/+4
| | | | | | | | | |
| | * | | | | | | | TST: fix tests for einsum returning a python objectmattip2023-03-301-2/+6
| | | | | | | | | |
| | * | | | | | | | BUG: work around shortcoming in PyArray_AssignZero for object dtypemattip2023-03-301-2/+15
| | | | | | | | | |
| | * | | | | | | | BUG: only check PyErr_Occurred if Python C-API is neededmattip2023-03-301-4/+8
| | | | | | | | | |
| | * | | | | | | | BUG: if dtype is object, do outbuf[:] = 0 rather than memsetmattip2023-03-301-1/+13
| | | | | | | | | |
| | * | | | | | | | Update numpy/core/src/multiarray/einsum_sumprod.c.src The Dog Lulu2023-03-291-25/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implementing Erics suggestions Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
| | * | | | | | | | PR_fixes_1iamsoto2023-03-294-385/+125
| | | | | | | | | |
| | * | | | | | | | WIP: Adding Object dtype to einsumiamsoto2023-03-292-5/+421
| | |/ / / / / / /
| * | | | | | | | Merge pull request #22493 from mwtoews/maint-openSebastian Berg2023-04-283-15/+15
| |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | MAINT: remove redundant open() modes and io.open() alias
| | * | | | | | | | MAINT: remove redundant open() modes and io.open() aliasMike Taves2022-10-293-15/+15
| | | | | | | | | |
| * | | | | | | | | Merge pull request #23666 from seberg/subarray-cleanupMatti Picus2023-04-2715-351/+150
| |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | DEP,BUG: Finalize subarray dtype FutureWarning and fix its assignment
| | * | | | | | | | | DEP: Finalize subarray from non-subarray creation futurewarningSebastian Berg2023-04-264-278/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This unfortunately switches over the C-only path when FromArray is called with a subarray dtype. Together with the previous commit (which is very simple but in a sense does the heavy lifting): Closes gh-23083
| | * | | | | | | | | MAINT: Fixup handling of subarray dtype in ufunc.resolve_dtypesSebastian Berg2023-04-262-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is now OK to just support, we won't replace things and things should work out for the most part (probably).
| | * | | | | | | | | MAINT: Refactor internal array creation to also allow dtype preservationSebastian Berg2023-04-2612-64/+92
| | | |_|/ / / / / / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases we know that we want to use the *exact* dtype that we already have (mainly when taking views). This is also useful internally because there are very rare code-paths were we even create temporary arrays that contain subarray dtypes.
| * | | | | | | | | Merge pull request #23358 from seberg/dtype-class-in-typesMatti Picus2023-04-278-161/+243
| |\ \ \ \ \ \ \ \ \ | | |/ / / / / / / / | |/| | | | | | | | API: Add DType classes into new `numpy.dtypes` module
| | * | | | | | | | Apply suggestions from code reviewSebastian Berg2023-04-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Matti Picus <matti.picus@gmail.com>
| | * | | | | | | | MAINT: Move module to be `np.dtypes` and add release noteSebastian Berg2023-04-124-11/+11
| | | | | | | | | |
| | * | | | | | | | TST: Update test due to windows Int vs intc name differenceSebastian Berg2023-04-121-2/+6
| | | | | | | | | |
| | * | | | | | | | API: Add `numpy.types` module and fill it with DType classesSebastian Berg2023-04-126-51/+122
| | | | | | | | | |
| | * | | | | | | | MAINT: Refactor type naming C codeSebastian Berg2023-04-122-110/+117
| | | | | | | | | |
| * | | | | | | | | Merge pull request #23660 from seberg/finalize-sequence-array-likeCharles Harris2023-04-253-138/+13
| |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | DEP: Finalize checking for sequence-like if something is array-like
| | * | | | | | | | | DEP: Finalize checking for sequence-like if something is array-likeSebastian Berg2023-04-253-138/+13
| | | |_|_|_|_|_|/ / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was always just a stop-gap for shapely basically, so there is no harm finalizing things.
| * | | | | | | | | ENH: float64 sin/cos using Numpy intrinsics (#23399)Christopher Sidebottom2023-04-256-92/+270
| |/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This takes the [sin](https://github.com/ARM-software/optimized-routines/blob/master/math/v_sin.c) and [cos](https://github.com/ARM-software/optimized-routines/blob/master/math/v_cos.c) algorithms from Optimized Routines under MIT license, and converts them to Numpy intrinsics. The routines are within the ULP boundaries of other vectorised math routines (<4ULP). The routines reduce performance in some special cases but improves normal cases. Comparing to the SVML implementation, these routines are more performant in special cases, we're therefore safe to assume the performance is acceptable for AArch64 as well. | performance ratio (lower is better) | benchmark | | ---- | ---- | | 1.8 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'cos'> 4 2 'd') | | 1.79 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'cos'> 4 4 'd') | | 1.77 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'cos'> 4 1 'd') | | 1.74 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'cos'> 2 2 'd') | | 1.74 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'cos'> 2 4 'd') | | 1.72 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'cos'> 2 1 'd') | | 1.6 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'cos'> 1 2 'd') | | 1.6 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'cos'> 1 4 'd') | | 1.56 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'cos'> 1 1 'd') | | 1.42 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'sin'> 2 2 'd') | | 1.41 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'sin'> 2 4 'd') | | 1.37 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'sin'> 2 1 'd') | | 1.26 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'sin'> 4 2 'd') | | 1.26 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'sin'> 4 4 'd') | | 1.2 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'sin'> 4 1 'd') | | 1.18 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'sin'> 1 2 'd') | | 1.18 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'sin'> 1 4 'd') | | 1.12 | bench_ufunc_strides.UnaryFPSpecial.time_unary(<ufunc 'sin'> 1 1 'd') | | 0.65 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'cos'> 4 2 'd') | | 0.64 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'cos'> 2 4 'd') | | 0.64 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'cos'> 4 4 'd') | | 0.64 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'cos'> 2 2 'd') | | 0.61 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'cos'> 1 4 'd') | | 0.61 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'cos'> 1 2 'd') | | 0.6 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'cos'> 2 1 'd') | | 0.6 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'cos'> 4 1 'd') | | 0.56 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'cos'> 1 1 'd') | | 0.52 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'sin'> 4 2 'd') | | 0.52 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'sin'> 4 4 'd') | | 0.52 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'sin'> 2 4 'd') | | 0.52 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'sin'> 2 2 'd') | | 0.47 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'sin'> 1 4 'd') | | 0.47 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'sin'> 1 2 'd') | | 0.46 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'sin'> 4 1 'd') | | 0.46 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'sin'> 2 1 'd') | | 0.42 | bench_ufunc_strides.UnaryFP.time_unary(<ufunc 'sin'> 1 1 'd') | Co-authored-by: Pierre Blanchard <Pierre.Blanchard@arm.com>
| * | | | | | | | Merge pull request #23298 from seiko2plus/cpp_half_supportSebastian Berg2023-04-2511-585/+1021
| |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | ENH: Extend the functionlty of C++ type `np::Half`
| | * | | | | | | | ENH: Extend the functionlty of C++ type `np::Half`Sayed Adel2023-04-0511-585/+1021
| | | |_|_|_|/ / / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - optimize float/double conversions on x86, requires for now raising up the baseline features to `f16c` at least during the build. - optimize float/double conversions on ppc64le, requires for now raising up the baseline features to `VSX3` at least during the build. - Brings `np::Half` to npymath
| * | | | | | | | DOC: Corrects scalar string documentation in regards to trailing null ↵Tajbinjohn2023-04-231-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | codepoints. Closes #20118
| * | | | | | | | DOC: Fix incorrect structure in `sqrt` docstringyuki2023-04-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the "See also" section of [`sqrt` docstring](https://numpy.org/devdocs/reference/generated/numpy.sqrt.html#numpy.sqrt), `Note: ...` is incorrectly parsed by numpydoc. So removed `:` to fix.
| * | | | | | | | DEP: deprecate scalar conversions for arrays with ndim > 0 (#10615)Nico Schlömer2023-04-207-16/+69
| | |_|_|_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This PR reflects some of the progress achieved in issue #10404 and is used to asses the impact of the changes. With the changes in this PR, `float(numpy.array([1.0])` now gives a warning; likewise some other things: ```python import numpy a = numpy.random.rand(10, 1) a[0] = numpy.array([1.0]) # okay a[0] = numpy.array(1.0) # okay a[0] = 1.0 # okay b = numpy.random.rand(10) b[0] = numpy.array([1.0]) # ValueError: setting an array element with a sequence. b[0, ...] = numpy.array([1.0]) # okay b[0] = numpy.array(1.0) # okay b[0] = 1.0 # okay ``` This aligns the behavior of numpy arrays with that of lists: ```python float([3.14]) ``` ``` TypeError: float() argument must be a string or a number, not 'list' ``` ```python import numpy as np a = np.random.rand(5) a[0] = [3.14] ``` ``` ValueError: setting an array element with a sequence. ``` Fixes #10404.
| * | | | | | | Merge pull request #23591 from ngoldbaum/refactor-zeroSebastian Berg2023-04-2012-88/+190
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | ENH: refactor zero-filling and expose dtype API slot for it
| | * | | | | | | DOC: warn against using zero-filling loop with a previously allocated arrayNathan Goldbaum2023-04-192-0/+6
| | | | | | | | |
| | * | | | | | | MAINT: housecleaning for traversal loop setup and implementationsNathan Goldbaum2023-04-195-89/+96
| | | | | | | | |
| | * | | | | | | MAINT: support traversal loops without initializing the descriptorNathan Goldbaum2023-04-191-1/+2
| | | | | | | | |
| | * | | | | | | MNT: respond to review commentsNathan Goldbaum2023-04-192-15/+11
| | | | | | | | |
| | * | | | | | | MAINT: refactor zero-filling to use a traversal loopNathan Goldbaum2023-04-186-77/+131
| | | | | | | | |
| | * | | | | | | ENH: Refactor special zero-filling to be managed by the DTypeNathan Goldbaum2023-04-187-49/+87
| | | | | | | | |
| | * | | | | | | MAINT: correct typos in dtype API documentation commentsNathan Goldbaum2023-04-181-3/+3
| | | | | | | | |
| * | | | | | | | Merge pull request #23557 from mhvk/arrayprint-subformat-use-thresholdMarten van Kerkwijk2023-04-192-10/+63
| |\ \ \ \ \ \ \ \ | | |/ / / / / / / | |/| | | | | | | ENH: Use threshold also inside SubArrayFormat.
| | * | | | | | | ENH: Use threshold also inside SubArrayFormat.Marten van Kerkwijk2023-04-072-10/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, for structured arrays that contain a lot of elements, those are always all shown, independent of the threshold print option. This PR ensures that threshold and edgeitems are respected. Note that multidimensional items are typeset without line breaks, to avoid breaking up the structure. Hence, this does not solve the issue that structured array elements can easily overfill a line on the console.
| * | | | | | | | BLD: use the C++ linker to link `_multiarray_umath.so`Ralf Gommers2023-04-161-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This gets rid of undefined symbol issues for `assert`. Closes gh-23122 Closes gh-23595