A fast and precise DFT wavelet code

# fft2d.f90 File Reference

Define routne FFT 2D. More...

Go to the source code of this file.

## Functions/Subroutines

subroutine FFT2d (n1, n2, nd1, nd2, z, isign, inzee, zw, ncache)
CALCULATES THE DISCRETE FOURIER TRANSFORM F(I1,I2)= S_(j1,j2) EXP(isign*i*2*pi*(j1*i1/n1+j2*i2/n2)) R(j1,j2) INPUT: n1,n2:physical dimension of the transform. It must be a product of the prime factors 2,3,5, but greater than 3. If two ni's are equal it is recommended to place them behind each other. nd1,nd2:memory dimension of Z. ndi must always be greater or equal than ni. It is recomended to chose ndi=ni if ni is odd and ndi=ni+1 if ni is even to obtain optimal execution speed. For small ni it can however sometimes be advantageous to set ndi=ni inzee=1: first part of Z is data array, second part work array inzee=2: first part of Z is work array, second part data array Z(1,i1,i2,inzee)=real(R(i1,i2)) Z(2,i1,i2,inzee)=imag(R(i1,i2)) OUTPUT: inzee=1: first part of Z is data array, second part work array inzee=2: first part of Z is work array, second part data array real(F(i1,i2))=Z(1,i1,i2,inzee) imag(F(i1,i2))=Z(2,i1,i2,inzee) inzee on output is in general different from inzee on input THE ARRAYELEMENTS Z( , , , ,3-inzee) ARE USED AS WORKING SPACE On a RISC machine with cache, it is very important to find the optimal value of NCACHE. NCACHE determines the size of the work array zw, that has to fit into cache. It has therefore to be chosen to equal roughly half the size of the physical cache in units of real*8 numbers. The optimal value of ncache can easily be determined by numerical experimentation. A too large value of ncache leads to a dramatic and sudden decrease of performance, a too small value to a to a slow and less dramatic decrease of performance. If NCACHE is set to a value so small, that not even a single one dimensional transform can be done in the workarray zw, the program stops with an error message. On a vector machine ncache has to be put to 0.

## Detailed Description

Define routne FFT 2D.

Definition in file fft2d.f90.

## Function Documentation

 subroutine FFT2d ( n1 , n2 , nd1 , nd2 , z , isign , inzee , zw , ncache )

CALCULATES THE DISCRETE FOURIER TRANSFORM F(I1,I2)= S_(j1,j2) EXP(isign*i*2*pi*(j1*i1/n1+j2*i2/n2)) R(j1,j2) INPUT: n1,n2:physical dimension of the transform. It must be a product of the prime factors 2,3,5, but greater than 3. If two ni's are equal it is recommended to place them behind each other. nd1,nd2:memory dimension of Z. ndi must always be greater or equal than ni. It is recomended to chose ndi=ni if ni is odd and ndi=ni+1 if ni is even to obtain optimal execution speed. For small ni it can however sometimes be advantageous to set ndi=ni inzee=1: first part of Z is data array, second part work array inzee=2: first part of Z is work array, second part data array Z(1,i1,i2,inzee)=real(R(i1,i2)) Z(2,i1,i2,inzee)=imag(R(i1,i2)) OUTPUT: inzee=1: first part of Z is data array, second part work array inzee=2: first part of Z is work array, second part data array real(F(i1,i2))=Z(1,i1,i2,inzee) imag(F(i1,i2))=Z(2,i1,i2,inzee) inzee on output is in general different from inzee on input THE ARRAYELEMENTS Z( , , , ,3-inzee) ARE USED AS WORKING SPACE On a RISC machine with cache, it is very important to find the optimal value of NCACHE. NCACHE determines the size of the work array zw, that has to fit into cache. It has therefore to be chosen to equal roughly half the size of the physical cache in units of real*8 numbers. The optimal value of ncache can easily be determined by numerical experimentation. A too large value of ncache leads to a dramatic and sudden decrease of performance, a too small value to a to a slow and less dramatic decrease of performance. If NCACHE is set to a value so small, that not even a single one dimensional transform can be done in the workarray zw, the program stops with an error message. On a vector machine ncache has to be put to 0.

Definition at line 50 of file fft2d.f90.

References ctrig_sg(), fftrot_sg(), fftstp_sg(), m, max, min, and n.

Here is the call graph for this function: