jfftw
Class FFTW

java.lang.Object
  extended by jfftw.FFTW
Direct Known Subclasses:
FFTWComplex, FFTWReal

public class FFTW
extends Object

Basic class for Java access to the fftw3 library to take Fourier Transforms or one-dimensional, two-dimensional or three-dimensional data held in double[] arrays.

This class set package defaults, manages the wisdom information and loads the sharable library. Actual numerical use of this package is via the extending classes.

The simplest use of the package is via DataArray and its extending classes that hides most of the complexity.


Field Summary
static int BACKWARD
          Flag for backward (on inverse) FFT
protected static PrintStream errorStream
          PrintStream for warning and error messages.
static int ESTIMATE
          Flag for quick and dirty plan search (fast, but no optimal)
static int EXHAUSTIVE
          Flag for exhaustive plan search (very slow)
static int FORWARD
          Flag for forward FFT
static int FOURIER
          Flag for Fourier space
protected static boolean loaded
          Boolean to determine in the sharable library has been loaded successfully.
static int PATIENT
          Flag for patient plan search (medium slow)
protected  int planFlag
          Integer to set to the current plan in use by the package.
static int REAL
          Flag for Real space
static String version
          Version flag
 
Constructor Summary
FFTW()
          Default constructor, do nothing but load the sharable library.
FFTW(boolean systemWisdom)
          Constructor with flag to optionally load the system wisdom file.
FFTW(FFTW fft)
          Constructor to for a new FFTW, being a copy of the specified one.
FFTW(File wisdomFile)
          Constructor to load specified wisdom file.
FFTW(String wisdomFileName)
          Constructor to load specified wisdom file specified by name.
 
Method Summary
 void addPlanFlag(int addition)
          Method to add to the plan flag
 void clearWisdom()
          Void method to clear the wisdom information
 boolean exportWisdom(File file)
          Boolean method to export the current wisdom to a file
 int getPlanFlag()
          Method to get the plan flag
 String getVersion()
          Method to get the version string
 String getWisdom()
          Method to get the wisdom information as a String
 boolean loadWisdom()
          Boolean method to load system wisdom file
 boolean loadWisdom(File file)
          Boolean method to load wisdom file from specified File
 boolean loadWisdom(String wisdom)
          Boolean method to load (or add) wisdom from a String.
static String readWisdom(File file)
          Static method to read a Wisdom file into a String
 void setErrorStream(PrintStream es)
          Method to reset the default errorStream for package.
 void setPlanFlag(int flag)
          Method to set the plan flag, default is ESTIMATE
 void setSystemWisdom(String fileName)
          Method to reset the system wisdom file location.
static boolean writeWisdom(String wisdom, File file)
          Static method to write wisdom String to a file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

version

public static final String version
Version flag

See Also:
Constant Field Values

REAL

public static final int REAL
Flag for Real space

See Also:
Constant Field Values

FOURIER

public static final int FOURIER
Flag for Fourier space

See Also:
Constant Field Values

FORWARD

public static final int FORWARD
Flag for forward FFT

See Also:
Constant Field Values

BACKWARD

public static final int BACKWARD
Flag for backward (on inverse) FFT

See Also:
Constant Field Values

EXHAUSTIVE

public static final int EXHAUSTIVE
Flag for exhaustive plan search (very slow)

See Also:
Constant Field Values

PATIENT

public static final int PATIENT
Flag for patient plan search (medium slow)

See Also:
Constant Field Values

ESTIMATE

public static final int ESTIMATE
Flag for quick and dirty plan search (fast, but no optimal)

Default for jttfw but NOT the normal FFTW default

See Also:
Constant Field Values

errorStream

protected static PrintStream errorStream
PrintStream for warning and error messages. Defaults to System.err.


planFlag

protected int planFlag
Integer to set to the current plan in use by the package. Defaults to FFTW.ESTIMATE.


loaded

protected static boolean loaded
Boolean to determine in the sharable library has been loaded successfully.

Constructor Detail

FFTW

public FFTW()
Default constructor, do nothing but load the sharable library.


FFTW

public FFTW(FFTW fft)
Constructor to for a new FFTW, being a copy of the specified one. The PlanFlag is copied.

Parameters:
fft - the FFTW
Since:
1.1

FFTW

public FFTW(boolean systemWisdom)
Constructor with flag to optionally load the system wisdom file. If load fails there is a non-fatal warning.

Parameters:
systemWisdom - if true default system wisdom file

FFTW

public FFTW(File wisdomFile)
Constructor to load specified wisdom file. If load fails there is a non-fatal warning.

Parameters:
wisdomFile - the FFTW wisdom file

FFTW

public FFTW(String wisdomFileName)
Constructor to load specified wisdom file specified by name. If load fails there is a non-fatal warning.

Parameters:
wisdomFileName - the name of the wisdom file
Method Detail

getVersion

public String getVersion()
Method to get the version string

Returns:
String

setPlanFlag

public void setPlanFlag(int flag)
Method to set the plan flag, default is ESTIMATE

Parameters:
flag - the plan flag

addPlanFlag

public void addPlanFlag(int addition)
Method to add to the plan flag

Parameters:
addition - the addition to add

getPlanFlag

public int getPlanFlag()
Method to get the plan flag

Returns:
int the plan flag

setErrorStream

public void setErrorStream(PrintStream es)
Method to reset the default errorStream for package. The default is System.err

Parameters:
es - the error PrintStream
Since:
1.2

setSystemWisdom

public void setSystemWisdom(String fileName)
Method to reset the system wisdom file location. Note this does not load the file.

Parameters:
fileName - name of default wisdom file

loadWisdom

public boolean loadWisdom()
Boolean method to load system wisdom file

Returns:
boolean true for success, false for failure

loadWisdom

public boolean loadWisdom(File file)
Boolean method to load wisdom file from specified File

Parameters:
file - the wisdom file
Returns:
boolean true for success, false for failure

loadWisdom

public boolean loadWisdom(String wisdom)
Boolean method to load (or add) wisdom from a String.

Parameters:
wisdom - the wisdom String
Returns:
boolean true for success, false for failure

clearWisdom

public void clearWisdom()
Void method to clear the wisdom information


exportWisdom

public boolean exportWisdom(File file)
Boolean method to export the current wisdom to a file

Parameters:
file - the output file
Returns:
boolean true if successful, else false

getWisdom

public String getWisdom()
Method to get the wisdom information as a String

Returns:
String returns the FFTW wisdom entry in a formatted String.

readWisdom

public static String readWisdom(File file)
Static method to read a Wisdom file into a String

Parameters:
file - the wisdom file
Returns:
String the wisdom as a String

writeWisdom

public static boolean writeWisdom(String wisdom,
                                  File file)
Static method to write wisdom String to a file

Parameters:
wisdom - the wisdom String
file - the output file