summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2025-04-05 11:12:15 -0300
committerJaron Kent-Dobias <jaron@kent-dobias.com>2025-04-05 11:12:15 -0300
commit96875ddafbf1ff821a4a1fd628c2e4758096700c (patch)
tree16d00b3727c5273233be6af37c29361cdbf100a6
parent44ed3056e815910b7f61c62a9b71976a3c47f4b3 (diff)
downloadcode-96875ddafbf1ff821a4a1fd628c2e4758096700c.tar.gz
code-96875ddafbf1ff821a4a1fd628c2e4758096700c.tar.bz2
code-96875ddafbf1ff821a4a1fd628c2e4758096700c.zip
Save and read fftw wisdom to speed initialization
-rw-r--r--fourier.cpp2
-rw-r--r--get_energy.cpp2
2 files changed, 3 insertions, 1 deletions
diff --git a/fourier.cpp b/fourier.cpp
index 1bef4b9..0c22637 100644
--- a/fourier.cpp
+++ b/fourier.cpp
@@ -25,8 +25,10 @@ Real ddf(Real λ, unsigned p, unsigned s, Real q) {
}
FourierTransform::FourierTransform(unsigned n, Real Δω, Real Δτ, unsigned flags) : a(2 * n), â(n + 1), Δω(Δω), Δτ(Δτ) {
+ fftw_import_wisdom_from_filename("fftw.wisdom");
plan_r2c = fftw_plan_dft_r2c_1d(2 * n, a.data(), reinterpret_cast<fftw_complex*>(â.data()), flags);
plan_c2r = fftw_plan_dft_c2r_1d(2 * n, reinterpret_cast<fftw_complex*>(â.data()), a.data(), flags);
+ fftw_export_wisdom_to_filename("fftw.wisdom");
}
FourierTransform::~FourierTransform() {
diff --git a/get_energy.cpp b/get_energy.cpp
index ae77595..8c610c5 100644
--- a/get_energy.cpp
+++ b/get_energy.cpp
@@ -55,7 +55,7 @@ int main(int argc, char* argv[]) {
Real y = y₀;
- FourierTransform fft(n, Δω, Δτ, FFTW_ESTIMATE);
+ FourierTransform fft(n, Δω, Δτ);
std::vector<Real> C(2 * n);
std::vector<Real> R(2 * n);