| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Allows access to internal functions for the file.
|
|
|
|
|
| |
The new searchsorted-based digitize introduced in #5101 segfaults
when it should raise a TypeError.
|
| |
|
|
|
|
|
|
| |
Pushes the GIL release one loop outward. First test for these functions (!).
Incorporates suggestions by @jaimefrio and @charris.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A NaN interpolation point was interpreted as out of bounds on the left
side, hence the value of the left parameter in the function call was
returned.
>>> np.interp(np.nan, [-10, 10], [-2, 2])
-2.0
NaN is a better choice.
Closes #605.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
`bincount` checks its input array to make sure there are no negative entries,
and to determine the size of the output array. This is done by calling two
different functions, each having to loop over the whole array. This PR
adds a new function, `minmax`, that computes the minimum and maximum of the
array in a single pass over it. This leads to speed-ups peaking at 1.5x,
with typical values for large arrays around 1.15x - 1.25x.
A full benchmark summary of the new implementation, including a supposedly
more efficient algorithm that turned out to run slower, can be found [here](https://gist.github.com/jaimefrio/8743836).
|
|
|
|
| |
minimize indexing.
|
|
|
|
|
|
| |
MAINT: rewrote `check_array_monotonic` to use array indices, not pointers.
TST: tests for proper handling of bins with all items almost equal now check
the return value for correctness, not just that an error is not raised.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The check for monotonic bin arrays of digitize doesn't properly handle
inputs with repeated entries at the beginning of the array:
```
>>> np.__version__
'1.8.0'
>>> np.digitize([1], [0, 0 , 2])
array([2], dtype=int64)
>>> np.digitize([1], [2, 2, 0])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: The bins must be monotonically increasing or decreasing
```
Modified `check_array_monotonic` in `_compiled_base.c` to skip over repeating
entries before deciding to check for increasing or decreasing monotonicity
and added relevant tests to `test_function_base.py`.
|
|
|
|
|
|
|
|
| |
Deallocation should just do nothing if provided a NULL pointer nditer
deletion broke this convention.
Removed many redundant NULL checks for various deallocation functions
used in numpy, they all end up in standard C free or PyMem_Free which
are both NULL safe.
|
|
|
|
|
|
|
|
|
|
| |
Because Numpy 1.8.0 will no longer supports Python versions < 2.6 we
no longer need to check for that and can also remove the code that is
specific to those earlier versions.
To make this a bit safer, the toplevel setup.py file now contains a
check of the Python version number and raises an error when run by an
unsupported version.
|
|
|
|
| |
See https://github.com/scipy/scipy/pull/279
|
|
|
|
|
|
| |
npy_pycompat.h
npy_3kcompat.h is semi-private, so this can be done.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Moves PyDataMem_NEW/FREE/RENEW to the external API.
Fixes PyDataMem_NEW/RENEW to return void* instead of char*.
Replaces PyDataMem_NEW/FREE with NpySortArray_malloc/free in sort.c.src
(should be reverted if npysort is moved to be part of multiarraymodule).
Adds PyDataMem_SetEventHook which takes a (PyDataMem_EventHookFunc *) as an argument,
with signature:
void hook(void *old, void *new, size_t size).
When not NULL, hook will be called at the end of each PyDataMem_NEW/FREE/RENEW:
result = PyDataMem_NEW(size) -> (*hook(NULL, result, size)
PyDataMem_FREE(ptr) -> (*hook(ptr, NULL, 0)
result = PyDataMem_RENEW(ptr, size) -> (*hook)(ptr, result, size)
Adds tests in multiarray_tests.c.src, driven by tests/test_multiarray.py.
|
|
|
|
| |
versioned
|
| |
|
| |
|
|
|
|
|
|
| |
The interp function was computing slopes for all intervals, even when there
were only a few points to be interpolated. Now it only does so when the
number of interpolation points exceeds the number of sample points.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Releases it only conditionally, as object arrays require refcounting to
be performed within the inner loop, making GIL release impractical.
|
|
|
|
| |
This makes subsequent thread-friendly modification easier.
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Sandwich certain potentially long running for loops that don't touch any
Python objects between NPY_BEGIN_ALLOW_THREADS and NPY_END_ALLOW_THREADS
so that the interpreter can potentially schedule another Python thread.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
It's a little bit shorter, and more intuitively expresses what the
flag does.
|
|
|
|
| |
iterator constructor
|
|
|
|
|
|
|
| |
NumPy convention
'NpyIter_IterNext_Fn' -> 'NpyIter_IterNextFunc *'
'NpyIter_GetCoords_Fn' -> 'NpyIter_GetCoordsFunc *'
|
| |
|
| |
|
| |
|
|
|
|
| |
arrays of sample points. Closes ticket #1064.
|