summaryrefslogtreecommitdiff
path: root/numpy
Commit message (Collapse)AuthorAgeFilesLines
...
| | * | | | | | | | | | | API: Allow SciPy to get away with assuming `trapz` is a Python functionSebastian Berg2023-01-202-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This wraps `trapz` into a proper python function and then copies all attributes expected on a Python function over from the "fake" version to the real one. This allows SciPy to pretend `trapz` is a Python function to create their own version.
| * | | | | | | | | | | | MAINT: Move unused import into hook for pyinstallerSebastian Berg2023-01-202-4/+4
| |/ / / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pyinstaller should pack it to allow running the tests, but doesn't pack the tests themselves and thus doesn't find the `import` statements that use `numpy.core._multiarray_tests`. This makes sure that pyinstaller will ship `numpy.core._multiarray_tests` in any case.
| * | | | | | | | | | | Merge pull request #23041 from charris/remove-nose-testingMatti Picus2023-01-2015-2062/+9
| |\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | MAINT: Remove all nose testing support.
| | * | | | | | | | | | | MAINT: Remove all nose testing support.Charles Harris2023-01-1915-2062/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NumPy switched to using pytest in 2018 and nose has been unmaintained for many years. We have kept NumPy's nose support to avoid breaking downstream projects who might have been using it and not yet switched to pytest or some other testing framework. With the arrival of Python 3.12, unpatched nose will raise an error. It it time to move on. Decorators removed - raises - slow - setastest - skipif - knownfailif - deprecated - parametrize - _needs_refcount These are not to be confused with pytest versions with similar names, e.g., pytest.mark.slow, pytest.mark.skipif, pytest.mark.parametrize. Functions removed - Tester - import_nose - run_module_suite
| * | | | | | | | | | | | MAINT: dtype.name works for NEP 42 dtypesNathan Goldbaum2023-01-192-1/+8
| | | | | | | | | | | | |
| * | | | | | | | | | | | DEP: deprecate np.finfo(None) (#23011)Daiki Shintani2023-01-192-0/+15
| | |_|/ / / / / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Deprecate np.finfo(None), it may be that we should more generally deprecate `np.dtype(None)` but this is a start and particularly weird maybe. Closes gh-14684
| * | | | | | | | | | | Merge pull request #23039 from seberg/fixup-array-func-CMatti Picus2023-01-192-1/+49
| |\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | BUG: Implement `ArrayFunctionDispatcher.__get__`
| | * | | | | | | | | | | BUG: Impelement `ArrayFunctionDispatcher.__get__`Sebastian Berg2023-01-182-1/+49
| | |/ / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While functions should not normally need this, Python functions do provide it (C functions do not, but we are a fatter object anyway). By implementing `__get__` we also ensure that `inspect.isroutine()` passes. And by that we ensure that Sphinx considers these a `py:function:` role. Closes gh-23032
| * | | | | | | | | | | BUG: fix ma.diff not preserving mask when using append/prepend (#22776)Marko Pacak2023-01-193-7/+176
| |/ / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Port CORE diff relevant code to MA and adapt docstrings examples and add tsts. Closes gh-22465
| * | | | | | | | | | Merge pull request #23019 from seberg/finalize-non-sequence-stackCharles Harris2023-01-174-31/+28
| |\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | DEP: Finalize the non-sequence stacking deprecation
| | * | | | | | | | | | DEP: Finalize the non-sequence stacking deprecationSebastian Berg2023-01-174-31/+28
| | | |_|/ / / / / / / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `__array_function__` API currently will exhaust iterators so we cannot accept sequences reasonably. Checking for `__getitem__` is presumably enough to reject that (and was what the deprecation used). Future changes could allow this again, although it is not a useful API anyway, since we have to materialize the iterable in any case.
| * | | | | | | | | | Merge pull request #22997 from seberg/issue-19291Charles Harris2023-01-172-97/+97
| |\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | API: Fix cython exception handling for exported extern C functions
| | * | | | | | | | | | API: Add "except *" in cython `.pyd` where necessary based on reviewSebastian Berg2023-01-112-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The incref/decref function shouldn't be able to fail (especially the decref). But right now they can, this will be fixed when we redo clearing (see gh-22924)
| | * | | | | | | | | | API: Fix cython exception handling for exported extern C functionsSebastian Berg2023-01-112-87/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This hopefully fixes them for all the functions currently in the `.pyd` files. A surprising amount of them look like scary thing I wouldn't mind to just delete :). Anyway, had looked at some Cython code today and remembered this. Closes gh-19291
| * | | | | | | | | | | Merge pull request #23020 from seberg/faster-array-functionCharles Harris2023-01-1715-391/+531
| |\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | ENH: Improve array function overhead by using vectorcall
| | * | | | | | | | | | | DOC: Adept internal docs a bit based on reviewSebastian Berg2023-01-171-2/+4
| | | | | | | | | | | | |
| | * | | | | | | | | | | TST: Cover some more internal array-function code pathsSebastian Berg2023-01-171-0/+50
| | | | | | | | | | | | |
| | * | | | | | | | | | | STY: Make linter happy in numeric.py changesSebastian Berg2023-01-171-2/+5
| | | | | | | | | | | | |
| | * | | | | | | | | | | BUG: Fix refcounting issues in C-side `like=` implementationSebastian Berg2023-01-171-10/+15
| | | | | | | | | | | | |
| | * | | | | | | | | | | MAINT: Fix stacklevels for the new C dispatcher not adding oneSebastian Berg2023-01-176-18/+18
| | | | | | | | | | | | |
| | * | | | | | | | | | | MAINT: Move some others functions to use fastcallSebastian Berg2023-01-171-23/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes these functions much faster when used with keyword arguments now that the array-function dispatching does not rely on `*args, **kwargs` anymore.
| | * | | | | | | | | | | MAINT: Move concatenate to fastcall protocolSebastian Berg2023-01-171-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The refactor to use vectorcall/fastcall is obviously much better if we don't have to go back and forth, for concatenate we get: arr = np.random.random(20) %timeit np.concatenate((arr, arr), axis=0) Going from ~1.2µs to just below 1µs and all the way down to ~850ns (fluctuates quite a lot down to 822 even). ~40% speedup in total which is not too shabby.
| | * | | | | | | | | | | ENH: Improve array function overhead by using vectorcallSebastian Berg2023-01-178-346/+413
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This moves dispatching for `__array_function__` into a C-wrapper. This helps speed for multiple reasons: * Avoids one additional dispatching function call to C * Avoids the use of `*args, **kwargs` which is slower. * For simple NumPy calls we can stay in the faster "vectorcall" world This speeds up things generally a little, but can speed things up a lot when keyword arguments are used on lightweight functions, for example:: np.can_cast(arr, dtype, casting="same_kind") is more than twice as fast with this. There is one alternative in principle to get best speed: We could inline the "relevant argument"/dispatcher extraction. That changes behavior in an acceptable but larger way (passes default arguments). Unless the C-entry point seems unwanted, this should be a decent step in the right direction even if we want to do that eventually, though. Closes gh-20790 Closes gh-18547 (although not quite sure why)
| * | | | | | | | | | | | BUG: use `_Alignof` rather than `offsetof()` on most compilers (#23016)Khem Raj2023-01-172-3/+13
| |/ / / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | WG14 N2350 made very clear that it is an UB having type definitions within "offsetof" [1]. This patch enhances the implementation of macro _ALIGN to use builtin "_Alignof" to avoid undefined behavior on when using std=c11 or newer clang 16+ has started to flag this [2] Fixes build when using -std >= gnu11 and using clang16+ Older compilers gcc < 4.9 or clang < 8 has buggy _Alignof even though it may support C11, exclude those compilers too [1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm [2] https://reviews.llvm.org/D133574 Signed-off-by: Khem Raj <raj.khem@gmail.com> * Apply suggestions from code review Signed-off-by: Khem Raj <raj.khem@gmail.com> Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
| * | | | | | | | | | | DOC: #22266 Add examples for tril_indices_from(), triu_indices_from() (#22562)Richie Cotton2023-01-161-2/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * DOC: #22266 Add examples for tri[lu]_indices_from() * DOC: see also for tri[lu]_indices_from() * DOC: Fix triu_indices_from example and minor updates. * incides -> indices * Update wording surrounding . Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
| * | | | | | | | | | | Merge pull request #22921 from charris/test-latest-cibuildwheelCharles Harris2023-01-161-3/+3
| |\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | BLD: Try building wheels with cibuildwheel 2.12.0
| | * | | | | | | | | | | BLD: Try cibuildwheel 2.11.4Charles Harris2023-01-161-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also cleanup some uneeded/commented stuff.
| | * | | | | | | | | | | BLD, SIMD: Pad asm to avoid C99 complains on CLANGSayed Adel2023-01-161-3/+3
| | | | | | | | | | | | |
| | * | | | | | | | | | | MAINT: Create lib path if missing.Charles Harris2023-01-161-0/+1
| | | | | | | | | | | | |
| * | | | | | | | | | | | DOC: Add example for np.ma.diag (#22960)Stefanie Molin2023-01-161-0/+32
| |/ / / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * DOC: Add example for np.ma.diag as part of numpy#22269 * Add descriptions to example. * Fix typo.
| * | | | | | | | | | | MAINT: `f2py` cleanup (#22885)Rohit Goswami2023-01-163-21/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Updates the free format handling of .f90 and other common extensions (through a minor re-write). Also removes an unused function. This disallows previously allowed (but highly unlikely to be present) code-paths, namely having fixed form F77 code in a fortran 90 file (with .f90). Co-authored-by: Sebastian Berg <sebastianb@nvidia.com>
| * | | | | | | | | | | DOC: Add version added information for the strict parameter in ↵Mark Harfouche2023-01-151-0/+2
| | |/ / / / / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | assert_array_equal (#23015)
| * | | | | | | | | | ENH: Faster numpy.load (try/except _filter_header) (#22916)Michael2023-01-132-5/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This pull requests speeds up numpy.load. Since _filter_header is quite a bottleneck, we only run it if we must. Users will get a warning if they have a legacy Numpy file so that they can save it again for faster loading. Main discussion and benchmarks see #22898 Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
| * | | | | | | | | | Merge pull request #22998 from seberg/dep-positive-finalizeCharles Harris2023-01-112-45/+2
| |\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | DEP: Finalize `+arr` returning a copy e.g. for string arrays
| | * | | | | | | | | | DEP: Finalize `+arr` returning a copy e.g. for string arraysSebastian Berg2023-01-112-45/+2
| | |/ / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was deprecated 4-5 years ago in NumPy 1.16. Pandas stumbled over it cleaning up their warning filters, so I decided to just expire it.
| * | | | | | | | | | ENH: Improve loadtxt error with dtype and non-matchinig column number (#22996)Sebastian Berg2023-01-112-2/+20
| |/ / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The number "changed" is weird if the user fixed it, so give a different message in that case.
| * | | | | | | | | DOC: Fix gh-22990 by correcting docstring of result_typeOleksandr Pavlyk2023-01-101-1/+1
| | | | | | | | | |
| * | | | | | | | | Merge pull request #22986 from seberg/issue-22984Charles Harris2023-01-102-5/+54
| |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | BUG: Ensure correct loop order in sin, cos, and arctan2
| | * | | | | | | | | BUG: Ensure correct loop order in sin, cos, and arctan2Sebastian Berg2023-01-102-5/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These were incorrect afer being vectorized. The commit additional tests these (not arctan2 admittedly) and adds a check to generate_umath to make it a bit less likely that future additions add this type of thing. Note that the check allows duplicated loops so long they are correctly ordered the *first* time. This makes results correct, but duplicated loops are not nice anyways and it would be nice to remove them. We could drop them manually in hindsight even? In any case, that should not be backported, so it is not includedhere. Closes gh-22984
| * | | | | | | | | | ENH: allow NEP 42 dtypes to work with np.char (#22863)Nathan Goldbaum2023-01-104-36/+100
| |/ / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes it possible for new-style NEP 42 string dtypes like ASCIIDType to work with the functions in np.char, this has leads to some mild modification (stricter behavior in bad paths). It will only work with dtypes with a scalar that subclasses str or bytes. I also assume that you can create instances of the user dtype from python like dtype_instance = CustomDType(size_in_bytes). This is a pretty big assumption about the API of the dtype, I'm not sure offhand how I can do this more portably or more safely. I also added a new macro, NPY_DT_is_user_defined, which checks dtype->type_num == -1, which is currently true for all custom dtypes using the experimental dtype API. This new macro is needed because NPY_DT_is_legacy will return false for np.void. This is only tested via the user dtypes currently.
| * | | | | | | | | Merge pull request #22980 from charris/fix-clang-suggestionsRalf Gommers2023-01-101-2/+2
| |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MAINT: Fix some noisy clang suggestions. [ci skip]
| | * | | | | | | | | MAINT: Fix some noisy clang suggestions.Charles Harris2023-01-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The suggestions looks like: ``` numpy/core/src/npysort/selection.cpp:426:39: warning suggest braces around initialization of subobject [-Wmissing-braces] arg_map{Tags::type_value, &introselect_noarg<Tags>, ^~~~~~~~~~~~~~~~~~~~~~~~ { } ```
| * | | | | | | | | | DOC: remove extraneous backtick from warning (#22981)Eddie Darling2023-01-091-1/+1
| |/ / / / / / / / /
| * | | | | | | | | Merge pull request #22779 from LeonaTaric/numpy_issue22745Charles Harris2023-01-091-0/+2
| |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | DOC: All integer values must be non-negative
| | * | | | | | | | | 去掉noteLeonaTaric2023-01-091-3/+2
| | | | | | | | | | |
| | * | | | | | | | | change note toLeonaTaric2022-12-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "All integer values must be non-negative"
| | * | | | | | | | | All entropy/seed not None must be non-negativeLeonaTaric2022-12-131-0/+3
| | | | | | | | | | |
| * | | | | | | | | | Bug: Fix fill violating read-only flag. (#22959)Panagiotis Zestanakis2023-01-082-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PyArray_FillWithScalar checks if destination is writeable before attempting to fill it. A relevant test is added as a method of TestRegression Closes gh-22922 Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
| * | | | | | | | | | MAINT: use pypy3.9 in testingmattip2023-01-081-5/+7
| | | | | | | | | | |
| * | | | | | | | | | DOC: Update docstring of `multivariate_normal` (#22938)Malte Londschien2023-01-071-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make a note on results depending on system due. Closes gh-22919