Ejemplo n.º 1
0
/* 1D Fourier transform: 
   Simply call stockham with proper arguments.  
   Allocated working space of size n dynamically.
*/
void fft(std::vector<complex>::iterator x, int n, int flag)
{
   std::vector<complex> y(n);
   
   assert(1 == flag || -1 == flag);
   //y = (complex *) malloc( n*sizeof(complex) );
   //assert(NULL != y);
   stockham(x, n, flag, 1, y.begin());
   //free(y);
}
Ejemplo n.º 2
0
/* 1D Fourier transform: 
   Simply call stockham with proper arguments.  
   Allocated working space of size n dynamically.
*/
void fft(complex x[], int n, int flag)
{
   complex *y;
   
   assert(1 == flag || -1 == flag);
   y = (complex *) malloc( n*sizeof(complex) );
   assert(NULL != y);
   stockham(x, n, flag, 1, y);
   free(y);
}
Ejemplo n.º 3
0
void fft3D(complex x[], int n1, int n2, int n3, int flag)
{
   complex *y;
   int i, n, n23;

   assert(1 == flag || -1 == flag);
   n23 = n2*n3;
   n = n1*n23;
   y = (complex *) malloc( n23*sizeof(complex) );
   assert(NULL != y);

   for(i=0; i < n; i += n3) {                                  /* FFT in z */
      stockham(x+i, n3, flag, 1, y);
   }
   for(i=0; i < n; i += n23) {                                 /* FFT in y */
      stockham(x+i, n23, flag, n3, y); 
   }
   free(y);
   cooley_tukey(x, n, flag, n23);                              /* FFT in x */
}
Ejemplo n.º 4
0
void fft2D(std::vector<complex>::iterator x, int n1, int n2, int flag)
{
   std::vector<complex> y(n2);
   int i, n;

   assert(1 == flag || -1 == flag);
   n = n1*n2;
   /*y = (complex *) malloc( n2*sizeof(complex) );
   assert(NULL != y);*/

   for(i=0; i < n; i += n2) {                                  /* FFT in y */
      stockham(x+i, n2, flag, 1, y.begin()); 
   }
   //free(y);
   cooley_tukey(x, n, flag, n2);                               /* FFT in x */
}