home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume1
/
8707
/
70
/
fft.doc
< prev
Wrap
Text File
|
1990-07-13
|
3KB
|
77 lines
Documentation for fft.c
This program is a direct translation from FORTRAN IV of E. O. Brigham's
program on the fast Fourier transform, The Fast Fourier Transform. I suggest
reading the book, to get the details of the method.
In translating this program from FORTRAN, I retained the bit swapping
function described by Brigham. Using bit operators, I assume that a more
efficient manner of bit swapping can be performed.
I used pointers to the data to be transformed to allow the routine to
be more general. Thus fft() needs to know the number of data points when it is
called which is only limited by memory size, which can get used up quickly
since each point is represented by two 8-byte numbers. A solution might be to
hold the data on disk and use disk access functions, if you run out of memory
for the data. This method should be avoided for small data sets, since the
calculation time increases dramatically with more data points to transform.
With disk overhead, calculation time will slow down considerably. To save
memory space you can redefine the variable types from double to single
precision at the expense of precision.
I have compared the performance of the fft to a regular Fourier trans-
form, and the fft wins out especially when there are more than 512 data points.
The restriction of having the data be a multiple of 2 is usually not prohibi-
tive since the data usually are generated by a computer in base 2, eg. radio
astronomy (my original purpose for writing this program), image analysis, etc.
Enclosed is some sample data and its transform. Use this to debug the
program if necessary ( I hate to receive a data analysis program with no data
to test the program ). These data have been checked for correctness by using
a standard FFT from a mainframe computer math library.
Finally if you have any questions or suggestions, please contact me:
Jim Pisano
P.O. Box 3134
Charlottesville, VA 22903
Or contact aeusemrs@csun.uucp (Mike Stump).
INPUT OUTPUT
index real imaginary real imaginary
_____________________________________________________________________________
1 -28.66 0.0 -00.11 0.0
2 -32.43 0.0 -29.98644 -38.211
3 -8.42 0.0 -62.32944 -23.91025
4 40.22 0.0 -58.32872 -10.02253
5 1.14 0.0 -58.46804 -7.78748
6 -25.05 0.0 -68.11068 -5.28995
7 12.14 0.0 -86.80929 -11.77746
8 27.82 0.0 -137.68 -0.06883
9 2.4 0.0 -33.03304 202.24
10 -19.68 0.0 82.43765 72.43995
11 7.55 0.0 25.90461 18.1517
12 17.22 0.0 8.26912 6.555
13 -0.58 0.0 -4.33195 3.91253
14 -12.5 0.0 -8.54575 -11.5672
15 0.89 0.0 -20.32586 -3.86289
16 10.45 0.0 -8.05521 10.74816
17 -1.16 0.0 1.77 0.0
18 -7.06 0.0 -8.0552 -10.74816
19 -0.23 0.0 -20.32586 3.86289
20 4.59 0.0 -8.54575 11.5672
21 1.45 0.0 -4.33195 -3.91253
22 -3.4 0.0 8.26913 -6.55501
23 3.03 0.0 25.9046 -18.15169
24 3.05 0.0 82.43763 -72.43996
25 3.67 0.0 -33.02996 -202.24
26 -0.51 0.0 -137.68 0.06884
27 -4.35 0.0 -86.80931 11.77746
28 -1.45 0.0 -68.11066 5.28995
29 5.64 0.0 -58.46805 7.78747
30 -0.96 0.0 -58.32872 10.02253
31 -4.46 0.0 -62.32945 23.91205
32 -1.25 0.0 -29.98643 38.21101