jwo.utils
Class JWFastFourierTransform

java.lang.Object
  extended by jwo.utils.JWFastFourierTransform

public class JWFastFourierTransform
extends Object

Calculates the Fast Fourier or Inverse Fast Fourier transforms of an array of discrete real or complex numbers respectively. Algorithm derived from Cooley et al (1969), implemented in Press et al (1988), Numerical Recipes in C. Adapted for two dimensions by A. Vali, University of Texas and D. Satnik, Central Washington University. Converted into Java by Jo Wood, 1998.

Version:
2.3, 11th April 2006.
Author:
Cooley, Press et al, Vali, Satnik and Wood.

Field Summary
static int FFT
          Indicates a forward transform.
static int IFFT
          Indicates an inverse transform.
 
Constructor Summary
JWFastFourierTransform(float[] realNum, float[] imagNum, int nRows, int nCols)
          Performs a forward Fast Fourier Transform of an array of real numbers.
JWFastFourierTransform(int transType, float[] realNum, float[] imagNum, int nRows, int nCols)
          Performs a Fast Fourier Transform of an array of real numbers (FFT) or complex coefficients (IFFT).
 
Method Summary
static boolean isPowerOf2(int n)
          Reports whether a given integer is a power of two or not.
static int minPowerOf2(int n)
          Reports the minimum power of 2 that is >= n.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FFT

public static final int FFT
Indicates a forward transform.

See Also:
Constant Field Values

IFFT

public static final int IFFT
Indicates an inverse transform.

See Also:
Constant Field Values
Constructor Detail

JWFastFourierTransform

public JWFastFourierTransform(float[] realNum,
                              float[] imagNum,
                              int nRows,
                              int nCols)
Performs a forward Fast Fourier Transform of an array of real numbers. The array is 1-dimensional representing a possibly 2-d array of size 2^n*2^m where n and m are integers. The array is replaced by its (complex) Fourier coefficients.

Parameters:
realNum - Real component of numbers to transform.
imagNum - Imaginary component of numbers to transform.
nRows - Number of rows (2^n) represented by array.
nCols - Number of columns (2^m) represented by array.

JWFastFourierTransform

public JWFastFourierTransform(int transType,
                              float[] realNum,
                              float[] imagNum,
                              int nRows,
                              int nCols)
Performs a Fast Fourier Transform of an array of real numbers (FFT) or complex coefficients (IFFT). The array is 1-dimensional representing a possibly 2-d array of size 2^n*2^m where n and m are integers. The array is replaced by its complex Fourier coefficients (FFT) or real values (IFFT).

Parameters:
transType - Type of transform, FFT for forward transform, IFFT for inverse transform.
realNum - Real component of numbers to transform.
imagNum - Imaginary component of numbers to transform.
nRows - Number of rows (2^n) represented by array.
nCols - Number of columns (2^m) represented by array.
Method Detail

isPowerOf2

public static boolean isPowerOf2(int n)
Reports whether a given integer is a power of two or not.

Parameters:
n - Number to test.
Returns:
True if a power of two, false if not.

minPowerOf2

public static int minPowerOf2(int n)
Reports the minimum power of 2 that is >= n.

Parameters:
n - Number to test.
Returns:
The smallest power of 2 that is >= n.


Copyright Jo Wood, 1996-2009, last modified, 17th April, 2009