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

#include <cmath>
#include <fftw3.h>
#include <vector>
#include <tuple>

#ifndef FFTW_THREADS
#define FFTW_THREADS 1
#endif

class FourierTransform {
private:
  Real* a;
  Complex* â;
  fftw_plan plan_r2c;
  fftw_plan plan_c2r;
  unsigned n;
  Real Δω;
  Real Δτ;
public:
  FourierTransform(unsigned n, Real Δω, Real Δτ, unsigned flags = 0);
  ~FourierTransform();
  std::vector<Complex> fourier(const std::vector<Real>& c);
  std::vector<Complex> fourier();
  std::vector<Real> inverse(const std::vector<Complex>& ĉ);
  void writeToA(unsigned i, Real ai);
  std::vector<Real> convolve(const std::vector<Real>& Γh, const std::vector<Real>& R);
};

std::string fourierFile(std::string prefix, unsigned p, unsigned s, Real λ, Real τ₀, Real y, unsigned log2n, Real τₘₐₓ);
Real energy(const std::vector<Real>& C, const std::vector<Real>& R, unsigned p, unsigned s, Real λ, Real y, Real Δτ);
std::tuple<std::vector<Complex>, std::vector<Complex>> RddfCtdfCt(FourierTransform& fft, const std::vector<Real>& C, const std::vector<Real>& R, unsigned p, unsigned s, Real λ);
Real estimateZ(FourierTransform& 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 y);