[英]How to calculate a sum of products of array elements using a fast Fourier transform?
I have some binary array. 我有一些二进制数组。 For example, let my array is:
例如,让我的数组是:
int a[] = {1, 0, 0, 0, 1, 0, 1, 0, 1}
I want to calculate the values based on this formula: 我想根据此公式计算值:
How to calculate this function, using a fast Fourier transform? 如何使用快速傅立叶变换计算此函数? I have a large array and I have to calculate this function many times.
我的数组很大,必须多次计算此函数。 So, I want to be able to calculate this function quick.
因此,我希望能够快速计算该函数。
你正在计算基本上是在时域只是在频率domain.So乘法刚刚得到的FFT的卷积和卷积a
与自身相乘,然后进行IFFT而在短返回时间domain.So ,您可以通过
b(2*i) = IFFT( FFT(a[0:2*i)]).FFT(a[0:2*i]) )
void main()
{
int i,k,sum=0;
for(i=0;i<9;i++)
{
for(k=0;k<2*i;k++)
{
sum + =(a[k]*a[2*i-k]; // calculating B
}
}
cout<<sum;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.