summaryrefslogtreecommitdiff
path: root/numpy
Commit message (Collapse)AuthorAgeFilesLines
* Revert "MAINT: `f2py` cleanup (#22885)"revert-22885-cleanCrackfortranRalf Gommers2023-01-223-19/+21
| | | | This reverts commit 6b5cd92675139511b4b24ddfe822e96b03700edb.
* DEP: Remove the deprecated utils.py shim.Charles Harris2023-01-212-30/+0
| | | | | The shim has been deprecated since 2019, the proper place to import utils funtions is directly from numpy.testing.
* Merge pull request #20970 from seberg/reduce-identity-array-methMatti Picus2023-01-2113-129/+508
|\ | | | | ENH: Move identity to the ArrayMethod to allow customization
| * MAINT: Rename `initial` to `legacy_initial` in ArrayMethodSebastian Berg2023-01-202-3/+5
| | | | | | | | | | It should only be used by the legacy method, so also reflect that in the field name.
| * DOC: Adept code comments for clarity based on code reviewSebastian Berg2023-01-204-13/+20
| | | | | | | | Co-authored-by: Matti Picus <matti.picus@gmail.com>
| * MAINT: Prepend scaled float test statics with `sfloat_`Sebastian Berg2023-01-201-14/+14
| | | | | | | | As requested by Matti in review.
| * MAINT: Address review comments by NathanSebastian Berg2023-01-203-23/+24
| |
| * MAINT: Rename PyUFunc_GetIDentity to PyUFunc_GetDefaultIdentitySebastian Berg2023-01-203-5/+6
| |
| * TST: Add test for wrapped ufuncs and reductions via ScaledFloatSebastian Berg2023-01-202-3/+104
| |
| * MAINT: Address many of Marten's commentsSebastian Berg2023-01-206-20/+39
| |
| * MAINT: Remove unneeded labelSebastian Berg2023-01-201-1/+0
| |
| * TST: Fix lint and ensure we have tests for empty arrays and reduceSebastian Berg2023-01-201-1/+14
| |
| * API: Bumpy experimental dtype api versionSebastian Berg2023-01-203-3/+3
| | | | | | | | | | Its a new version (it changed ;)), plus I took the liberty to move things around a bit ABI wise.
| * BUG: Fixup copying the wrong size in the cached path mostlySebastian Berg2023-01-202-8/+8
| |
| * MAINT: Rework things to make reorderability static and default to no initial ↵Sebastian Berg2023-01-207-185/+218
| | | | | | | | value
| * MAINT: Fixup names, and add workaround lost in rebaseSebastian Berg2023-01-201-6/+21
| |
| * MAINT: Rename arraymethod reduction identity getterSebastian Berg2023-01-205-57/+69
| | | | | | | | | | Need to look into whether to cut out the dynamic discovery of reorderability though.
| * DOC,MAINT: Address "simple" review comments by MartenSebastian Berg2023-01-204-27/+32
| |
| * BUG: Fixup the default array-method, got the refcounting wrong...Sebastian Berg2023-01-201-5/+7
| |
| * ENH: Support identity-function in experimental DType APISebastian Berg2023-01-203-0/+66
| | | | | | | | | | Also add it to the wrapped array-method (ufunc) implementation so that a Unit dtype can reasonably use an identity for reductions.
| * ENH: Move identity to the ArrayMethod to allow customizationSebastian Berg2023-01-206-92/+195
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also fixes/changes that the identity value is defined by the reduce dtype and not by the result dtype. That does not make a different in any sane use-case, but there is a theoretical change: arr = np.array([]) out = np.array(None) # object array np.add.reduce(arr, out=out, dtype=np.float64) Where the output result was previously an integer 0, due to the output being of `object` dtype, but now it is the correct float due to the _operation_ being done in `float64`, so that the output should be `np.zeros((), dtype=np.float64).astype(object)`.
* | CI: musllinux_x86_64 (#22864)Andrew Nelson2023-01-203-3/+23
|/ | | [ci skip]
* Merge pull request #23034 from seberg/wrap-trapzRalf Gommers2023-01-202-0/+40
|\ | | | | API: Allow SciPy to get away with assuming `trapz` is a Python function
| * 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.