FFTW简介及使用

本文介绍了FFTW库,这是一个用于计算离散傅立叶变换的高性能C子程序库,支持一维或多维数据,包括复数和实数数据。文章详细说明了如何在Windows+VS环境下生成.lib文件并配置项目使用所需版本。此外,还提供了float版本的使用示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://fftw.org/

FFTW is a C subroutine library for computing the discrete Fourier transform (DFT) in one or more dimensions, of arbitrary input size, and of both real and complex data (as well as of even/odd data, i.e. the discrete cosine/sine transforms or DCT/DST).  We believe that FFTW, which is free software, should become the FFT library of choice for most applications.

 

在Windows+VS下使用FFTW

http://fftw.org/install/windows.html

这里有32和64位两个版本。

使用前先生成.lib:

     lib /def:libfftw3-3.def
     lib /def:libfftw3f-3.def
     lib /def:libfftw3l-3.def

64位

     lib /machine:x64 /def:libfftw3l-3.def

不带后缀的文件(libfftw3-3)是double版,f后缀是float,l后缀是long double。

配置vs project使用想要的lib。

具体函数参考official document:fftw3.pdf

注意不同版本的库,类型和函数名不一样。

例如float版的example就是(see fftw3.pdf first):

// 初始化只需一次

fftwf_complex *in, *out;

fftwf_plan p;

fftwf_malloc(...);

fftwf_plan_xxx(...);

......

// 只要FFT参数不变,不需再次初始化,反复fftwf_execute即可。

fftwf_execute(p);

// 删除资源

fftwf_destrop(...);

fftwf_free(...);

 

fftw3.pdf中更多内容

1. 对相同长度、不同缓冲的情况重复利用fftwf_plan

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值