| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|\
| |
| | |
BF bug #808
|
| |
| |
| |
| |
| |
| |
| | |
the argument passed to be used as the item to be insterted, and a list was
passed as the positions. This was fixed by simply duplicating the item to
be inserted so that it was a list of equal length and then control was
passed to the already exsisting code to handel this case
|
|\ \
| | |
| | | |
Meshgrid enhancements (>2-D, sparse grids, matrix indexing)
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | | |
(test_io.TestSavezLoad)
|
| |/
|/|
| |
| |
| |
| | |
npy_pycompat.h
npy_3kcompat.h is semi-private, so this can be done.
|
|\ \
| | |
| | | |
BUG: make genfromtxt work with comments=None. Closes Github issue 329.
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Small arrays are sorted with insertion sort, which is a stable
sort. Consequently larger arrays are needed to check that the
sort used is properly stable.
The test was also refactored to make it more compact.
|
| | | |
|
|\ \ \
| |/ /
|/| | |
ENH: expose PyDataMem_NEW/FREE/RENEW as numpy API functions with an event hook.
|
| |\ \ |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
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.
|
| | | | |
|
| |/ /
|/| | |
|
| | |
| | |
| | |
| | |
| | | |
otherwise zipfile of python3 gets confused to receive bytes for the header
whenever handle is opened for a text (unicode) file
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | | |
"isclosed" logic
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | | |
opened (ticket #2178)
Also made all assignments of own_file go in pair with assignments to fid to make things clearer
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The original masked-NA-NEP branch contained a large number of changes
in addition to the core NA support. For example:
- ufunc.__call__ support for where= argument
- nditer support for arbitrary masks (in support of where=)
- ufunc.reduce support for simultaneous reduction over multiple axes
- a new "array assignment API"
- ndarray.diagonal() returning a view in all cases
- bug-fixes in __array_priority__ handling
- datetime test changes
etc. There's no consensus yet on what should be done with the
maskna-related part of this branch, but the rest is generally useful
and uncontroversial, so the goal of this branch is to identify exactly
which code changes are involved in maskna support.
The basic strategy used to create this patch was:
- Remove the new masking-related fields from ndarray, so no arrays
are masked
- Go through and remove all the code that this makes
dead/inaccessible/irrelevant, in a largely mechanical fashion. So
for example, if I saw 'if (PyArray_HASMASK(a)) { ... }' then that
whole block was obviously just dead code if no arrays have masks,
and I removed it. Likewise for function arguments like skipna that
are useless if there aren't any NAs to skip.
This changed the signature of a number of functions that were newly
exposed in the numpy public API. I've removed all such functions from
the public API, since releasing them with the NA-less signature in 1.7
would create pointless compatibility hassles later if and when we add
back the NA-related functionality. Most such functions are removed by
this commit; the exception is PyArray_ReduceWrapper, which requires
more extensive surgery, and will be handled in followup commits.
I also removed the new ndarray.setasflat method. Reason: a comment
noted that the only reason this was added was to allow easier testing
of one branch of PyArray_CopyAsFlat. That branch is now the main
branch, so that isn't an issue. Nonetheless this function is arguably
useful, so perhaps it should have remained, but I judged that since
numpy's API is already hairier than we would like, it's not a good
idea to add extra hair "just in case". (Also AFAICT the test for this
method in test_maskna was actually incorrect, as noted here:
https://github.com/njsmith/numpyNEP/blob/master/numpyNEP.py
so I'm not confident that it ever worked in master, though I haven't
had a chance to follow-up on this.)
I also removed numpy.count_reduce_items, since without skipna it
became trivial.
I believe that these are the only exceptions to the "remove dead code"
strategy.
|
|\ \
| | |
| | | |
ENH: Add kwarg support for vectorize (tickets #2100, #1156, and #1487) (clean)
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This is a substantial rewrite of vectorize to remove all introspection and
caching behaviour. This greatly simplifies the logic of the code, and allows
for much more generalized behaviour, simultaneously fixing tickets #1156,
#1487, and #2100. There will probably be a performance hit because caching is
no longer used (but should be able to be reinstated if needed).
As vectorize is a convenience function with poor performance in general,
perhaps this is okay. Rather than trying to inspect the function to determine
the number of arguments, defaults, and argument names, we just use the
arguments passed on the call to determine the behaviour on each call.
All tests pass and code is fully covered
Fixes:
Ticket #2100: kwarg support for vectorize
- API: Optional excluded argument to exclude some args from vectorization.
- Added documentation, examples, and coverage tests
- Added additional coverage test and base case for functions with no args
- Factored original behaviour into _vectorize_call
- Some minor documentation and error message corrections
Ticket #1156: Support vectorizing over instance methods
- No longer an issue since everything is determined by the call.
Ticket: #1487: result depends on execution order
- No longer caching, so the behaviour is as was expected.
ENH: Simple cache for vectorize
- Added simple cache to prevent vectorize from calling pyfunc twice on the first
argument when determining the output types and added regression test.
- Added documentation for excluded positional arguments.
- Documentation cleanups.
- Cleaned up variable names.
ENH: Performance improvements for backward compatibility of vectorize.
After some simple profiling, I found that the wrapping used to
support the caching of the previous commit wasted more time than
it saved, so I added a flag to allow the user to toggle. Moral:
caching makes sense only if the function is expensive and is off
by default.
I also compared performance with the original vectorize and opted
for keeping a cache of _ufunc if otypes is specified and there are
no kwargs/excluded vars. This case is easy to implement, and allows
users to reproduce (almost) the old performance characteristics if
needed. (The new version is about 5% slower in this case).
It would be much more complicated to add a similar cache in the case
where kwargs are used, and since a wrapper is used here, the
performance gain would be negligible (profiling showed that wrapping
was a more significant slowdown than the extra call to frompyfunc).
- API: Added cache kwarg which allows the user to toggle caching
of the first result.
- DOC: Added Notes section with a discussion of performance and a
warning that vectorize should not be used for performance.
- Added private _ufunc member to implement old-style of cache for
special case with no kwargs, excluded, and with otypes specified.
- Modified test case.
Partially address ticket #1982
- I tried to use hasattr(outputs, '__len__') rather than
isinstance(outputs, tuple) in order to allow for functions to return
lists. This, however, means that strings will get vectorized over
each character which breaks previous behaviour. Keeping old
behaviour for now.
|
|\ \ \
| | | |
| | | | |
fix the wrapping problem of fill_diagonal with tall matrix.
|
| | | |
| | | |
| | | |
| | | | |
behavior.
|
| | | | |
|
|/ / / |
|
|\ \ \
| |/ / |
|
| | |
| | |
| | |
| | | |
We are using the new tweak_* bento API wherever possible.
|
| | |
| | |
| | |
| | |
| | | |
The ipmt function was also fixed to handle broadcasting. The tests
were improved and extended to cover the broadcasting capability.
|
| | | |
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
PyArray_Diagonal is changed to return a copy of the diagonal (as in
numpy 1.6 and earlier), but with a new (hidden) WARN_ON_WRITE flag
set. Writes to this array (or views thereof) will continue to work as
normal, but the first write will trigger a DeprecationWarning.
We also issue this warning if someone extracts a non-numpy writeable
view of the array (e.g., by accessing the Python-level .data
attribute). There are likely still places where the data buffer is
exposed that I've missed -- review welcome!
New known-fail test: eye() for maskna arrays was only implemented by
exploiting ndarray.diagonal's view-ness, so it is now unimplemented
again, and the corresponding test is marked known-fail.
|
| | |
|
| |
| |
| |
| |
| | |
Fix incorrect python version checks in test_print.py.
Fix missing build_err_msg import and wrong variable in test_io.py.
|
| |
| |
| |
| | |
Equal and nearly-equal size requirement is not true when passing a 1-D array of indices.
|
| |
| |
| |
| | |
versioned
|
| | |
|
|\ \
| | |
| | | |
ENH: Give digitize left or right open interval option
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
Rearrange some of the documentation and shorten lines. A few long
lines of code were also broken.
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The various padding functions are exposed as options to a public 'pad'
function. Example:
pad(a, 5, mode='mean')
Current modes are 'constant', 'edge', 'linear_ramp', 'maximum', 'mean',
'median', 'minimum', 'reflect', 'symmetric', 'wrap', and <function>
This commit includes unit tests and doctests and is based on feature
request ticket #655.
|