FFT

   more...
Computes the Discrete Fourier Transform of one complex sequence.
Function Return Value
Complex array containing the Discrete Fourier Transform of X . The result is the complex array of the same shape and rank as X. (Output)
Required Argument
X — Array containing the sequence for which the transform is to be computed. X is an assumed shape complex array of rank 1, 2 or 3. If X is real or double, it is converted to complex internally prior to the computation. (Input)
Optional Arguments, Packaged Options
WORK — A COMPLEX array of the same precision as the data. For rank-1 transforms the size of WORK is n + 15. To define this array for each problem, set WORK(1) = 0. Each additional rank adds the dimension of the transform plus 15. Using the optional argument WORK increases the efficiency of the transform.
The option and derived type names are given in the following tables:
Option Names for FFT
Option Value
Options_for_fast_dft
1
Name of Unallocated Option Array to Use for Setting Options
Use
Derived Type
?_fft_options(:)
Use when setting options for calls hereafter.
?_options
?_fft_options_once(:)
Use when setting options for next call only.
?_options
For a description on how to use these options, see Matrix Optional Data Changes. See FAST_DFT located in Chapter 6, “Transforms” for the specific options for this routine.
FORTRAN 90 Interface
FFT (X [] )
Description
Computes the Discrete Fourier Transform of a complex sequence. This function uses FAST_DFT, FAST_2DFT, and FAST_3DFT from Chapter 6.
Example (operator_ex37.f90)
 
use rand_gen_int
use fft_int
use ifft_int
use linear_operators
 
implicit none
 
! This is Example 4 for FAST_DFT (using operators).
 
integer j
integer, parameter :: n=40
real(kind(1e0)) :: err, one=1e0
real(kind(1e0)), dimension(n) :: a, b, c, yy(n,n)
complex(kind(1e0)), dimension(n) :: f, fa, fb
! Generate two random periodic sequences 'a' and 'b'.
a=rand(a); b=rand(b)
! Compute the convolution 'c' of 'a' and 'b'.
yy(1:,1)=b
do j=2,n
yy(2:,j)=yy(1:n-1,j-1)
yy(1,j)=yy(n,j-1)
end do
 
c=yy .x. a
 
! Compute f=inverse(transform(a)*transform(b)).
fa = fft(a)
fb = fft(b)
f=ifft(fa*fb)
! Check the Convolution Theorem:
! inverse(transform(a)*transform(b)) = convolution(a,b).
err = norm(c-f)/norm(c)
if (err <= sqrt(epsilon(one))) then
write (*,*) 'Example 4 for FAST_DFT (operators) is correct.'
end if
 
end
Published date: 03/19/2020
Last modified date: 03/19/2020