Anonymous user
Fast Fourier transform: Difference between revisions
Updated D code
(Updated D code) |
|||
Line 347:
int N = x.length;
if (N <= 1) return x;
auto ev =
auto od =
auto l = map!(k => ev[k] + expi(-2*PI*k/N) * od[k])(iota(N / 2));
auto r = map!(k => ev[k] - expi(-2*PI*k/N) * od[k])(iota(N / 2));
return
}
Line 358:
}</lang>
Output:<pre>[4+0i, 1+-2.41421i, 0+0i, 1+-0.414214i, 0+0i, 1+0.414214i, 0+0i, 1+2.41421i]</pre>
But in D2 built-in complex numbers will be deprecated.
=={{header|GAP}}==
|