Re: question about fft2df

From: À×öª <leiting2002_at_nyahnyahspammersnyahnyah>
Date: Tue Mar 20 2012 - 10:05:26 MDT

Hi, Andy and All NCL users,
With Andy's help, I think I find out the actual definition of output/return of ncl function fft2df ( it 's supposed to be the same as the sub rfft2f in the pack Andy provided). In their accompanying help document, it is found the definition for the 2d fft,
^^^^^^^^^^^^^^^^^^
 R Real output array of two dimensions. The full complex transform
         of r(i,j) is given by:
 
                                 L-1 M-1
              C(I,J) = 1/(L*M)*SUM SUM R(L1,M1)*
                                 L1=0 M1=0
   
                    EXP(-SQRT(-1)*2*PI*(I*L1/L + J*M1/M))

         The complex transform of a real array has conjugate symmetry.
         That is, c(i,j) = congugate c(l-i,m-j) so only half the transform
         is computed and packed back into the original array R.
VVVVVVVVVVVVVVVV

The L and M are the size of the input . Namely L is the N in my original question.
So, the actual output of this sub and fft2df of ncl is of size ( L, M) ( or (N,M)). But, since they are symmetric,only
(N, M/2+1) are output.
This perfectly answer my previous question.
I think it will be helpful for NCL staff to put the above definition of the 2d fft on the help webpage for function fft2df.

Andy , your help is appreciated and pls correct any confusion/misunderstanding in the above.

Best wishes,
Ting

 

> Date: Sat, 17 Mar 2012 20:42:28 -0600
> From: mai@ucar.edu
> To: leiting2002@hotmail.com
> Subject: Re: question about fft2df
>
> On 03/17/2012 08:10 PM, À×öª wrote:
>
> > Would you pls tell me where I can see the fortran counterpart of the fft2df of NCL? So, I can
> > understand why it has such dimension sizes.
>
> Two source files are attached. Why two? It's a long story. The one with comments (fftpack5.1.tar) is
> not the version used in NCL. The one with no comments and explicit double precision
> (fftpack5_dp.tar) is the one used in NCL. These were written at different times by the same two
> people. The calling sequence is the same, I think. (See my test code and pay attention to the
> leading dimension of the input array -- it must be larger than N because the output is complex
> numbers which overwrite the input, a very bad programming style that was common many years ago. Paul
> Swarztrauber died not very long ago. I talked to Richard Valent yesterday. He does not know or does
> not remember much about these programs.)
>
> So I will also attach my little driver program which prints out the same values as the NCL Example 1
> and I will also attach a very slightly modified version of the NCL program (to get 64-bit floats
> instead of 32-bit -- all actual calculations in NCL are done in 64-bit floating point precision,
> even when the input is 32-bit). If you run the two program, you should see the same numbers coming out.
>
> You will have to build the libraries or at least get all of the needed routines into your compile. I
> used gfortran because that is what is used to build NCL.
>
> Run the test NCL program like this:
>
> % ncl -n testfft.ncl
>
> Please do not hesitate to contact me again if you have any more questions.
>
> Andy
                                               

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Mar 20 10:05:36 2012

This archive was generated by hypermail 2.1.8 : Tue Mar 20 2012 - 15:27:15 MDT