created FFT::fwd and FFT::inv with ReturnByValue

This commit is contained in:
Mark Borgerding
2010-03-07 21:31:06 -05:00
parent b528b747c1
commit 5b2c8b77df
2 changed files with 80 additions and 3 deletions

View File

@@ -225,8 +225,28 @@ void test_complex2d()
}
*/
template <typename T,int nrows,int ncols>
void test_return_by_value()
{
Matrix<complex<T>,nrows,ncols> in;
Matrix<complex<T>,nrows,ncols> in1;
in.Random();
Matrix<complex<T>,nrows,ncols> out1;
Matrix<complex<T>,nrows,ncols> out2;
FFT<T> fft;
fft.fwd(out1,in);
out2 = fft.fwd(in);
VERIFY( (out1-out2).norm() < test_precision<T>() );
in1 = fft.inv(out1);
VERIFY( (in1-in).norm() < test_precision<T>() );
}
void test_FFTW()
{
test_return_by_value<float,1,32>();
test_return_by_value<double,1,32>();
//test_return_by_value<long double,1,32>();
//CALL_SUBTEST( ( test_complex2d<float,4,8> () ) ); CALL_SUBTEST( ( test_complex2d<double,4,8> () ) );
//CALL_SUBTEST( ( test_complex2d<long double,4,8> () ) );
CALL_SUBTEST( test_complex<float>(32) ); CALL_SUBTEST( test_complex<double>(32) ); CALL_SUBTEST( test_complex<long double>(32) );