[SciPy-user] scipy.basic to numpy

Rob Managan managan at llnl.gov
Thu Jan 5 16:19:45 CST 2006

At 2:22 PM -0600 1/5/06, Pearu Peterson wrote:
>  > On Jan 5, 2006, at 4:03 PM, Travis Oliphant wrote:
>  >> Please re-send any bug reports regarding fft on OSX.
>What is the output of
>    scipy.show_config()

[mangrove:~/Documents/devel/scipy] managan% python
Python 2.4.1 (#2, Mar 31 2005, 00:05:10)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>  import scipy
>>>  scipy.show_config()
     extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
     extra_compile_args = ['-faltivec']
     define_macros = [('NO_ATLAS_INFO', 3)]

     extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
     extra_compile_args = ['-faltivec', 
     define_macros = [('NO_ATLAS_INFO', 3)]


     libraries = ['rfftw', 'fftw']
     library_dirs = ['/Users/managan/Documents/local/lib']
     define_macros = [('SCIPY_FFTW_H', None)]
     include_dirs = ['/Users/managan/Documents/local/include']
Here is the basic error I see
>>>  import numpy
>>>  x = numpy.arange(16)*2*numpy.pi/16.0
>>>  sx = numpy.sin(x)
>>>  sx
array([  0.00000000e+00,   3.82683432e-01,   7.07106781e-01,
          9.23879533e-01,   1.00000000e+00,   9.23879533e-01,
          7.07106781e-01,   3.82683432e-01,   1.22464680e-16,
         -3.82683432e-01,  -7.07106781e-01,  -9.23879533e-01,
         -1.00000000e+00,  -9.23879533e-01,  -7.07106781e-01,
>>>  scipy.fft(sx)
array([  1.77975831e-16 +0.00000000e+00j,
         -1.36807534e-15 -8.00000000e+00j,
         -3.87815369e-16 -8.43346956e-16j,
          1.91553812e-16 -1.08399892e-15j,
          1.14423775e-17 -4.99600361e-16j,
          1.91553812e-16 -1.95820501e-16j,
          6.32744729e-16 -1.77213142e-16j,
          4.95108994e-16 +0.00000000e+00j,
          2.88998134e-16 +0.00000000e+00j,
          4.95108994e-16 -0.00000000e+00j,
          6.32744729e-16 +1.77213142e-16j,
          1.91553812e-16 +1.95820501e-16j,
          1.14423775e-17 +4.99600361e-16j,
          1.91553812e-16 +1.08399892e-15j,
         -3.87815369e-16 +8.43346956e-16j,  -1.36807534e-15 +8.00000000e+00j])
>>>  scipy.ifft(scipy.fft(sx))
array([  2.46519033e-32+0.j,  -3.12314248e-16-0.j,  -8.32667268e-17-0.j,
         -5.85949503e-18-0.j,   0.00000000e+00-0.j,   1.72392949e-16-0.j,
          1.38777878e-16-0.j,   1.18025219e-16-0.j,   1.22464680e-16+0.j,
          1.18025219e-16+0.j,   1.38777878e-16+0.j,   1.72392949e-16+0.j,
          0.00000000e+00+0.j,  -5.85949503e-18+0.j,  -8.32667268e-17+0.j,

>>>  numpy.ifft(numpy.fft(sx))
array([  6.16297582e-32 +0.00000000e+00j,
          3.82683432e-01 +0.00000000e+00j,
          7.07106781e-01 -5.55111512e-17j,
          9.23879533e-01 +1.23259516e-32j,
          1.00000000e+00 -2.46519033e-32j,
          9.23879533e-01 +0.00000000e+00j,
          7.07106781e-01 -5.55111512e-17j,
          3.82683432e-01 -1.23259516e-32j,
          1.22464680e-16 +0.00000000e+00j,
         -3.82683432e-01 +0.00000000e+00j,
         -7.07106781e-01 +5.55111512e-17j,
         -9.23879533e-01 +1.23259516e-32j,
         -1.00000000e+00 +2.46519033e-32j,
         -9.23879533e-01 +0.00000000e+00j,
         -7.07106781e-01 +5.55111512e-17j,  -3.82683432e-01 -1.23259516e-32j])

The real parts of the last two should agree but scipy gives zeros to 
within roundoff.
Rob Managan               email managan at llnl.gov
LLNL                      phone: 925-423-0903
P.O. Box 808, L-095       FAX:   925-422-3389
Livermore, CA  94551-0808

More information about the SciPy-user mailing list