Thread View: cn.bbs.comp.program
1 messages
1 total messages
Started by ǧ��·�
Tue, 12 Oct 1999 00:00
Re: ˭��fft����
Author: ǧ��·�
Date: Tue, 12 Oct 1999 00:00
Date: Tue, 12 Oct 1999 00:00
39 lines
1275 bytes
1275 bytes
> [1;36m==> Wu_Jie(�ã���) ˵��: [37;40m[0m
> c�������æ����һ����
> лл��
��ʽ�㷨���ݹ���ã������in[]�С�û�м�鳤���Dz��ǻ�2�ġ�
void FFT(complex in[],int len)
{ int i,j,k;
complex temp1;
complex x,y;
if(len>2)
{
for(i=0,j=0;i<len;i++) //divide to Two
{
if(i-i/2*2)
{ temp1=in[j];
for(k=j;k<len-1;k++)
in[k]=in[k+1];
in[len-1]=temp1;}
else {
j++;}
}
FFT(in,len/2);
FFT(in+len/2,len/2);
for(i=0;i<len/2;i++)
{ x=in[i];
y=in[i+len/2];
in[i]=x+y*pow(exp(complex(0,-2*PI/len)),i);
in[i+len/2]=x-y*pow(exp(complex(0,-2*PI/len)),i);
}
}
else{ x=in[0];
y=in[1];
in[0]=x+y;
in[1]=x-y;
}
}
--
�� ��Դ: �й�ƴ�BBSվ [bbs.ustc.edu.cn]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads