From 85bd7d1931b2f1d036d12ccfef3f4e9393cbbe8f Mon Sep 17 00:00:00 2001 From: majiang Date: Fri, 25 Oct 2013 23:19:42 +0900 Subject: [PATCH] improve Fft comments: fix typo 'nterleaved'; add description of FFT conventions --- std/numeric.d | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/std/numeric.d b/std/numeric.d index 5aca3f4b342..f7983b3717e 100644 --- a/std/numeric.d +++ b/std/numeric.d @@ -2343,9 +2343,9 @@ private: immutable halfLen = n / 2; - // This loop is unrolled and the two iterations are nterleaved relative - // to the textbook FFT to increase ILP. This gives roughly 5% speedups - // on DMD. + // This loop is unrolled and the two iterations are interleaved + // relative to the textbook FFT to increase ILP. This gives roughly 5% + // speedups on DMD. for(size_t k = 0; k < halfLen; k += 2) { immutable cosTwiddle1 = cosFromLookup(k); immutable sinTwiddle1 = negSinFromLookup(k); @@ -2471,6 +2471,9 @@ public: * * Returns: An array of complex numbers representing the transformed data in * the frequency domain. + * + * Conventions: The exponent is negative and the factor is one, + * i.e., output[j] := sum[ exp(-2 PI i j k / N) input[k] ]. */ Complex!F[] fft(F = double, R)(R range) const if(isFloatingPoint!F && isRandomAccessRange!R) { @@ -2527,6 +2530,9 @@ public: * the same compile-time interface. * * Returns: The time-domain signal. + * + * Conventions: The exponent is positive and the factor is 1/N, i.e., + * output[j] := (1 / N) sum[ exp(+2 PI i j k / N) input[k] ]. */ Complex!F[] inverseFft(F = double, R)(R range) const if(isRandomAccessRange!R && isComplexLike!(ElementType!R) && isFloatingPoint!F) {