-
Notifications
You must be signed in to change notification settings - Fork 0
/
fft_plan.hpp
39 lines (31 loc) · 1.15 KB
/
fft_plan.hpp
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
// SPDX-License-Identifier: GPL-2.0
// Wrapper around FFTW plan, that allocates and deallocates memory.
//
// The input buffer can either be real, complex, or empty.
// The plan can either be forward (F) or backward (F^-1).
// Either the complex Fourier transform or its real norm is calculated.
// The output buffer must accordingly be either complex or real.
//
// This gives quite a lot of combinations which makes the code quite intricate.
// It might be better to split this into different classes.
#ifndef FFT_PLAN_HPP
#define FFT_PLAN_HPP
#include "aligned_buf.hpp"
#include <complex>
class FFTBuf;
class FFTPlan {
FFTBuf ∈
AlignedBuf<std::complex<double>> mid; // Intermediate buffer for real transforms.
FFTBuf &out;
void *plan; // nullptr if input is empty (i.e. generate empty output).
// The following are marked const, because the kind of plan can not change.
// To change, destroy and recreate.
const bool forward; // Forward or backward transform.
const bool norm; // Calculate norm of complex.
const bool in_is_complex;
public:
FFTPlan(FFTBuf &in, FFTBuf &out, bool forward, bool norm);
~FFTPlan();
void execute();
};
#endif