From c0b129ef8eada11d10f01ddf4b7a85dc198b242e Mon Sep 17 00:00:00 2001 From: mdubravski Date: Fri, 12 Feb 2021 14:28:19 -0500 Subject: correlate fix --- numpy/core/numeric.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'numpy/core/numeric.py') diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 89f56fa09..7f60cd916 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -710,6 +710,7 @@ def correlate(a, v, mode='valid'): -------- convolve : Discrete, linear convolution of two one-dimensional sequences. multiarray.correlate : Old, no conjugate, version of correlate. + scipy.signal.correlate : uses FFT which has far superior performance on large arrays. Notes ----- @@ -720,6 +721,10 @@ def correlate(a, v, mode='valid'): which is related to ``c_{av}[k]`` by ``c'_{av}[k] = c_{av}[-k]``. + The convolution can often be calcualted much faster using ``scipy.signal.correlate``. + ``numpy.correlate`` performs slowly because it does not use FFT; for large arrays (i.e. n = 1e5) ``scipy.signal.correlate`` might be considered. + + Examples -------- >>> np.correlate([1, 2, 3], [0, 1, 0.5]) -- cgit v1.2.1 From bfa80170b46ce19f03c535cb41bb1cc933e87b1d Mon Sep 17 00:00:00 2001 From: mdubravski <41096057+mdubravski@users.noreply.github.com> Date: Sat, 13 Feb 2021 12:09:46 -0500 Subject: Update numpy/core/numeric.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rewording to eliminate redundancy Co-authored-by: Melissa Weber Mendonça --- numpy/core/numeric.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'numpy/core/numeric.py') diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 7f60cd916..28b4d78d5 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -721,8 +721,7 @@ def correlate(a, v, mode='valid'): which is related to ``c_{av}[k]`` by ``c'_{av}[k] = c_{av}[-k]``. - The convolution can often be calcualted much faster using ``scipy.signal.correlate``. - ``numpy.correlate`` performs slowly because it does not use FFT; for large arrays (i.e. n = 1e5) ``scipy.signal.correlate`` might be considered. + `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might be considered. Examples -- cgit v1.2.1 From 39acd8da404ff278a5bb1cfa97dadb9b7a813979 Mon Sep 17 00:00:00 2001 From: mdubravski <41096057+mdubravski@users.noreply.github.com> Date: Sat, 13 Feb 2021 12:10:03 -0500 Subject: Update numpy/core/numeric.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rewording to eliminate redundancy Co-authored-by: Melissa Weber Mendonça --- numpy/core/numeric.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/core/numeric.py') diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 28b4d78d5..0e0bacbe7 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -710,7 +710,7 @@ def correlate(a, v, mode='valid'): -------- convolve : Discrete, linear convolution of two one-dimensional sequences. multiarray.correlate : Old, no conjugate, version of correlate. - scipy.signal.correlate : uses FFT which has far superior performance on large arrays. + scipy.signal.correlate : uses FFT which has superior performance on large arrays. Notes ----- -- cgit v1.2.1 From b15bd82a7b50e721125b54f8cc11a0850ce10a21 Mon Sep 17 00:00:00 2001 From: mdubravski <41096057+mdubravski@users.noreply.github.com> Date: Sun, 14 Feb 2021 09:12:28 -0500 Subject: Update numpy/core/numeric.py Co-authored-by: Matti Picus --- numpy/core/numeric.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'numpy/core/numeric.py') diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 0e0bacbe7..7675386e7 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -721,7 +721,9 @@ def correlate(a, v, mode='valid'): which is related to ``c_{av}[k]`` by ``c'_{av}[k] = c_{av}[-k]``. - `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might be considered. + `numpy.correlate` may perform slowly in large arrays (i.e. n = 1e5) because it does + not use the FFT to compute the convolution; in that case, `scipy.signal.correlate` might + be preferable. Examples -- cgit v1.2.1