All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jnt.FFT.ComplexDoubleFFT_Mixed Maven / Gradle / Ivy

Go to download

The S-Space Package is a Natural Language Processing library for distributional semantics representations. Distributional semantics representations model the meaning of words, phrases, and sentences as high dimensional vectors or probability distributions. The library includes common algorithms such as Latent Semantic Analysis, Random Indexing, and Latent Dirichlet Allocation. The S-Space package also includes software libraries for matrices, vectors, graphs, and numerous clustering algorithms.

The newest version!
package jnt.FFT;

/** Computes FFT's of complex, double precision data of arbitrary length n.
  * This class uses the Mixed Radix method; it has special methods to handle
  * factors 2, 3, 4, 5, 6 and 7, as well as a general factor.
  * 

* This method appears to be faster than the Radix2 method, when both methods apply, * but requires extra storage (which ComplexDoubleFFT_Mixed manages itself). *

* See {@link ComplexDoubleFFT ComplexDoubleFFT} for details of data layout. * * @author Bruce R. Miller [email protected] * @author Contribution of the National Institute of Standards and Technology, * @author not subject to copyright. * @author Derived from GSL (Gnu Scientific Library) * @author GSL's FFT Code by Brian Gough [email protected] * @author Since GSL is released under * @author GPL, * @author this package must also be. */ public class ComplexDoubleFFT_Mixed extends ComplexDoubleFFT{ static final double PI = Math.PI; public ComplexDoubleFFT_Mixed(int n){ super(n); setup_wavetable(n); } public void transform(double data[], int i0, int stride) { checkData(data,i0,stride); transform_internal(data, i0, stride, -1); } public void backtransform (double data[], int i0, int stride){ checkData(data,i0,stride); transform_internal(data, i0, stride, +1); } /*______________________________________________________________________ Setting up the Wavetable */ private int factors[]; // Reversed the last 2 levels of the twiddle array compared to what the C version had. private double twiddle[][][]; private int available_factors[]={7, 6, 5, 4, 3, 2}; void setup_wavetable(int n){ if (n <= 0) throw new Error("length must be positive integer : "+n); this.n = n; factors = Factorize.factor(n, available_factors); double d_theta = -2.0 * PI / ((double) n); int product = 1; twiddle = new double[factors.length][][]; for (int i = 0; i < factors.length; i++) { int factor = factors[i]; int product_1 = product; /* product_1 = p_(i-1) */ product *= factor; int q = n / product; twiddle[i] = new double[q+1][2*(factor-1)]; double twid[][] = twiddle[i]; for(int j=1; j





© 2015 - 2024 Weber Informatics LLC | Privacy Policy