我是编程的初学者,目前正在尝试开发一个需要快速傅里叶变换实现的项目.
到目前为止,我设法实现了以下内容:
有没有人有任何替代方案和建议来提高程序的速度而不会失去准确性.
short FFTMethod::FFTcalc(short int dir,long m,double *x,double *y)
{
long n,i,i1,j,k,i2,l,l1,l2;
double c1,c2,tx,ty,t1,t2,u1,u2,z;
/* Calculate the number of points */
n = 1;
for (i=0;i<m;i++)
n *= 2;
/* Do the bit reversal */
i2 = n >> 1;
j = 0;
for (i=0;i<n-1;i++) {
if (i < j) {
tx = x[i];
ty = y[i];
x[i] = x[j];
y[i] = y[j];
x[j] = tx;
y[j] = ty;
}
k = i2;
while (k <= j) {
j …Run Code Online (Sandbox Code Playgroud)