Class FFT

java.lang.Object
  extended byFFT

public class FFT
extends java.lang.Object

FFT - Object oriented Fast Fourier Transfrom package. Adapted with minimal changes to routines from "Numerical Recipes", W.H.Press et al., Cambridge University Press (1986)


Field Summary
(package private) static int bothParts
           
protected  Complex[] data
           
(package private) static int firstPart
           
(package private) static int inKSpace
           
(package private) static int inXSpace
           
protected  boolean isTwoReals
           
protected  int location
           
(package private) static int secondPart
           
 int size
           
protected  int toConfig
           
protected  int toFourier
           
 
Constructor Summary
FFT(Complex[] arg1, Complex[] arg2, int location)
          FFT object constructed out of TWO complex arrays of dimension power(n,2).
FFT(Complex[] arg, int location)
          FFT object constructed from ONE complex array of dimension power(n,2).
FFT(double[] arg1, double[] arg2, int location)
          FFT object constructed out of TWO real arrays of dimension power(n,2).
FFT(double[] arg, int location)
          FFT object constructed from ONE real array of dimension power(n,2).
FFT(FFT fft)
          FFT object constructed from another FFT object
 
Method Summary
 Complex[] aliasedConvolution(double units)
          Computes the convolution of two REAL numbers stored in the real and imaginary part of the data[] array which has previously been initialized.
 Complex[] expandedConvolution(double units)
          Computes the convolution of two REAL numbers stored in the real and imaginary part of the data[] array which has previously been initialized.
protected  void four1(Complex[] datac, int nh, int isign)
          Fast Fourier transform of one complex array of dimension power(n,2).
 Complex[] getFromKSpace(int index, double units)
          Transform array to Fourier space.
 double[] getFromKSpacePart(int index, double units)
          Transform array to Fourier space and returns a real array depending on the argument.
 Complex[] getFromXSpace(double units)
          Transform array to configuration space.
 double[] getFromXSpacePart(int index, double units)
          Transform array to configuration space.
protected  void twofft(Complex[] datac, Complex[] fft1, Complex[] fft2, int n)
          Fast Fourier transforms of two real arrays of dimension power(n,2).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

size

public int size

inXSpace

static final int inXSpace
See Also:
Constant Field Values

inKSpace

static final int inKSpace
See Also:
Constant Field Values

bothParts

static final int bothParts
See Also:
Constant Field Values

firstPart

static final int firstPart
See Also:
Constant Field Values

secondPart

static final int secondPart
See Also:
Constant Field Values

location

protected int location

data

protected Complex[] data

isTwoReals

protected boolean isTwoReals

toFourier

protected final int toFourier
See Also:
Constant Field Values

toConfig

protected final int toConfig
See Also:
Constant Field Values
Constructor Detail

FFT

public FFT(Complex[] arg,
           int location)
FFT object constructed from ONE complex array of dimension power(n,2).

Parameters:
arg - Complex array
location - Either inXSpace or inKSpace

FFT

public FFT(double[] arg,
           int location)
FFT object constructed from ONE real array of dimension power(n,2).

Parameters:
arg - Real array
location - Either inXSpace or inKSpace

FFT

public FFT(Complex[] arg1,
           Complex[] arg2,
           int location)
FFT object constructed out of TWO complex arrays of dimension power(n,2).

Parameters:
arg1 - First dataset
arg2 - Second dataset
location - Either inXSpace or inKSpace

FFT

public FFT(double[] arg1,
           double[] arg2,
           int location)
FFT object constructed out of TWO real arrays of dimension power(n,2).

Parameters:
arg1 - First dataset
arg2 - Second dataset
location - Either inXSpace or inKSpace

FFT

public FFT(FFT fft)
FFT object constructed from another FFT object

Parameters:
fft - An FFT object to be duplicated
Method Detail

getFromKSpace

public Complex[] getFromKSpace(int index,
                               double units)
Transform array to Fourier space.

Parameters:
index - bothParts = complex number, firstPart = real part or first transform if there is two, secondPart = imaginary part or second transform.
units - to scale with for physical results
Returns:
Complex array in Fourier space. If isTwoReals, the real and imaginary parts contain the result of transforms of two real numbers.
See Also:
FFT

getFromKSpacePart

public double[] getFromKSpacePart(int index,
                                  double units)
Transform array to Fourier space and returns a real array depending on the argument.

Parameters:
index - firstPart = real part or first transform if there is two, secondPart = imaginary part or second transform.
units - to scale with for physical results
Returns:
Real array in Fourier space.
See Also:
FFT

getFromXSpace

public Complex[] getFromXSpace(double units)
Transform array to configuration space.

Parameters:
units - to scale with for physical results
Returns:
Complex array in X space. If isTwoReals, the real and imaginary parts contain the result of two real transforms.
See Also:
FFT

getFromXSpacePart

public double[] getFromXSpacePart(int index,
                                  double units)
Transform array to configuration space.

Parameters:
index - firstPart = real part or first transform, secondPart = iminary part or second transform.
units - to scale with for physical results
Returns:
Real or imaginary part of a complex array in Xspace. If isTwoReals, the real and imaginary parts contain the result of two real transforms.
See Also:
FFT

aliasedConvolution

public Complex[] aliasedConvolution(double units)
Computes the convolution of two REAL numbers stored in the real and imaginary part of the data[] array which has previously been initialized. This is implement here WITHOUT any spectral expansion to show the effect of ALIASING in nonlinear problems.

Parameters:
units - to scale with for physical results
Returns:
Result of the convolution (carefull ALIASED !)
See Also:
FFT

expandedConvolution

public Complex[] expandedConvolution(double units)
Computes the convolution of two REAL numbers stored in the real and imaginary part of the data[] array which has previously been initialized. Here, the spectrum is temporarily extended to twice its original size by padding the transforms with zeros.

Parameters:
units - to scale with for physical results
Returns:
Result of a correct convolution (with no aliasing).
See Also:
FFT

twofft

protected void twofft(Complex[] datac,
                      Complex[] fft1,
                      Complex[] fft2,
                      int n)
Fast Fourier transforms of two real arrays of dimension power(n,2). Given a complex input array formed by packing two real arrays into real and imaginary parts, this routine calls four1() and returns two complex output arrays fft1[0:n-1] and fft2[0:n-1], each of complex length n, which contain the discrete transforms of the respective data arrays. Adapted with minimal changes from "Numerical Recipes", W.H.Press et al., Cambridge University Press (1986)


four1

protected void four1(Complex[] datac,
                     int nh,
                     int isign)
Fast Fourier transform of one complex array of dimension power(n,2). Replaces datac[0:n-1] by its discrete Fourier transform, if isign is 1, or replaces datac[0:n-1] by n times its inverse discrete Fourier transform, if isign is input as -1. Adapted with minimal changes from "Numerical Recipes", W.H.Press et al., Cambridge University Press (1986)