diff options
author | alex <argriffi@ncsu.edu> | 2015-05-29 10:20:07 -0400 |
---|---|---|
committer | alex <argriffi@ncsu.edu> | 2015-05-29 10:20:07 -0400 |
commit | dd88309a8f4f559688c3fcba3ec41b932f37eeb1 (patch) | |
tree | 9095181258cde5eb2005ee77033206dc6ddf1d4f /numpy/fft/fftpack.py | |
parent | 949315787a51eb86db0f8a19b4c257a0ef739f32 (diff) | |
download | numpy-dd88309a8f4f559688c3fcba3ec41b932f37eeb1.tar.gz |
MAINT: in fft, make copying more explicit
Diffstat (limited to 'numpy/fft/fftpack.py')
-rw-r--r-- | numpy/fft/fftpack.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/numpy/fft/fftpack.py b/numpy/fft/fftpack.py index 19c6bed0f..89fc1e37f 100644 --- a/numpy/fft/fftpack.py +++ b/numpy/fft/fftpack.py @@ -249,7 +249,8 @@ def ifft(a, n=None, axis=-1): >>> plt.show() """ - a = np.array(a, dtype=complex) + # The copy may be required for multithreading. + a = np.array(a, copy=True, dtype=complex) if n is None: n = shape(a)[axis] return _raw_fft(a, n, axis, fftpack.cffti, fftpack.cfftb, _fft_cache) / n @@ -329,7 +330,8 @@ def rfft(a, n=None, axis=-1): exploited to compute only the non-negative frequency terms. """ - a = np.array(a, dtype=float) + # The copy may be required for multithreading. + a = np.array(a, copy=True, dtype=float) return _raw_fft(a, n, axis, fftpack.rffti, fftpack.rfftf, _real_fft_cache) @@ -409,7 +411,8 @@ def irfft(a, n=None, axis=-1): specified, and the output array is purely real. """ - a = np.array(a, dtype=complex) + # The copy may be required for multithreading. + a = np.array(a, copy=True, dtype=complex) if n is None: n = (shape(a)[axis] - 1) * 2 return _raw_fft(a, n, axis, fftpack.rffti, fftpack.rfftb, @@ -482,7 +485,8 @@ def hfft(a, n=None, axis=-1): [ 2., -2.]]) """ - a = np.array(a, dtype=complex) + # The copy may be required for multithreading. + a = np.array(a, copy=True, dtype=complex) if n is None: n = (shape(a)[axis] - 1) * 2 return irfft(conjugate(a), n, axis) * n @@ -535,7 +539,8 @@ def ihfft(a, n=None, axis=-1): array([ 1.-0.j, 2.-0.j, 3.-0.j, 4.-0.j]) """ - a = np.array(a, dtype=float) + # The copy may be required for multithreading. + a = np.array(a, copy=True, dtype=float) if n is None: n = shape(a)[axis] return conjugate(rfft(a, n, axis))/n @@ -1003,7 +1008,8 @@ def rfftn(a, s=None, axes=None): [ 0.+0.j, 0.+0.j]]]) """ - a = np.array(a, dtype=float) + # The copy may be required for multithreading. + a = np.array(a, copy=True, dtype=float) s, axes = _cook_nd_args(a, s, axes) a = rfft(a, s[-1], axes[-1]) for ii in range(len(axes)-1): @@ -1123,7 +1129,8 @@ def irfftn(a, s=None, axes=None): [ 1., 1.]]]) """ - a = np.array(a, dtype=complex) + # The copy may be required for multithreading. + a = np.array(a, copy=True, dtype=complex) s, axes = _cook_nd_args(a, s, axes, invreal=1) for ii in range(len(axes)-1): a = ifft(a, s[ii], axes[ii]) |