From b9576ed22a57cb8c7bf04038c5792bb2b499f390 Mon Sep 17 00:00:00 2001 From: Timo Kluck Date: Thu, 29 Dec 2011 18:42:26 +0100 Subject: 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. --- numpy/lib/tests/test_function_base.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'numpy/lib/tests') 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)): -- cgit v1.2.1