| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
ENH: Ensure that assertion of unsigned dtypes does not return results
|
| |
| |
| |
| | |
that wrapped around.
|
|\ \
| | |
| | | |
API: Introduce optional (and partial) NEP 50 weak scalar logic
|
| | |
| | |
| | |
| | | |
Unfortunately, this shows that the rational tests are still broken a bit.
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This ensures that the precision is not downcast, which could make
a small value zero (for float16 mostly).
This lets tests pass that check whether `np.float16(0)` is almost
equal to 0, which otherwise fail (because `float16(0.00000001)`
will evaluate to 0 exactly.
|
| | | |
|
| |/
| |
| |
| |
| | |
Even the new promotion has to use the min-scalar logic to avoid
picking up a float16 loop for `np.int8(3) * 3.`.
|
|/
|
|
|
|
| |
Fixes #9542
Co-authored-by: Bas van Beek <43369155+BvB93@users.noreply.github.com>
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
i.e. `numpy.typing` and `numpy._typing`
|
|
|
|
|
|
|
|
|
|
|
| |
* TST: Test suppression of asset_array_equal RuntimeWarning See #18992
* ENH: Suppress over-/underflow warnings on asset_array_equal - Closes #18992
* MAINT: Resolve linting issues of prior commit
* MAINT: Simplified ignore and test case of asset_array_equal
* MAINT: Removed unused import in test_utils.py
|
|\
| |
| | |
TYP,ENH: Improve typing with the help of `ParamSpec`
|
| | |
|
|\ \
| |/
|/| |
BUG: Avoid importing numpy.distutils on import numpy.testing (#20769)
|
| |
| |
| |
| |
| | |
Move the offending imports into the functions that use them so that
numpy.distutils is only loaded if those functions are required.
|
| | |
|
|/ |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
`load_module` is deprecated since python 3.4 and will be removed in python 3.12.
Use `exec_module` instead. Provide a convenience function in `distutils.misc_utils`
instead of `npy_load_module` from `compat.py3k`.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes gh-17467. Adds a public struct to hold memory manipulation routines PyDataMem_Handler and two new API functions PyDataMem_SetHandler to replace the current routines with the new ones, and PyDataMem_GetHandlerName to get the string name of the current routines (either globally or for a specific ndarray object). This also changes the size of the ndarray object to hold the PyDataMem_Handler active when it was created so subsequent actions on its data memory will remain consistent.
Tests and documentation are included. Along the way, I found some places in the code where the current policy is inconsistent (all data memory handling should have gone through npy_*_cache not PyDataMem_*) so even if this is rejected it might improve the cache handling.
The PyDataMem_Handler has fields to override memcpy, these are currently not implemented: memcpy in the code base is untouched. I think this PR is invasive enough as-is, if desired memcpy can be handled in a follow-up PR.
* ENH: add and use global configurable memory routines
* ENH: add tests and a way to compile c-extensions from tests
* fix allocation/free exposed by tests
* DOC: document the new APIs (and some old ones too)
* BUG: return void from FREE, also some cleanup
* MAINT: changes from review
* fixes from linter
* setting ndarray->descr on 0d or scalars mess with FREE
* make scalar allocation more consistent wrt np_alloc_cache
* change formatting for sphinx
* remove memcpy variants
* update to match NEP 49
* ENH: add a python-level get_handler_name
* ENH: add core.multiarray.get_handler_name
* Allow closure-like definition of the data mem routines
* Fix incompatible pointer warnings
* Note PyDataMemAllocator and PyMemAllocatorEx differentiation
Co-authored-by: Matti Picus <matti.picus@gmail.com>
* Redefine default allocator handling
* Always allocate new arrays using the current_handler
* Search for the mem_handler name of the data owner
* Sub-comparisons don't need a local mem_handler
* Make the default_handler a valid PyDataMem_Handler
* Fix PyDataMem_SetHandler description (NEP discussion)
* Pass the allocators by reference
* Implement allocator context-locality
* Fix documentation, make PyDataMem_GetHandler return const
* remove import of setuptools==49.1.3, doesn't work on python3.10
* Fix refcount leaks
* fix function signatures in test
* Return early on PyDataMem_GetHandler error (VOID_compare)
* Add context/thread-locality tests, allow testing custom policies
* ENH: add and use global configurable memory routines
* ENH: add tests and a way to compile c-extensions from tests
* fix allocation/free exposed by tests
* DOC: document the new APIs (and some old ones too)
* BUG: return void from FREE, also some cleanup
* MAINT: changes from review
* fixes from linter
* setting ndarray->descr on 0d or scalars mess with FREE
* make scalar allocation more consistent wrt np_alloc_cache
* change formatting for sphinx
* remove memcpy variants
* update to match NEP 49
* ENH: add a python-level get_handler_name
* ENH: add core.multiarray.get_handler_name
* Allow closure-like definition of the data mem routines
* Fix incompatible pointer warnings
* Note PyDataMemAllocator and PyMemAllocatorEx differentiation
Co-authored-by: Matti Picus <matti.picus@gmail.com>
* Redefine default allocator handling
* Always allocate new arrays using the current_handler
* Search for the mem_handler name of the data owner
* Sub-comparisons don't need a local mem_handler
* Make the default_handler a valid PyDataMem_Handler
* Fix PyDataMem_SetHandler description (NEP discussion)
* Pass the allocators by reference
* remove import of setuptools==49.1.3, doesn't work on python3.10
* fix function signatures in test
* try to fix cygwin extension building
* YAPF mem_policy test
* Less empty lines, more comments (tests)
* Apply suggestions from code review (set an exception and)
Co-authored-by: Matti Picus <matti.picus@gmail.com>
* skip test on cygwin
* update API hash for changed signature
* TST: add gc.collect to make sure cycles are broken
* Implement thread-locality for PyPy
Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
* Update numpy/core/tests/test_mem_policy.py
Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
* fixes from review
* update circleci config
* fix test
* make the connection between OWNDATA and having a allocator handle more explicit
* improve docstring, fix flake8 for tests
* update PyDataMem_GetHandler() from review
* Implement allocator lifetime management
* update NEP and add best-effort handling of error in PyDataMem_UserFREE
* ENH: fix and test for blindly taking ownership of data
* Update doc/neps/nep-0049.rst
Co-authored-by: Elias Koromilas <elias.koromilas@gmail.com>
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
instead of `import numpy.testing as npt`.
- all of NumPy's own tests themselves use the from-import variant
- There's `import numpy.typing as npt` around in some places so
we should not abbreviate another module import with `npt`.
Optional further enhancement: If this is a convention we also want
users to adopt, this should be mentioned in the module docstring of
`numpy.testing`.
|
|\
| |
| | |
MAINT: OrderedDict is no longer necessary from Python 3.7
|
| | |
|
|\ \
| | |
| | | |
ENH: Use new argument parsing for array creation functions
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The array creation functions have the most to gain:
1. np.asarray is 4 times faster and commonly used.
2. Other functions are wrapped using __array_function__ in Python
making it more difficult
This commit (unfortunatly) has to do a few things:
* Modify __array_function__ C-side dispatching to accomodate
the fastcall argument convention.
* Move asarray, etc. to C after removing all "fast paths" from
np.array (simplifying the code)
* Fixup imports, since asarray was imported directly in a few places
* Replace some places where `np.array` was probably used for speed
instead of np.asarray or similar. (or by accident in 1 or 2 places)
|
|/ |
|
|
|
|
|
|
|
|
|
|
|
|
| |
... or when the input isn't/cannot be a set. I left a few usages, e.g.
in random sampling, where "set" is reasonable as informal description of
an array as the order doesn't matter; however, for e.g. np.gradient the
order of the returned list is clearly important, so "set" is wrong.
Also some other minor doc edits noticed during the grepping: using
`shape` instead of `form` in `cov` is consistent with most other places;
the wording in `Polynomial.trim` now matches other methods on the same
class.
|
|\
| |
| | |
DEP: deprecate np.testing.dec
|
| | |
|
| |
| |
| |
| |
| |
| | |
Since the decorators in np.testing.dec are intended for nose test framework
support, deprecate them by updating the docstring and adding a warning when
they are used on functions
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This update a coupe of references (single backticks) that actually are not to
verbatim/code (double backticks); and a couple of verbatim to reference
when they do actually exists and can be resolved in context.
I probably missed other; and stayed simple but spoted a few other
inconsistencies that I did not fix:
- some ``...`` could actually be :math:`...` but not always clear if
it would be better.
- some intervals are [``...``], other are ``[...]``
I guess they could be discussed individually; it was mostly the failing
references that bothered me.
|