summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--print_correlations.cpp86
1 files changed, 86 insertions, 0 deletions
diff --git a/print_correlations.cpp b/print_correlations.cpp
new file mode 100644
index 0000000..45a10b5
--- /dev/null
+++ b/print_correlations.cpp
@@ -0,0 +1,86 @@
+#include "log-fourier.hpp"
+
+#include <getopt.h>
+#include <iostream>
+#include <iomanip>
+#include <filesystem>
+
+int main(int argc, char* argv[]) {
+ /* Model parameters */
+ unsigned p = 2;
+ unsigned s = 2;
+ Real λ = 0.5;
+ Real τ₀ = 0;
+
+ /* Log-Fourier parameters */
+ unsigned log2n = 8;
+ Real Δτ = 0.1;
+ Real k = 0.1;
+ unsigned pad = 2;
+ Real logShift = 0;
+ bool shiftSquare = false;
+
+ /* Iteration parameters */
+ Real β = 0;
+
+ int opt;
+
+ while ((opt = getopt(argc, argv, "p:s:2:T:t:k:h:D:0:S")) != -1) {
+ switch (opt) {
+ case 'p':
+ p = atoi(optarg);
+ break;
+ case 's':
+ s = atoi(optarg);
+ break;
+ case '2':
+ log2n = atoi(optarg);
+ break;
+ case 't':
+ τ₀ = atof(optarg);
+ break;
+ case 'k':
+ k = atof(optarg);
+ break;
+ case 'h':
+ logShift = atof(optarg);
+ break;
+ case 'D':
+ Δτ = atof(optarg);
+ break;
+ case '0':
+ β = atof(optarg);
+ break;
+ case 'S':
+ shiftSquare = true;
+ break;
+ default:
+ exit(1);
+ }
+ }
+
+ unsigned N = pow(2, log2n);
+ Real Γ₀ = 1;
+ Real μ₀ = τ₀ > 0 ? (sqrt(1+4*Γ₀*τ₀)-1)/(2*τ₀) : Γ₀;
+
+ Real shift = μ₀ * pow(10, logShift);
+ if (shiftSquare) shift *= μ₀;
+ LogarithmicFourierTransform fft(N, k, Δτ, pad, shift);
+
+ std::vector<Real> C(N);
+ std::vector<Real> R(N);
+ std::vector<Complex> Ĉ(N);
+ std::vector<Complex> Ȓ(N);
+
+ std::cout << std::setprecision(16);
+
+ if (std::filesystem::exists(logFourierFile("C", p, s, λ, τ₀, β, log2n, Δτ, logShift))) {
+ logFourierLoad(C, R, Ĉ, Ȓ, p, s, λ, τ₀, β, log2n, Δτ, logShift);
+
+ for (unsigned n = 0; n < N; n++) {
+ std::cout << fft.t(n) << " " << C[n] << " " << R[n] << " " << fft.ν(n) << " " << Ĉ[n] << " " << Ȓ[n] << std::endl;
+ }
+ }
+
+ return 0;
+}