diff options
author | Tobias Pitters <tobias.pitters@gmail.com> | 2020-06-10 01:11:54 +0200 |
---|---|---|
committer | Tobias Pitters <tobias.pitters@gmail.com> | 2020-06-10 01:11:54 +0200 |
commit | e7603603e14288c9aedc0f6216f940c6658ee8e5 (patch) | |
tree | 8da4d895f8993043945f45d1b24b4d2c753c4627 /numpy/lib/function_base.py | |
parent | 949bda505d226150bae0d7324ca675899c8396b9 (diff) | |
download | numpy-e7603603e14288c9aedc0f6216f940c6658ee8e5.tar.gz |
make lerp be able to handle 0d cases
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 03e4112d5..645a77cdb 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -3875,10 +3875,10 @@ def _quantile_is_valid(q): def _lerp(a, b, t, out=None): """ Linearly interpolate from a to b by a factor of t """ - #return add(a, subtract(b, a, out=out)*t, out=out) diff_b_a = subtract(b, a) - if np.isscalar(a) and np.isscalar(b) and (np.isscalar(t) or np.ndim(t) == 0): + _scalar_or_0d = lambda x: np.isscalar(a) or np.ndim(x) == 0 + if _scalar_or_0d(a) and _scalar_or_0d(b) and _scalar_or_0d(t): if t <= 0.5: return add(a, diff_b_a * t, out=out) else: |