00001 #ifndef vnl_fft_1d_h_ 00002 #define vnl_fft_1d_h_ 00003 /* 00004 fsm@robots.ox.ac.uk 00005 */ 00006 00007 //: In-place 1D fast fourier transform. 00008 00009 #include <vnl/vnl_vector.h> 00010 #include <vnl/algo/vnl_fft_base.h> 00011 00012 template <class T> 00013 struct vnl_fft_1d : vnl_fft_base<1, T> 00014 { 00015 typedef vnl_fft_base<1, T> base; 00016 00017 //: constructor takes length of signal. 00018 vnl_fft_1d(int N) { 00019 base::factors_[0].resize(N); 00020 } 00021 00022 00023 //: dir = +1/-1 according to direction of transform. 00024 void transform(vnl_vector<vcl_complex<T> > &signal, int dir) 00025 { base::transform(signal.data_block(), dir); } 00026 00027 //: forward FFT 00028 void fwd_transform(vnl_vector<vcl_complex<T> > &signal) 00029 { transform(signal, +1); } 00030 00031 //: backward (inverse) FFT 00032 void bwd_transform(vnl_vector<vcl_complex<T> > &signal) 00033 { transform(signal, -1); } 00034 00035 //: return length of signal. 00036 unsigned size() const { return base::factors_[0].number(); } 00037 00038 }; 00039 00040 #endif