summaryrefslogtreecommitdiff
path: root/numpy/core/numeric.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r--numpy/core/numeric.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py
index 086439656..7675386e7 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 superior performance on large arrays.
Notes
-----
@@ -720,6 +721,11 @@ 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 preferable.
+
+
Examples
--------
>>> np.correlate([1, 2, 3], [0, 1, 0.5])
@@ -2350,8 +2356,13 @@ def isclose(a, b, rtol=1.e-5, atol=1.e-8, equal_nan=False):
# Make sure y is an inexact type to avoid bad behavior on abs(MIN_INT).
# This will cause casting of x later. Also, make sure to allow subclasses
# (e.g., for numpy.ma).
- dt = multiarray.result_type(y, 1.)
- y = array(y, dtype=dt, copy=False, subok=True)
+ # NOTE: We explicitly allow timedelta, which used to work. This could
+ # possibly be deprecated. See also gh-18286.
+ # timedelta works if `atol` is an integer or also a timedelta.
+ # Although, the default tolerances are unlikely to be useful
+ if y.dtype.kind != "m":
+ dt = multiarray.result_type(y, 1.)
+ y = array(y, dtype=dt, copy=False, subok=True)
xfin = isfinite(x)
yfin = isfinite(y)