jjil.algorithm
Class Fft1d

java.lang.Object
  extended by jjil.algorithm.Fft1d

public class Fft1d
extends java.lang.Object

Computes 1-dimensional FFT of a complex array.


Constructor Summary
Fft1d(int nMaxWidth)
          Creates a new Fft1d object capable of computing FFTs up to a given maximum width.
 
Method Summary
 Complex[] fft(Complex[] x)
          Computes forward FFT of the complex array.
 Complex[] ifft(Complex[] x)
          Computes inverse FFT of the input complex array.
 void setMaxWidth(int N)
          Sets a new maximum width.
 java.lang.String toString()
          String describing current FFT instance.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Fft1d

public Fft1d(int nMaxWidth)
      throws Error
Creates a new Fft1d object capable of computing FFTs up to a given maximum width.

Parameters:
nMaxWidth - The maximum width to compute FFTs for. This is used to precompute the complex roots of unity used in the FFT calculation. Must be a power of 2.
Throws:
Error - if width parameter is not a power of two.
Method Detail

fft

public Complex[] fft(Complex[] x)
              throws Error
Computes forward FFT of the complex array.

Parameters:
x - The complex array to compute the FFT of.
Returns:
The FFT of the input.
Throws:
Error - if image size is not a power of two or is larger than maximum width set in the constructor.

ifft

public Complex[] ifft(Complex[] x)
               throws Error
Computes inverse FFT of the input complex array.

Parameters:
x - The input complex array.
Returns:
The FFT of the input.
Throws:
Error - if the input size is not a power of two or is larger than the maximum set in the constructor.

setMaxWidth

public void setMaxWidth(int N)
                 throws Error
Sets a new maximum width. If smaller than what has been specified before, no effect. Otherwise computes some more complex roots of unity.

Parameters:
N - The new maximum width.
Throws:
Error - If N is not a power of 2.

toString

public java.lang.String toString()
String describing current FFT instance.

Overrides:
toString in class java.lang.Object
Returns:
The name and maximum width of this instance.