home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / fractal / kaos.lha / fftlib / fft_set_len.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-12-19  |  756 b   |  28 lines

  1. /*
  2. ### procedure for computing the length of time series for fft ###
  3. */
  4. #define MAXPOWER 31
  5. int power_of_two[MAXPOWER] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216,
  6. 33554432,67108864,134217728,268435456,536870912,1073741824};
  7.  
  8. #define FFTMAX 21
  9. fft_set_len()
  10. {
  11.     int i,is_power_of_two=0;
  12.     extern int tser_len,power_of_two[];
  13.     extern char string[];
  14.  
  15.     for(i=0;i<FFTMAX && tser_len >= power_of_two[i];i++){
  16.         if(tser_len == power_of_two[i]){
  17.             is_power_of_two = 1;
  18.             break;
  19.         }
  20.     }
  21.     if(is_power_of_two!=1){
  22.         tser_len = power_of_two[i-1];
  23.         sprintf(string,"FFT: Length of time series is set to a power of two (%d).",tser_len);
  24.         system_mess_proc(0,string);
  25.         return;
  26.     }
  27. }
  28.