From de63203a32c9ce24cb1cd090a232c47833476dfd Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Fri, 9 Feb 2007 17:55:37 +0000 Subject: Do not attempt to convolve empty arrays. --- numpy/core/numeric.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'numpy/core/numeric.py') diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 4329cae5c..b56dfbc44 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -219,8 +219,11 @@ def convolve(a,v,mode='full'): """Returns the discrete, linear convolution of 1-D sequences a and v; mode can be 'valid', 'same', or 'full' to specify size of the resulting sequence. """ + a,v = array(a,ndmin=1),array(v,ndmin=1) if (len(v) > len(a)): a, v = v, a + assert len(a) > 0, 'a cannot be empty' + assert len(v) > 0, 'v cannot be empty' mode = _mode_from_name(mode) return multiarray.correlate(a,asarray(v)[::-1],mode) -- cgit v1.2.1