summaryrefslogtreecommitdiff
path: root/log_get_energy.cpp
blob: 3ea2ab8eefe5bf9f9ca99cde45e244d549c5e247 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include "log-fourier.hpp"
#include <getopt.h>
#include <iostream>

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;

  /* Iteration parameters */
  Real β₀ = 0;
  Real βₘₐₓ = 0.7;
  Real Δβ = 0.01;

  int opt;

  while ((opt = getopt(argc, argv, "p:s:2:T:t:b:d:k:D:0:")) != -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 'b':
      βₘₐₓ = atof(optarg);
      break;
    case 'd':
      Δβ = atof(optarg);
      break;
    case 'k':
      k = atof(optarg);
      break;
    case 'D':
      Δτ = atof(optarg);
      break;
    case '0':
      β₀ = atof(optarg);
      break;
    default:
      exit(1);
    }
  }

  unsigned N = pow(2, log2n);

  LogarithmicFourierTransform fft(N, k, Δτ, 4);

  std::vector<Real> C(N);
  std::vector<Real> R(N);
  std::vector<Complex> Ct(N);
  std::vector<Complex> Rt(N);

  Real β = β₀;

  while (β += Δβ, β <= βₘₐₓ) {
    if (logFourierLoad(C, R, Ct, Rt, p, s, λ, τ₀, β, log2n, Δτ, k)) {

      Real e = energy(fft, C, R, p, s, λ, β);

      Real μ = estimateZ(fft, C, Ct, R, Rt, p, s, λ, τ₀, β);

      std::cout << p << " " << s << " " << λ << " " << τ₀ << " " << β << " " << μ << " " << Ct[0].real() << " " << e << std::endl;
    }
  }

  return 0;
}