diff --git a/Homework3/src/fft.hh b/Homework3/src/fft.hh index b432a45..7640cc1 100644 --- a/Homework3/src/fft.hh +++ b/Homework3/src/fft.hh @@ -1,48 +1,56 @@ #ifndef FFT_HH #define FFT_HH /* ------------------------------------------------------ */ #include "matrix.hh" #include "my_types.hh" #include /* ------------------------------------------------------ */ struct FFT { static Matrix transform(Matrix& m); static Matrix itransform(Matrix& m); static Matrix> computeFrequencies(int size); }; /* ------------------------------------------------------ */ inline Matrix FFT::transform(Matrix& m_in) { - fftw_complex* C_in, C_out; + fftw_complex *C_in; + fftw_complex *C_out; + fftw_plan forward_plan; UInt length = m_in.size()*m_in.size(); UInt rows = m_in.rows(); UInt columns = m_in.cols(); C_in = new fftw_complex [length]; C_out = new fftw_complex [length]; - forward_plan = fftw_plan_dft_2d(rows, columns, C_in, C_out); + forward_plan = fftw_plan_dft_2d(rows, columns, C_in, C_out, FFTW_FORWARD, FFTW_ESTIMATE); + + fftw_execute(forward_plan); + + fftw_destroy_plan(forward_plan); + fftw_free(C_in); + fftw_free(C_out); } /* ------------------------------------------------------ */ inline Matrix FFT::itransform(Matrix& m_in) { } /* ------------------------------------------------------ */ /* ------------------------------------------------------ */ inline Matrix> FFT::computeFrequencies(int size) { } #endif // FFT_HH