[SciPy-user] fft-problems
Lev Givon
lev at columbia.edu
Mon May 22 09:20:29 EDT 2006
Received from Alpha on Sun, May 21, 2006 at 03:36:12PM EDT:
> Hello everybody,
>
> playing around with scipy I'm stuck with a problem with fftconvolve
> in scipy.signal and other fft-related stuff. Fft operations yield too
> many zeros, much to high coefficients and many NANs in the matrix.
>
> The code below illustrates my problem. I'd be thankful for any help
> or comments.
>
> Thanks,
> Alpha
>
>
>
> import scipy
> from scipy import *
> a = array([[1,1,1],[1,1,1],[1,1,1]])
> print(a)
> print(scipy.signal.convolve(a,a))
> print(scipy.signal.fftconvolve(a,a))
> # both results should be equal or at leas similar, yet they aren't
>
>
> This is the output on my system:
> >>> print(a)
> [[1 1 1]
> [1 1 1]
> [1 1 1]]
>
> >>> print(scipy.signal.convolve(a,a))
> [[1 2 3 2 1]
> [2 4 6 4 2]
> [3 6 9 6 3]
> [2 4 6 4 2]
> [1 2 3 2 1]]
>
> >>> print(scipy.signal.fftconvolve(a,a))
> [[ 2.54728497e+014 2.40207507e+287 1.09183674e+277
> 1.98812999e+286 1.42688102e+286]
> [ 8.09194231e+284 4.34718284e+284 -6.99555293e+281
> 6.99555647e+281 -4.34718284e+284]
> [ 6.80511448e+286 -1.42688102e+286 -1.98812999e+286
> 0.00000000e+000 0.00000000e+000]
> [ 0.00000000e+000 0.00000000e+000 0.00000000e+000
> 0.00000000e+000 0.00000000e+000]
> [ 0.00000000e+000 0.00000000e+000 0.00000000e+000
> 0.00000000e+000 0.00000000e+000]]
>
> --
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user
convolve and fftconvolve returned consistent answers when I tried the
above code on scipy 0.4.8 built with numpy 0.9.8 and fftw 3.0.1.
L.G.
More information about the SciPy-User
mailing list