MCPcopy Create free account
hub / github.com/algorithm-archivists/algorithm-archive / dft

Function dft

contents/cooley_tukey/code/cpp/fft.cpp:24–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22
23template <typename Iter>
24void dft(Iter X, Iter last) {
25 const auto N = last - X;
26 std::vector<complex> tmp(N);
27 for (auto i = 0; i < N; ++i) {
28 for (auto j = 0; j < N; ++j) {
29 tmp[i] += X[j] * exp(complex(0, -2.0 * M_PI * i * j / N));
30 }
31 }
32 std::copy(std::begin(tmp), std::end(tmp), X);
33}
34
35// `cooley_tukey` does the cooley-tukey algorithm, recursively
36template <typename Iter>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected