Sun Java Solaris Communities My SDN Account Join SDN
 
Article

Fast Fourier Transform (FFT) Routines: New FFT Interfaces with the SUN ONE Studio 7, Compiler Collection Sun Performance Library

 
By David Lindt  

Sun [tm] ONE Studio, Compiler Collection 7 Sun Performance Library provides new interfaces for computing the fast Fourier transform. These routines supersede the FFT routines provided with earlier versions of the Sun Performance Library, which were based on FFTPACK and VFFTPACK. The old FFT interfaces are included for backward compatibility, but the old routines will no longer be supported.

Introduction

The discrete Fourier transform (DFT) has always been an important analytical tool in many areas in science and engineering. However, it was not until the development of the fast Fourier transform (FFT) that the DFT became widely used. This is because the DFT requires O(N2) computations, while the FFT only requires O(Nlog2N) operations.

Sun Performance Library contains a set of routines that computes the FFT, related FFT operations, such as convolution and correlation, and trigonometric transforms.

For information on the Fortran 95 and C interfaces and types of arguments used in each routine, see the section 3P man pages for the individual routines. For example, to display the man page for the SFFTC routine, type man -s 3P sfftc. Routine names must be lowercase. For an overview of the FFT routines, type man -s 3P fft.

Forward and Inverse FFT Routines

The following table shows the mapping between the new FFT routines and the corresponding FFTPACK and VFFTPACK routines included in previous versions of the Sun ONE Studio Compiler Collection. (P) denotes FFT routines that are parallelized.

New FFT
Routine
Name
Replaces
FFTPACK/
VFFTPACK
Routine
Description
CFFTC (P) CFFTI
CFFTF (P)
CFFTB (P)
Initialize the trigonometric weight and factor tables or compute the one-dimensional forward or inverse FFT of a complex sequence.
CFFTC2 (P) CFFT2I
CFFT2F (P)
CFFT2B (P)
Initialize the trigonometric weight and factor tables or compute the two-dimensional forward or inverse FFT of a two-dimensional complex array.
CFFTC3 (P) CFFT3I
CFFT3F (P)
CFFT3B (P)
Initialize the trigonometric weight and factor tables or compute the three-dimensional forward or inverse FFT of three-dimensional complex array.
CFFTCM (P) VCFFTI
VCFFTF (P)
VCFFTB (P)
Initialize the trigonometric weight and factor tables or compute the one-dimensional forward or inverse FFT of a set of data sequences stored in a two-dimensional complex array.
CFFTS RFFTI
RFFTB
EZFFTI
EZFFTB
Initialize the trigonometric weight and factor tables or compute the one-dimensional inverse FFT of a complex sequence.
CFFTS2 RFFT2I
RFFT2B
Initialize the trigonometric weight and factor tables or compute the two-dimensional inverse FFT of a two-dimensional complex array.
CFFTS3 (P) RFFT3I
RFFT3B
Initialize the trigonometric weight and factor tables or compute the three-dimensional inverse FFT of three-dimensional complex array.
CFFTSM VRFFTI
VRFFTB (P)
Initialize the trigonometric weight and factor tables or compute the one-dimensional inverse FFT of a set of data sequences stored in a two-dimensional complex array.
DFFTZ DFFTI
DFFTF
DEZFFTI
DEZFFTF
Initialize the trigonometric weight and factor tables or compute the one-dimensional forward FFT of a double precision sequence.
DFFTZ2 DFFT2I
DFFT2F
Initialize the trigonometric weight and factor tables or compute the two-dimensional forward FFT of a two-dimensional double precision array.
DFFTZ3 (P) DFFT3I
DFFT3F
Initialize the trigonometric weight and factor tables or compute the three-dimensional forward FFT of three-dimensional double precision array.
DFFTZM VDFFTI
VDFFTF (P)
Initialize the trigonometric weight and factor tables or compute the one-dimensional forward FFT of a set of data sequences stored in a two-dimensional double precision array.
SFFTC RFFTI
RFFTF
EZFFTI
EZFFTF
Initialize the trigonometric weight and factor tables or compute the one-dimensional forward FFT of a real sequence.
SFFTC2 RFFT2I
RFFT2F
Initialize the trigonometric weight and factor tables or compute the two-dimensional forward FFT of a two-dimensional real array.
SFFTC3 (P) RFFT3I
RFFT3F
Initialize the trigonometric weight and factor tables or compute the three-dimensional forward FFT of three-dimensional real array.
SFFTCM VRFFTI
VRFFTF (P)
Initialize the trigonometric weight and factor tables or compute the one-dimensional forward FFT of a set of data sequences stored in a two-dimensional real array.
ZFFTD DFFTI
DFFTB
DEZFFTI
DEZFFTB
Initialize the trigonometric weight and factor tables or compute the one-dimensional inverse FFT of a double complex sequence.
ZFFTD2 DFFT2I
DFFT2B
Initialize the trigonometric weight and factor tables or compute the two-dimensional inverse FFT of a two-dimensional double complex array.
ZFFTD3 (P) DFFT3I
DFFT3B
Initialize the trigonometric weight and factor tables or compute the three-dimensional inverse FFT of three-dimensional double complex array.
ZFFTDM VDFFTI
VDFFTB (P)
Initialize the trigonometric weight and factor tables or compute the one-dimensional inverse FFT of a set of data sequences stored in a two-dimensional double complex array
ZFFTZ (P) ZFFTI
ZFFTF (P)
ZFFTB (P)
Initialize the trigonometric weight and factor tables or compute the one-dimensional forward or inverse FFT of a double complex sequence.
ZFFTZ2 (P) ZFFT2I
ZFFT2F (P)
ZFFT2B (P)
Initialize the trigonometric weight and factor tables or compute the two-dimensional forward or inverse FFT of a two-dimensional double complex array.
ZFFTZ3 (P) ZFFT3I
ZFFT3F (P)
ZFFT3B (P)
Initialize the trigonometric weight and factor tables or compute the three-dimensional forward or inverse FFT of three-dimensional double complex array.
ZFFTZM (P) VZFFTI
VZFFTF (P)
VZFFTB (P)
Initialize the trigonometric weight and factor tables or compute the one-dimensional forward or inverse FFT of a set of data sequences stored in a two-dimensional double complex array.

FFTPACK and VFFTPACK routines are still included with this version of Sun Performance Library, but they are no longer supported. For information on using the FFTPACK and VFFTPACK routines, see the section 3p man pages or the bookUsing Sun Performance Library with Fortran and C User's Guide provided with the Sun WorkShop 6 update 2 release.

The following table lists the names of the Sun ONE Studio 7 Compiler Collection FFT routines and their calling sequence. Double precision routine names are in square brackets. See the individual man pages for detailed information on the data type and size of the arguments.

FFT Routines and Their Arguments

Routine Name

Arguments

Linear Routines

CFFTS [ZFFTD]

(OPT, N1, SCALE, X, Y, TRIGS, IFAC, WORK, LWORK, ERR)

SFFTC [DFFTZ]

(OPT, N1, SCALE, X, Y, TRIGS, IFAC, WORK, LWORK, ERR)

CFFTSM [ZFFTDM]

(OPT, N1, N2, SCALE, X, LDX1, Y, LDY1, TRIGS, IFAC, WORK, LWORK, ERR)

SFFTCM [DFFTZM]

(OPT, N1, N2, SCALE, X, LDX1, Y, LDY1, TRIGS, IFAC, WORK, LWORK, ERR)

CFFTC [ZFFTZ]

(OPT, N1, SCALE, X, Y, TRIGS, IFAC, WORK, LWORK, ERR)

CFFTCM [ZFFTZM]

(OPT, N1, N2, SCALE, X, LDX1, Y, LDY1, TRIGS, IFAC, WORK, LWORK, ERR)

Two-Dimensional Routines

CFFTS2 [ZFFTD2]

(OPT, N1, N2, SCALE, X, LDX1, Y, LDY1, TRIGS, IFAC, WORK, LWORK, ERR)

SFFTC2 [DFFTZ2]

(OPT, N1, N2, SCALE, X, LDX1, Y, LDY1, TRIGS, IFAC, WORK, LWORK, ERR)

CFFTC2 [ZFFTZ2]

(OPT, N1, N2, SCALE, X, LDX1, Y, LDY1, TRIGS, IFAC, WORK, LWORK, ERR)

Three-Dimensional Routines

CFFTS3 [ZFFTD3]

(OPT, N1, N2, N3, SCALE, X, LDX1, LDX2, Y, LDY1, LDY2, TRIGS, IFAC, WORK, LWORK, ERR)

SFFTC3 [DFFTZ3]

(OPT, N1, N2, N3, SCALE, X, LDX1, LDX2, Y, LDY1, LDY2, TRIGS, IFAC, WORK, LWORK, ERR)

CFFTC3 [ZFFTZ3]

(OPT, N1, N2, N3, SCALE, X, LDX1, LDX2, Y, LDY1, LDY2, TRIGS, IFAC, WORK, LWORK, ERR)

Sun Performance Library FFT routines use the following arguments.

  • OPT : Flag indicating whether the routine is called to initialize or to : compute the transform.
  • N1 , N2 , N3 : Problem dimensions for one, two, and three dimensional : transforms.
  • X : Input array where X is of type COMPLEX if the routine is a complex-to-complex transform or a complex-to-real tranform. X is of type REAL for a real-to-complex transform.
  • Y : Output array where Y is of type COMPLEX if the routine is a complex-to-complex transform or a real-to-complex tranform. Y is of type REAL for a complex-to-real transform.
  • LDX1 , LDX2 and LDY1 , LDY2 : LDX1 and LDX2 are the leading dimensions of the input array, and LDY1 and LDY2 are the leading dimensions of the output array. The FFT routines allow the output to overwrite the input, which is an in-place transform, or to be stored in a separate array apart from the input array, which is an out-of-place transform. In complex-to-complex tranforms, the input data is of the same size as the output data. However, real-to-complex and complex-to-real transforms have different memory requirements for input and output data. Care must be taken to ensure that the input array is large enough to accommodate the transform results when computing an in-place tranform.
  • TRIGS : Array containing the trigonometric weights.
  • IFAC : Array containing factors of the problem dimensions. The problem sizes are as follows:
    • Linear FFT: Problem size of dimension N1
    • Two-dimensional FFT: Problem size of dimensions N1 and N2
    • Three-dimensional FFT: Problem size of dimensions N1, N2, and N3

    While N1 , N2 , and N3 can be of any size, a real-to-complex or a complex-to-real transform can be computed most efficiently when

     

    and a complex-to-complex transform can be computed most efficiently when

     

    where p , q , r , s , t , u , and v are integers and p , q , r , s , t , u , v 0.

  • WORK : Workspace whose size depends on the routine and the number of threads : that are being used to compute the transform if the routine is : parallelized.
  • LWORK : Size of workspace. If LWORK is zero, the routine will allocate a workspace with the required size.
  • SCALE : A scalar with which the output is scaled. Occasionally in : literature, the inverse transform is defined with a scaling factor of :
  • for one-dimensional transforms, for two-dimensional transforms, and for three-dimensional transforms. In such case, the inverse transform is said to be normalized. If a normalized FFT is followed by its inverse FFT, the result is the original input data. The Sun Performance Library FFT routines are not normalized. However, normalization can be done easily by calling the inverse FFT routine with the appropriate scaling factor stored in SCALE .
  • ERR : A flag returning a nonzero value if an error is encountered in the routine and zero otherwise.

Conclusion

This article has presented an overview of the new Sun ONE Studio 7 Compiler Collection Sun Performance Library FFT interfaces. For more information on the Sun Performance Library forward and inverse FFT routines, sine and cosine transforms, and the covolution and correlation routines, see the Sun Performance Library User's Guide. For detailed information on a specific routine, see the section 3P man pages.


Related Information


About the Author

David Lindt is a senior technical writer in the Sun ONE Studio technical communications group.