2.8.2 - One Dimensional FFTs - JdlFFT

John W. Campbell

2.8.2.1 Introduction

This class has method for calculating complex or real one dimensional Fast Fourier Transforms (forward or inverse) for transforms where the number of points is a power of two. The code is based around that described in the book 'Numerical Recipes in Fortran'. In the current implementation the weighting factors are calculated only once (or when the number of points or direction of the FFT is changed) providing increased performance when a series of one dimensional FFTs are to be computed for the same number of points and same direction.

Class, constructor and methods:

Class Details
Accessible Fields
Constructor
Calculate Complex and Real FFT's

2.8.2.2 Class Details

Package:
Jdl.JdlLib;
Class name:
JdlFFT
Class definition:
public class JdlFFT
Extends:
Object
Implements:
none
Actions:
none

2.8.2.3 Accessible Fields

No fields with public, package or protected access defined.

2.8.2.4 Constructor

2.8.2.4.1 Introduction

There is a single standard constructor.

Constructor:

Standard constructor

2.8.2.4.2 Standard constructor

This constructs the JdlFFT object.

Constructor Definition:
public JdlFFT ()
Parameters List:
none

2.8.2.5 Calculate Complex and Real FFT's

2.8.2.5.1 Introduction

Methods are available to calculate 1-dimensional forward and reverse Fourier transforms for complex and real data.

Methods:

Complex Fourier transform - complexTransform
Real Fourier transform - realTransform

2.8.2.5.2 Complex Fourier transform - complexTransform

This method is used to calculate a forward or reverse one dimensional FFT for an array of complex data (stored in a float array). The number of points must be a power of two. The reverse transform points are scaled by npow**2 (the number of complex points to be transformed).

Method Definition:
public int complexTransform(float[] x, int npow, int isgn)
Parameters List:
x
Array of data to be transformed (2*npow**2 points). The real and imaginary components of the data are stored in adjacant elements in the float array. The output is written back to this array.
npow
The power of two. There are 2**npow points in the transform.
isgn
Flag =1, forward transform, =-1 reverse transform.
Method Return:
Error flag:
=0, OK
=1, Error in parameters

2.8.2.5.3 Real Fourier transform - realTransform

This method is used to calculate a one dimensional forward or reverse real FFT for an array of real data. The number of points must be a power of two. The reverse transform points are scaled by npow**2 (the number of points to be transformed). The result is the complex transform with the real and imaginary components in adjacant locations.

Method Definition:
public int realTransform(float[] x, int npow, int isgn)
Parameters List:
x
Array of real data to be transformed (2*npow**2 elements in length). On input values are stored in the first 2**npow elements. On output the complex data are stored in 2**npow pairs of data values with the real and imaginary components in adjacant locations in the real array.
npow
The power of two. There are 2**npow points in the transform. npow must be > 1.
isgn
Sign flag:
= 1, Forward transform -> half of complex transform 2**NPOW/2 real/imag pairs.
= 2, Forward transform -> full complex transform 2**NPOW real/imag pairs.
= -1, Reverse transform (from half complex transform).
= -2, Reverse transform (from full complex transform).
Method Return:
Error flag:
= 0, OK.
= 1, Error in parameters.

⇑ Up 2   ⇑ Up 1   ⇑ Top of this