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

edu.mines.jtk.dsp.Pfacc Maven / Gradle / Ivy

The newest version!
/****************************************************************************
Copyright 2005, Colorado School of Mines and others.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
****************************************************************************/
package edu.mines.jtk.dsp;

import static edu.mines.jtk.util.ArrayMath.*;
import edu.mines.jtk.util.Check;

/**
 * Prime-factor complex-to-complex FFT. The FFT length nfft must be composed 
 * of mutually prime factors from the set {2,3,4,5,7,8,9,11,13,16}. This
 * restriction implies that n cannot exceed 720720 = 5*7*9*11*13*16.
 * 

* References: *

  • * Temperton, C., 1985, Implementation of a self-sorting in-place prime * factor fft algorithm: Journal of Computational Physics, v. 58, * p. 283-299. *
  • * Temperton, C., 1988, A new set of minimum-add rotated rotated dft * modules: Journal of Computational Physics, v. 75, p. 190-198. *
* @author Dave Hale, Colorado School of Mines * @version 2005.03.21 */ class Pfacc { /** * Determines whether the specified FFT length is valid. * @param nfft the FFT length. * @return true, if valid; false, otherwise. */ static boolean nfftValid(int nfft) { return binarySearch(_ntable,nfft)>=0; } /** * Returns an FFT length optimized for memory. The FFT length will be the * smallest valid length that is not less than the specified length n. * @param n the lower bound on FFT length. * @return the FFT length. * @exception IllegalArgumentException if the specified length n exceeds * the maximum length supported by this implementation. Currently, the * maximum length is 720,720. */ static int nfftSmall(int n) { Check.argument(n<=720720,"n does not exceed 720720"); int itable = binarySearch(_ntable,n); if (itable<0) itable = -(itable+1); return _ntable[itable]; } /** * Returns an FFT length optimized for speed. The FFT length will be the * fastest valid length that is not less than the specified length n. * @param n the lower bound on FFT length. * @return the FFT length. * @exception IllegalArgumentException if the specified length n exceeds * the maximum length supported by this implementation. Currently, the * maximum length is 720,720. */ static int nfftFast(int n) { Check.argument(n<=720720,"n does not exceed 720720"); int ifast = binarySearch(_ntable,n); if (ifast<0) ifast = -(ifast+1); int nfast = _ntable[ifast]; int nstop = 2*nfast; double cfast = _ctable[ifast]; for (int i=ifast+1; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy