diff options
author | Marten van Kerkwijk <mhvk@astro.utoronto.ca> | 2017-12-10 14:32:40 -0500 |
---|---|---|
committer | Marten van Kerkwijk <mhvk@astro.utoronto.ca> | 2019-01-03 17:33:07 -0500 |
commit | 5afe650403bdb3aa1a3189c1b8c3233501208521 (patch) | |
tree | 224d819ab8a7d2e80a460648f1e8cb231bd4d237 /numpy/core/_methods.py | |
parent | fd89a4137969b676d4449e2b61ecd7f4c5811d7a (diff) | |
download | numpy-5afe650403bdb3aa1a3189c1b8c3233501208521.tar.gz |
ENH: allow where in reduce operations.
In this implementation, if the ufunc does not have an identity, it needs
an initial vavlue to be supplied.
Diffstat (limited to 'numpy/core/_methods.py')
-rw-r--r-- | numpy/core/_methods.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/numpy/core/_methods.py b/numpy/core/_methods.py index 33f6d01a8..51362c761 100644 --- a/numpy/core/_methods.py +++ b/numpy/core/_methods.py @@ -24,20 +24,20 @@ umr_all = um.logical_and.reduce # avoid keyword arguments to speed up parsing, saves about 15%-20% for very # small reductions def _amax(a, axis=None, out=None, keepdims=False, - initial=_NoValue): - return umr_maximum(a, axis, None, out, keepdims, initial) + initial=_NoValue, where=True): + return umr_maximum(a, axis, None, out, keepdims, initial, where) def _amin(a, axis=None, out=None, keepdims=False, - initial=_NoValue): - return umr_minimum(a, axis, None, out, keepdims, initial) + initial=_NoValue, where=True): + return umr_minimum(a, axis, None, out, keepdims, initial, where) def _sum(a, axis=None, dtype=None, out=None, keepdims=False, - initial=_NoValue): - return umr_sum(a, axis, dtype, out, keepdims, initial) + initial=_NoValue, where=True): + return umr_sum(a, axis, dtype, out, keepdims, initial, where) def _prod(a, axis=None, dtype=None, out=None, keepdims=False, - initial=_NoValue): - return umr_prod(a, axis, dtype, out, keepdims, initial) + initial=_NoValue, where=True): + return umr_prod(a, axis, dtype, out, keepdims, initial, where) def _any(a, axis=None, dtype=None, out=None, keepdims=False): return umr_any(a, axis, dtype, out, keepdims) |