00001 #ifndef FFT_HPP 00002 #define FFT_HPP 00003 00013 00014 00017 class Complex { 00018 double re, im; 00019 public: 00021 Complex(double _re = 0, double _im = 0); 00023 double GetRe() const; 00025 double GetIm() const; 00027 double GetNorm() const; 00029 Complex operator+(const Complex &op2) const; 00031 Complex operator-(const Complex &op2) const; 00033 Complex operator*(const Complex &op2) const; 00035 Complex operator/(const Complex &op2) const; 00036 void operator+=(const Complex &op2); 00037 void operator*=(const Complex &op2); 00038 void operator/=(const Complex &op2); 00039 }; 00040 00042 00045 class FourierTransform { 00046 unsigned k; 00047 unsigned N; 00048 unsigned *rev; 00049 void set_reverse(); 00050 public: 00052 FourierTransform(unsigned _k); 00054 enum mv_mode {normal, conj}; 00056 00060 void Matvec(const Complex *vec, Complex *res, 00061 mv_mode mode = normal) const; 00063 00067 void MatvecFast(const Complex *vec, Complex *res, 00068 mv_mode mode = normal); 00070 ~FourierTransform(); 00071 }; 00072 00073 #endif /* FFT_HPP */