Dhairya Malhotra 7 年之前
父節點
當前提交
e576003513
共有 1 個文件被更改,包括 6 次插入4 次删除
  1. 6 4
      include/sctl/fft_wrapper.hpp

+ 6 - 4
include/sctl/fft_wrapper.hpp

@@ -329,9 +329,10 @@ template <> class FFT<double> : public FFT_Generic<double, FFT<double>> {
   ~FFT() { if (this->Dim(0) && this->Dim(1)) fftw_destroy_plan(plan); }
 
   void Setup(FFT_Type fft_type_, Long howmany_, const Vector<Long>& dim_vec) {
-    if (Dim(0) && Dim(1)) fftw_destroy_plan(plan); plan = NULL;
+    if (Dim(0) && Dim(1)) fftw_destroy_plan(plan);
     this->fft_type = fft_type_;
     this->howmany = howmany_;
+    plan = NULL;
 
     Long rank = dim_vec.Dim();
     Vector<int> dim_vec_(rank);
@@ -389,7 +390,6 @@ template <> class FFT<double> : public FFT_Generic<double, FFT<double>> {
   }
 
   void Execute(const Vector<ValueType>& in, Vector<ValueType>& out) const {
-    // TODO: check alignment of in and out
     Long N0 = this->Dim(0);
     Long N1 = this->Dim(1);
     if (!N0 || !N1) return;
@@ -437,9 +437,10 @@ template <> class FFT<float> : public FFT_Generic<float, FFT<float>> {
   ~FFT() { if (this->Dim(0) && this->Dim(1)) fftwf_destroy_plan(plan); }
 
   void Setup(FFT_Type fft_type_, Long howmany_, const Vector<Long>& dim_vec) {
-    if (Dim(0) && Dim(1)) fftwf_destroy_plan(plan); plan = NULL;
+    if (Dim(0) && Dim(1)) fftwf_destroy_plan(plan);
     this->fft_type = fft_type_;
     this->howmany = howmany_;
+    plan = NULL;
 
     Long rank = dim_vec.Dim();
     Vector<int> dim_vec_(rank);
@@ -544,9 +545,10 @@ template <> class FFT<long double> : public FFT_Generic<long double, FFT<long do
   ~FFT() { if (this->Dim(0) && this->Dim(1)) fftwl_destroy_plan(plan); }
 
   void Setup(FFT_Type fft_type_, Long howmany_, const Vector<Long>& dim_vec) {
-    if (Dim(0) && Dim(1)) fftwl_destroy_plan(plan); plan = NULL;
+    if (Dim(0) && Dim(1)) fftwl_destroy_plan(plan);
     this->fft_type = fft_type_;
     this->howmany = howmany_;
+    plan = NULL;
 
     Long rank = dim_vec.Dim();
     Vector<int> dim_vec_(rank);