Merge pull request #1664 from majiang/master

improve Fft comments: add description of FFT conventions
This commit is contained in:
David Nadlinger 2013-10-29 08:20:19 -07:00
commit 6dbeb6b8a7

View file

@ -2339,9 +2339,9 @@ private:
immutable halfLen = n / 2; immutable halfLen = n / 2;
// This loop is unrolled and the two iterations are nterleaved relative // This loop is unrolled and the two iterations are interleaved
// to the textbook FFT to increase ILP. This gives roughly 5% speedups // relative to the textbook FFT to increase ILP. This gives roughly 5%
// on DMD. // speedups on DMD.
for(size_t k = 0; k < halfLen; k += 2) { for(size_t k = 0; k < halfLen; k += 2) {
immutable cosTwiddle1 = cosFromLookup(k); immutable cosTwiddle1 = cosFromLookup(k);
immutable sinTwiddle1 = negSinFromLookup(k); immutable sinTwiddle1 = negSinFromLookup(k);
@ -2467,6 +2467,9 @@ public:
* *
* Returns: An array of complex numbers representing the transformed data in * Returns: An array of complex numbers representing the transformed data in
* the frequency domain. * 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 Complex!F[] fft(F = double, R)(R range) const
if(isFloatingPoint!F && isRandomAccessRange!R) { if(isFloatingPoint!F && isRandomAccessRange!R) {
@ -2523,6 +2526,9 @@ public:
* the same compile-time interface. * the same compile-time interface.
* *
* Returns: The time-domain signal. * 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 Complex!F[] inverseFft(F = double, R)(R range) const
if(isRandomAccessRange!R && isComplexLike!(ElementType!R) && isFloatingPoint!F) { if(isRandomAccessRange!R && isComplexLike!(ElementType!R) && isFloatingPoint!F) {