summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #290 from mforbes/new-vectorize-cleanTravis E. Oliphant2012-06-121-141/+179
|\ | | | | ENH: Add kwarg support for vectorize (tickets #2100, #1156, and #1487) (clean)
| * ENH: Add kwarg support for vectorize (tickets #2100, #1156, and #1487)Michael McNeil Forbes2012-05-311-141/+179
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | remove unused variables from histogramddJake Vanderplas2012-06-111-2/+0
|/
* DOC: merge wiki doc edits.Ralf Gommers2012-03-031-5/+5
|
* ENH: Support datetime64, timedelta64 in gradient. Allow array-like input.Ben Root2012-01-271-2/+11
|
* ENH: Add function for adding docstrings to ufuncs.Chris Jordan-Squire2011-08-291-1/+7
|
* ENH: missingdata: Add maskna= parameter to np.copy and ndarray.copyMark Wiebe2011-08-271-2/+11
|
* ENH: missingdata: trying some more functions to see how they treat NAsMark Wiebe2011-08-271-0/+4
|
* ENH: Faster asarray_chkfiniteChris Jordan-Squire2011-08-131-2/+1
|
* BUG: fixed histogramdd bug with empty inputs. Closes #1899.David Huard2011-07-241-3/+3
|
* BUG: fix asarray_chkfinite to take dtype and order args, as advertisedLars Buitinck2011-07-191-4/+4
| | | | Includes a doctest for dtype.
* ENH: Fix some functions to use copyto instead of the deprecated putmask.Charles Harris2011-07-091-7/+7
|
* DOC:BUG: fix percentile examples. Closes #1813.Ralf Gommers2011-04-291-7/+6
|
* STY: Update exception style, easy ones.Charles Harris2011-04-051-1/+1
|
* DOC: improve clarity of window function docs.Ralf Gommers2011-04-021-55/+33
| | | | Thanks to Yury Zaytsev for the suggestion.
* BUG: handle empty inputs in cov and corrcoef. Closes #1773.Ralf Gommers2011-04-021-1/+7
|
* BUG: make histogramdd work with infinite size bins. Closes #1788.Ralf Gommers2011-04-011-7/+23
| | | | | Also add more informative error messages for wrongly specified bins, for both histogram and histogram2d/dd.
* DEP: deprecate normed kw in histogram and restore its old behavior. IntroduceRalf Gommers2011-03-301-19/+28
| | | | | | | | | | | | | | | density kw. This reverts part of the following commits: 3743430e 400a2a67 3743430e Behavior for normed keyword is again the same as it was in Numpy 1.5. The desired behavior (probability density) is implemented by the new density keyword, which reflects the functionality better than "normed". For a discussion on this issue, see the Numpy mailing list thread started on Aug 6th, 2010.
* BUG: make np.median() work for 0-D arrays. Also add tests. Closes #1747.Ralf Gommers2011-03-291-2/+5
|
* ENH: Make all histogram functions work with empty input.Ralf Gommers2011-03-271-11/+18
|
* DOC: lib: point the reader towards masked arrays when there is missing dataPauli Virtanen2011-03-251-16/+2
|
* DOC: Add a note about None values in the average documentation (#1180)Mark Wiebe2011-03-251-0/+15
| | | | | | | It was suggested in issue #1180 to add an ignore_None= parameter to average, but I think this does not fit cleanly into NumPy, and rather educating users about Python list comprehensions is better. This is an attempt to do that.
* ENH: Use fmax.reduce and fmin.reduce to implement nanmax and nanmin.Charles Harris2011-03-071-6/+12
|
* DOC: commit some more fixes from the doc wiki.rgommers2011-03-031-12/+14
|
* DOC: merge more doc wiki edits.rgommers2011-03-021-1/+1
|
* added a warning concerning the buggy normalization in histogram with ↵dhuard2010-08-301-0/+11
| | | | non-uniform bin widths
* Fixed bug in histogram for non-uniform bin widths and normed=True.dhuard2010-08-271-1/+1
|
* DOC: wiki merge, npyio, format and function_basergommers2010-07-311-25/+45
|
* ENH: Make trapz work with ndarray subclasses. Thanks to Ryan May. Closes #1438.rgommers2010-07-311-5/+11
|
* ENH: Add ddof keyword to masked versions of cov and corrcoef.Charles Harris2010-07-071-4/+8
|
* Fix missing rowvar in cov call in corrcoeff.Charles Harris2010-07-071-1/+1
|
* Don't deprecated bias keyword, just add ddof.Charles Harris2010-07-071-41/+25
|
* ENH: Add ddof keyword to cov and corrcoef. Deprecate bias keyword.Charles Harris2010-07-071-29/+56
|
* BUG: lib: fix sinc to handle array-like inputs properly (fixes #1523)Pauli Virtanen2010-06-271-0/+1
|
* CLN: Cleanup nanops code a bit. Patch is from Tony Yu.Charles Harris2010-06-071-7/+7
|
* BUG: Fix failed detection of unsigned integers in _nanop. Fixes ticket #1300.Charles Harris2010-05-261-1/+1
|
* BUG: Correctly handle in-place output in percentile.Stefan van der Walt2010-05-161-3/+9
|
* BUG: Allow any array-like input to percentile.Stefan van der Walt2010-05-161-0/+2
|
* Add percentile function.Travis Oliphant2010-05-151-2/+128
|
* BUG: Make interp handle zero dimensional ndarrays as interpolationCharles Harris2010-05-071-6/+8
| | | | | points. Add some tests for interp. Fixes ticket #1177. unc_api.txt.tmp
* Merge branch 'vectorize'Charles Harris2010-05-061-45/+93
|
* BUG: fix kaiser for M=1.David Cournapeau2010-03-311-0/+2
|
* * Use putmask instead of fancy indexing in _nanop (bug #1421)pierregm2010-03-221-1/+4
|
* BUG: lib: fix #1435, np.gradient should use zeros_likePauli Virtanen2010-03-181-1/+1
| | | | Thanks to Ryan May for the patch.
* 3K: lib: fix some bytes vs. str issues in _iotools.py and io.py -- mainly ↵Pauli Virtanen2010-02-201-1/+13
| | | | genfromtxt
* more docstring updates from pydoc website (thanks to everyone who contributed!)Jarrod Millman2010-02-171-13/+9
|
* removed old behavior for the histogram function.dhuard2010-02-161-135/+65
|
* fixed a whole bunch of doctestsPaul Ivanov2009-12-281-12/+72
|
* Merge deprecate_with_doc into deprecate(message="...").Stefan van der Walt2009-10-251-2/+2
|
* Docstring update: libPauli Virtanen2009-10-021-44/+182
|