Skip to content

Commit fe358f8

Browse files
committed
Shorter version of formula, one line less
1 parent 3227558 commit fe358f8

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

contents/cooley_tukey/code/c++/fft.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ void dft(Iter X, Iter last) {
2626
std::vector<complex> tmp(N);
2727
for (auto i = 0; i < N; ++i) {
2828
for (auto j = 0; j < N; ++j) {
29-
using namespace std::literals::complex_literals;
30-
tmp[i] += X[j] * exp(-2.0 * M_PI * i * j / N * 1i);
29+
tmp[i] += X[j] * exp(complex(0, -2.0 * M_PI * i * j / N));
3130
}
3231
}
3332
std::copy(std::begin(tmp), std::end(tmp), X);

contents/cooley_tukey/cooley_tukey.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ In the end, the code looks like:
119119
{% sample lang="c" %}
120120
[import:20-39, lang:"c_cpp"](code/c/fft.c)
121121
{% sample lang="cpp" %}
122-
[import:36-67, lang:"c_cpp"](code/c++/fft.cpp)
122+
[import:35-66, lang:"c_cpp"](code/c++/fft.cpp)
123123
{% sample lang="hs" %}
124124
[import:6-19, lang:"haskell"](code/haskell/fft.hs)
125125
{% sample lang="py" %}

0 commit comments

Comments
 (0)