diff options
author | Stefan van der Walt <stefan@sun.ac.za> | 2007-02-09 17:55:37 +0000 |
---|---|---|
committer | Stefan van der Walt <stefan@sun.ac.za> | 2007-02-09 17:55:37 +0000 |
commit | de63203a32c9ce24cb1cd090a232c47833476dfd (patch) | |
tree | 42baf27f7be2d749dcca4e7d117849652202134a /numpy/core/numeric.py | |
parent | e7a51c37517f0fc62624c7e8e40d63ba416d096d (diff) | |
download | numpy-de63203a32c9ce24cb1cd090a232c47833476dfd.tar.gz |
Do not attempt to convolve empty arrays.
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r-- | numpy/core/numeric.py | 3 |
1 files changed, 3 insertions, 0 deletions
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) |