diff options
author | Tobias Pitters <tobias.pitters@gmail.com> | 2020-05-26 21:12:05 +0200 |
---|---|---|
committer | Tobias Pitters <tobias.pitters@gmail.com> | 2020-05-27 19:35:59 +0200 |
commit | 708798bf82299081b040f672173956ac8a39e877 (patch) | |
tree | 2871b78acb729a336d398b568cc86c2aa38b7f4f /numpy/lib/function_base.py | |
parent | 54de868a1a37b182a94f2d521fe2c695bf19ddea (diff) | |
download | numpy-708798bf82299081b040f672173956ac8a39e877.tar.gz |
remove pdb; add hypothesis tests for monotony, boundedness and symmetry of lerp
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 3fb45b09a..168623b82 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -3875,8 +3875,14 @@ def _quantile_is_valid(q): def _lerp(a, b, t, out=None): """ Linearly interpolate from a to b by a factor of t """ - offset = subtract(b, a) * t - return add(a, offset, out=out) + #a + (b-a)*t if t < 0.5 else b - (b-a)*(1-t) + if t < 0.5: + return add(a, subtract(b, a)*t, out=out) + else: + return subtract(b, subtract(b, a)*(1-t), out=out) + # a + (b-a)*t + #offset = subtract(b, a) * t + #return add(a, offset, out=out) def _quantile_ureduce_func(a, q, axis=None, out=None, overwrite_input=False, |