INTERFACE PZFourierChain; TYPE T = ARRAY OF ARRAY OF LONGREAL; (* Row i of FourierChain contains the Fourier coefficients of coordinate i of a FloatChain. *) PROCEDURE FFT(VAR V: ARRAY OF LONGREAL; VAR F: ARRAY OF LONGREAL); (* This routine computes the ``smart'' Fourier transform "F" of a vector "v", and its inverse. By definition he two are related by the equation "v[i] = Sum { F[j] * basis(N,j)(i) : j = 0..N-1 } where "basis(N,j)(i) = sqrt(2/N) * cos((2*Pi*j*i / N) + Pi/4)" and "N = NUMBER(v) = NUMBER(F)". The "basis" functions are orthonormal, meaning that "Sum { basis(N,j)(i)*basis(N,k)(i) : i = 0..N-1 } = dirac(j,k)" for all "j" and "k" in "0..N-1". Therefore, the Fourier transform "F" can be computed by scalar products: "F[j] = Sum { v[i] * basis(N,j)(i) : i = 0..N-1 }" The actual frequency of component "F[j]" is "MIN(j MOD N, (N-j) MOD N)". *) PROCEDURE Order(band, step, length: LONGREAL): CARDINAL; (* Selects a suitable number of resampling points for computing the FFT of a FloatChain, given the filter cutoff wavelength "band", the minimum spacing "step", and the total chain length "length". *) PROCEDURE Diff(VAR F: T; order: CARDINAL); (* Replaces the FFT of a curve by the FFT of its "order"th derivative, after discarding the maximum frequency term. *) END PZFourierChain.