| 139 | |
| 140 | template <int Container, typename T> |
| 141 | void test_complex_generic(int nfft) |
| 142 | { |
| 143 | typedef typename FFT<T>::Complex Complex; |
| 144 | typedef typename VectorType<Container,Complex>::type ComplexVector; |
| 145 | |
| 146 | FFT<T> fft; |
| 147 | |
| 148 | ComplexVector inbuf(nfft); |
| 149 | ComplexVector outbuf; |
| 150 | ComplexVector buf3; |
| 151 | for (int k=0;k<nfft;++k) |
| 152 | inbuf[k]= Complex( (T)(rand()/(double)RAND_MAX - .5), (T)(rand()/(double)RAND_MAX - .5) ); |
| 153 | fft.fwd( outbuf , inbuf); |
| 154 | |
| 155 | VERIFY( T(fft_rmse(outbuf,inbuf)) < test_precision<T>() );// gross check |
| 156 | fft.inv( buf3 , outbuf); |
| 157 | |
| 158 | VERIFY( T(dif_rmse(inbuf,buf3)) < test_precision<T>() );// gross check |
| 159 | |
| 160 | // verify that the Unscaled flag takes effect |
| 161 | ComplexVector buf4; |
| 162 | fft.SetFlag(fft.Unscaled); |
| 163 | fft.inv( buf4 , outbuf); |
| 164 | for (int k=0;k<nfft;++k) |
| 165 | buf4[k] *= T(1./nfft); |
| 166 | VERIFY( T(dif_rmse(inbuf,buf4)) < test_precision<T>() );// gross check |
| 167 | |
| 168 | // verify that ClearFlag works |
| 169 | fft.ClearFlag(fft.Unscaled); |
| 170 | fft.inv( buf3 , outbuf); |
| 171 | VERIFY( T(dif_rmse(inbuf,buf3)) < test_precision<T>() );// gross check |
| 172 | } |
| 173 | |
| 174 | template <typename T> |
| 175 | void test_complex(int nfft) |