vec_math
Class FastFourierTransform

java.lang.Object
  extended by vec_math.FastFourierTransform

public class FastFourierTransform
extends Object

Does a fast fourier transform following the algorithm presented in Numerical Recipes, p. 507f


Nested Class Summary
static class FastFourierTransform.RealTest
          Test the real-value fft.
static class FastFourierTransform.Test
           
static class FastFourierTransform.WhiteNoise
           
 
Constructor Summary
FastFourierTransform()
           
 
Method Summary
static Complex[] fft(Complex[] x)
          Does fft in the complex domain.
static Complex[] ifft(Complex[] x)
          Does inverse fft in the complex domain.
static Complex[] realFft(Double[] real)
          Does an fft of a real data set by splitting it into a complex array half the size.
static double[] zeroPad(double[] in)
          Returns a double array that is zero-padded to both side and has a length that is the closest ceiling power-of-two to the length of the input array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FastFourierTransform

public FastFourierTransform()
Method Detail

fft

public static Complex[] fft(Complex[] x)
Does fft in the complex domain. The input data is conserved and a new complex array is retuyrned. This is not very memory efficient.

Parameters:
x - Complex input data, length must be a power of 2.
Returns:
The Fourier transform of the input data or null input has wrong length.

ifft

public static Complex[] ifft(Complex[] x)
Does inverse fft in the complex domain. The input data is conserved and a new complex array is retuyrned. This is not very memory efficient.

Parameters:
x - Complex input data, length must be a power of 2.
Returns:
The inverse Fourier transform of the input data or null input has wrong length.

realFft

public static Complex[] realFft(Double[] real)
Does an fft of a real data set by splitting it into a complex array half the size.

Returns:
The positive half of the transform an array of n/2+1

zeroPad

public static double[] zeroPad(double[] in)
Returns a double array that is zero-padded to both side and has a length that is the closest ceiling power-of-two to the length of the input array. Uses the System.arraycopy(java.lang.Object, int, java.lang.Object, int, int) method.