frost-fft
Version:
Fast Fourier Transform (FFT) implementation in TypeScript using the Cooley–Tukey algorithm for power-of-2 input lengths
32 lines (31 loc) • 1.46 kB
TypeScript
/**
* Reset internal tables. Used during benchmarking.
*/
export declare function _resetTables(): void;
/**
* Calculate the smallest power of two greater or equal to the input value.
* @param x Integer to compare to.
* @returns Smallest `2**n` such that `x <= 2**n`.
*/
export declare function ceilPow2(x: number): number;
/**
* Calculate the unnormalized forward discrete Fourier transform.
* @param realIn Real components of the signal.
* @param imagIn Imaginary components of the signal (all zeros assumed if missing).
* @returns Array of [real coefficients, imaginary coefficients].
*/
export declare function fft(realIn: Float64Array, imagIn?: Float64Array): [Float64Array, Float64Array];
/**
* Calculate the unnormalized reverse discrete Fourier transform.
* @param realIn Real coefficients of a forward transform.
* @param imagIn Imaginary coefficients of a forward transform.
* @returns Array of [real signal, imaginary signal] scaled by the length of the original signal.
*/
export declare function ifft(realIn: Float64Array, imagIn: Float64Array): [Float64Array, Float64Array];
/**
* Calculate the unnormalized reverse discrete Fourier transform.
* @param realIn Real coefficients of a forward transform.
* @param imagIn Imaginary coefficients of a forward transform.
* @returns Real signal scaled by the length of the original signal.
*/
export declare function ifftReal(realIn: Float64Array, imagIn: Float64Array): Float64Array;