diff options
author | Timo Kluck <tkluck@infty.nl> | 2011-12-29 18:42:26 +0100 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2012-04-01 08:20:25 -0600 |
commit | b9576ed22a57cb8c7bf04038c5792bb2b499f390 (patch) | |
tree | 13cafe8b02eab06cba5da24f963c996761a66715 /numpy/lib/tests/test_function_base.py | |
parent | 72185d34170369ec07e8e84ed18d2f6a814e327a (diff) | |
download | numpy-b9576ed22a57cb8c7bf04038c5792bb2b499f390.tar.gz |
ENH: improve interp() speed in some cases.
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.
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 145c83b77..67a5204a1 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -1179,6 +1179,11 @@ class TestInterp(TestCase): x0 = np.array(.3, dtype=object) assert_almost_equal(np.interp(x0, x, y), .3) + def test_if_len_x_is_small(self): + xp = np.arange(0, 1000, 0.0001) + fp = np.sin(xp) + assert_almost_equal(np.interp(np.pi, xp, fp), 0.0) + def compare_results(res, desired): for i in range(len(desired)): |