summaryrefslogtreecommitdiff
path: root/numpy
Commit message (Collapse)AuthorAgeFilesLines
* TST: add tests for the existence and round-tripping of datetime limitsEric Wieser2019-03-281-0/+38
|
* MAINT: Simplify logic in convert_datetime_to_datetimestructEric Wieser2019-03-281-133/+78
| | | | Most of this is just emulating the behavior of python's divmod. With a carefully crafted out parameter, we can eliminate a lot of repetition
* Merge pull request #12988 from qwhelan/bool_ufuncEric Wieser2019-03-285-3/+88
|\ | | | | ENH: Create boolean and integer ufuncs for isnan, isinf, and isfinite.
| * ENH: Create boolean and integer ufuncs for isnan, isinf, and isfinite.Christopher Whelan2019-03-095-3/+88
| | | | | | | | | | | | | | | | Previously, boolean values would be routed through the half implementations of these functions, which added considerable overhead. Creating specialized ufuncs improves performance by ~250x Additionally, enable autovectorization of new isnan, isinf, and isfinite ufuncs.
* | DOC: Use std docstring for multivariate normal (#13203)Kevin Sheppard2019-03-281-1/+1
| | | | | | Switch from python-style kwarg signature to style used for all other functions
* | MAINT: add overlap checks to choose, take, put, putmask (#13182)Allan Haldane2019-03-273-38/+81
| | | | | | Fixes #9293, #6272
* | DOC: correction to numpy.pad docstring (#13149)Gregory R. Lee2019-03-252-6/+3
| | | | | | * DOC: fix mistatement in numpy.pad docstring
* | MAINT: Rewrite numpy.pad without concatenate (gh-11358)Lars Grueter2019-03-252-965/+585
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ENH: Add support for constant, edge, linear_ramp to new numpy.pad Passes unit tests: - TestConstant - TestEdge - TestZeroPadWidth - TestLegacyVectorFunction - TestNdarrayPadWidth - TestUnicodeInput - TestLinearRamp * MAINT: Simplify diff / change order of functions * MAINT: Revert to old handling of keyword-only arguments * ENH: Add support for stat modes * ENH: Add support for "reflect" mode * MAINT: Remove _slice_column * ENH: Add support for "symmetric" mode * MAINT: Simplify mode "linear_ramp" Creating the linear ramp as an array with 1-sized dimensions except for the one given by `axis` allows implicit broadcasting to the needed shape. This seems to be even a little bit faster that doing this by hand and allows the simplicifaction of the algorithm. Note: Profiling and optimization will be done again at a later stage. * MAINT: Reorder arguments of a sum and fix typo Addresses feedback raised in PR. * ENH: Add support for "wrap" mode This completes the first draft of the complete rewrite meaning all unit tests should pass from this commit onwards. * MAINT: Merge functions for "reflect" and "symmetric" mode The set functions were nearly the same, apart from some index offsets. Merging them reduces code duplication. * TST: Add regression test for gh-11216 The rewrite in past commits fixed this bug. * BUG: Fix edge case for _set_wrap_both when pad_amt contains 0. And include test to protect against regression. * MAINT: Simplify and optimize pad modes Major changes & goals: Don't deal with pad area in the front and back separately. This modularity isn't needed and makes handling of the right edge more awkward. All modes now deal with the left and right side at the same time. Move the creation of the linear ramps fully to its own function which behaves like a vectorized version of linspace. Separate calculation and application of the pad area where possible. This means that _get_edges can be reused for _get_linear_ramps. Combine _normalize_shape and _validate_lengths in a single function which should handles common cases faster. Add new mode "empty" which leaves the padded areas undefined. Add documentation where it was missing. * TST: Don't use np.empty in unit tests * MAINT: Reorder workflow in numpy.pad and deal with empty dimensions Only modes "constant" and "empty" can extend dimensions of size 0. Deal with this edge case gracefully for all other modes either fail or return empty array with padded non-zero dimensions. Handle default values closer to their actual usage. And validate keyword arguments that must be numbers. * MAINT: Add small tweaks to control flow and documentation * BUG: Ensure wrap mode works if right_pad is 0 * ENH: Use reduced region of interest for iterative padding When padding multiple dimensions iteratively corner values are unnecessarily overwritten multiple times. This function reduces the working area for the first dimensions so that corners are excluded. * MAINT: Restore original argument order in _slice_at_axis * MAINT: Keep original error message of broadcast_to * MAINT: Restore old behavior for non-number end_values. * BENCH: Make the pad benchmark pagefault in setup * ENH/TST: Preserve memory layout (order) of the input array and add appropriate unit test. * STY: Revert cosmetical changes to reduce diff * MAINT: Pin dtype to float64 for np.pad's benchmarks * MAINT: Remove redundant code path in _view_roi * MAINT/TST: Provide proper error message for unsupported modes and add appropriate unit test. * STY: Keep docstrings consistent and fix typo. * MAINT: Simplify logical workflow in pad * MAINT: Remove dtype argument from _linear_ramp The responsibility of rounding (but without type conversion) is not really need in _linear_ramp and only makes it a little bit harder to reason about. * DOC: Add version tag to new argument "empty" * MAINT: Default to C-order for padded arrays unless the input is F-contiguous. * MAINT: Name slice of original area consistently for all arguments describing the same thing. * STY: Reduce vertical space * MAINT: Remove shape argument from _slice_at_axis Simplifies calls to this function and the function itself. Using `(...,)` instead should keep this unambiguous. This change is not compatible with Python 2.7 which doesn't support this syntax outside sequence slicing. If that is wanted one could use `(Ellipsis,)` instead. * TST: Test if end_values of linear_ramp are exact which was not given in the old implementation `_arange_ndarray`. * DOC: Improve comments and wrap long line * MAINT: Refactor index_pair to width_pair Calling the right value an index is just plain wrong as it can't be used as such. * MAINT: Make _linear_ramp compatible with size=0 * MAINT: Don't rely on negative indices for slicing Calculating the proper positive index of the start of the right pad area makes it possible to omit the extra code paths for a width of 0. This should make the code easier to reason about. * MAINT: Skip calculation of right_stat if identical If the input area for both sides is the same we don't need to calculate it twice. * TST: Adapt tests from gh-12789 to rewrite of pad * TST: Add tests for mode "empty" * TST: Test dtype persistence for all modes * TST: Test exception for unsupported modes * TST: Test repeated wrapping for each side individually. Reaches some only partially covered if-statments in _set_wrap_both. * TST: Test padding of empty dimension with constant * TST: Test if end_values of linear_ramp are exact which was not given in the old implementation `_arange_ndarray`. (Was accidentally overwritten during the last merge). * TST: Test persistence of memory layout Adapted from an older commit 3ac4d2a1b9b258d65f8d2b5f8f25f88e3a0e8f58 which was accidentally overwritten during the last merge. * MAINT: Simplify branching in _set_reflect_both Reduce branching and try to make the calculation of the various indices easier to understand. * TST: Parametrize TestConditionalShortcuts class * TST: Test empty dimension padding for all modes * TST: Keep test parametrization ordered Keep parametrization ordered, otherwise pytest-xdist might believe that different tests were collected during parallelization causing test failures. * DOC: Describe performance improvement of np.pad as well as the new mode "empty" in release notes (see gh-11358). * DOC: Remove outdated / misleading notes These notes are badly worded or actually misleading. For a better explanation on how these functions work have a look at the context and comments just above the lines calling these functions.
* | Merge pull request #12547 from bashtage/mvnormal-tol-checkAllan Haldane2019-03-212-0/+9
|\ \ | | | | | | ENH: Cast covariance to double in random mvnormal
| * | ENH: Cast covariance to double in random mvnormalKevin Sheppard2018-12-142-0/+9
| | | | | | | | | | | | | | | | | | | | | Cast the covariance in the multivariate normal to double so that the interpretation of tol is cleaner. closes #10839
* | | STY: Fix weird indents to be multiples of 4 spacesEric Wieser2019-03-2013-78/+78
| | |
* | | Merge pull request #13147 from Kai-Striega/DOC_int_overflowMatti Picus2019-03-191-0/+39
|\ \ \ | | | | | | | | DOC: Add description of overflow errors
| * | | DOC: Minor fix in Integer Overflow docKai Striega2019-03-191-3/+3
| | | | | | | | | | | | | | | | Change `np.power` -> `numpy.power` to make it reference the function's documentation
| * | | DOC: Remove extra letter from docsKai Striega2019-03-191-1/+1
| | | |
| * | | DOC: Add description of overflow errorrskai2019-03-181-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Unlike Python, NumPy integers have fixed sizes. This can lead to confusion when a integer overflow occurs and users expect NumPy integer types to behave similarily to Python integers. This commit explains integer overflow, an example and potential work arounds.
* | | | Merge pull request #13117 from kshyatt/ksh/padMatti Picus2019-03-191-8/+8
|\ \ \ \ | | | | | | | | | | DOC: Fix arg type for np.pad, fix #9489
| * | | | Update parameter description for constant and end valuesKatharine Hyatt2019-03-141-6/+6
| | | | |
| * | | | DOC: fix arg type for np.pad, fix #9489Katharine Hyatt2019-03-131-2/+2
| | | | |
* | | | | Merge pull request #13099 from liwt31/add-indexing-docMatti Picus2019-03-191-1/+3
|\ \ \ \ \ | | | | | | | | | | | | DOC: Add note about "copy and slicing"
| * | | | | DOC: add copy on slicing noticewtli2019-03-141-1/+3
| | | | | |
* | | | | | Merge pull request #13116 from kshyatt/ksh/linalgMatti Picus2019-03-181-14/+14
|\ \ \ \ \ \ | | | | | | | | | | | | | | DOC: Add backticks in linalg docstrings.
| * | | | | | Double to single for linking, = -> ==Katharine Hyatt2019-03-181-3/+3
| | | | | | |
| * | | | | | Single to double backticks for variable in docstringKatharine Hyatt2019-03-141-1/+1
| | | | | | |
| * | | | | | DOC: add backticks to linalgKatharine Hyatt2019-03-131-14/+14
| | |/ / / / | |/| | | |
* | | | | | Merge pull request #13140 from mattip/lgtm-fixesCharles Harris2019-03-1714-32/+17
|\ \ \ \ \ \ | | | | | | | | | | | | | | DEV: cleanup imports and some assignments (from LGTM)
| * | | | | | DEV: cleanup imports and some assignments (from LGTM)mattip2019-03-1714-32/+17
| | | | | | |
* | | | | | | Merge pull request #13146 from eric-wieser/poly-powCharles Harris2019-03-177-90/+43
|\ \ \ \ \ \ \ | |_|_|_|/ / / |/| | | | | | MAINT: Unify polynomial power functions
| * | | | | | MAINT: Unify polynomial power functionsEric Wieser2019-03-167-90/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These power functions are all the same - the algorithm used does not care about the basis. `polypow` and `chebpow` have some optimizations in their versions, which this maintains
* | | | | | | Merge pull request #13137 from ffontaine/masterCharles Harris2019-03-161-1/+2
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | BUG: Fix build for glibc on ARC and uclibc.
| * | | | | | | FIX: no FPU exceptions bits on ARC glibcFabrice Fontaine2019-03-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The FPU exceptions bits are missing in fenv.h in glibc for ARC architecture. Signed-off-by: Evgeniy Didin <Evgeniy.Didin@synopsys.com> [Retrieved (and slightly updated) from: https://git.buildroot.net/buildroot/tree/package/python-numpy/0003-no-FPU-exceptions-bits-on-ARC-glibc.patch] Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
| * | | | | | | Don't use <fenv.h> on uClibcFabrice Fontaine2019-03-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> [Retrieved (and slightly updated) from: https://git.buildroot.net/buildroot/tree/package/python-numpy/0001-no-fenv-on-uclibc.patch] Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
* | | | | | | | Merge pull request #13126 from eric-wieser/deprecate-float-orderCharles Harris2019-03-1613-132/+111
|\ \ \ \ \ \ \ \ | |_|_|/ / / / / |/| | | | | | | DEP: polynomial: Be stricter about integral arguments
| * | | | | | | Merge branch 'master' into deprecate-float-orderEric Wieser2019-03-1629-227/+251
| |\ \ \ \ \ \ \ | | |_|/ / / / / | |/| | | | | |
| * | | | | | | DEP: polynomial: Be stricter about integral argumentsEric Wieser2019-03-1613-132/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the behavior for: * The `deg` and `axis` arguments of `<type>der` * The `deg` and `axis` arguments of `<type>int` * The `deg` argument of `<type>gauss` * The `deg` argument of `<type>vander2d` * The `deg` argument of `<type>vander3d` The old behavior was: * Raise `ValueError` if the argument is a float, but not an integral one * Allow a float like `1.0` to mean `1`. This is inconsistent with most other integer-accepting APIs in numpy, which require these to be actual integers, and raise TypeError when they are not. The new behavior is: * Raise `TypeError` if the argument is a float, but not an integral one * Emit a `DeprecationWarning` if a float like `1.0` is passed, continuing to allow it its old meaning.
* | | | | | | | Merge pull request #13115 from kshyatt/ksh/hypergeomMatti Picus2019-03-161-9/+11
|\ \ \ \ \ \ \ \ | |_|/ / / / / / |/| | | | | | | DOC: Fix #12050 by updating numpy.random.hypergeometric docs
| * | | | | | | Fix backticks, expand out docstring, improve consistencyKatharine Hyatt2019-03-141-8/+10
| | | | | | | |
| * | | | | | | DOC: Fix #12050 by updating numpy.random.hypergeometric docsKatharine Hyatt2019-03-131-8/+8
| | |_|/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | - Add backticks for some parameters in the body - Address the wording changes in the issue
* | | | | | | Merge pull request #13130 from eric-wieser/unify-polyfitCharles Harris2019-03-167-450/+94
|\ \ \ \ \ \ \ | | |/ / / / / | |/| / / / / | |_|/ / / / |/| | | | | MAINT: Unify polynomial fitting functions
| * | | | | MAINT: Unify polynomial fitting functionsEric Wieser2019-03-157-450/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These fitting functions are all the same - the algorithm used does not care about the basis. This was done using: * A regex find / replace on all but poly and cheb * A manual diff showing that cheb differed only by whitespace * A manual diff showing that poly differed in `deg.ndim == 1` vs `deg.ndim > 0`. Given that this function only allows `deg.ndim <= 1`, and `ndim >= 0`, these two comparison are equivalent.
* | | | | | Merge pull request #4808 from stefanv/pad_mode_positionalRalf Gommers2019-03-152-8/+7
|\ \ \ \ \ \ | | | | | | | | | | | | | | ENH: Make the `mode` parameter of np.pad default to 'constant'
| * | | | | | Fix array dispatcherStefan van der Walt2019-03-152-2/+2
| | | | | | |
| * | | | | | ENH: Make `mode` parameter default to `constant` (padding by zero)Stefan van der Walt2019-03-132-7/+6
| | |/ / / / | |/| | | |
* | | | | | Merge pull request #13128 from eric-wieser/unify-polyaddCharles Harris2019-03-157-114/+39
|\ \ \ \ \ \ | | |/ / / / | |/| | | | MAINT: Unify polynomial addition and subtraction functions
| * | | | | MAINT: Unify polynomial addition and subtraction functionsEric Wieser2019-03-147-114/+39
| | | | | | | | | | | | | | | | | | | | | | | | These functions are all the same - the algorithm used does not care about the basis.
* | | | | | Merge pull request #13125 from raptorsun/fix_cblas_detectionMatti Picus2019-03-151-0/+2
|\ \ \ \ \ \ | | | | | | | | | | | | | | BUG: Fix unhandled exception in CBLAS detection
| * | | | | | if neither libcblas or libblas is linkable, it consider libcblas is ↵Haoyu Sun2019-03-151-0/+2
| | |/ / / / | |/| | | | | | | | | | | | | | | | inexistent, avoiding unhandled exception.
* | | | | | BUG: Fix np.rec.fromarrays on arrays which are already structured (#12887)Daniel Hrisca2019-03-142-4/+9
|/ / / / / | | | | | | | | | | | | | | | Previously fromarrays would fail when trying to construct a nested structured array. Fixed by using the dtype object directly, rather than round-tripping it through a string.
* | | | | Merge pull request #12879 from mattip/deprecate-exec_commandRalf Gommers2019-03-132-26/+28
|\ \ \ \ \ | | | | | | | | | | | | DEP: deprecate exec_command
| * | | | | DEP: deprecate exec_commandmattip2019-03-102-26/+28
| | | | | |
* | | | | | Merge pull request #13109 from anntzer/chainingMarten van Kerkwijk2019-03-131-10/+13
|\ \ \ \ \ \ | | | | | | | | | | | | | | Prevent traceback chaining in _wrapfunc.