热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

numpy之间有什么区别?fft和scipy.fftpack吗?-Whatisthedifferencebetweennumpy.fftandscipy.fftpack?

Isthelaterjustasynonymoftheformer,oraretheytwodifferentimplementationsofFFT?Whicho

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

后者只是前者的同义词,还是FFT的两个不同实现?哪一个更好?

3 个解决方案

#1


33  

SciPy does more:

SciPy更多:

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

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 .fftpack.helper。fftfreq numpy.fft.helper。fftfreq实际上运行的是相同的代码。

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:

然而,SciPy有自己的许多功能实现。源代码有性能基准,比较原始的NumPy和新的SciPy版本。我的老式笔记本电脑显示了如下内容:

                 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)

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.

似乎SciPy随着数组大小的增加运行得更快,尽管这些只是人为设计的示例,对于您的特定项目来说,这两者都值得尝试。

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

这是值得一看的源代码http://www.scipy.org/Download#头-312ad78cdf85a9ca6fa17a266752069d23f785d1。是的,那些.f文件真的是Fortran!:- d

#2


16  

I found that numpy's 2D fft was significantly faster than scipy's, but FFTW was faster than both (using the PyFFTW bindings). Performance tests are here: code.google.com/p/agpy/source/browse/trunk/tests/test_ffts.py

我发现numpy的2D fft明显比scipy快,但是FFTW比两者都快(使用PyFFTW绑定)。性能测试在这里:code.google.com/p/agpy/source/browse/trunk/tests/test_ffts.py

And the results (for n x n arrays):

结果(n x n个数组):

           n                sp               np             fftw
           8:         0.010189         0.005077         0.028378
          16:         0.010795         0.008069         0.028716
          32:         0.014351         0.008566         0.031076
          64:         0.028796         0.019308         0.036931
         128:         0.093085         0.074986         0.088365
         256:         0.459137         0.317680         0.170934
         512:         2.652487         1.811646         0.571402
        1024:        10.722885         7.796856         3.509452

#3


3  

Looking at the github respositories for each, scipy is not just importing numpy's version and renaming it (although it does borrow some functionality). You'll have to dig into the code if you want to discern the difference in implementations since the documentation doesn't make a direct comparison.

考虑到github对每个用户的贡献,scipy不仅仅是导入numpy的版本并重新命名它(尽管它确实借用了一些功能)。如果您想要了解实现的差异,那么您就必须深入研究代码,因为文档并没有直接比较。

https://github.com/numpy/numpy/tree/master/numpy/fft

https://github.com/numpy/numpy/tree/master/numpy/fft

https://github.com/scipy/scipy/tree/master/scipy/fftpack

https://github.com/scipy/scipy/tree/master/scipy/fftpack


推荐阅读
  • CF:3D City Model(小思维)问题解析和代码实现
    本文通过解析CF:3D City Model问题,介绍了问题的背景和要求,并给出了相应的代码实现。该问题涉及到在一个矩形的网格上建造城市的情景,每个网格单元可以作为建筑的基础,建筑由多个立方体叠加而成。文章详细讲解了问题的解决思路,并给出了相应的代码实现供读者参考。 ... [详细]
  • 微软头条实习生分享深度学习自学指南
    本文介绍了一位微软头条实习生自学深度学习的经验分享,包括学习资源推荐、重要基础知识的学习要点等。作者强调了学好Python和数学基础的重要性,并提供了一些建议。 ... [详细]
  • 在Docker中,将主机目录挂载到容器中作为volume使用时,常常会遇到文件权限问题。这是因为容器内外的UID不同所导致的。本文介绍了解决这个问题的方法,包括使用gosu和suexec工具以及在Dockerfile中配置volume的权限。通过这些方法,可以避免在使用Docker时出现无写权限的情况。 ... [详细]
  • Android Studio Bumblebee | 2021.1.1(大黄蜂版本使用介绍)
    本文介绍了Android Studio Bumblebee | 2021.1.1(大黄蜂版本)的使用方法和相关知识,包括Gradle的介绍、设备管理器的配置、无线调试、新版本问题等内容。同时还提供了更新版本的下载地址和启动页面截图。 ... [详细]
  • 本文介绍了Perl的测试框架Test::Base,它是一个数据驱动的测试框架,可以自动进行单元测试,省去手工编写测试程序的麻烦。与Test::More完全兼容,使用方法简单。以plural函数为例,展示了Test::Base的使用方法。 ... [详细]
  • sklearn数据集库中的常用数据集类型介绍
    本文介绍了sklearn数据集库中常用的数据集类型,包括玩具数据集和样本生成器。其中详细介绍了波士顿房价数据集,包含了波士顿506处房屋的13种不同特征以及房屋价格,适用于回归任务。 ... [详细]
  • HDFS2.x新特性
    一、集群间数据拷贝scp实现两个远程主机之间的文件复制scp-rhello.txtroothadoop103:useratguiguhello.txt推pushscp-rr ... [详细]
  • MyBatis多表查询与动态SQL使用
    本文介绍了MyBatis多表查询与动态SQL的使用方法,包括一对一查询和一对多查询。同时还介绍了动态SQL的使用,包括if标签、trim标签、where标签、set标签和foreach标签的用法。文章还提供了相关的配置信息和示例代码。 ... [详细]
  • Imtryingtofigureoutawaytogeneratetorrentfilesfromabucket,usingtheAWSSDKforGo.我正 ... [详细]
  • IjustinheritedsomewebpageswhichusesMooTools.IneverusedMooTools.NowIneedtoaddsomef ... [详细]
  • 本文详细介绍了git常用命令及其操作方法,包括查看、添加、提交、删除、找回等操作,以及如何重置修改文件、抛弃工作区修改、将工作文件提交到本地暂存区、从版本库中删除文件等。同时还介绍了如何从暂存区恢复到工作文件、恢复最近一次提交过的状态,以及如何合并多个操作等。 ... [详细]
  • Whatsthedifferencebetweento_aandto_ary?to_a和to_ary有什么区别? ... [详细]
  • Linux重启网络命令实例及关机和重启示例教程
    本文介绍了Linux系统中重启网络命令的实例,以及使用不同方式关机和重启系统的示例教程。包括使用图形界面和控制台访问系统的方法,以及使用shutdown命令进行系统关机和重启的句法和用法。 ... [详细]
  • 本文介绍了九度OnlineJudge中的1002题目“Grading”的解决方法。该题目要求设计一个公平的评分过程,将每个考题分配给3个独立的专家,如果他们的评分不一致,则需要请一位裁判做出最终决定。文章详细描述了评分规则,并给出了解决该问题的程序。 ... [详细]
  • FeatureRequestIsyourfeaturerequestrelatedtoaproblem?Please ... [详细]
author-avatar
手机用户2502934787
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有