MCPcopy Create free account
hub / github.com/abess-team/abess / test_complex_generic

Function test_complex_generic

python/include/unsupported/test/FFTW.cpp:141–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139
140template <int Container, typename T>
141void 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
174template <typename T>
175void test_complex(int nfft)

Callers

nothing calls this directly

Calls 4

fft_rmseFunction · 0.85
dif_rmseFunction · 0.85
fwdMethod · 0.45
invMethod · 0.45

Tested by

no test coverage detected