ts-scikit
Version:
A scientific toolkit written in Typescript
156 lines (155 loc) • 6.95 kB
TypeScript
/**
* A fast Fourier transform of complex-valued arrays.
* <p>
* The FFT length nfft equals the number of <em>complex</em> numbers
* transformed. The transform of nfft complex numbers yields nfft compplex
* numbers. Those complex numbers are packed into arrays as [real_0, imag_0,
* real-1, imag_1, ...]. Here, real_k and imag_k correspond to the real and
* imaginary parts, respectively, of the complex number with array index k.
* <p>
* When input and output arrays are the same array, transforms are
* performed in-place. For example, an input array cx[2*nfft] of nfft
* complex numbers may be the same as an output array cy[2*nfft] of
* nfft complex numbers. By "the same array", we mean that cx==cy.
* <p>
* Transforms may be performed for any dimension of a multi-dimensional
* array. For example, we may transform the 1st dimension of an input
* array cx[n2][2*nfft] of n2*nfft complex numbers to an output array
* cy[n2][2*nfft] of n2*nfft complex numbers. Or, we may transform the
* 2nd dimension of an input array cx[nfft][2*n1] of nfft*n1 complex
* numbers to an output array cy[nfft][2*n1] of nfft*n1 complex numbers.
* In either case, the input array cx and the output array cy may be the
* same array, such that the transform may be performed in-place.
*/
export declare class FftComplex {
private readonly _nfft;
/**
* Returns an FFT length optimized for speed.
* <p>
* 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.
* @returns the FFT length.
*/
static FastNFFT(n: number): number;
/**
* Returns an FFT length optimized for memory.
* <p>
* 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.
*/
static SmallNFFT(n: number): number;
private static _checkSign;
private static _checkArray;
/**
* Constructs a new FFT, with specified length.
* <p>
* Valid FFT lengths an be obtained by calling the methods
* {@link SmallNFFT} and {@link FastNFFT}.
* @param nfft the FFT length, which must be valid.
*/
constructor(nfft: number);
/**
* The FFT length for this FFT.
*/
get nfft(): number;
/**
* Computes a complex-to-complex fast Fourier transform.
* Transforms a 1-D input array cx[2*nfft] of nfft complex numbers
* to a 1-D output array cy[2*nfft] of nfft complex numbers.
* @param sign the sign (1 or -1) of the exponent used in the FFT.
* @param cx the input array.
* @param cy the output array.
*/
complexToComplex(sign: number, cx: number[], cy: number[]): void;
/**
* Computes a complex-to-complex dimension-1 fast Fourier transform.
* <p>
* Transforms a 2-D input array cx[n2][2*nfft] of n2*nfft complex numbers
* to a 2-D output array cy[n2][2*nfft] of n2*nfft complex numbers.
* @param sign the sign (1 or -1) of the exponent used in the FFT.
* @param n2 the 2nd dimension of arrays.
* @param cx the input array.
* @param cy the output array.
*/
complexToComplex1(sign: number, cx: number[][], cy: number[][], n2: number): void;
/**
* Computes a complex-to-complex dimension-1 fast Fourier transform.
* <p>
* Transforms a 3-D input array cx[n3][n2][2*nfft] of n3*n2*nfft complex
* numbers to a 3-D output array cy[n3][n2][2*nfft] of n3*n2*nfft complex
* numbers.
* @param sign the sign (1 or -1) of the exponent used in the FFT.
* @param n2 the 2nd dimension of arrays.
* @param n3 the 3rd dimension of arrays.
* @param cx the input array.
* @param cy the output array.
*/
complexToComplex1(sign: number, cx: number[][][], cy: number[][][], n2: number, n3: number): void;
/**
* Computes a complex-to-complex dimension-2 fast Fourier transform.
* <p>
* Transforms a 2-D input array cx[nfft][2*n1] of nfft*n1 complex numbers
* to a 2-D output array cy[nfft][2*n1] of nfft*n1 complex numbers.
* @param sign the sign (1 or -1) of the exponent used in the FFT.
* @param n1 the 1st dimension of arrays.
* @param cx the input array.
* @param cy the output array.
*/
complexToComplex2(sign: number, cx: number[][], cy: number[][], n1: number): void;
/**
* Computes a complex-to-complex dimension-2 fast Fourier transform.
* <p>
* Transforms a 3-D input array cx[n3][nfft][2*n1] of n3*nfft*n1 complex
* numbers to a 3-D output array cy[n3][nfft][2*n1] of n3*nfft*n1 complex
* numbers.
* @param sign the sign (1 or -1) of the exponent used in the FFT.
* @param n1 the 1st dimension of arrays.
* @param n3 the 3rd dimension of arrays.
* @param cx the input array.
* @param cy the output array.
*/
complexToComplex2(sign: number, cx: number[][][], cy: number[][][], n1: number, n3: number): void;
/**
* Computes a complex-to-complex dimension-3 fast Fourier transform.
* <p>
* Transforms a 3-D input array cx[nfft][n2][2*n1] of nfft*n2*n1 complex
* numbers to a 3-D output array cy[nfft][n2][2*n1] of nfft*n2*n1 complex
* numbers.
* @param sign the sign (1 or -1) of the exponent used in the FFT.
* @param n1 the 1st dimension of arrays.
* @param n2 the 2nd dimension of arrays.
* @param cx the input array.
* @param cy the output array.
*/
complexToComplex3(sign: number, cx: number[][][], cy: number[][][], n1: number, n2: number): void;
/**
* Scales n1 complex numbers in the specified array by 1/nfft.
* The inverse of a complex-to-complex FFT is a complex-to-complex
* FFT (with opposite sign) followed by this scaling.
* @param n1 1st (only) dimension of the array cx.
* @param cx the input/output array[2*n1].
*/
scale(cx: number[], n1: number): void;
/**
* Scales n1*n2 complex numbers in the specified array by 1/nfft.
* The inverse of a complex-to-complex FFT is a complex-to-complex
* FFT (with opposite sign) followed by this scaling.
* @param n1 the 1st dimension of the array cx.
* @param n2 the 2nd dimension of the array cx.
* @param cx the input/output array[n2][2*n1].
*/
scale(cx: number[][], n1: number, n2: number): void;
/**
* Scales n1*n2*n3 complex numbers in the specified array by 1/nfft.
* The inverse of a complex-to-complex FFT is a complex-to-complex
* FFT (with opposite sign) followed by this scaling.
* @param n1 the 1st dimension of the array cx.
* @param n2 the 2nd dimension of the array cx.
* @param n3 the 3rd dimension of the array cx.
* @param cx the input/output array[n3][n2][2*n1].
*/
scale(cx: number[][][], n1: number, n2: number, n3: number): void;
}