Class Complex

java.lang.Object
ffx.numerics.fft.Complex

public class Complex extends Object
Compute the FFT of complex, double precision data of arbitrary length n. This class uses a mixed radix method and has special methods to handle factors [2, 3, 4, 5, 6, 7] and a general method for larger prime factors.
Since:
1.0
Author:
Michal J. Schnieders
Derived from:
Bruce R. Miller (bruce.miller@nist.gov)
Contribution of the National Institute of Standards and Technology, not subject to copyright.
Derived from:
GSL (Gnu Scientific Library) FFT Code by Brian Gough (bjg@network-theory.co.uk)
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Complex(int n)
    Construct a Complex instance for data of length n.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    dft(double[] in, double[] out)
    Static DFT method used to test the FFT.
    void
    fft(double[] data, int offset, int stride)
    Compute the Fast Fourier Transform of data leaving the result in data.
    int[]
    Getter for the field factors.
    void
    ifft(double[] data, int offset, int stride)
    Compute the (un-normalized) inverse FFT of data, leaving it in place.
    void
    inverse(double[] data, int offset, int stride)
    Compute the normalized inverse FFT of data, leaving it in place.
    static boolean
    Check if a dimension is a preferred dimension.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Complex

      public Complex(int n)
      Construct a Complex instance for data of length n. Factorization of n is designed to use special methods for small factors, and a general routine for large odd prime factors. Scratch memory is created of length 2*n, which is reused each time a transform is computed.
      Parameters:
      n - Number of complex numbers (n .GT. 1).
  • Method Details

    • preferredDimension

      public static boolean preferredDimension(int dim)
      Check if a dimension is a preferred dimension.
      Parameters:
      dim - the dimension to check.
      Returns:
      true if the dimension is a preferred dimension.
    • getFactors

      public int[] getFactors()
      Getter for the field factors.
      Returns:
      an array of int.
    • fft

      public void fft(double[] data, int offset, int stride)
      Compute the Fast Fourier Transform of data leaving the result in data. The array data must contain the data points in the following locations:
       Re(d[i]) = data[offset + stride*i] Im(d[i]) = data[offset + stride*i+1]
       
      Parameters:
      data - an array of double.
      offset - the offset to the beginning of the data.
      stride - the stride between data points.
    • ifft

      public void ifft(double[] data, int offset, int stride)
      Compute the (un-normalized) inverse FFT of data, leaving it in place. The frequency domain data must be in wrap-around order, and be stored in the following locations:
       Re(D[i]) = data[offset + stride*i] Im(D[i]) = data[offset + stride*i+1]
       
      Parameters:
      data - an array of double.
      offset - the offset to the beginning of the data.
      stride - the stride between data points.
    • inverse

      public void inverse(double[] data, int offset, int stride)
      Compute the normalized inverse FFT of data, leaving it in place. The frequency domain data must be stored in the following locations:
       Re(D[i]) = data[offset + stride*i] Im(D[i]) = data[offset + stride*i+1]
       
      Parameters:
      data - an array of double.
      offset - the offset to the beginning of the data.
      stride - the stride between data points.
    • dft

      public static void dft(double[] in, double[] out)
      Static DFT method used to test the FFT.
      Parameters:
      in - input array.
      out - output array.