summaryrefslogtreecommitdiff
path: root/log-fourier.hpp
blob: b11db0fb64dda6e5cfbb77ec094db71616997fd9 (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
#pragma once
#include "types.hpp"

#include <cmath>
#include <fftw3.h>
#include <vector>
#include <gsl/gsl_sf_gamma.h>

class LogarithmicFourierTransform {
private:
  Complex* a;
  Complex* â;
  fftw_plan a_to_â;
  fftw_plan â_to_a;
  unsigned N;
  unsigned pad;
  Real k;
  Real Δτ;
  Real τₛ;
  Real ωₛ;
  Real sₛ;
public:
  LogarithmicFourierTransform(unsigned N, Real k, Real Δτ, unsigned pad = 4);
  ~LogarithmicFourierTransform();
  Real τ(unsigned n) const;
  Real ω(unsigned n) const;
  Real t(unsigned n) const;
  Real ν(unsigned n) const;
  Real s(unsigned n) const;
  std::vector<Complex> fourier(const std::vector<Real>& c, bool symmetric);
  std::vector<Real> inverse(const std::vector<Complex>& ĉ);
};

std::string logFourierFile(std::string prefix, unsigned p, unsigned s, Real λ, Real τ₀, Real β, unsigned log2n, Real Δτ, Real k);

void logFourierSave(const std::vector<Real>& C, const std::vector<Real>& R, const std::vector<Complex>& Ct, const std::vector<Complex>& Rt, unsigned p, unsigned s, Real λ, Real τ₀, Real β, unsigned log2n, Real Δτ, Real k);

bool logFourierLoad(std::vector<Real>& C, std::vector<Real>& R, std::vector<Complex>& Ct, std::vector<Complex>& Rt, unsigned p, unsigned s, Real λ, Real τ₀, Real β, unsigned log2n, Real Δτ, Real k);

std::tuple<std::vector<Complex>, std::vector<Complex>> RddfCtdfCt(LogarithmicFourierTransform& fft, const std::vector<Real>& C, const std::vector<Real>& R, unsigned p, unsigned s, Real λ);

Real estimateZ(LogarithmicFourierTransform& fft, const std::vector<Real>& C, const std::vector<Complex>& Ct, const std::vector<Real>& R, const std::vector<Complex>& Rt, unsigned p, unsigned s, Real λ, Real τ₀, Real β);

Real energy(const LogarithmicFourierTransform& fft, std::vector<Real>&  C, const std::vector<Real>& R, unsigned p, unsigned s, Real λ, Real β);