Re: NXC: Fast Fourier Transformation (FFT) for NXT
Posted: 14 Jul 2011, 16:27
				
				the 1st: this way?
the 2nd: no problem:
			Code: Select all
   i=0;
   while (i<nn-1) {
      if (i < j) {
         tx = fx_[i];
         ty = fy_[i];
         fx_[i] = fx_[j];
         fy_[i] = fy_[j];
         fx_[j] = tx;
         fy_[j] = ty;
      }
      k = i2;
      while (k <= j) {
         j -= k;
         k >>= 1;
      }
      j += k;
      ++i;
   }
Code: Select all
      for (i=j;i<nn;i+=l2) {
            i1 = i + l1;
            tx=fx_[i1];
            ty=fy_[i1];
            
            t1 = u1 * tx - u2 * ty ;
            t2 = u1 * ty + u2 * tx ;
            
            fx_[i1] = fx_[i] - t1;
            fy_[i1] = fy_[i] - t2;
            fx_[i] += t1;
            fy_[i] += t2;
      }