numpy.fft和scipy.fftpack有什么区别? [英] What is the difference between numpy.fft and scipy.fftpack?

查看:943
本文介绍了numpy.fft和scipy.fftpack有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

后面是前者的同义词,还是它们是FFT的两种不同实现?哪个更好?

Is the later just a synonym of the former, or are they two different implementations of FFT? Which one is better?

推荐答案

SciPy做得更多:

SciPy does more:

  • http://docs.scipy.org/doc/numpy/reference/routines.fft.html
  • http://docs.scipy.org/doc/scipy/reference/fftpack.html#

此外,SciPy通过其自己的界面导出一些NumPy功能,例如,如果您执行 scipy.fftpack.helper.fftfreq numpy.fft.helper.fftfreq 您实际上正在运行相同的代码.

In addition, SciPy exports some of the NumPy features through its own interface, for example if you execute scipy.fftpack.helper.fftfreq and numpy.fft.helper.fftfreq you're actually running the same code.

但是,SciPy具有许多功能的自己的实现.该消息来源具有性能基准,用于比较原始NumPy和新SciPy版本.我的旧笔记本电脑显示如下内容:

However, SciPy has its own implementations of much functionality. The source has performance benchmarks that compare the original NumPy and new SciPy versions. My archaic laptop shows something like this:

                 Fast Fourier Transform
=================================================
      |    real input     |   complex input    
-------------------------------------------------
 size |  scipy  |  numpy  |  scipy  |  numpy 
-------------------------------------------------
  100 |    0.07 |    0.06 |    0.06 |    0.07  (secs for 7000 calls)
 1000 |    0.06 |    0.09 |    0.09 |    0.09  (secs for 2000 calls)
  256 |    0.11 |    0.11 |    0.12 |    0.11  (secs for 10000 calls)
  512 |    0.16 |    0.21 |    0.20 |    0.21  (secs for 10000 calls)
 1024 |    0.03 |    0.04 |    0.04 |    0.04  (secs for 1000 calls)
 2048 |    0.05 |    0.09 |    0.08 |    0.08  (secs for 1000 calls)
 4096 |    0.05 |    0.08 |    0.07 |    0.09  (secs for 500 calls)
 8192 |    0.10 |    0.20 |    0.19 |    0.21  (secs for 500 calls)

似乎SciPy的运行速度随着数组大小的增加而显着提高,尽管这些只是人为的例子,值得在您的特定项目中同时尝试这两个例子.

It does seem that SciPy runs significantly faster as the array increases in size, though these are just contrived examples and it would be worth experimenting with both for your particular project.

值得检查一下源代码 http://www.scipy.org/Download#head-312ad78cdf85a9ca6fa17a266752069d23f785d1.是的,那些.f文件确实是Fortran! :-D

It's worth checking out the source code http://www.scipy.org/Download#head-312ad78cdf85a9ca6fa17a266752069d23f785d1 . Yes those .f files really are Fortran! :-D

这篇关于numpy.fft和scipy.fftpack有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆