Class Complex
- 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
ConstructorsConstructorDescriptionComplex(int n) Construct a Complex instance for interleaved data of length n.Complex(int n, DataLayout1D dataLayout, int imOffset) Construct a Complex instance for data of length n.Complex(int n, DataLayout1D dataLayout, int imOffset, int nFFTs) Construct a Complex instance for data of length n. -
Method Summary
Modifier and TypeMethodDescriptionstatic voiddft(double[] in, double[] out) Static DFT method used to test the FFT.static voiddftBlocked(double[] in, double[] out) Static DFT method used to test the FFT.voidfft(double[] data, int offset, int stride) Compute the Fast Fourier Transform of data leaving the result in data.voidfft(double[] data, int offset, int stride, int nextFFT) Compute the Fast Fourier Transform of data leaving the result in data.int[]Getter for the fieldfactors.voidifft(double[] data, int offset, int stride) Compute the (un-normalized) inverse FFT of data, leaving it in place.voidifft(double[] data, int offset, int stride, int nextFFT) Compute the (un-normalized) inverse FFT of data, leaving it in place.voidinverse(double[] data, int offset, int stride) Compute the normalized inverse FFT of data, leaving it in place.voidinverse(double[] data, int offset, int stride, int nextFFT) Compute the normalized inverse FFT of data, leaving it in place.static voidTest the Complex FFT.static booleanpreferredDimension(int dim) Check if a dimension is a preferred dimension.voidsetMinSIMDLoopLength(int minSIMDLoopLength) Configure the minimum SIMD inner loop length.voidsetUseSIMD(boolean useSIMD) Configure use of SIMD operators.toString()String representation of the Complex FFT.
-
Constructor Details
-
Complex
public Complex(int n) Construct a Complex instance for interleaved 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).
-
Complex
Construct a Complex instance for data of length n. The offset to each imaginary part relative to the real part is given by im. Factorization of n is designed to use special methods for small 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).dataLayout- Data layout (interleaved or blocked).imOffset- Offset to the imaginary part of each complex number relative to its real part.
-
Complex
Construct a Complex instance for data of length n. The offset to each imaginary part relative to the real part is given by im. Factorization of n is designed to use special methods for small 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).dataLayout- Data layout (interleaved or blocked).imOffset- Offset to the imaginary part of each complex number relative to its real part.nFFTs- Number of FFTs to process (default = 1).
-
-
Method Details
-
toString
String representation of the Complex FFT. -
setUseSIMD
public void setUseSIMD(boolean useSIMD) Configure use of SIMD operators.- Parameters:
useSIMD- True to use SIMD operators.
-
setMinSIMDLoopLength
public void setMinSIMDLoopLength(int minSIMDLoopLength) Configure the minimum SIMD inner loop length. For interleaved data, the default minimum SIMD loop length is 1 using AVX-128 (1 Real and 1 Imaginary per load). For blocked data, the default minimum SIMD loop length is 1 using AVX-128 (2 Real or 2 Imaginary per load). Setting this value higher than one reverts to scalar operations for short inner loop lengths.- Parameters:
minSIMDLoopLength- Minimum SIMD inner loop length.
-
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 fieldfactors.- 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 + im]
where im is 1 for interleaved data or a constant set when the class was constructed.
- Parameters:
data- an array of double.offset- the offset to the beginning of the data.stride- the stride between data points.
-
fft
public void fft(double[] data, int offset, int stride, int nextFFT) 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] + k * nextFFT Im(d[i]) = data[offset + stride*i + im] + k * nextFFT
where im is 1 for interleaved data or a constant set when the class was constructed. The value of k is the FFT number (0 to nFFTs-1). The value of nextFFT is the stride between FFT data sets. The nextFFT value is ignored if the number of FFTs is 1.
- Parameters:
data- an array of double.offset- the offset to the beginning of the data.stride- the stride between data points.nextFFT- the offset to the beginning of the next FFT when nFFTs > 1.
-
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 + im]
- 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, int nextFFT) 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] + k * nextFFT Im(d[i]) = data[offset + stride*i + im] + k * nextFFT
where im is 1 for interleaved data or a constant set when the class was constructed. The value of k is the FFT number (0 to nFFTs-1). The value of nextFFT is the stride between FFT data sets. The nextFFT value is ignored if the number of FFTs is 1.
- Parameters:
data- an array of double.offset- the offset to the beginning of the data.stride- the stride between data points.nextFFT- the offset to the beginning of the next FFT when nFFTs > 1.
-
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 + im]
where im is 1 for interleaved data or a constant set when the class was constructed.
- 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, int nextFFT) 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] + k * nextFFT Im(d[i]) = data[offset + stride*i + im] + k * nextFFT
where im is 1 for interleaved data or a constant set when the class was constructed. The value of k is the FFT number (0 to nFFTs-1). The value of nextFFT is the stride between FFT data sets. The nextFFT value is ignored if the number of FFTs is 1.
- Parameters:
data- an array of double.offset- the offset to the beginning of the data.stride- the stride between data points.nextFFT- the offset to the beginning of the next FFT when nFFTs > 1.
-
dft
public static void dft(double[] in, double[] out) Static DFT method used to test the FFT.- Parameters:
in- input array.out- output array.
-
dftBlocked
public static void dftBlocked(double[] in, double[] out) Static DFT method used to test the FFT.- Parameters:
in- input array.out- output array.
-
main
Test the Complex FFT.
-