diff options
Diffstat (limited to 'numpy/lib')
-rw-r--r-- | numpy/lib/function_base.py | 1 | ||||
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 1a93b5a1d..03a4ef0b6 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -2737,6 +2737,7 @@ def sinc(x): <matplotlib.image.AxesImage object at 0x...> """ + x = np.asanyarray(x) y = pi* where(x == 0, 1.0e-20, x) return sin(y)/y diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 696d9bc85..5d0f8aa45 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -499,6 +499,13 @@ class TestSinc(TestCase): #check symmetry assert_array_almost_equal(w, flipud(w), 7) + def test_array_like(self): + x = [0, 0.5] + y1 = sinc(array(x)) + y2 = sinc(list(x)) + y3 = sinc(tuple(x)) + assert_array_equal(y1, y2) + assert_array_equal(y1, y3) class TestHistogram(TestCase): def setUp(self): |