summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
Commit message (Collapse)AuthorAgeFilesLines
* [FIX] preserve memory order in np.copy()Nathaniel J. Smith2012-10-011-2/+4
| | | | | This switches us back to the behaviour seen in numpy 1.6 and earlier, which it turns out that scikit-learn (and probably others) relied on.
* MAINT: Use linspace instead of arange in some examples.endolith2012-09-171-3/+3
| | | | | | The original code used arange with offsets and scaling to generate sample points. Using linspace simplifies the code and clarifies the intent.
* BUG: Fix for issues #378 and #392Han Genuit2012-09-071-6/+8
| | | | | | This should fix the problems with numpy.insert(), where the input values were not checked for all scalar types and where values did not get inserted properly, but got duplicated by default.
* Merge pull request #352 from HackerSchool12/bugfix808Travis E. Oliphant2012-07-171-13/+7
|\ | | | | BF bug #808
| * BUG: Ticket #808: Insert was not performing properly when an integer wasLoftie Ellis2012-07-151-13/+7
| | | | | | | | | | | | | | 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
* | Merge pull request #192 from rgommers/meshgrid3dTravis E. Oliphant2012-07-171-33/+106
|\ \ | |/ |/| Meshgrid enhancements (>2-D, sparse grids, matrix indexing)
| * STY: meshgrid: some minor changes to address review comments.Ralf Gommers2012-02-051-1/+1
| |
| * TST: meshgrid: test expected shapes for Cartesian and matrix indexing.Ralf Gommers2011-12-281-5/+11
| |
| * BUG: meshgrid: raise error on single input.Ralf Gommers2011-12-281-4/+5
| |
| * MAINT: clean up docstring and some minor items in meshgrid. Remove ndgrid.Ralf Gommers2011-12-131-42/+36
| |
| * ENH: enhance meshgrid to generate 3D grids, sparse grids, matrix indexing.Per A. Brodtkorb2011-12-131-34/+106
| |
* | DOC: merge doc wiki edits. A number of small edits in linalg and lib.Ralf Gommers2012-07-071-3/+8
| |
* | DOC: merge wiki edits. Add percentile to statistics routines (ML suggestion).Ralf Gommers2012-07-071-3/+4
| |
* | Remove maskna API from ndarray, and all (and only) the code supporting itNathaniel J. Smith2012-06-161-10/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | 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
|