本文整理汇总了C++中FFT::ClearFlag方法的典型用法代码示例。如果您正苦于以下问题:C++ FFT::ClearFlag方法的具体用法?C++ FFT::ClearFlag怎么用?C++ FFT::ClearFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FFT
的用法示例。
在下文中一共展示了FFT::ClearFlag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_scalar_generic
void test_scalar_generic(int nfft)
{
typedef typename FFT<T>::Complex Complex;
typedef typename FFT<T>::Scalar Scalar;
typedef typename VectorType<Container, Scalar>::type ScalarVector;
typedef typename VectorType<Container, Complex>::type ComplexVector;
FFT<T> fft;
ScalarVector tbuf(nfft);
ComplexVector freqBuf;
for (int k = 0; k < nfft; ++k)
tbuf[k] = (T)(rand() / (double)RAND_MAX - .5);
// make sure it DOESN'T give the right full spectrum answer
// if we've asked for half-spectrum
fft.SetFlag(fft.HalfSpectrum);
fft.fwd(freqBuf, tbuf);
VERIFY((size_t)freqBuf.size() == (size_t)((nfft >> 1) + 1));
VERIFY(fft_rmse(freqBuf, tbuf) < test_precision<T>()); // gross check
fft.ClearFlag(fft.HalfSpectrum);
fft.fwd(freqBuf, tbuf);
VERIFY((size_t)freqBuf.size() == (size_t)nfft);
VERIFY(fft_rmse(freqBuf, tbuf) < test_precision<T>()); // gross check
if (nfft & 1)
return; // odd FFTs get the wrong size inverse FFT
ScalarVector tbuf2;
fft.inv(tbuf2, freqBuf);
VERIFY(dif_rmse(tbuf, tbuf2) < test_precision<T>()); // gross check
// verify that the Unscaled flag takes effect
ScalarVector tbuf3;
fft.SetFlag(fft.Unscaled);
fft.inv(tbuf3, freqBuf);
for (int k = 0; k < nfft; ++k)
tbuf3[k] *= T(1. / nfft);
// for (size_t i=0;i<(size_t) tbuf.size();++i)
// cout << "freqBuf=" << freqBuf[i] << " in2=" << tbuf3[i] << " - in=" << tbuf[i] << " => " << (tbuf3[i] - tbuf[i] ) << endl;
VERIFY(dif_rmse(tbuf, tbuf3) < test_precision<T>()); // gross check
// verify that ClearFlag works
fft.ClearFlag(fft.Unscaled);
fft.inv(tbuf2, freqBuf);
VERIFY(dif_rmse(tbuf, tbuf2) < test_precision<T>()); // gross check
}
示例2: test_complex_generic
void test_complex_generic(int nfft)
{
typedef typename FFT<T>::Complex Complex;
typedef typename VectorType<Container,Complex>::type ComplexVector;
FFT<T> fft;
ComplexVector inbuf(nfft);
ComplexVector outbuf;
ComplexVector buf3;
for (int k=0;k<nfft;++k)
inbuf[k]= Complex( (T)(rand()/(double)RAND_MAX - .5), (T)(rand()/(double)RAND_MAX - .5) );
fft.fwd( outbuf , inbuf);
VERIFY( fft_rmse(outbuf,inbuf) < test_precision<T>() );// gross check
fft.inv( buf3 , outbuf);
VERIFY( dif_rmse(inbuf,buf3) < test_precision<T>() );// gross check
// verify that the Unscaled flag takes effect
ComplexVector buf4;
fft.SetFlag(fft.Unscaled);
fft.inv( buf4 , outbuf);
for (int k=0;k<nfft;++k)
buf4[k] *= T(1./nfft);
VERIFY( dif_rmse(inbuf,buf4) < test_precision<T>() );// gross check
// verify that ClearFlag works
fft.ClearFlag(fft.Unscaled);
fft.inv( buf3 , outbuf);
VERIFY( dif_rmse(inbuf,buf3) < test_precision<T>() );// gross check
}