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

jnt.FFT.ComplexDouble2DFFT 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 the FFT of 2 dimensional complex, double precision data.
  * The data is stored in a 1-dimensional array in Row-Major order.
  * The physical layout in the array data, of the mathematical data d[i,j] is as follows:
  *
  *    Re(d[i,j]) = data[i*rowspan + 2*j]
  *    Im(d[i,j]) = data[i*rowspan + 2*j + 1]
  *
* where rowspan must be at least 2*ncols (it defaults to 2*ncols). * The transformed data is returned in the original data array in * wrap-around order along each dimension. * * @author Bruce R. Miller [email protected] * @author Contribution of the National Institute of Standards and Technology, * @author not subject to copyright. */ public class ComplexDouble2DFFT { int nrows; int ncols; ComplexDoubleFFT rowFFT, colFFT; /** Create an FFT for transforming nrows*ncols points of Complex, double precision * data. */ public ComplexDouble2DFFT(int nrows, int ncols) { if ((nrows <= 0) || (ncols <= 0)) throw new IllegalArgumentException("The array dimensions >=0 : "+nrows+","+ncols); this.nrows = nrows; this.ncols = ncols; rowFFT = new ComplexDoubleFFT_Mixed(ncols); colFFT = (nrows == ncols ? rowFFT : new ComplexDoubleFFT_Mixed(nrows)); } protected void checkData(double data[], int rowspan){ if (rowspan < 2*ncols) throw new IllegalArgumentException("The row span "+rowspan+ "is shorter than the row length "+2*ncols); if (nrows*rowspan > data.length) throw new IllegalArgumentException("The data array is too small for "+ nrows+"x"+rowspan+" data.length="+data.length);} /** Compute the Fast Fourier Transform of data leaving the result in data. * The array data must be dimensioned (at least) 2*nrows*ncols, consisting of * alternating real and imaginary parts. */ public void transform(double data[]) { transform(data,2*ncols); } /** Compute the Fast Fourier Transform of data leaving the result in data. * The array data must be dimensioned (at least) 2*nrows*ncols, consisting of * alternating real and imaginary parts. */ public void transform(double data[], int rowspan) { checkData(data,rowspan); for(int i=0; iwraparound format */ public double[] toWraparoundOrder(double data[]){ return data; } /** Return data in wraparound order. * rowspan is used to traverse data; the new array is in * packed (rowspan = 2*ncols) format. * @see wraparound format */ public double[] toWraparoundOrder(double data[], int rowspan){ if (rowspan == 2*ncols) return data; double newdata[] = new double[2*nrows*ncols]; for(int i=0; i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy