|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opensourcephysics.numerics.FFT
public class FFT
FFT computes FFT's of complex, double precision data of arbitrary length n. This class has been copied from Bruce Miller's FFT package for use in the Open Source Physics Project. The original package contains code for other transformations and other data types. 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 algorithm appears to be faster than the Radix2 method, when both methods apply, but requires extra storage (which FFTComplex manages itself).
Complex data is represented by 2 double values in sequence: the real and imaginary parts. Thus N data points are represented by a double array dimensioned to 2*N. The physical layout in the array data, of the mathematical data d[i] is as follows:
Re(d[i]) = data[i0 + stride*i] Im(d[i]) = data[i0 + stride*i+1]The default offset, i0, is 0 and the stride is 2. The transformed data is returned in the original data array in wrap-around order.
Constructor Summary | |
---|---|
FFT()
Constructs a complex FFT transformation. |
|
FFT(int n)
Constructs a complex FFT transformation for n complex data points. |
Method Summary | |
---|---|
double[] |
backtransform(double[] data)
Computes the back Fast Fourier Transform of data leaving the result in data. |
static int[] |
factor(int n,
int[] fromfactors)
Return the prime factors of n. |
int |
getN()
Gets the number of complex data points. |
double[] |
getNaturalFreq(double delta)
Gets an array containing the frequencies in natural order. |
double[] |
getNaturalFreq(double xmin,
double xmax)
Gets an array containing the frequencies in natural order. |
double[] |
getNaturalModes()
Gets an array containing the mode numbers in natural order. |
double[] |
getNaturalOmega(double delta)
Gets an array containing the frequencies in natural order. |
double[] |
getNaturalOmega(double xmin,
double xmax)
Gets an array containing the frequencies in natural order. |
double |
getNormalization()
Gets the normalization constant. |
double[] |
getWrappedFreq(double delta)
Gets an array containing the frequencies in wrap-around order. |
double[] |
getWrappedFreq(double xmin,
double xmax)
Gets an array containing the frequencies in wrap-around order. |
double[] |
getWrappedModes()
Gets an array containing the mode numbers in wrap-around order. |
double[] |
getWrappedOmega(double delta)
Gets an array containing the angular frequencies (wavenumber) in wrap-around order. |
double[] |
getWrappedOmega(double xmin,
double xmax)
Gets an array containing the angular frequencies (wavenumber) in wrap-around order. |
double[] |
inverse(double[] data)
Computes the (nomalized) inverse FFT of data, leaving it in place. |
void |
setN(int n)
Sets the number of complex data points. |
void |
setNormalization(double norm)
Sets the normalization constant. |
double[] |
toNaturalOrder(double[] data)
Reorder the transformed data from most negative frequency to most positive frequency leaving the result in data. |
double[] |
toWrapAroundOrder(double[] data)
Reorder the data using wraparound order. |
double[] |
transform(double[] data)
Computes the Fast Fourier Transform of data leaving the result in data. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FFT(int n)
n
- the number of complex data pointspublic FFT()
Method Detail |
---|
public void setN(int n)
n
- intpublic int getN()
public void setNormalization(double norm)
norm
- doublepublic double getNormalization()
public double[] transform(double[] data)
data
- double[] the data to be transformed
public double[] backtransform(double[] data)
data
- double[] the data to be transformed
public double[] inverse(double[] data)
Re(D[i]) = data[i] Im(D[i]) = data[i+1]
data
- double[] the data to be transformed
public double[] toNaturalOrder(double[] data)
data
- double[] the data to be transformed
public double[] toWrapAroundOrder(double[] data)
data
- double[] the data to be transformed
public double[] getWrappedModes()
public double[] getWrappedOmega(double delta)
delta
-
public double[] getWrappedOmega(double xmin, double xmax)
xmin
- xmax
-
public double[] getWrappedFreq(double delta)
delta
-
public double[] getWrappedFreq(double xmin, double xmax)
xmin
- xmax
-
public double[] getNaturalFreq(double delta)
delta
-
public double[] getNaturalFreq(double xmin, double xmax)
xmin
- xmax
-
public double[] getNaturalOmega(double delta)
delta
-
public double[] getNaturalOmega(double xmin, double xmax)
xmin
- xmax
-
public double[] getNaturalModes()
public static int[] factor(int n, int[] fromfactors)
n
- fromfactors
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |