www.pudn.com > 医学算法.rar > fft2.c
/*
*
* $Header: fft.c,v 1.2 84/03/25 23:39:22 malcolm Exp $
*
* $Log: fft.c,v $
* Revision 1.2 84/03/25 23:39:22 malcolm
* Took out Fortran garbage.
*
*
*/
static char *RCSid = "$Header: fft.c,v 1.2 84/03/25 23:39:22 malcolm Exp $";
/*
fft - calculate FFT
Carl Crawford
Purdue University
W. Lafayette, IN. 47907
Calling Sequence....fft(real,im,m,iopt)
Where real and im are the real and imaginary
parts of the input data. The result is
returned in place. M is the log base 2
of the number of elements in the array.
Iopt is equal to 0 for the forward
transform and 1 for the inverse transform.
*/
fft(a,b,m,iopt)
float a[]; /* real part of data */
float b[]; /* imaginary part of data */
int m; /* size of data = 2**m */
int iopt; /* 0=dft, 1=idft */
{
int nv2,nm1,n,le,le1,ip;
float pi,pile1,tmp;
float ua,ub,wa,wb,ta,tb,*ap,*bp;
register i,j,l;
extern float sin(), cos();
n = 1<>1;
ua = 1.0; ub = 0.0;
pile1 = pi / le1;
wa = cos(pile1); wb = -sin(pile1);
for(j=0;j