Package edu.emory.mathcs.jtransforms.fft

Examples of edu.emory.mathcs.jtransforms.fft.DoubleFFT_1D


    return realFFT(x, inverse);
  }

  @Internal
  public static ComplexVector fft(ComplexVector x, boolean inverse) {
    DoubleFFT_1D fft = new DoubleFFT_1D(x.length());
   
    double array[] = new double[x.length() * 2];
    for(int i=0;i!=x.length();++i) {
      array[i*2] = x.getElementAsComplex(i).getReal();
      array[i*2+1] = x.getElementAsComplex(i).getImaginary();
    }
    if(inverse) {
      fft.complexInverse(array, false);
    } else {
      fft.complexForward(array);
    }
    return toComplex(array);
  }
View Full Code Here


    return toComplex(array);
  }
 
  private static ComplexVector realFFT(Vector x, boolean inverse) {
   
    DoubleFFT_1D fft = new DoubleFFT_1D(x.length());
   
    double array[] = new double[x.length() * 2];
    for(int i=0;i!=x.length();++i) {
      array[i] = x.getElementAsDouble(i);
    }
   
    if(inverse) {
      fft.realInverse(array, false);
    } else {
      fft.realForwardFull(array);
    }
    return toComplex(array);
  }
View Full Code Here

   
    void fft() {
        numberOfTraces = this.fid.length;
        numberOfSamples = this.fid[0].getLength();
        this.spec = new ComplexArray[numberOfTraces];
        DoubleFFT_1D fourierTransform = new DoubleFFT_1D(numberOfSamples);
        //ComplexArray specElement;
        for (int i = 0; i < numberOfTraces; i++) {
                 double[] interleaved = this.fid[i].toDoubleArray(
                                ComplexArray.reductionMode.INTERLEAVED);
               fourierTransform.complexForward(interleaved);
               ComplexArray tmp = new ComplexArray(numberOfSamples);
               tmp.setInterleavedDoubles(interleaved);
               this.spec[i] = tmp.circShift().clone();
           
        }
View Full Code Here

   
     void ifft() {
        numberOfTraces = this.spec.length;
        numberOfSamples = this.spec[0].getLength();
        this.fid = new ComplexArray[numberOfTraces];
        DoubleFFT_1D inverseFourierTransform = new DoubleFFT_1D(numberOfSamples);
        for (int i = 0; i < numberOfTraces; i++) {
                 double[] interleavedArray = this.spec[i].toDoubleArray(
                                ComplexArray.reductionMode.INTERLEAVED);
               inverseFourierTransform.complexInverse(interleavedArray, true);
               ComplexArray tmp = new ComplexArray(numberOfSamples);
               tmp.setInterleavedDoubles(interleavedArray);
               this.fid[i] = tmp.clone();
           
        }
View Full Code Here

            //The number of coefficients for the FFT
            int transformLength = coef.length / 2// N real, imag pairs

            // Perform the FFT. Values are placed back in coef[].
            DoubleFFT_1D fft = new DoubleFFT_1D(transformLength);
            fft.complexForward(coef);

            // Swap the left/right halves of the output array
            // to get the negative freqs into the proper place.
            for (int i = 0; i < transformLength; ++i)
            {
View Full Code Here

   */
  public static ComplexNumber[] transform1DComplex(final ComplexNumber[] z) {
    ArgumentChecker.notNull(z, "array of complex number");
    final int n = z.length;
    final double[] a = packFull(z);
    DoubleFFT_1D fft = CACHE_1D.get(n);
    if (fft == null) {
      fft = new DoubleFFT_1D(n);
      CACHE_1D.put(n, fft);
    }
    fft.complexForward(a);
    return unpackFull(a);
  }
View Full Code Here

   */
  public static ComplexNumber[] inverseTransform1DComplex(final ComplexNumber[] z, final boolean scale) {
    ArgumentChecker.notNull(z, "array of complex number");
    final int n = z.length;
    final double[] a = packFull(z);
    DoubleFFT_1D fft = CACHE_1D.get(n);
    if (fft == null) {
      fft = new DoubleFFT_1D(n);
      CACHE_1D.put(n, fft);
    }
    fft.complexInverse(a, scale);
    return unpackFull(a);
  }
View Full Code Here

   */
  public static ComplexNumber[] fullTransform1DReal(final double[] h) {
    ArgumentChecker.notEmpty(h, "array of doubles");
    final int n = h.length;
    final double[] a = Arrays.copyOf(h, 2 * n);
    DoubleFFT_1D fft = CACHE_1D.get(n);
    if (fft == null) {
      fft = new DoubleFFT_1D(n);
      CACHE_1D.put(n, fft);
    }
    fft.realForwardFull(a);
    return unpackFull(a);
  }
View Full Code Here

   */
  public static ComplexNumber[] fullInverseTransform1DReal(final double[] x, final boolean scale) {
    ArgumentChecker.notEmpty(x, "array of doubles");
    final int n = x.length;
    final double[] a = Arrays.copyOf(x, 2 * n);
    DoubleFFT_1D fft = CACHE_1D.get(n);
    if (fft == null) {
      fft = new DoubleFFT_1D(n);
      CACHE_1D.put(n, fft);
    }
    fft.realInverseFull(a, scale);
    return unpackFull(a);
  }
View Full Code Here

   */
  public static ComplexNumber[] transform1DReal(final double[] h) {
    ArgumentChecker.notEmpty(h, "array of doubles");
    final int n = h.length;
    final double[] a = Arrays.copyOf(h, n);
    DoubleFFT_1D fft = CACHE_1D.get(n);
    if (fft == null) {
      fft = new DoubleFFT_1D(n);
      CACHE_1D.put(n, fft);
    }
    fft.realForward(a);
    return unpack(a);
  }
View Full Code Here

TOP

Related Classes of edu.emory.mathcs.jtransforms.fft.DoubleFFT_1D

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.