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, throwLoadException, 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(String wisdomFile)
          Constructor to load specified wisdom file by name
 
Method Summary
 double[][] oneDimensional(double[][] in, double[][] out, int dirn)
          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[][] in, 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[] in, double[] out, int dirn)
          Method to take one-dimensional Complex FFT with the data supplied in a one-dimensional interleaved double array.
 double[] oneDimensional(double[] in, int dirn, boolean overwrite)
          Method to take one-dimensional Complex FFT with the data supplied in a one-dimensional interleaved double array.
 double[][] threeDimensional(int width, int height, int depth, double[][] in, double[][] out, int dirn)
          Method to take a Complex three-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[][] in, int dirn, boolean overwrite)
          Method to take a Complex three-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[] in, double[] out, int dirn)
          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[] threeDimensional(int width, int height, int depth, double[] in, 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[][] in, double[][] out, int dirn)
          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[][] in, 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[] in, double[] out, int dirn)
          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
 double[] twoDimensional(int width, int height, double[] in, 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
 
Methods inherited from class jfftw.FFTW
addPlanFlag, clearWisdom, exportWisdom, getPlanFlag, getVersion, getWisdom, loadWisdom, loadWisdom, loadWisdomFromString, readWisdom, 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(String wisdomFile)
Constructor to load specified wisdom file by name

Parameters:
wisdomFile -
Method Detail

oneDimensional

public double[] oneDimensional(double[] in,
                               double[] out,
                               int dirn)
Method to take one-dimensional Complex FFT with the data supplied in a one-dimensional interleaved double array.

Parameters:
in - the input data
out - the output data (may be the same as in)
dirn - direction +1 for forward, -1 to backward
Returns:
double[] the output array being out
Throws:
NullPointerException - of null or zero length arrays send.
IllegalArgumentException - of in and out arrays of different length

oneDimensional

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

Parameters:
in - 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[][] in,
                                 double[][] out,
                                 int dirn)
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:
in - two-dimensional array, real in [0][i] and imag in [0][i]
out - two-dimensional array to return the data.
dirn - forward or inverse transform
Returns:
double[][] transformed data, being out
Throws:
IllegalArgumentException - if real and imaginary array of different length.

oneDimensional

public double[][] oneDimensional(double[][] in,
                                 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:
in - two-dimensional array, real in [0][i] and imag in [0][i]
dirn - forward or inverse transform
overwrite - if true transform will overwrite in, else a new array will be created.
Returns:
double[][] transformed data.

twoDimensional

public double[] twoDimensional(int width,
                               int height,
                               double[] in,
                               double[] out,
                               int dirn)
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 data
height - the height of the data
in - the input data array to be transformed
out - the output data array, may be the same as in
dirn - direction +1 for forward, -1 to backward
Returns:
double[] the FFTed array
Throws:
NullPointerException - if null or zero length data send.
IllegalArgumentException - if width and height does not match the both array lengths.

twoDimensional

public double[] twoDimensional(int width,
                               int height,
                               double[] in,
                               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
in - 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.

twoDimensional

public double[][] twoDimensional(int width,
                                 int height,
                                 double[][] in,
                                 double[][] out,
                                 int dirn)
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
in - two-dimensional array, real in [0][i] and imag in [0][i]
out - two-dimensional array for the output.
dirn - forward or inverse transform
Returns:
double[][] transformed data
Throws:
IllegalArgumentException - if real and imaginary array of different length, or width*height does not match the array lengths.

twoDimensional

public double[][] twoDimensional(int width,
                                 int height,
                                 double[][] in,
                                 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
in - two-dimensional array, real in [0][i] and imag in [0][i]
dirn - forward or inverse transform
overwrite - in true it will overwrite the in array, else a new array will be created.
Returns:
double[][] transformed data

threeDimensional

public double[] threeDimensional(int width,
                                 int height,
                                 int depth,
                                 double[] in,
                                 double[] out,
                                 int dirn)
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
in - input the data
out - the output data, may be the same as in.
dirn - direction +1 for forward, -1 to backward
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[] in,
                                 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
in - 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[][] in,
                                   double[][] out,
                                   int dirn)
Method to take a Complex three-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
in - two-dimensional array, real in [0][i] and imag in [1][i]
out - the output array.
dirn - forward or inverse transform
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[][] in,
                                   int dirn,
                                   boolean overwrite)
Method to take a Complex three-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
in - two-dimensional array, real in [0][i] and imag in [1][i]
dirn - forward or inverse transform
overwrite - if true it the output will overwrite else a new array will be formed.
Returns:
double[][] transformed data
Throws:
IllegalArgumentException - if real and imaginary array of different length, or width*height does not match the array lengths.