summaryrefslogtreecommitdiff
path: root/numpy/lib
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #290 from mforbes/new-vectorize-cleanTravis E. Oliphant2012-06-122-168/+307
|\ | | | | 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-312-168/+307
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #306 from nouiz/fill_diagonalTravis E. Oliphant2012-06-122-4/+74
|\ \ | | | | | | fix the wrapping problem of fill_diagonal with tall matrix.
| * | add the warp parameter to fill_diagonal for people that could want the old ↵Frederic2012-06-112-4/+49
| | | | | | | | | | | | behavior.
| * | fix the wrapping problem of fill_diagonal with tall matrix.Frederic2012-06-112-1/+26
| | |
* | | remove unused variables from histogramddJake Vanderplas2012-06-111-2/+0
|/ /
* | Merge branch 'master' into clean-up-diagonalNathaniel J. Smith2012-06-063-24/+103
|\ \ | |/
| * REF: simplify extension customization.David Cournapeau2012-06-011-13/+6
| | | | | | | | We are using the new tweak_* bento API wherever possible.
| * BUG: Changed ipmt to accept array_like arguments.Tim Cera2012-05-202-11/+97
| | | | | | | | | | The ipmt function was also fixed to handle broadcasting. The tests were improved and extended to cover the broadcasting capability.
* | Document the PyArray_Diagonal transition scheme.Nathaniel J. Smith2012-05-161-2/+5
| |
* | Transition scheme for allowing PyArray_Diagonal to return a viewNathaniel J. Smith2012-05-161-1/+7
|/ | | | | | | | | | | | | | | | 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.
* ENH: Change datetime64 to use c_metadata instead of metadataMark Wiebe2012-05-101-1/+0
|
* BUG: Fix some test bugs.Charles Harris2012-05-021-4/+4
| | | | | Fix incorrect python version checks in test_print.py. Fix missing build_err_msg import and wrong variable in test_io.py.
* DOC: Fix outdated docstring.Tony S Yu2012-04-091-5/+5
| | | | Equal and nearly-equal size requirement is not true when passing a 1-D array of indices.
* DEP: Update all the '#define NPY_NO_DEPRECATED_API' instances to beMark Wiebe2012-04-061-1/+1
| | | | versioned
* BUG: Fix missing np prefix in test_function_base.py.Charles Harris2012-04-051-1/+1
|
* Merge pull request #245 from jseabold/digitize-open-rightTravis E. Oliphant2012-04-042-18/+105
|\ | | | | ENH: Give digitize left or right open interval option
| * TST: Add namespaces to digitize tests + one more testSkipper Seabold2012-04-031-9/+17
| |
| * ENH: Give digitize left or right open interval optionSkipper Seabold2012-04-032-16/+95
| |
* | STY: Touch up documentation in arraypad.pyCharles Harris2012-04-041-111/+125
| | | | | | | | | | Rearrange some of the documentation and shorten lines. A few long lines of code were also broken.
* | ENH: Add module containing functions for padding n-dimensional arrays.tim cera2012-04-043-0/+1299
|/ | | | | | | | | | | | | 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.
* WRN: Fix compiler warnings in _compiled_base.c.Charles Harris2012-04-011-5/+5
|
* STY: Style cleanups in numpy/lib/tests/test_function_base.Charles Harris2012-04-011-240/+245
| | | | | Make imports from numpy.testing explicit. Use np namespace.
* ENH: improve interp() speed in some cases.Timo Kluck2012-04-012-19/+49
| | | | | | 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.
* BUG: ticket #2063, make unique return consistent index.Bryan Van de Ven2012-03-301-3/+6
| | | | | | Make unique use mergesort when return_index is true. This quarantees that the returned indices are of the first occurrence of the unique elements and makes the behavior better defined and consistent.
* TST: fix string comparison test failures on Windows for Python 2.5.Ralf Gommers2012-03-071-3/+22
| | | | | | | | | | | | | This is caused by the inconsistent floating point handling of Python itself. On Windows with 2.5: >>> "%s" % 1e-6 '1e-006' With 2.6: >>> "%s" % 1e-6 '1e-06' Reviewed as PR-225.
* DOC: Change versionadded from 2.0.0 to 1.7.0 where needed.Charles Harris2012-03-041-2/+2
|
* ENH: Allow bincount to accept empty arrays.Skipper Seabold2012-03-043-8/+27
|
* DOC: merge wiki doc edits.Ralf Gommers2012-03-034-46/+60
|
* TST: filter one more printed warning.Ralf Gommers2012-03-021-3/+12
| | | | | This one wasn't actually converted to a test error, because it's not a RuntimeWarning. Maybe need to add an option to raise on UserWarning too.
* TST: filter RuntimeWarnings for invalids from some more test files.Ralf Gommers2012-03-021-8/+12
| | | | This should fix the test errors seen on both MinGW and MSVC9 related to this.
* ENH: lib: break reference cycle in NpzFile (#2048)Pauli Virtanen2012-02-162-1/+19
| | | | | This allows these objects to be freed by refcount, rather than requiring the gc, which can be useful in some situations.
* Added ipmt (interest portion of payment) and ppmt (principal portion of ↵tim cera2012-02-122-14/+73
| | | | payment) functions. Added doctests and unit tests.
* Merge branch 'replace-noprefix'Charles Harris2012-02-091-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * replace-noprefix: (30 commits) BUG: Fix typo npydouble. UPD: Remove now redundant typedef. UPD: Fix a few more spots missing prefixes. BUG: Fix scons build script so it works with umathmodule.c. STY: Cleanup some prefixing that crept into comments. UPD: Various fixes, Remove #define NPY_NO_PREFIX from files in core. ENH: Add some needed macros to include files. UPD: Use prefixed types in scalartypes.c.src. UPD: Make multiarray *.c files use prefixed macros. UPD: Use prefixed types in arraytypes.c.src. ENH: Add a few needed macros to npy_common.h. UPD: Include ndarrayobject.h instead of arrayobject.h in boolean_ops.c.src. UPD: Use prefixed types in lowlevel_strided_loops.c.src template headers. UPD: Use explicit prefixed types in einsum.c.src template headers. UPD: Use prefixed versions of double and int in multiarray_tests.c.src. UPD: Remove includes of noprefix.h in ufunc_object.c and _compiled_base.c. BUG: Fix unprefixed reference to cdouble in ndarrayobject.h. UPD: Use prefixed macros in numpy/core/src/scalarmathmodule.c.src. UPD: Use prefixed macros in numpy/core/src/umath/funcs.inc.src. MOV: Rename umathmodule.c.src umathmodule.c since it has no templates. ...
| * UPD: Various fixes, Remove #define NPY_NO_PREFIX from files in core.Charles Harris2012-02-051-1/+1
| |
| * UPD: Remove includes of noprefix.h in ufunc_object.c and _compiled_base.c.Charles Harris2012-02-041-1/+1
| |
| * UPD: Use prefixed macros in *.c files except numarray and linalg.Charles Harris2012-02-041-1/+1
| |
* | BUG: Fix improper usage of warning filters in the testsMark Wiebe2012-02-081-30/+46
|/
* STY: lib/src - replace macros in old_defines.h with new.Charles Harris2012-02-041-2/+2
|
* STY: Add comment and rename monotonic_ functino to be more descriptiveMark Wiebe2012-01-271-2/+7
|
* Merge remote-tracking branch 'dwf/release_gil_in_libfunctions'Mark Wiebe2012-01-271-48/+112
|\
| * DOC: add a high-level comment for arr_insert_loopDavid Warde-Farley2012-01-251-0/+8
| |
| * REF: simplify multi-loop breaking with a goto.David Warde-Farley2011-09-201-4/+4
| |
| * ENH: release the GIL for arr_insert inner loop.David Warde-Farley2011-09-201-3/+14
| | | | | | | | | | Releases it only conditionally, as object arrays require refcounting to be performed within the inner loop, making GIL release impractical.
| * REF: factor out inner loop of arr_insert.David Warde-Farley2011-09-201-32/+44
| | | | | | | | This makes subsequent thread-friendly modification easier.
| * ENH: release GIL for C loops in ravel/unravel.David Warde-Farley2011-09-191-14/+36
| |
| * ENH: Use char instead of int for error flag.David Warde-Farley2011-09-191-1/+1
| |
| * ENH: less fine-grained GIL management in digitize.David Warde-Farley2011-09-181-13/+10
| |
| * ENH: release the GIL in some C library functions.David Warde-Farley2011-09-181-0/+14
| | | | | | | | | | | | 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.
* | TST: Test gradient(...) of datetime64 and timedelta64 arrays.Ben Root2012-01-271-1/+19
| |