| unit fftun;interface
 uses Math, Sysutils, Ap, ftbase;
 
 ...
 
 procedure FFTC1D(var A : TComplex1DArray; N : AlglibInteger);
 var
 Plan : FTPlan;
 I : AlglibInteger;
 Buf : TReal1DArray;
 begin
 Assert(N>0, 'FFTC1D: incorrect N!');
 
 //
 // Special case: N=1, FFT is just identity transform.
 // After this block we assume that N is strictly greater than 1.
 //
 if N=1 then
 begin
 Exit;
 end;
 
 //
 // convert input array to the more convinient format
 //
 GetMem(buf,2*n);
 SetLength(Buf, 2*N);
 I:=0;
 while I<=N-1 do
 begin
 Buf[2*I+0] := A[I].X;
 Buf[2*I+1] := A[I].Y;
 Inc(I);
 end;
 
 //
 // Generate plan and execute it.
 //
 // Plan is a combination of a successive factorizations of N and
 // precomputed data. It is much like a FFTW plan, but is not stored
 // between subroutine calls and is much simpler.
 //
 FTBaseGenerateComplexFFTPlan(N, Plan);
 FTBaseExecutePlan(Buf, 0, N, Plan);//After this procedure, the array is filled with the Buf "+ NAN".
 
 //
 // result
 //
 I:=0;
 while I<=N-1 do
 begin
 A[I].X := Buf[2*I+0];
 A[I].Y := Buf[2*I+1];
 Inc(I);
 end;
 
 
 
						
							| Attachments: |  
								|  after.jpg [ 37.11 KiB | Viewed 25625 times ]
 
 |  
								|  befor.jpg [ 25.17 KiB | Viewed 25625 times ]
 
 |  |