|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.mines.jtk.dsp.FftReal
public class FftReal
Fast Fourier transform of real-valued arrays. The FFT length nfft equals the number of real numbers transformed. The transform of nfft real numbers yields nfft/2+1 complex numbers. (The imaginary parts of the first and last complex numbers are always zero.) For real-to-complex and complex-to-real transforms, nfft is always an even number.
Complex numbers are packed into arrays of floats as [real_0, imag_0, real_1, imag_1, ...]. Here, real_k and imag_k correspond to the real and imaginary parts of the complex number with index k.
When input and output arrays are the same array, transforms are performed in-place. For example, an input array rx[nfft] of nfft real numbers may be the same as an output array cy[nfft+2] of nfft/2+1 complex numbers. By "the same array", we mean that rx==cy. In this case, both rx.length and cy.length equal nfft+2. When we write rx[nfft] (here and below), we imply that only the first nfft floats in the input array rx are accessed.
Transforms may be performed for any dimension of a multi-dimensional array. For example, we may transform the 1st dimension of an input array rx[n2][nfft] of n2*nfft real numbers to an output array cy[n2][nfft+2] of n2*(nfft/2+1) complex numbers. Or, we may transform the 2nd dimension of an input array rx[nfft][n1] of nfft*n1 real numbers to an output array cy[nfft/2+1][2*n1] of (nfft/2+1)*n1 complex numbers. In either case, the input array rx and the output array cy may be the same array, such that the transform may be performed in-place.
In-place transforms are typically used to reduce memory consumption. Note, however, that memory consumption is reduced for only dimension-1 in-place transforms. Dimension-2 (and higher) in-place transforms save no memory, because of the contiguous packing of real and imaginary parts of complex numbers in multi-dimensional arrays of floats. (See above.) Therefore, dimension-1 transforms are best when performing real-to-complex or complex-to-real transforms of multi-dimensional arrays.
| Constructor Summary | |
|---|---|
FftReal(int nfft)
Constructs a new FFT, with specified length. |
|
| Method Summary | |
|---|---|
void |
complexToReal(int sign,
float[] cx,
float[] ry)
Computes a complex-to-real fast Fourier transform. |
void |
complexToReal1(int sign,
int n2,
float[][] cx,
float[][] ry)
Computes a complex-to-real dimension-1 fast Fourier transform. |
void |
complexToReal1(int sign,
int n2,
int n3,
float[][][] cx,
float[][][] ry)
Computes a complex-to-real dimension-1 fast Fourier transform. |
void |
complexToReal2(int sign,
int n1,
float[][] cx,
float[][] ry)
Computes a complex-to-real dimension-2 fast Fourier transform. |
int |
getNfft()
Gets the FFT length nfft for this FFT. |
static int |
nfftFast(int n)
Returns an FFT length optimized for speed. |
static int |
nfftSmall(int n)
Returns an FFT length optimized for memory. |
void |
realToComplex(int sign,
float[] rx,
float[] cy)
Computes a real-to-complex fast Fourier transform. |
void |
realToComplex1(int sign,
int n2,
float[][] rx,
float[][] cy)
Computes a real-to-complex dimension-1 fast Fourier transform. |
void |
realToComplex1(int sign,
int n2,
int n3,
float[][][] rx,
float[][][] cy)
Computes a real-to-complex dimension-1 fast Fourier transform. |
void |
realToComplex2(int sign,
int n1,
float[][] rx,
float[][] cy)
Computes a real-to-complex dimension-2 fast Fourier transform. |
void |
scale(int n1,
float[] rx)
Scales n1 real numbers in the specified array by 1/nfft. |
void |
scale(int n1,
int n2,
float[][] rx)
Scales n1*n2 real numbers in the specified array by 1/nfft. |
void |
scale(int n1,
int n2,
int n3,
float[][][] rx)
Scales n1*n2*n3 real numbers in the specified array by 1/nfft. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FftReal(int nfft)
nfftSmall(int)
and nfftFast(int).
nfft - the FFT length, which must be valid.| Method Detail |
|---|
public static int nfftSmall(int n)
n - the lower bound on FFT length.
java.lang.IllegalArgumentException - if the specified length n exceeds
the maximum length supported by this implementation. Currently, the
maximum length is 1,441,440.public static int nfftFast(int n)
n - the lower bound on FFT length.
java.lang.IllegalArgumentException - if the specified length n exceeds
the maximum length supported by this implementation. Currently, the
maximum length is 1,441,440.public int getNfft()
public void realToComplex(int sign,
float[] rx,
float[] cy)
sign - the sign (1 or -1) of the exponent used in the FFT.rx - the input array.cy - the output array.
public void complexToReal(int sign,
float[] cx,
float[] ry)
sign - the sign (1 or -1) of the exponent used in the FFT.cx - the input array.ry - the output array.
public void realToComplex1(int sign,
int n2,
float[][] rx,
float[][] cy)
sign - the sign (1 or -1) of the exponent used in the FFT.n2 - the 2nd dimension of arrays.rx - the input array.cy - the output array.
public void complexToReal1(int sign,
int n2,
float[][] cx,
float[][] ry)
sign - the sign (1 or -1) of the exponent used in the FFT.n2 - the 2nd dimension of arrays.cx - the input array.ry - the output array.
public void realToComplex2(int sign,
int n1,
float[][] rx,
float[][] cy)
sign - the sign (1 or -1) of the exponent used in the FFT.n1 - the 1st dimension of arrays.rx - the input array.cy - the output array.
public void complexToReal2(int sign,
int n1,
float[][] cx,
float[][] ry)
sign - the sign (1 or -1) of the exponent used in the FFT.n1 - the 1st dimension of arrays.cx - the input array.ry - the output array.
public void realToComplex1(int sign,
int n2,
int n3,
float[][][] rx,
float[][][] cy)
sign - the sign (1 or -1) of the exponent used in the FFT.n2 - the 2nd dimension of arrays.n3 - the 3rd dimension of arrays.rx - the input array.cy - the output array.
public void complexToReal1(int sign,
int n2,
int n3,
float[][][] cx,
float[][][] ry)
sign - the sign (1 or -1) of the exponent used in the FFT.n2 - the 2nd dimension of arrays.n3 - the 3rd dimension of arrays.cx - the input array.ry - the output array.
public void scale(int n1,
float[] rx)
n1 - 1st (only) dimension of the array rx.rx - the input/output array[n1].
public void scale(int n1,
int n2,
float[][] rx)
n1 - the 1st dimension of the array rx.n2 - the 2nd dimension of the array rx.rx - the input/output array[n2][n1].
public void scale(int n1,
int n2,
int n3,
float[][][] rx)
n1 - the 1st dimension of the array rx.n2 - the 2nd dimension of the array rx.n3 - the 3rd dimension of the array rx.rx - the input/output array[n3][n2][n1].
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||