15 #ifndef __gfftstdalg_h
16 #define __gfftstdalg_h
49 template<
int_t K,
int_t M,
typename T,
int S,
class W,
bool doStaticLoop>
52 template<int_t K, int_t M,
typename T,
int S,
class W,
53 template<
typename>
class Complex>
54 class DFTk_x_Im_T<K,M,Complex<T>,S,W,false>
57 typedef Compute<typename W::Re,2> WR;
58 typedef Compute<typename W::Im,2> WI;
59 static const int_t N = K*M;
60 DFTk_inp<K,M,Complex<T>,S> spec_inp;
62 void apply(Complex<T>* data)
66 Complex<T> w[K-1], wp[K-1];
69 wp[0] = Complex<T>(WR::value(), WI::value());
74 for (int_t i=0; i<K-2; ++i)
75 wp[i+1] = wp[i]*wp[0];
77 for (int_t i=0; i<K-1; ++i)
80 for (int_t i=1; i<M; i++) {
81 spec_inp.apply(data+i, w);
83 for (int_t i=0; i<K-1; ++i)
90 template<int_t M,
typename T,
int S,
class W,
91 template<
typename>
class Complex>
92 class DFTk_x_Im_T<3,M,Complex<T>,S,W,false> {
94 typedef Compute<typename W::Re,2> WR;
95 typedef Compute<typename W::Im,2> WI;
96 static const int_t N = 3*M;
98 DFTk_inp<3,M,Complex<T>,S> spec_inp;
100 void apply(Complex<T>* data)
102 spec_inp.apply(data);
110 Complex<T> wp1(WR::value(), WI::value());
113 Complex<T> wp2(wp1*wp1);
117 for (int_t i=1; i<M; i++) {
118 spec_inp.apply(data+i, w);
126 template<int_t M,
typename T,
int S,
class W,
127 template<
typename>
class Complex>
128 class DFTk_x_Im_T<2,M,Complex<T>,S,W,false> {
129 typedef typename TempTypeTrait<T>::Result LocalVType;
130 typedef Compute<typename W::Re,2> WR;
131 typedef Compute<typename W::Im,2> WI;
132 DFTk_inp<2,M,Complex<T>,S> spec_inp;
134 void apply(Complex<T>* data)
136 spec_inp.apply(data);
141 Complex<T> wp(WR::value(), WI::value());
144 for (int_t i=1; i<M; i++) {
145 spec_inp.apply(data+i, &w);
154 template<int_t N,
typename Head,
typename T,
int S,
class W1, int_t LastK,
155 template<
typename>
class Complex>
156 class InTime<N, Loki::Typelist<Head,Loki::NullType>, Complex<T>, S, W1, LastK>
158 typedef typename TempTypeTrait<T>::Result LocalVType;
159 static const int_t K = Head::first::value;
160 static const int_t M = N/K;
162 typedef typename IPowBig<W1,K>::Result WK;
163 typedef Loki::Typelist<Pair<
typename Head::first,
SInt<Head::second::value-1> >, Loki::NullType> NFactNext;
164 InTime<M,NFactNext,Complex<T>,S,WK,K*LastK> dft_str;
166 DFTk_x_Im_T<K,M,Complex<T>,S,W1,
false> dft_scaled;
168 void apply(Complex<T>* data)
170 for (int_t m=0; m < N; m+=M)
171 dft_str.apply(data + m);
173 dft_scaled.apply(data);
178 template<int_t N, int_t K,
typename Tail,
typename T,
int S,
class W1, int_t LastK,
179 template<
typename>
class Complex>
180 class InTime<N, Loki::Typelist<Pair<SInt<K>, SInt<0> >,Tail>, Complex<T>, S, W1, LastK>
181 :
public InTime<N, Tail, Complex<T>, S, W1, LastK> {};
185 template<int_t N,
typename T,
int S,
class W1, int_t LastK,
186 template<
typename>
class Complex>
187 class InTime<N,Loki::Typelist<Pair<SInt<N>, SInt<1> >, Loki::NullType>,Complex<T>,S,W1,LastK> {
188 DFTk_inp<N, 1, Complex<T>, S> spec_inp;
190 void apply(Complex<T>* data)
192 spec_inp.apply(data);
199 template<int_t N,
typename Head,
typename Tail,
typename T,
int S,
class W1, int_t LastK,
200 template<
typename>
class Complex>
201 class InTimeOOP<N, Loki::Typelist<Head,Tail>, Complex<T>, S, W1, LastK>
203 typedef typename TempTypeTrait<T>::Result LocalVType;
204 static const int_t K = Head::first::value;
205 static const int_t M = N/K;
207 typedef typename IPowBig<W1,K>::Result WK;
208 typedef Loki::Typelist<Pair<
typename Head::first,
SInt<Head::second::value-1> >, Tail> NFactNext;
209 InTimeOOP<M,NFactNext,Complex<T>,S,WK,K*LastK> dft_str;
211 DFTk_x_Im_T<K,M,Complex<T>,S,W1,
false> dft_scaled;
214 void apply(
const Complex<T>* src, Complex<T>* dst)
217 for (int_t m = 0; m < N; m+=M, lk+=LastK)
218 dft_str.apply(src + lk, dst + m);
220 dft_scaled.apply(dst);
225 template<int_t N, int_t K,
typename Tail,
typename T,
int S,
class W1, int_t LastK,
226 template<
typename>
class Complex>
227 class InTimeOOP<N, Loki::Typelist<Pair<SInt<K>, SInt<0> >,Tail>, Complex<T>, S, W1, LastK>
228 :
public InTimeOOP<N, Tail, Complex<T>, S, W1, LastK> {};
232 template<int_t N,
typename T,
int S,
class W1, int_t LastK,
233 template<
typename>
class Complex>
234 class InTimeOOP<N,Loki::Typelist<Pair<SInt<N>, SInt<1> >, Loki::NullType>,Complex<T>,S,W1,LastK>
235 :
public DFTk<N, LastK, 1, Complex<T>, S> {};