diff options
author | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2025-05-08 15:59:23 -0300 |
---|---|---|
committer | Jaron Kent-Dobias <jaron@kent-dobias.com> | 2025-05-08 15:59:23 -0300 |
commit | 77e8c94e5b41287e97e36e34a97478400637d102 (patch) | |
tree | 53082e2ee0dac17202c75ea8ba3e133876fdfe95 /log-fourier_test.cpp | |
parent | 5fd9866479ec50051d2c9eeb4e217e9376e6f9b4 (diff) | |
download | code-77e8c94e5b41287e97e36e34a97478400637d102.tar.gz code-77e8c94e5b41287e97e36e34a97478400637d102.tar.bz2 code-77e8c94e5b41287e97e36e34a97478400637d102.zip |
Work to debug log-fourier
Diffstat (limited to 'log-fourier_test.cpp')
-rw-r--r-- | log-fourier_test.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/log-fourier_test.cpp b/log-fourier_test.cpp new file mode 100644 index 0000000..678e4b1 --- /dev/null +++ b/log-fourier_test.cpp @@ -0,0 +1,50 @@ +#include "log-fourier.hpp" +#include <getopt.h> +#include <iostream> + +int main(int argc, char* argv[]) { + /* Log-Fourier parameters */ + unsigned log2n = 8; + Real Δτ = 0.1; + Real k = 0.1; + unsigned pad = 4; + + int opt; + + while ((opt = getopt(argc, argv, "p:s:2:T:t:b:d:g:k:D:e:0:lS:x:P:")) != -1) { + switch (opt) { + case '2': + log2n = atoi(optarg); + break; + case 'k': + k = atof(optarg); + break; + case 'D': + Δτ = atof(optarg); + break; + case 'P': + pad = atoi(optarg); + break; + default: + exit(1); + } + } + + unsigned N =log2n; + + LogarithmicFourierTransform fft(N, k, Δτ, pad); + + std::vector<Complex> a(N); + + for (unsigned i = 0; i < N; i++) { + a[i] = 1 / (1 + pow(fft.ν(i), 2)); + } + + std::vector<Real> â = fft.inverse(a); + + for (unsigned i = 0; i < N; i++) { + std::cout << fft.t(i) << " " << â[i] << std::endl; + } + + return 0; +} |