如何在MatrixXf中使用本征FFT? [英] How to use Eigen FFT with MatrixXf?

查看:130
本文介绍了如何在MatrixXf中使用本征FFT?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Eigen库的新手.我想计算特征矩阵的FFT.但是,我这样做的尝试表明,不支持的Eigen FFT模块不能与MatrixXf一起使用.我想完成类似的事情:

I am new to the Eigen library. I would like to compute FFT of Eigen Matrices. However, my attempts to do so indicate that the unsupported Eigen FFT module can't be used with MatrixXf. I want to pull off something like:

#include <eigen3/unsupported/Eigen/FFT>
#include<Eigen/Dense>
#include<iostream>
using namespace std;
using namespace Eigen;
int main(){
    MatrixXf A = MatrixXf::Random(3,10);
    FFT<float> fft;
    MatrixXf B;
    fft.fwd(B,A);
}

这可以实现吗?任何其他建议,欢迎.从Matlab迁移到Eigen花费了我大量的自我说服力,我宁愿不要使用其他库,除非它是不可避免的.谢谢.

Is this achievable? Any other suggestions are welcome. It took me a great deal of self persuasion to migrate to Eigen from matlab, and I would prefer not using a different library unless it's inevitable. Thanks.

推荐答案

这是一个合理的期望.不幸的是,以目前的形式,FFT并不完全支持它.

This is a reasonable expectation. Unfortunately in its current form, FFT does not support that exactly.

MatrixXcf B(3,10);  // note the change from real to complex
//fft.fwd(B,A); // It is natural to want to do this, unfortunately it is not yet supported

// it works to iterate over the columns
for (int k=0;k<A.cols();++k)
    B.col(k) = fft.fwd( A.col(k) );

这篇关于如何在MatrixXf中使用本征FFT?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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