jfftw
Class FFTWComplex

java.lang.Object
  extended by jfftw.FFTW
      extended by jfftw.FFTWComplex

public class FFTWComplex
extends FFTW

Class to implement simple one-off Complex to Complex Fourier transforms using jfftw as a native library.

A new plan is created for each FFT. This is sub-optimal for a large number of FFTs, but reasonable for ``one-off''.


Field Summary
 
Fields inherited from class jfftw.FFTW
BACKWARD, errorStream, ESTIMATE, EXHAUSTIVE, FORWARD, FOURIER, loaded, PATIENT, planFlag, REAL, version
 
Constructor Summary
FFTWComplex()
          Default constructor which load sharable library and sets defaults.
FFTWComplex(boolean systemWisdom)
          Constructor to optionally load system wisdom file
FFTWComplex(FFTW fft)
          Constructor to form a FFTWComplex from a FFTW, The PlanFlag is also copied.
FFTWComplex(File wisdomFile)
          Constructor to load specified wisdom file
FFTWComplex(String wisdomFile)
          Constructor to load specified wisdom file by name
 
Method Summary
 double[][] oneDimensional(double[][] data, int dirn, boolean overwrite)
          Method to take a Complex one-dimensional FFT with the real and imaging data split format in a two-dimensional array of size [2][length] with the the i th component with real in the [0][i] element and the imaginary element in the [1][i] element.
 double[] oneDimensional(double[] data, int dirn, boolean overwrite)
          Method to take one-dimensional Complex FFT with the data supplied in a one-dimensional interleaved double array with real parts in even elements, and imaginary in the odd elements.
 double[][] threeDimensional(int width, int height, int depth, double[][] data, int dirn, boolean overwrite)
          Method to take a Complex the-dimensional FFT with the real and imaging data split format in a two-dimensional array of size [2][length] with the the i th component with real in the [0][i] element and the imaginary element in the [1][i] element.
 double[] threeDimensional(int width, int height, int depth, double[] data, int dirn, boolean overwrite)
          Method to take three-dimensional Complex FFT with the data supplied in a one-dimensional double array with real parts in even elements, and imaginary in the odd.
 double[][] twoDimensional(int width, int height, double[][] data, int dirn, boolean overwrite)
          Method to take a Complex two-dimensional FFT with the real and imaging data split format in a two-dimensional array of size [2][length] with the the i th component with real in the [0][i] element and the imaginary element in the [1][i] element.
 double[] twoDimensional(int width, int height, double[] data, int dirn, boolean overwrite)
          Method to take two-dimensional Complex FFT with the data supplied in a one-dimensional double array with real parts in even elements, and imaginary in the odd.
 
Methods inherited from class jfftw.FFTW
addPlanFlag, clearWisdom, exportWisdom, getPlanFlag, getVersion, getWisdom, loadWisdom, loadWisdom, loadWisdom, readWisdom, setErrorStream, setPlanFlag, setSystemWisdom, writeWisdom
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FFTWComplex

public FFTWComplex()
Default constructor which load sharable library and sets defaults.


FFTWComplex

public FFTWComplex(FFTW fft)
Constructor to form a FFTWComplex from a FFTW, The PlanFlag is also copied.

Parameters:
fft - the FFTW
Since:
1.1

FFTWComplex

public FFTWComplex(boolean systemWisdom)
Constructor to optionally load system wisdom file

Parameters:
systemWisdom - if true loads system wisdom file

FFTWComplex

public FFTWComplex(File wisdomFile)
Constructor to load specified wisdom file

Parameters:
wisdomFile -

FFTWComplex

public FFTWComplex(String wisdomFile)
Constructor to load specified wisdom file by name

Parameters:
wisdomFile -
Method Detail

oneDimensional

public double[] oneDimensional(double[] data,
                               int dirn,
                               boolean overwrite)
Method to take one-dimensional Complex FFT with the data supplied in a one-dimensional interleaved double array with real parts in even elements, and imaginary in the odd elements.

Parameters:
data - the data to be transformed
dirn - direction +1 for forward, -1 to backward
overwrite - if true data is overwritten with FFT, else a new array is returned.
Returns:
double[] the FFTed array (if overwrite = true, this will overwrite the input array).

oneDimensional

public double[][] oneDimensional(double[][] data,
                                 int dirn,
                                 boolean overwrite)
Method to take a Complex one-dimensional FFT with the real and imaging data split format in a two-dimensional array of size [2][length] with the the i th component with real in the [0][i] element and the imaginary element in the [1][i] element.

Parameters:
data - two-dimensional array, real in [0][i] and imag in [0][i]
dirn - forward or inverse transform
overwrite - if true overwrite given data, else return in new space
Returns:
double[][] transformed data
Throws:
IllegalArgumentException - if real and imaginary array of different length.

twoDimensional

public double[] twoDimensional(int width,
                               int height,
                               double[] data,
                               int dirn,
                               boolean overwrite)
Method to take two-dimensional Complex FFT with the data supplied in a one-dimensional double array with real parts in even elements, and imaginary in the odd. Element i,j is located at Real part 2*(j*width + i) Imag part 2*(j*width + i) + 1

Parameters:
width - the width of the image data
height - the height of the image data
data - the data to be transformed
dirn - direction +1 for forward, -1 to backward
overwrite - if true data is overwritten with FFT, else a new array is returned.
Returns:
double[] the FFTed array (if overwrite = true, this will be the same at the input data array.
Throws:
IllegalArgumentException - if width and height does not match the array length.

twoDimensional

public double[][] twoDimensional(int width,
                                 int height,
                                 double[][] data,
                                 int dirn,
                                 boolean overwrite)
Method to take a Complex two-dimensional FFT with the real and imaging data split format in a two-dimensional array of size [2][length] with the the i th component with real in the [0][i] element and the imaginary element in the [1][i] element.

Parameters:
width - width of the data
height - height of the data
data - two-dimensional array, real in [0][i] and imag in [0][i]
dirn - forward or inverse transform
overwrite - if true overwrite given data, else return in new space
Returns:
double[][] transformed data
Throws:
IllegalArgumentException - if real and imaginary array of different length, or width*height does not match the array lengths.

threeDimensional

public double[] threeDimensional(int width,
                                 int height,
                                 int depth,
                                 double[] data,
                                 int dirn,
                                 boolean overwrite)
Method to take three-dimensional Complex FFT with the data supplied in a one-dimensional double array with real parts in even elements, and imaginary in the odd. Element (i,j,k) is located at: RealPart 2*(k*width*height + j*width + i) ImagPart 2*(k*width*height * j*width + i) + 1

Parameters:
width - the width of the image data
height - the height of the image data
data - the data to be transformed
dirn - direction +1 for forward, -1 to backward
overwrite - if true data is overwritten with FFT, else a new array is returned.
Returns:
double[] the FFTed array (if overwrite = true, this will be the same at the input data array.
Throws:
IllegalArgumentException - if width, height and depth does not match the array length.

threeDimensional

public double[][] threeDimensional(int width,
                                   int height,
                                   int depth,
                                   double[][] data,
                                   int dirn,
                                   boolean overwrite)
Method to take a Complex the-dimensional FFT with the real and imaging data split format in a two-dimensional array of size [2][length] with the the i th component with real in the [0][i] element and the imaginary element in the [1][i] element.

Parameters:
width - width of the data
height - height of the data
depth - depth of the data
data - two-dimensional array, real in [0][i] and imag in [0][i]
dirn - forward or inverse transform
overwrite - if true overwrite given data, else return in new space
Returns:
double[][] transformed data
Throws:
IllegalArgumentException - if real and imaginary array of different length, or width*height does not match the array lengths.