From 79e8e2ceddbf86b4b9d4240a156bd7cfb2e615ef Mon Sep 17 00:00:00 2001 From: Guillaume Courrier Date: Tue, 26 Nov 2019 13:50:55 +0100 Subject: [PATCH] =?UTF-8?q?Impl=C3=A9mentation=20de=20la=20fft?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/src/math.hpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tests/src/math.hpp b/tests/src/math.hpp index 46bcb99..77a2b3c 100644 --- a/tests/src/math.hpp +++ b/tests/src/math.hpp @@ -33,18 +33,19 @@ namespace math { return complex(res.real()/sig.size(), res.imag()/sig.size()); }; - //TODO: implémenter la fonction csignal diff(const csignal& input, complex mean) { - return csignal(); + csignal res; + for (auto x: input) { + res.push_back(x - mean); + } + return res; } - //TODO implémenter la fft csignal fft_rec(const csignal& input) { int size = input.size(); if (size == 1) { - //TODO: que faire dans ce cas ? - return csignal(); + return input; } else { csignal odd; csignal even; @@ -90,7 +91,6 @@ namespace math { int kmax = 2*cmax; for (int m=0; m